$def with (page)
$if ctx.user: $ loginLinks = [ $ { "href": ctx.user.key, "text": _("My Profile") }, $ { "href": homepath() + "/account/loans", "text": _("My Loans") }, $ { "href": ctx.user.key + "/lists", "text": _("My Lists") }, $ { "href": "/account/books", "text": _("My Reading Log") }, $ { "href": "/account/books/already-read/stats", "text": _("My Reading Stats") }, $ { "href": homepath() + "/account", "text": _("Settings") }, $ { "post": "/account/logout", "text": _("Log out") }, $ ] $else: $ loginLinks = [ $ { "loginClass": "login-links" } $ ] $ moreLinks = [ $ { "href": "/books/add", "text": _("Add a Book") }, $ { "href": "/sponsorship", "text": _("Sponsor a Book") }, $ { "href": "/recentchanges", "text": _("Recent Community Edits") }, $ { "href": "/developers", "text": _("Developer Center") }, $ { "href": "/help", "text": _("Help & Support") } $ ] $ browseLinks = [ $ { "href": "/subjects", "text": _("Subjects") }, $ { "new": "", "href": "/explore", "text": _("Library Explorer") }, $ { "href": "/lists", "text": _("Lists") }, $ { "new": "", "href": "/collections", "text": _("Collections") }, $ { "href": "/k-12", "text": _("K-12 Student Library") }, $ { "href": "/random", "text": _("Random Book") }, $ { "href": "/advancedsearch", "text": _("Advanced Search") } $ ] $ hamburgerProps = { $ 'name': 'hamburger', $ 'links': [ { "subsection": _("My Open Library") } ] + loginLinks + $ [ { "subsection": _("Browse") } ] + browseLinks + [ { "subsection": _("More") } ] + moreLinks, $ 'image': '/static/images/hamburger-icon.svg', $ 'image-class': 'hamburger__icon', $ 'label': 'additional options menu', $ 'show_mask': True $ }
$_('Open Library logo')
$ browseProps = { $ 'name': 'browse', $ 'label': _('Browse'), $ 'links': browseLinks $ } $ moreProps = { $ 'name': 'more', $ 'label': _('More'), $ 'links': moreLinks $ }
$if not ctx.user: $if ctx.user: $code: accountProps = { 'name': 'account', 'label': 'My account', # It seems like in the local dev environment (and presumably _only_ in the local # dev environment), this get_internet_archive_id returns None. Setting it to an # empty string returns a valid image ¯\_(ツ)_/¯ 'image': 'https://archive.org/services/img/' + (get_internet_archive_id(ctx.user.key) or ''), 'image-class': 'header-dropdown__icon', 'links': loginLinks } $accountProps['links'].insert(5, { "href": "/account/books/notes", "text": _("My Book Notes") }) $:render_template("lib/header_dropdown", accountProps ) $:render_template("lib/header_dropdown", hamburgerProps )