hmn/src/templates/src/include/header.html

96 lines
4.7 KiB
HTML
Raw Normal View History

2021-03-18 01:25:06 +00:00
<header class="mb3">
2021-03-26 03:33:00 +00:00
<div class="user-options flex justify-center justify-end-ns">
{{ if .User }}
2021-07-22 02:16:10 +00:00
{{ if .User.IsStaff }}
2021-05-11 22:53:23 +00:00
<a class="admin-panel" href="{{ .Header.AdminUrl }}"><span class="icon-settings"> Admin</span></a>
2021-03-26 03:33:00 +00:00
{{ end }}
2021-06-22 09:50:40 +00:00
<a class="username settings" href="{{ .Header.UserSettingsUrl }}"><span class="icon-settings"></span> {{ .User.Username }}</a>
<a class="logout" href="{{ .Header.LogoutActionUrl }}"><span class="icon-logout"></span> Log Out</a>
2021-03-26 03:33:00 +00:00
{{ else }}
2021-05-11 22:53:23 +00:00
<a class="register" id="register-link" href="{{ .Header.RegisterUrl }}">Register</a>
<a class="login" id="login-link" href="{{ .LoginPageUrl }}">Log in</a>
2021-03-18 01:25:06 +00:00
<div id="login-popup">
2021-05-11 22:53:23 +00:00
<form action="{{ .Header.LoginActionUrl }}" method="post">
2021-03-26 03:33:00 +00:00
{{/* TODO: CSRF */}}
2021-03-18 01:25:06 +00:00
<table>
<tr>
<th><label>Username:</label></th>
<td><input type="text" name="username" class="textbox username" value="" /></td>
</tr>
<tr>
<th><label>Password:</label></th>
<td><input type="password" name="password" class="textbox password" value="" /></td>
</tr>
2021-03-26 03:33:00 +00:00
{{/* TODO: Forgot password flow? Or just on standalone page? */}}
2021-03-18 01:25:06 +00:00
</table>
<input type="hidden" name="redirect" value="{{ $.CurrentUrl }}">
<div class="pt2">
2021-03-18 01:25:06 +00:00
<input type="submit" value="Log In" />
</div>
</form>
</div>
2021-03-26 03:33:00 +00:00
{{ end }}
</div>
2021-06-06 23:48:43 +00:00
<div class="menu-bar flex flex-column flex-row-l justify-between {{ if .IsProjectPage }}project{{ end }}">
2021-03-18 01:25:06 +00:00
<div class="flex flex-column flex-row-ns">
2021-05-11 22:53:23 +00:00
<a href="{{ .Header.HMNHomepageUrl }}" class="logo hmdev-logo">
2021-03-18 01:25:06 +00:00
<div class="underscore"></div>
</a>
<div class="items flex items-center justify-center justify-start-ns">
2021-06-06 23:48:43 +00:00
{{ if .IsProjectPage }}
2021-05-11 22:53:23 +00:00
<a class="project-logo" href="{{ .Header.ProjectHomepageUrl }}">
2021-03-18 01:25:06 +00:00
<h1>{{ .Project.Name }}</h1>
</a>
{{ end }}
2021-06-06 23:48:43 +00:00
{{ if not .IsProjectPage }}
<a href="{{ .Header.ProjectIndexUrl }}" class="projects">Projects</a>
{{ end }}
2021-03-18 01:25:06 +00:00
{{ if .Project.HasBlog }}
2021-06-06 23:48:43 +00:00
<a href="{{ .Header.BlogUrl }}" class="blog">{{ if .IsProjectPage }}Blog{{ else }}News{{ end }}</a>
2021-03-18 01:25:06 +00:00
{{ end }}
{{ if .Project.HasForum }}
2021-05-11 22:53:23 +00:00
<a href="{{ .Header.ForumsUrl }}" class="forums">Forums</a>
2021-03-18 01:25:06 +00:00
{{ end }}
{{ if .Project.HasLibrary }}
2021-05-11 22:53:23 +00:00
<a href="{{ .Header.LibraryUrl }}" class="library">Library</a>
2021-03-18 01:25:06 +00:00
{{ end }}
{{ if .Project.IsHMN }}
2021-05-11 22:53:23 +00:00
<a href="{{ .Header.ManifestoUrl }}" class="misson">Mission</a>
2021-03-18 01:25:06 +00:00
{{ end }}
{{/* {% if project.default_annotation_category %} */}}
{{ if .Header.EpisodeGuideUrl }}
2021-05-11 22:53:23 +00:00
<a href="{{ .Header.EpisodeGuideUrl }}" class="annotations">Episode Guide</a>
2021-03-18 01:25:06 +00:00
{{ end }}
2021-07-08 07:40:30 +00:00
{{ if .Header.EditUrl }}
<a class="edit" href="{{ .Header.EditUrl }}" title="Edit {{ .Project.Name }}"><span class="icon">0</span>&nbsp;Settings</a>
{{ end }}
2021-03-18 01:25:06 +00:00
</div>
</div>
2021-08-17 20:09:24 +00:00
<form onsubmit="this.querySelector('input[name=q]').value = this.querySelector('#searchstring').value + ' site:handmade.network';" class="dn ma0 flex-l flex-column justify-center items-end" method="GET" action="{{ .Header.SearchActionUrl }}" target="_blank">
<input type="hidden" name="q" />
<input class="site-search bn lite pa2 fira" type="text" id="searchstring" value="" placeholder="Search with DuckDuckGo" size="17" />
2021-03-18 01:25:06 +00:00
<input id="search_button_homepage" type="submit" value="Go"/>
</form>
</div>
</header>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
var loginPopup = document.getElementById("login-popup");
var loginLink = document.getElementById("login-link");
if (loginPopup !== null) {
loginLink.removeAttribute("href");
loginLink.onclick = function() {
loginPopup.classList.toggle("open");
}
}
for (const time of document.querySelectorAll('time')) {
const d = new Date(Date.parse(time.dateTime));
time.title = d.toLocaleString();
}
2021-03-18 01:25:06 +00:00
});
</script>