$def with (authors, name_path, dict_path)
$# :param list[dict] authors: e.g. {name: str, key: str}
$# :param str name_path: form path for the user-visible author name
$# :param str dict_path: form path for the author dict
$jsdef render_author_autocomplete_item(item):
$if item.key == "__new__":
$_('Create a new record for')
$item.name
$else:
$item.name
$if item.birth_date or item.death_date:
(${item.birth_date or ' '}–${item.death_date or ' '})
$item.key.split('/')[2]
•
$if item.work_count == 0:
No books associated with $item.name
$elif item.work_count == 1:
1 book
titled $item.works[0]
$else:
$item.work_count books
including $item.works[0]
$if item.subjects:
Subjects: ${', '.join(item.subjects)}
$jsdef render_author(name_path, dict_path, disabled, i, author):
$ config = {'name_path': name_path, 'dict_path': dict_path}
$for author in (authors or [storage(name="", key="")]):
$:render_author(name_path, dict_path, True, loop.index0, author)