hanayo/templates/navbar.html
2019-02-23 16:51:12 +00:00

75 lines
2.9 KiB
HTML

{{ define "navbar" }}
{{ $isRAP := and (hasAdmin .Context.User.Privileges) (isRAP .Path) }}
{{ $isAdmin := hasAdmin .Context.User.Privileges }}
{{ $ds := band .ClientFlags 1 }}
<div class="ui secondary fixed-height stackable white background main menu no margin bottom{{ if .DisableHH }} dropped{{ end }}" id="navbar">
<div class="ui container">
<div class="item">
<b><a href="/" title="{{ .T "Home page" }}"><img class="ripple logo" src="/static/logos/text-{{ if $ds }}white{{ else }}black{{ end }}.png" alt="Yozora"></a></b>
</div>
{{ if $isRAP }}
{{/*
Note:
RAP navbar will be completely different from standard navbar,
meaning it will have the buttons and all the stuff that are in
the current RAP's sidebar.
*/}}
{{ else }}
<div class="ui dropdown item">
<span> Leaderboards </span>
<div class="menu">
{{ navbarItem .Path (.T "Leaderboard") "/leaderboard" }}
{{ navbarItem .Path (.T "Relax Leaderboard") "/relaxboard" }}
{{ navbarItem .Path (.T "Autopilot Leaderboard") "/autoboard" }}
</div>
</div>
<div class="ui dropdown item">
<span>{{ .T "Help" }}</span>
<div class="menu">
{{ navbarItem .Path (.T "About") "/about" }}
{{ navbarItem .Path (.T "Server switcher") "/static/switcher.exe" }}
<div class="divider"></div>
{{ navbarItem .Path (.T "Chat (Discord)") .Conf.DiscordServer }}
{{ navbarItem .Path (.T "Contact support") "/help" }}
</div>
</div>
{{ if .Context.User.Username }}
<div class="ui dropdown item">
<span>{{ .T "Beatmaps" }}</span>
<div class="menu">
{{ navbarItem .Path (.T "Request beatmap ranking") "/beatmaps/rank_request" }}
</div>
</div>
{{ end }}
{{ navbarItem .Path (.T "Donate" | printf "<i class=\"red heart icon\"></i>%s") "/donate" }}
{{ if $isAdmin }}{{ navbarItem .Path (.T "RAP" | printf "<b>%s</b>") "https://old.yozora.pw/p/100" }}{{ end }}
{{ end }}
<div class="firetrucking-right-menu">
<div class="item">
<div class="ui search" id="user-search">
<div class="ui icon input">
<input class="prompt" type="text" placeholder="{{ .T "Looking for someone?" }}" id="user-search-input">
<i class="search link icon"></i>
</div>
</div>
</div>
{{ if .Context.User.Username }}
<div class="ui dropdown item">
<img class="ui avatar image" src="{{ config "AvatarURL" }}/{{ .Context.User.ID }}">
<span>{{ .Context.User.Username }}</span>
<div class="menu">
{{ navbarItem .Path (.T "Profile") (printf "/u/%d" .Context.User.ID) }}
{{ navbarItem .Path (.T "Friends") "/friends" }}
{{ navbarItem .Path (.T "Settings") "/settings" }}
{{ navbarItem .Path (.T "Log out") (printf "/logout?k=%s" (.Session.Get "logout")) }}
</div>
</div>
{{ else }}
{{ navbarItem .Path (.T "Log in") "/login" }}
{{ navbarItem .Path (.T "Register") "/register" }}
{{ end }}
</div>
</div>
</div>
{{ end }}