hanayo/templates/navbar.html

75 lines
3.0 KiB
HTML
Raw Normal View History

2019-02-23 13:29:15 +00:00
{{ 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">
2019-02-23 16:51:12 +00:00
<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>
2019-02-23 13:29:15 +00:00
</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 }}
2019-02-23 16:51:12 +00:00
<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>
2019-02-23 13:29:15 +00:00
<div class="ui dropdown item">
<span>{{ .T "Help" }}</span>
<div class="menu">
{{ navbarItem .Path (.T "About") "/about" }}
2019-02-23 16:51:12 +00:00
{{ navbarItem .Path (.T "Server switcher") "/static/switcher.exe" }}
2019-02-23 13:29:15 +00:00
<div class="divider"></div>
{{ navbarItem .Path (.T "Chat (Discord)") .Conf.DiscordServer }}
2019-02-23 16:51:12 +00:00
{{ navbarItem .Path (.T "Contact support") "/help" }}
2019-02-23 13:29:15 +00:00
</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 }}
2019-02-23 17:53:12 +00:00
{{ if .has_donor }}{{ navbarItem .Path (.T "Donate" | printf "<i id='bouncy' class=\"red heart icon\"></i>%s") "/donate" }}{{else}}{{ navbarItem .Path (.T "Donate" | printf "<i class=\"red heart icon\"></i>%s") "/donate" }}{{ end }}
2019-02-23 16:51:12 +00:00
{{ if $isAdmin }}{{ navbarItem .Path (.T "RAP" | printf "<b>%s</b>") "https://old.yozora.pw/p/100" }}{{ end }}
2019-02-23 13:29:15 +00:00
{{ 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 }}