-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
nav_head.html
136 lines (126 loc) · 5.67 KB
/
nav_head.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
$def with (page)
$ is_privileged_user = ctx.user and (ctx.user.is_admin() or ctx.user.is_super_librarian())
<header id="header-bar" class="header-bar">
$if ctx.user:
$ loginLinks = [
$ { "href": "/account/books", "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", "name":"hamburger-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/books", "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": "/booktalks", "text": _("Book Talks"), "track": "BookTalks" },
$ { "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
$ }
<div class="logo-component">
<a href="/" title="$_('The Internet Archive\'s Open Library: One page for every book')">
<div class="logo-txt">
<img class="logo-icon" src="/static/images/openlibrary-logo-tighter.svg"
width="189" height="47"
alt="$_('Open Library logo')"/>
</div>
</a>
</div>
$ browseProps = {
$ 'name': 'browse',
$ 'label': _('Browse'),
$ 'links': browseLinks
$ }
$ myBooksProps = {
$ 'name': 'mybooks',
$ 'label': _('My Books'),
$ 'links': myBooksLinks
$ }
<ul class="navigation-component">
<li>$:render_template("lib/header_dropdown", myBooksProps, track_prefix="MainNav")</li>
<li>$:render_template("lib/header_dropdown", browseProps, track_prefix="MainNav")</li>
</ul>
<div class="search-component">
<div class="search-bar-component">
<div class="search-bar">
<div class="search-facet">
<label class="search-facet-selector">
<span aria-hidden="true" class="search-facet-value">$_("All")</span>
<select aria-label="Search by">
<option value="all">$_("All")</option>
<option value="title">$_("Title")</option>
<option value="author">$_("Author")</option>
<option value="text">$_("Text")</option>
<option value="subject">$_("Subject")</option>
<option value="lists">$_("Lists")</option>
<option value="advanced">$_("Advanced")</option>
</select>
</label>
</div>
<form class="search-bar-input" action="/search" method="get">
<input type="text" name="q" placeholder="$_('Search')" aria-label="Search" autocomplete="off">
<input name="mode" type="checkbox" aria-hidden="true" aria-label="Search checkbox" checked="checked" value="" id="ftokenstop" class="hidden instantsearch-mode">
<input type="submit" value="" class="search-bar-submit" aria-label="Search submit">
<div class="vertical-separator"></div>
<a
id="barcode_scanner_link"
class="search-by-barcode-submit"
aria-label="$_('Search by barcode')"
title="$_('Search by barcode')"
href="/barcodescanner?returnTo=/isbn/$$$$$$"
>
</a>
</form>
</div>
<div class="search-dropdown">
<ul class="search-results">
</ul>
</div>
</div>
</div>
$if not ctx.user:
<ul class="auth-component">
<li class="hide-me">
<a class="btn"
href="/account/login">$_("Log In")</a></li>
<li><a class="btn primary" href="/account/create">$_("Sign Up")</a></li>
</ul>
$:render_template("lib/header_dropdown", hamburgerProps, track_prefix="Hamburger")
</header>
<header class="header-bar mobile">
<ul class="navigation-component mobile">
<li>$:render_template("lib/header_dropdown", myBooksProps, track_prefix="MainNav")</li>
<li>$:render_template("lib/header_dropdown", browseProps, track_prefix="MainNav")</li>
</ul>
</header>