$def with (page)
$if ctx.user: $ loginLinks = [] $else: $ loginLinks = [ $ { "href": "/account/login", "text": _("Log in") }, $ { "href": "/account/create", "text": _("Sign up") } $ ] $ 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") } $ ] $ hamburgerProps = { $ 'name': 'hamburger', $ 'links': loginLinks + moreLinks, $ 'image': '/static/images/menu.png', $ 'label': 'additional options menu' $ } $:render_template("lib/header_dropdown", hamburgerProps )
$_('Open Library logo')
$ browseProps = { $ 'name': 'browse', $ 'label': _('Browse'), $ 'links': [ $ { "href": "/subjects", "text": _("Subjects") }, $ { "href": "/lists", "text": _("Lists") }, $ { "href": "/collections", "text": _("Collections") }, $ { "href": "/k-12", "text": _("K-12 Student Library") }, $ { "href": "/random", "text": _("Random Book") }, $ { "href": "/advancedsearch", "text": _("Advanced Search") } $ ] $ } $ 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 ''), 'links': [ { "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") } ] } $:render_template("lib/header_dropdown", accountProps )