$def with (docs, key, shelf_counts, doc_count, lists=None, user=None, logged_in_user=None, public=False, sort_order='desc', owners_page=False, q="", results_per_page=25, ratings=[]) $# Displays a user's reading log $# :param list docs: $# :param Literal['currently-reading', 'want-to-read', 'already-read', 'sponsorships', 'loans', 'notes', 'observations'] key: $# :param Dict[str: int] shelf_counts: $# :param list? lists: $# :param user: $# :param bool public: $# :param str q: search term. $ component_times = {} $ component_times['TotalTime'] = time() $ username = user.key.split('/')[-1] $ current_page = int(input(page=1).page) $ total_docs = shelf_counts.get(key, None) $ userDisplayName = user.displayname or ctx.user.displayname $ userKey = user.key or ctx.user.key $ breadcrumb = _("Reading Log") $ header_title = "" $if key == 'currently-reading': $ header_title = _("Currently Reading") $elif key == 'want-to-read': $ header_title = _("Want To Read") $elif key == 'already-read': $ header_title = _("Already Read") $if not header_title: $if key == 'sponsorships': $ header_title = _("Sponsorships") $elif key == 'notes': $ header_title = _("Book Notes") $elif key == 'observations': $ header_title = _("Reviews") $elif key == 'loans': $ header_title = _("Loans") $elif key == 'imports': $ header_title = _("Imports and Exports") $elif key == 'lists': $ header_title = _('My Lists') $elif key == 'list': $ header_title = docs.get('name', 'List') $else: $ header_title = key $ breadcrumb = header_title $var title: $header_title
$:render_template("account/sidebar", user, key=key, public=public, owners_page=owners_page, counts=shelf_counts, lists=lists, component_times=component_times)
$ component_times['Details header'] = time()

$if not owners_page: $userDisplayName » $header_title $else: $header_title

$if owners_page and key in ['currently-reading', 'already-read', 'want-to-read']: $_('Stats')
$if owners_page:

$if key == 'notes': $_('Your book notes are private and cannot be viewed by other patrons.') $elif key == 'observations': $_('Your book reviews will be shared anonymously with other patrons.') $elif key in ['currently-reading', 'already-read', 'want-to-read']: $if public: $_('Your reading log is currently set to public') or $else: $_('Your reading log is currently set to private') — $_('Manage your privacy settings')

$if key == 'list':
$:macros.databarView(docs)
$ component_times['Details header'] = time() - component_times['Details header'] $ component_times['Details content'] = time()
$if key == 'loans': $:render_template('account/loans', logged_in_user, docs) $elif key == 'notes': $:render_template('account/notes', docs, user, shelf_counts['notes'], page=current_page) $elif key == 'observations': $:render_template('account/observations', docs, user, shelf_counts['observations'], page=current_page) $elif key == 'imports': $:render_template('account/import') $elif key == 'lists': $:render_template('lists/lists', docs, lists, show_header=False) $elif key == 'already-read': $:render_template('account/reading_log', docs, key, shelf_counts[key], doc_count, owners_page, current_page, sort_order=sort_order, user=user, include_ratings=owners_page, q=q, results_per_page=results_per_page, ratings=ratings) $elif key in {'currently-reading', 'want-to-read', 'sponsorships'}: $:render_template('account/reading_log', docs, key, shelf_counts[key], doc_count, owners_page, current_page, sort_order=sort_order, user=user, q=q, results_per_page=results_per_page) $else: $:render_template('type/list/view', docs, check_owner=False, owns_page=True)
$ component_times['Details content'] = time() - component_times['Details content']
$ component_times['TotalTime'] = time() - component_times['TotalTime'] $if query_param('debug'): $:macros.Profile(component_times)