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
| {% import ( "strings"
"{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cmenu" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/app/lib/menu" "{{{ .Package }}}/views/components" "{{{ .Package }}}/views/vutil" ) %}
{% func Nav(as *app.State, ps *cutil.PageState) %} <nav id="navbar"> <a class="logo" href="{%s ps.RootPath %}" title="{%s ps.RootTitle %} {%s as.BuildInfo.String() %}">{%= components.SVGRef(ps.RootIcon, 32, 32, ``, ps) %}</a> <div class="breadcrumbs"> <a class="link" href="{%s ps.RootPath %}">{%s ps.RootTitle %}</a>{%= NavItems(ps.Menu, ps.Breadcrumbs) %} </div>{{{ if .HasModule "search" }}} {%- if ps.SearchPath != "-" -%} <form action="{%s ps.SearchPath %}" class="search" title="search"> <input type="search" name="q" placeholder=" " /> <div class="search-image" style="display: none;"><svg><use xlink:href="#svg-searchbox" /></svg></div> </form> {%- endif -%}{{{ end }}}{{{ if .HasModule "help" }}} {%= Help(as, ps) %}{{{ end }}} <a class="profile"{{{ if .HasAccount }}} title="{%s ps.AuthString() %}"{{{ else }}} title="Settings"{{{ end }}} href="{%s ps.ProfilePath %}"> {{{ if .HasAccount }}}{%- if i := ps.Accounts.Image(); i != "" -%} <img style="width: 24px; height: 24px;" src="{%s i %}" /> {%- else -%} {%= components.SVGRef(`profile`, 24, 24, ``, ps) %} {%- endif -%}{{{ else }}}{%= components.SVGRef(`profile`, 24, 24, ``, ps) %}{{{ end }}} </a> {%- if !ps.HideMenu -%} <input type="checkbox" id="menu-toggle-input" style="display: none;" /> <label class="menu-toggle" for="menu-toggle-input"><div class="spinner diagonal part-1"></div><div class="spinner horizontal"></div><div class="spinner diagonal part-2"></div></label> {%= Menu(ps) %} {%- endif -%} </nav>{% endfunc %}
{% func NavItems(m menu.Items, breadcrumbs cmenu.Breadcrumbs) %}{% stripspace %} {% for idx, bc := range breadcrumbs %} {% code i := m.GetByPath(breadcrumbs[:idx + 1]) %} {%= vutil.Indent(true, 2) %} <span class="separator">/</span> {%= vutil.Indent(true, 2) %} {% if i == nil %} {% code bcLink := "" if strings.Contains(bc, "||") { bci := strings.Index(bc, "||") bcLink = bc[bci + 2:] bc = bc[:bci] } %} <a class="link" href="{%s bcLink %}">{%s bc %}</a> {% else %} <a class="link" href="{%s i.Route %}">{%s i.Title %}</a> {% endif %} {% endfor %} {% endstripspace %}{% endfunc %}
|