/templates/type/work/view.tmpl
Type: /type/template
body: value: $def with (page)


$ _t = i18n.get_namespace('/type/edition')
$ _ = i18n.get_namespace('/mode/view')

$var title: $page.title

<table border="0" cellpadding="0" cellspacing="0" width="100%" style="clear:both"><tr><td valign="top" width="100%">

<div id="header" style="padding-left: 30px">           
     <div id="title">$page.title</div>
            $if page.get('subtitle'): <div class="subtitle" style="margin-top: -4px;">$page.subtitle<br /></div>
        <div id="statement" style="padding-left: 0px;">
            $if page.authors: by <span class="datalink">$:thingrepr(page.authors)</span><br />
        </div>
</div>


$ s = "subjects", "first_sentence",

<div style="padding: 0px 0px 20px 30px; margin-right: 20px;">
<table border="0" cellpadding="0" cellspacing="0">
    $if page.description:
        <tr><td valign="top" class="formheader contenttext" style="padding-left: 0px;">
        $_t.description:
        </td><td class="formfield contenttext">$page.description</td></tr>
    $for name in s:
        $if page[name]:
            <tr><td valign="top" class="formheader contenttext" style="padding-left: 0px;">$_t[name]:</td>
            $if name == "subjects":
                <td valign="top" class="formfield contenttext" style="padding-left: 0px;">
                    <ul>
                    $for subject in page[name]:
                        <li><a href="$subject">$subject</a></li>
                    </ul>
                </td>
            $else:
                <td valign="top" class="formfield contenttext">$:thingrepr(page[name])</td>
            </tr>
$if page.notes:
    <td valign="top" class="formheader contenttext" style="padding-left: 0px; padding-bottom: 24px; border-bottom: 1px solid #ccc;">$_t['notes']:</td>
    <td valign="top" class="formfield contenttext" width="100%" style="padding-bottom: 24px; border-bottom: 1px solid #ccc;">$:thingrepr(page.notes)</td>
<tr>
</table>

$if page.table_of_contents:
    <div class="toc-header" style="padding-top: 35px;">
    <b>$_t.table_of_contents</b>

    $#:macros.FlourishButton("edit", changequery(m='edit'), "right", "edition")

    </div>

        $if page.table_of_contents:
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    $ first = "first"
                    $for toc in page.table_of_contents:
                        <tr>
                            <td class="toc-number rule $first">$loop.index&nbsp;&nbsp;</td>
                            <td class="toc rule $first" width="100%">$toc.title</td>
                            <td class="toc-link-end rule $first" align="center">&nbsp;&nbsp;</td>
                        </tr>
                        $ first = ""
                </table>
        $#else:
        $#    <p><em><span class="copyright">No table of contents available</span> <img src="/static/images/arrow.red.png" alt="Disclosure Arrow" /> <a href="$changequery(m='edit')"  style="text-decoration: underline">Add it!</a></em></p>


<div style="padding-left: 30px;">

$if page.editions:
    <table border="0" cellspacing="5" cellpadding="0" border="0" width="100%">
    $ col = 0
    $for book in page.editions:
        $if col == 0: <tr>
        <td class="cover" style="vertical-align: top; padding-bottom: 4px;">
             $ olid = book.key.split('/')[-1]
             <a href="$book.key">$:macros.CoverImage(book, size="S")</a>
        </td>
        <td style="vertical-align: top; padding-bottom: 4px;" width="50%">
             <span class="book-details-italic" style="color: #000">
             <a href="$book.key" class="result" style="text-decoration: underline;">$book.title_prefix $book.title</a>
             $if book.ocaid:
                 <a href="/bookreader/$book.ocaid" style="color: #900; text-decoration: none; background-color: #fff; font-size: 11px; border: 1px solid #bebe7c; font-weight: bold">&nbsp;$_.fulltext&nbsp;</a>
             <br />
             $if book.subtitle: $book.subtitle<br />
               
             $if book.get('publish_date'): $book.publish_date, 
             $if book.get('publishers'): $:thingrepr(book.publishers)
             $if book.get('publish_places'): ($:thingrepr(book.publish_places).strip())
             <br /></span><span style="color: #666">
             $ edition_and_lang = ''
             $if book.edition_name:
                 $ edition_and_lang += book.edition_name
             $if book.languages:
                 $ edition_and_lang += ', '.join([l.name for l in book.languages])
             $if edition_and_lang and book.number_of_pages:
                 $ edition_and_lang += ', '
             $edition_and_lang
             $if book.number_of_pages:
                 $book.number_of_pages pages
         </span></td>
         $ col += 1
         $if col == 2:
             </tr>
             $ col = 0
    $if col != 0: </tr>
    </table>

</div>

</td><td valign="top">
    $:macros.WorkInfo(page)
</td></tr></table>

<br /><br />

<div class="copyright-footer">
    $ editions_page = safeint(query_param('editions_page', '0'))
    $if editions_page != 0:
        &larr; <a href="$:changequery(editions_page=editions_page - 1)" class="datalink" rel="nofollow">prev</a>
    
    $if len(page.editions) == 20:
        ... <a href="$:changequery(editions_page=editions_page + 1)" class="datalink" rel="nofollow">next</a> &rarr;
</div>
title: Work View