nav.html 3.5 KB
Newer Older
GitLab's avatar
GitLab committed
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<nav class="navbar navbar-default navbar-fixed-top navbar-custom">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
        <span class="sr-only">{{ i18n "toggleNavigation" }}</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="{{ "" | absLangURL }}">{{ .Site.Title }}</a>
    </div>

    <div class="collapse navbar-collapse" id="main-navbar">
      <ul class="nav navbar-nav navbar-right">
        {{ range .Site.Menus.main.ByWeight }}
          {{ if .HasChildren }}
            <li class="navlinks-container">
              <a class="navlinks-parent" href="javascript:void(0)">{{ .Name }}</a>
              <div class="navlinks-children">
                {{ range .Children }}
                  <a href="{{ .URL | relLangURL }}">{{ .Name }}</a>
                {{ end }}
              </div>
            </li>
          {{ else }}
            <li>
              <a title="{{ .Name }}" href="{{ .URL  | relLangURL }}">{{ .Name }}</a>
            </li>
          {{ end }}
        {{ end }}

        {{ if .Site.IsMultiLingual }}
          {{ if ge (len .Site.Languages) 3 }}
            <li class="navlinks-container">
              <a class="navlinks-parent" href="javascript:void(0)">{{ i18n "languageSwitcherLabel" }}</a>
              <div class="navlinks-children">
                {{ range .Site.Languages }}
                  {{ if not (eq .Lang $.Site.Language.Lang) }}
                  <a href="/{{ .Lang }}" lang="{{ .Lang }}">{{ default .Lang .LanguageName }}</a>
                  {{ end }}
                {{ end }}
              </div>
            </li>
          {{ else }}
            <li>
              {{ range .Site.Languages }}
                {{ if not (eq .Lang $.Site.Language.Lang) }}
                  <a href="/{{ .Lang }}" lang="{{ .Lang }}">{{ default .Lang .LanguageName }}</a>
                {{ end }}
              {{ end }}
            </li>
          {{ end }}
        {{ end }}

        {{ if isset .Site.Params "gcse" }}
          <li>
            <a href="#modalSearch" data-toggle="modal" data-target="#modalSearch" style="outline: none;">
              <span class="hidden-sm hidden-md hidden-lg">{{ i18n "gcseLabelShort" }}</span> <span id="searchGlyph" class="glyphicon glyphicon-search"></span>
            </a>
          </li>
        {{ end }}
      </ul>
    </div>

    <div class="avatar-container">
      <div class="avatar-img-border">
        {{ if isset .Site.Params "logo" }}
          <a title="{{ .Site.Title }}" href="{{ "" | absLangURL }}">
            <img class="avatar-img" src="{{ .Site.Params.logo | absURL }}" alt="{{ .Site.Title }}" />
          </a>
        {{ end }}
      </div>
    </div>

  </div>
</nav>

<!-- Search Modal -->
{{ if isset .Site.Params "gcse" }}
  <div id="modalSearch" class="modal fade" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ i18n "gcseLabelLong" . }}</h4>
        </div>
        <div class="modal-body">
          <gcse:search></gcse:search>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">{{ i18n "gcseClose" }}</button>
        </div>
      </div>
    </div>
  </div>
{{ end }}