]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/web/views/list_books.tmpl
Feat(web:books): Показывать список книг с разбивкой по авторам и сериям
[m_librarian.git] / m_librarian / web / views / list_books.tmpl
index 9566e89ff56bf8a78326420fa27a8dfc7de40a4e..cab1e1d3edad0856bb6888ab160e1b2c816d4b7e 100644 (file)
@@ -5,26 +5,30 @@
 #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%">
   #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
-  #if $book.series
+  #for $author in $sorted($books_by_author)
+    #set $books = $books_by_author[$author]
+    #for $book in $books
+    #if $book.series != $series
+    #if $series is not None
+    </optgroup>
+    #end if
+    #set $series = $book.series
+    <optgroup label="#slurp
+$author — #slurp
+    #if $book.series
 $cgi.escape($series, 1)#slurp
-  #else
+    #else
 Вне серий#slurp
-  #end if
+    #end if
 ">
-  #end if
-  <option value="$book.id">$book.ser_no $cgi.escape($book.title)</option>
+    #end if
+    <option value="$book.id">$book.ser_no $cgi.escape($book.title)</option>
+    #end for
   #end for
   </optgroup>
   </select>