]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/web/views/list_books.tmpl
Fix(web): Выровнять вправо размер книги
[m_librarian.git] / m_librarian / web / views / list_books.tmpl
index 9566e89ff56bf8a78326420fa27a8dfc7de40a4e..5d70c8885948caa00430cfc452d3f483c147db85 100644 (file)
@@ -1,37 +1,56 @@
 #encoding utf-8
 #import cgi
+#from m_librarian.translations import translations
 #extends views.layout
 #attr $title = 'Список книг'
 #def body
 <h1>$title</h1>
 
-#if $books
+#if $books_by_author
   <form action="/download/" method="POST" style="height: 80%">
-  <div style="width: 100%; height: 90%">
-  <select multiple name="books" style="height: 100%">
+  <table style="width: 100%; height: 90%">
+  <tr>
+  <td>&nbsp;</td>
+  #set $_ = $getattr($translations, 'ugettext', None) or $translations.gettext
+  #for $column in $columns
+    <td style="text-align: center">$cgi.escape($_($column))</td>
+  #end for
+  </tr>
   #set $series = None
-  #for $book in $books
-  #if $book.series != $series
-  #if $series is not None
-  </optgroup>
-  #end if
-  #set $series = $book.series
-  <optgroup label="#slurp
+  #set $columns1 = $len($columns)+1
+  #for $author in $sorted($books_by_author)
+    #set $books = $books_by_author[$author]
+    #for $book in $books
+    #if $book.series != $series
+    #set $series = $book.series
+  <tr>
+  <td colspan="$columns1"><b>
+  $author — <i>
   #if $book.series
 $cgi.escape($series, 1)#slurp
   #else
 Вне серий#slurp
   #end if
-">
+  </i></b></td>
+  </tr>
+    #end if
+  <tr>
+  <td><input type=checkbox name=books value="$book.id"></td>
+  #for $column in $columns
+  #if $column in ('ser_no', 'size')
+  #set $style = ' style="text-align: right; width: 5ex"'
+  #else
+  #set $style = ''
   #end if
-  <option value="$book.id">$book.ser_no $cgi.escape($book.title)</option>
+  <td$style>$cgi.escape(unicode($getattr($book, $column) or ''))</td>
+  #end for
+  </tr>
+    #end for
   #end for
-  </optgroup>
-  </select>
-  </div>
-  <div style="width: 100%; text-align: center">
-  <input type="submit" value="Скачать">
-  </div>
+  <tr>
+  <td colspan="$columns1" style="text-align: center"><input type="submit" value="Скачать"></td>
+  </tr>
+  </table>
   </form>
 #else
   <p>Не найдено ни одной книги!</p>