$def with (page) $ is_privileged_user = ctx.user and (ctx.user.is_admin() or ctx.user.is_usergroup_member('/usergroup/super-librarians'))
$if ctx.user: $ loginLinks = [ $ { "href": "/account/loans", "text": _("My Books"), "track": "MyBooks", "subheading": _("Loans, Reading Log, Lists, Stats") }, $ { "href": ctx.user.key, "text": _("My Profile"), "track": "MyProfile" }, $ { "href": homepath() + "/account", "text": _("Settings"), "track": "MySettings" }, $ { "post": "/account/logout", "text": _("Log out"), "track": "Logout" }, $ ] $if is_privileged_user: $ loginLinks.insert(2, { "href": homepath() + "/merges", "text": _("Pending Merge Requests"),"track": "MyRequests", "badge": True }) $else: $ loginLinks = [ $ { "loginClass": "login-links" } $ ] $ myBooksLinks = [ $ { "href": homepath() + "/account/loans", "text": _("My Books"), "track": "MyBooks" }, $ ] $ browseLinks = [ $ { "href": "/subjects", "text": _("Subjects"), "track": "Subjects" }, $ { "href": "/trending", "text": _("Trending"), "track": "Trending" }, $ { "href": "/explore", "text": _("Library Explorer"), "track": "Explore" }, $ { "href": "/lists", "text": _("Lists"), "track": "Lists" }, $ { "href": "/collections", "text": _("Collections"), "track": "Collections" }, $ { "href": "/k-12", "text": _("K-12 Student Library"), "track": "K12Library" }, $ { "href": "/random", "text": _("Random Book"), "track": "RandomBook" }, $ { "href": "/advancedsearch", "text": _("Advanced Search"), "track": "AdvancedSearch" } $ ] $ contributeLinks = [ $ { "href": "/books/add", "text": _("Add a Book"), "track": "AddBook" }, $ { "href": "/recentchanges", "text": _("Recent Community Edits"), "track": "RecentEdits" } $ ] $ resourceLinks = [ $ { "href": "/help", "text": _("Help & Support"), "track": "Help" }, $ { "href": "/developers", "text": _("Developer Center"), "track": "DevelopersHelp" }, $ { "href": "/librarians", "text": _("Librarians Portal"), "track": "LibrariansHelp" } $ ] $ hamburgerProps = { $ 'name': 'hamburger', $ 'links': [ { "subsection": _("My Open Library") } ] + loginLinks + $ [ { "subsection": _("Browse") } ] + browseLinks + $ [ { "subsection": _("Contribute") } ] + contributeLinks + $ [ { "subsection": _("Resources") } ] + resourceLinks, $ '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 $ } $ myBooksProps = { $ 'name': 'mybooks', $ 'label': _('My Books'), $ 'links': myBooksLinks $ }
$if not ctx.user: $:render_template("lib/header_dropdown", hamburgerProps, track_prefix="Hamburger")