Browse Source

added members mouseover info

master
Chris 6 years ago
parent
commit
10941c4f5e
  1. 2
      layouts/eventtypes/terms.html
  2. 5
      layouts/members/terms.html
  3. 31
      layouts/partials/members-summary.html
  4. 2
      layouts/partials/term-summary.html

2
layouts/eventtypes/terms.html

@ -37,7 +37,7 @@
{{ partial "term-summary.html" (dict "page" .Page "param_name" "eventtypes" "param_title" .Page.Title ) }} {{ partial "term-summary.html" (dict "page" .Page "param_name" "eventtypes" "param_title" .Page.Title ) }}
</div> </div>
<div id="{{ .Page.Title }}" class="flex justify-center pt1"> <div id="{{ .Page.Title }}" class="flex justify-center pt1">
<br> <br>
</div> </div>
</div> </div>

5
layouts/members/terms.html

@ -34,7 +34,10 @@
</div> </div>
<div class="flex pt1"> <div class="flex pt1">
{{ partial "members-summary.html" .Page }} {{ partial "members-summary.html" (dict "page" .Page "param_title" .Page.Title ) }}
</div>
<div id="{{ .Page.Title }}" class="flex justify-center pt1">
<br>
</div> </div>
</div> </div>

31
layouts/partials/members-summary.html

@ -1,6 +1,7 @@
{{ $key := .Title }} {{ $key := .page.Title }}
{{ $pages := where .Site.RegularPages "Type" "in" (slice "posts") }} {{ $pages := where .page.Site.RegularPages "Type" "in" (slice "posts") }}
{{ $count := len $pages }} {{ $count := len $pages }}
{{ $param_title := .param_title }}
{{ $totalWidth := 100.0 }} {{ $totalWidth := 100.0 }}
{{ $totalHeight := 50.0 }} {{ $totalHeight := 50.0 }}
@ -9,13 +10,22 @@
{{ $color := "#357edd" }} {{ $color := "#357edd" }}
<svg width="{{ $totalWidth }}%" height="{{ $totalHeight }}" <script>
xmlns="http://www.w3.org/2000/svg"> function onyearover(year, key, count){
document.getElementById( key ).innerHTML = year + ": " + count + " km";
}
function onyearout(key){
document.getElementById( key ).innerHTML = "<br>";
}
</script>
<svg width="{{ $totalWidth }}%" height="{{ $totalHeight }}" xmlns="http://www.w3.org/2000/svg">
<rect height="100%" width="100%" opacity="0.1" fill="{{ $color }}"/> <rect height="100%" width="100%" opacity="0.1" fill="{{ $color }}"/>
{{ $x := 0 }} {{ $x := 0 }}
{{ $year := 0 }}
{{ range sort ( $pages.GroupByDate "2006" ) "Key" }} {{ range sort ( $pages.GroupByDate "2006" ) "Key" }}
{{ $maxDist := 0.00 }} {{ $maxDist := 0.00 }}
{{ $maxCount := 0 }} {{ $maxCount := 0 }}
{{ $dist := 0.00 }} {{ $dist := 0.00 }}
@ -23,6 +33,7 @@ xmlns="http://www.w3.org/2000/svg">
{{ range .Pages }} {{ range .Pages }}
{{ $maxCount = add 1 $maxCount }} {{ $maxCount = add 1 $maxCount }}
{{ $year = dateFormat "2006" .Date }}
{{ $isMember := false }} {{ $isMember := false }}
@ -47,11 +58,11 @@ xmlns="http://www.w3.org/2000/svg">
{{ else }} {{ else }}
{{ $height = mul (float $totalHeight ) ( div (float $count ) ( float $maxCount ) ) }} {{ $height = mul (float $totalHeight ) ( div (float $count ) ( float $maxCount ) ) }}
{{ end }} {{ end }}
{{/* {{ $maxDist }} */}} {{/* $maxDist */}}
{{/* {{ $dist }} */}} {{/* $dist */}}
{{/* {{ $x }} */}} {{/* $x */}}
{{/* {{ $height }} */}} {{/* $height */}}
<rect opacity="0.2" height="{{ $height }}" y="{{ sub $totalHeight $height }}" x="{{ $x }}%" <rect onmouseover="onyearover({{ $year }}, {{ $param_title }}, {{ math.Round $dist }} )" onmouseout="onyearout({{ $param_title }})" opacity="0.2" height="{{ $height }}" y="{{ sub $totalHeight $height }}" x="{{ $x }}%"
width="{{ $width }}%" fill="{{ $color }}" stroke-width="1.5" stroke="{{$color}}"/> width="{{ $width }}%" fill="{{ $color }}" stroke-width="1.5" stroke="{{$color}}"/>
{{ $x = add $x $width }} {{ $x = add $x $width }}

2
layouts/partials/term-summary.html

@ -22,6 +22,8 @@ document.getElementById( key ).innerHTML = "<br>";
} }
</script> </script>
<svg width="{{ $totalWidth }}%" height="{{ $totalHeight }}" <svg width="{{ $totalWidth }}%" height="{{ $totalHeight }}"
xmlns="http://www.w3.org/2000/svg"> xmlns="http://www.w3.org/2000/svg">
<rect height="100%" width="100%" opacity="0.1" fill="{{ $color }}"/> <rect height="100%" width="100%" opacity="0.1" fill="{{ $color }}"/>

Loading…
Cancel
Save