-
Notifications
You must be signed in to change notification settings - Fork 223
/
nav.ego
47 lines (42 loc) · 1.59 KB
/
nav.ego
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
<%
package webui
import (
"net/http"
"strings"
)
func ego_nav(w io.Writer, req *http.Request) {
%>
<div class="fixed-top bg-light navbar-default">
<div class="container-fluid">
<div class="navbar navbar-light navbar-fixed-top navbar-expand-md py-0">
<a class="navbar-brand flex-grow-1" href="<%= root(req) %>/">
<span class="status">
<% x := currentStatus(req) %>
<i class="status-sprite status-<%= x %>" style="background-image: url(<%= root(req) %>/static/img/status.png);"></i>
</span>
<%= productTitle(req) %>
</a>
<span class="status-text">
<i class="status-icon status-<%= x %>"></i>
<%= t(req, x) %>
</span>
<button class="navbar-toggler ms-3" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-center" id="navbar-menu">
<ul class="navbar-nav" data-navbar="static">
<% for _, tab := range DefaultTabs {
if tab.Path == "/" { %>
<li class="nav-item<% if req.RequestURI == "/" { %> active<% } %>">
<% } else { %>
<li class="nav-item<% if strings.HasPrefix(req.RequestURI, tab.Path) { %> active<% } %>">
<% } %>
<a class="nav-link p-3" href="<%= relative(req, tab.Path) %>"><%= t(req, tab.Name) %></a>
</li>
<% } %>
</ul>
</div>
</div>
</div>
</div>
<% } %>