misp-website/layouts/partials/nav.html

178 lines
8.7 KiB
HTML

<header class="navbar-affixed-top" data-spy="affix" data-offset-top="62">
<div class="navbar navbar-default yamm" role="navigation" id="navbar">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand home" href="{{ "/" | relURL }}">
{{ if default false .Site.Params.disabled_logo }}
<h4>{{ .Site.Params.logo_text }}</h4>
{{ else }}
<img src="{{ .Site.Params.logo | relURL }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm" />
<img src="{{ .Site.Params.logo_small | relURL }}" alt="{{ .Title }} logo" class="visible-xs visible-sm" />
{{ end }}
<span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
</a>
<div class="navbar-buttons">
<button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse" data-target="#navigation">
<span class="sr-only">{{ i18n "navToggle" }}</span>
<i class="fas fa-align-justify"></i>
</button>
</div>
</div>
<!--/.navbar-header -->
<div class="navbar-collapse collapse" id="navigation">
<ul class="nav navbar-nav navbar-right">
{{ $current := . }}
{{ range .Site.Menus.main.ByWeight }}
{{ $topLevel := replace .URL "/" "" }}
{{ $active := "" }}
{{ if eq $current.RelPermalink .URL }}
{{ $active = "active" }}
{{ end }}
{{ if eq $current.Type $topLevel }}
{{ $active = "active" }}
{{ end }}
{{ if and (or (eq $current.RelPermalink .URL) (eq "term" $current.Kind)) (in (slice "page" "term") $current.Kind) }}
{{ range (split .URL "/") }}
{{ if eq "blog" . }}
{{ $active = "active" }}
{{ end }}
{{ end }}
{{ end }}
{{ if .HasChildren }}
<!-- Check if the first child marks a menu section identifier -->
{{ $hasSections := (hasPrefix (index .Children 0).Identifier "section.") }}
<li class="dropdown{{ if $hasSections }} use-yamm yamm-fw{{end}} {{ $active }}">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
{{ if $hasSections }}
<ul class="dropdown-menu">
<li>
<div class="yamm-content">
<div class="row">
{{ if ne .URL "" }}
<div class="col-sm-6">
<img src="{{ .URL }}" class="img-responsive hidden-xs"/>
</div>
{{ end }}
<div class="col-sm-3">
<ul>
{{ range .Children.ByWeight }}
{{ $column := printf "%s" .Post }}
{{ if eq $column "1" }}
{{ if .HasChildren }}
<h5>{{ .Name }}</h5>
<ul>
{{ range .Children.ByWeight }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{- end }}
</ul>
{{ else }}
<li><a href="{{ .URL}}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
<div class="col-sm-3">
<ul>
{{ range .Children.ByWeight }}
{{ $column := printf "%s" .Post }}
{{ if eq $column "2" }}
{{ if .HasChildren }}
<h5>{{ .Name }}</h5>
<ul>
{{ range .Children.ByWeight }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ else }}
<li><a href="{{ .URL}}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
{{ if eq .URL "" }}
<div class="col-sm-3">
<ul>
{{ range .Children }}
{{ $column := printf "%s" .Post }}
{{ if eq $column "3" }}
{{ if .HasChildren }}
<h5>{{ .Name }}</h5>
<ul>
{{ range .Children.ByWeight }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ else }}
<li><a href="{{ .URL}}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
<div class="col-sm-3">
<ul>
{{ range .Children }}
{{ $column := printf "%s" .Post }}
{{ if eq $column "4" }}
{{ if .HasChildren }}
<h5>{{ .Name }}</h5>
<ul>
{{ range .Children.ByWeight }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ else }}
<li><a href="{{ .URL}}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
{{ end }}
</div>
</div>
</li>
</ul>
{{ else }}
<ul class="dropdown-menu">
{{ range .Children.ByWeight }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ end }}
</li>
{{ else }}
<li class="dropdown {{ $active }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>
<!--/.nav-collapse -->
<div class="collapse clearfix" id="search">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-template-main"><i class="fas fa-search"></i></button>
</span>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
</header>
<!-- *** NAVBAR END ***-->