Browse Source

hide experiments list when there are none

master
Sean Dockray 4 years ago
parent
commit
b17e51cd18
4 changed files with 105 additions and 20 deletions
  1. +37
    -0
      themes/sandpoints/assets/css/site.css
  2. +1
    -1
      themes/sandpoints/assets/css/site.min.css
  3. +57
    -18
      themes/sandpoints/layouts/partials/header.html
  4. +10
    -1
      themes/sandpoints/layouts/partials/singlebody.html

+ 37
- 0
themes/sandpoints/assets/css/site.css View File

@@ -489,6 +489,43 @@ a.edit-button:hover {
font-size: 1rem;
}

.alsoin {
font-weight: bold;
display: inline-flex;
padding-left: 0.2rem;
padding-right: 0.3rem;
}

.ddmenu {
cursor: pointer;
display: inline-grid;
}

.ddmenu input {
display: none;
}

.ddmenu li {
list-style-type: none;
}

.ddmenu .hiddendiv {
display: none;
margin-top: -0.9rem;
}

input:focus,
select:focus,
textarea:focus,
label:focus,
button:focus {
outline: none;
}

.ddmenu input:checked ~ .hiddendiv {
display: block;
}

.logolink {
width: 2.4rem;
margin-left: auto;


+ 1
- 1
themes/sandpoints/assets/css/site.min.css
File diff suppressed because it is too large
View File


+ 57
- 18
themes/sandpoints/layouts/partials/header.html View File

@@ -3,6 +3,24 @@
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}

{{ $is_in_ := newScratch }}
{{ with eq $scratch.depth "crust" }}
{{ range $scratch.is_in }}
{{ range $k,$v := $s.Get (printf "/%s" .File) }}
{{ if eq $k "is_in" }}
{{ range $v }}
{{ $is_in_.Set (printf "/%s" .File) (printf "/%s" .File) }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

{{ $is_in_is_in := (slice) }}
{{ range $is_in_.Values }}
{{ $is_in_is_in = $is_in_is_in | append ($.GetPage .) }}
{{ end }}

{{ if eq hugo.Environment "preview" }}
{{- $gitUrl := .Site.Params.giturl -}}
<div class="headiter">
@@ -20,26 +38,47 @@
<img src="/images/bibliotheke.svg" />
</a>
<div class="breadcrumbs">
{{ if eq $scratch.depth "mantle" }}
{{ if isset $scratch "is_in" }}
<a href="{{ with (index $scratch.is_in 0) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ with (index $scratch.is_in 0) }}{{ substr .Title 0 1 }}</span><i>{{ substr .Title 1 }}</i>{{ if gt (len $scratch.is_in) 1 }}+{{ end}}</a>{{ end }}
{{ end }}
<span class="mantlebar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}
{{ if eq $scratch.depth "mantle" }}
{{ if isset $scratch "is_in" }}
<a href="{{ with (index $scratch.is_in 0) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ with (index $scratch.is_in 0) }}{{ substr .Title 0 1 }}</span><i>{{ substr .Title 1 }}</i></a>{{ end }}
{{ end }}
<span class="mantlebar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}

{{ if eq $scratch.depth "crust" }}
{{ if isset $scratch "is_in" }}
{{ $_ := index $scratch.is_in 0 }}
{{ $_ = $s.Get (printf "/%s" $_.File) }}
{{ if eq $scratch.depth "crust" }}
{{ with gt (len $is_in_is_in) 1 }}
<div class="ddmenu">
<input id="toggly1" type="checkbox">
<label for="toggly1" tabindex="1"><span class="sup">cf.&nbsp;</span><a href="{{ with (index $scratch.is_in 0) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ with (index $is_in_is_in 0) }}<i>{{ .Title }}</i></a>&nbsp;{{ end }}</label>
<div class="hiddendiv">
<ul class="mt-4">
{{ range after 1 $is_in_is_in }}
<li><a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><i>{{ .Title }}</i></a></li>
{{ end }}
</ul>
</div>
</div>
{{ else }}
{{ $home := index $is_in_is_in 0 }}
<a href="{{ $home.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ substr $home.Title 0 1 }}</span><i>{{ substr $home.Title 1 }}</i></a>
{{ end }}

{{ if isset $_ "is_in" }}
{{ $home := index $_.is_in 0 }}
<a href="{{ $home.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ substr $home.Title 0 1 }}</span><i>{{ substr $home.Title 1 }}</i></a>
{{ end }}
» <a href="{{ with (index $scratch.is_in 0) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ with (index $scratch.is_in 0) }}<i>{{ .Title }}</i></a>{{ end }}
{{ end }}
<span class="mantlebar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ with gt (len $scratch.is_in) 1 }}
»&nbsp;
<div class="ddmenu">
<input id="toggly" type="checkbox">
<label for="toggly" tabindex="1"><span class="sup">cf.&nbsp;</span><a href="{{ with (index $scratch.is_in 0) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ with (index $scratch.is_in 0) }}<i>{{ .Title }}</i></a>&nbsp;{{ end }}</label>
<div class="hiddendiv">
<ul class="mt-4">
{{ range after 1 $scratch.is_in }}
<li><a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><i>{{ .Title }}</i></a></li>
{{ end }}
</ul>
</div>
</div>
{{ else }}»&nbsp;<a href="{{ with (index $scratch.is_in 0) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ with (index $scratch.is_in 0) }}<i>{{ .Title }}</i></a>{{ end }}
{{ end }}
<span class="mantlebar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}
</div>
</div>


+ 10
- 1
themes/sandpoints/layouts/partials/singlebody.html View File

@@ -8,6 +8,15 @@
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}

{{ $has_children := true }}
{{ if isset $scratch "has_children" }}
{{ if eq (len $scratch.has_children) 1 }}
{{ if not (index $scratch.has_children 0) }}
{{ $has_children = false }}
{{ end }}
{{ end }}
{{ end }}

<div class="{{ $scratch.depth }}title"><span class="sup">{{ substr $currentDir 0 -1 }}⁄{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>

<div class="grid">
@@ -17,7 +26,7 @@
{{ end }}
</div>
<div class="rightcolumn">
{{ if (not (eq $scratch.depth "crust")) }}
{{ if and ($has_children) (not (eq $scratch.depth "crust")) }}
<div class="has">
{{ if isset $scratch "has" }}
<span class="sup">has {{ $scratch.has }}⁄</span>


Loading…
Cancel
Save