$def with (work, editions=None, edition=None)
$ book_keys = []
$_('Edition') |
$_('Availability') |
$ edition_list_start = time()
$ editions = editions or work.get_sorted_editions()
$ index_padding = len(str(len(editions)))
$for book in editions:
$ book_keys.append(book['key'].replace('/books/', ''))
$ edition_sort_key = str(loop.index0+1).zfill(index_padding)
$if book.key == edition.key:
$# This enables us to always render a select edition first in the table (default)
$:render_template("books/edition-sort", book, edition_sort_key, render_first=True)
$else:
$:render_template("books/edition-sort", book, edition_sort_key)
$ edition_list_secs = time() - edition_list_start
$_("Add another edition?")
$if ctx.user and ctx.user.is_admin() and query_param('debug'):
Getting list of editions took $("%.2f" % edition_list_secs) seconds