Browse Source

added years

master
Chris 6 years ago
parent
commit
f25b5ea0a8
  1. 1
      config.toml
  2. 2
      layouts/index.html
  3. 70
      layouts/partials/years-summary.html
  4. 2
      layouts/stats/list.html
  5. 42
      layouts/years/term.html
  6. 48
      layouts/years/terms.html

1
config.toml

@ -21,6 +21,7 @@ archetypeDir = "../kollegen-posts/archetypes"
eventtype = "eventtypes"
member = "members"
location = "locations"
year = "years"
[sitemap]
changefreq = "monthly"

2
layouts/index.html

@ -1,5 +1,5 @@
{{ define "main" }}
{{ partial "navigation-bar.html" ( dict "context" . "items" (slice "sports" "eventtypes" "members" "locations") )}}
{{ partial "navigation-bar.html" ( dict "context" . "items" (slice "sports" "eventtypes" "members" "locations" "years") )}}
<article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center w-100 w-70-ns center lh-copy mid-gray">
Der Kollege lädt ein, man trifft sich zum Radeln.

70
layouts/partials/years-summary.html

@ -0,0 +1,70 @@
{{ $key := .page.Title }}
{{ $pages := .pages }}
{{ $count := len $pages }}
{{ $param_name := .param_name }}
{{ $param_title := .param_title }}
{{ $totalWidth := 100.0 }}
{{ $totalHeight := 50.0 }}
{{ $width := div $totalWidth 12 }}
{{ $color := "#a8c7f0" }}
{{ $strokecolor := "#d3e3f8" }}
<script>
function onyearover(year, key, count){
// alert( year + key + "!")
document.getElementById( key ).innerHTML = year + ": " + count;
}
function onyearout(key){
// alert( year + key + "!")
document.getElementById( key ).innerHTML = "<div style='color: transparent'>:</div>";
}
</script>
<svg width="{{ $totalWidth }}%" height="{{ $totalHeight }}"
xmlns="http://www.w3.org/2000/svg">
<rect height="100%" width="100%" opacity="0.1" fill="{{ $color }}"/>
{{ $month := 0 }}
{{ $actMonth := 0 }}
{{ $maxCount := 0 }}
{{ $actCount := 0 }}
{{ range $pages }}
{{ $month = dateFormat "2006-01" .Date }}
{{ if ne $month $actMonth }}
{{ $actMonth = $month }}
{{ $actCount = 0 }}
{{ end }}
{{ $actCount = add 1 $actCount }}
{{ $maxCount = add 1 $maxCount }}
{{ $month = dateFormat "2006-01" .Date }}
{{ if gt $actCount $maxCount }}
{{ $maxCount = $actCount }}
{{ end }}
{{ end }}
{{ $x := 0 }}
{{ $month := 0 }}
{{ range sort ( $pages.GroupByDate "2006-01" ) "Key" }}
{{ range first 1 .Pages }}
{{ $month = .Params.Date.Format "01" }}
{{ end }}
{{ $height := 0 }}
{{ $height = mul (float $totalHeight ) ( div (float ( len .Pages ) ) ( float $maxCount ) ) }}
{{ $x = mul ( sub ( float $month ) 1 ) $width }}
<rect onmouseover="onyearover({{ $month }}, {{ $param_title }}, {{ len .Pages }} )" onmouseout="onyearout({{ $param_title }})" height="{{ $height }}" y="{{ sub $totalHeight $height }}" x="{{ $x }}%"
width="{{ $width }}%" fill="{{ $color }}" stroke-width="1.5" stroke="{{$strokecolor}}"
class="dim"/>
{{$x }}
{{ end }}
</svg>

2
layouts/stats/list.html

@ -99,7 +99,7 @@
<div class="center flex flex-wrap bg-white">
<div class="flex ">
<div class="f3 pt3 blue b">
<a href="../posts/#{{ .Key }}" class="link black dim">
<a href="../years/{{ .Key }}" class="link black dim">
{{ .Key }}
</a>
</div>

42
layouts/years/term.html

@ -0,0 +1,42 @@
{{ define "main" }}
{{ $nextYear := (int .Title) }}
{{ $pages := where .Site.RegularPages "Type" "in" (slice "posts") }}
{{ $pages = sort $pages "Date" }}
{{ $pages = first 1 $pages }}
{{ $next := printf "%s/%s" "years" .Title }}
{{ partial "navigation-bar.html" ( dict "context" . "items" (slice "years" ) )}}
<article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img mid-gray">
{{ $total_distance := 0 }}
{{ $total_ascent := 0 }}
{{ $total_nr_of_tours := 0 }}
{{ range .Pages }}
{{ $act_ascent:= int .Params.ascent_m }}
{{ $total_ascent = add $act_ascent $total_ascent }}
{{ $act_distance:= int .Params.distance_km }}
{{ $total_distance = add $act_distance $total_distance }}
{{ $total_nr_of_tours = add 1 $total_nr_of_tours }}
{{ end }}
<p>Touren des Jahres {{ .Title }}!</p>
{{ partial "statistic-summary.html" ( dict "total_nr" $total_nr_of_tours "distance" $total_distance "ascent" $total_ascent ) }}
</div>
</article>
<div class="mw8 center">
<section class="flex-ns flex-wrap justify-around mt5">
{{ range .Pages }}
<div class="relative w-100 mb4 bg-white">
{{ partial "summary-with-thumbnail.html" . }}
</div>
{{ end }}
</section>
</div>
{{ end }}

48
layouts/years/terms.html

@ -0,0 +1,48 @@
{{ define "main" }}
{{ partial "navigation-bar.html" ( dict "context" . "items" (slice "/" ) )}}
<article class="measure-wide center pa3 pa4-ns nested-copy-line-height nested-img">
<section class="cf pv3 pv4-l f4 tc-l measure-wide lh-copy mid-gray">
<div class="cf pv3 pv4-l f4 tc-l measure-wide lh-copy mid-gray">
<p>Events nach Jahren. Die Pulsbar zeigt die relative Anzahl pro Monat. Navigiere weiter in die Posts eines Jahres.</p>
</div>
</section>
<div class="w-100">
{{ range .Data.Terms.Alphabetical.Reverse }}
<section class="mt1">
<div class="flex flex-column bg-white ba b--white bw2 ">
<div class="flex bg-white">
<div class="flex">
<div class="f1 w4 tr pr4 pt1 bg-blue white">
{{ len .Pages }}
</div>
</div>
<div class="flex flex-column pl2">
<div class=" pl2 ">
{{ humanize .Page.Section }}
</div>
<a href="{{ .Page.Permalink }}" class="f3 b near-black link black dim pr4 pt2 pb2">
{{ .Page.Title }}
</a>
</div>
</div>
<div class="flex pt1">
{{ partial "years-summary.html" (dict "page" .Page "param_title" .Page.Title "pages" .Pages) }}
</div>
<div id="{{ .Page.Title }}" class="flex justify-center pt1">
<div style="color:transparent">:</div>
</div>
</div>
</section>
{{ end }}
</div>
</article>
{{ end }}
Loading…
Cancel
Save