diff options
| author | Felix Hanley <felix@userspace.com.au> | 2020-03-26 00:30:29 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2020-03-26 00:30:29 +0000 |
| commit | fed28a39d4465be006184f5b27f1acaea4796eb5 (patch) | |
| tree | 7167dcef2952d1813e2b77edb509ec23c629bc22 /tmpl | |
| parent | 8eb8549b9121e3708c697361c83f39c1dfc846b5 (diff) | |
| download | sws-fed28a39d4465be006184f5b27f1acaea4796eb5.tar.gz sws-fed28a39d4465be006184f5b27f1acaea4796eb5.tar.bz2 | |
Add filtering for browsers, countries and paths
Diffstat (limited to 'tmpl')
| -rw-r--r-- | tmpl/filter.tmpl (renamed from tmpl/timerange.tmpl) | 11 | ||||
| -rw-r--r-- | tmpl/hitView.tmpl | 23 | ||||
| -rw-r--r-- | tmpl/site.tmpl | 4 | ||||
| -rw-r--r-- | tmpl/worldMap.tmpl | 2 |
4 files changed, 24 insertions, 16 deletions
diff --git a/tmpl/timerange.tmpl b/tmpl/filter.tmpl index 09ea04f..420f74a 100644 --- a/tmpl/timerange.tmpl +++ b/tmpl/filter.tmpl @@ -1,4 +1,4 @@ -{{ define "timerange" }} +{{ define "filter" }} <div class="timerange"> <!-- <form> @@ -33,8 +33,11 @@ </select> </form> --> - <a href="?begin={{ datetimeRelative "-24h"}}">last day</a> - <a href="?begin={{ datetimeRelative "-168h"}}">last 7 days</a> - <a href="?begin={{ datetimeRelative "-720h"}}">last 30 days</a> + <a href="?{{ datetimeRelative "-24h" | .QuerySetEncode "begin" }}">last day</a> + <a href="?{{ datetimeRelative "-168h" | .QuerySetEncode "begin" }}">last 7 days</a> + <a href="?{{ datetimeRelative "-720h" | .QuerySetEncode "begin" }}">last 30 days</a> + <a href="?{{ .QuerySetEncode "bots" "0" }}">without bots</a> + <a href="?{{ .QuerySetEncode "bots" "" }}">with bots</a> + <a href="?{{ .QuerySetEncode "bots" "1" }}">only bots</a> </div> {{ end }} diff --git a/tmpl/hitView.tmpl b/tmpl/hitView.tmpl index b5a5d05..2636c5f 100644 --- a/tmpl/hitView.tmpl +++ b/tmpl/hitView.tmpl @@ -1,5 +1,6 @@ {{ define "hitView" }} {{ $siteID := .Site.ID }} + {{ $payload := . }} <section class="panel panel--wide"> <header class="panel__header"> <h3 class="panel__title">Hits</h3> @@ -29,7 +30,7 @@ {{ if lt $i 10 }} <tr> <td class="details__name"> - <a href="/sites/{{ $siteID }}/pages?path={{ .Path }}">{{ .Path }}</a> + <a href="/sites/{{ $siteID }}?{{ $payload.QuerySetEncode "path" .Path }}">{{ .Path }}</a> </td> <td class="details__count"><span class="details__percent">{{ percent .Count $sum | round 1 }}%</span> ({{ .Count }})</td> </tr> @@ -54,7 +55,9 @@ <table class="table is-striped details details--countries"> {{ range .CountrySet }} <tr> - <td class="details__name">{{ .Name | countryName }}</td> + <td class="details__name"> + <a href="/sites/{{ $siteID }}?{{ $payload.QuerySetEncode "country" .Name }}">{{ .Name | countryName }}</a> + </td> <td class="details__count"><span class="details__percent">{{ percent .Count $sum | round 1 }}%</span> ({{ .Count }})</td> </tr> {{ end }} @@ -90,16 +93,18 @@ <header class="panel__header"> <h3 class="panel__title">User agents</h3> </header> - {{ if .Browsers }} + {{ if .BrowserSet }} <figure class="figure figure--graph"> - <img src="{{ piechart .Site.ID "b" .Begin .End }}" /> - {{ template "barChart" .Browsers }} + <img src="{{ piechart "b" . }}" /> + {{ template "barChart" .BrowserSet }} </figure> - {{ $sum := .Browsers.YSum }} + {{ $sum := .BrowserSet.YSum }} <table class="table is-striped details details--browsers"> - {{ range .Browsers }} + {{ range .BrowserSet }} <tr> - <td class="details__name">{{ .Name }}</td> + <td class="details__name"> + <a href="/sites/{{ $siteID }}?{{ $payload.QuerySetEncode "browser" .Name }}">{{ .Name }}</a> + </td> <td class="details__count"><span class="details__percent">{{ percent .Count $sum | round 1 }}%</span> ({{ .Count }})</td> </tr> {{ end }} @@ -125,7 +130,7 @@ <!-- <span class="summary__comparison"></span> --> </div> {{ end }} - {{ with .Browsers }} + {{ with .BrowserSet }} <div class="summary"> <span class="summary__title">Total Browsers</span> <span class="summary__count">{{ .Count }}</span> diff --git a/tmpl/site.tmpl b/tmpl/site.tmpl index d506eca..b2ef689 100644 --- a/tmpl/site.tmpl +++ b/tmpl/site.tmpl @@ -3,7 +3,7 @@ <header class="header--site"> {{ if .Site.ID }} {{ with .Site }} - <h1 class="title--site">Site summary for {{ .Name }}</h1> + <h1 class="title--site">Hits for {{ .Name }}</h1> <span class="title__description--site">{{ .Description }}</span> {{ end }} {{ else }} @@ -14,7 +14,7 @@ {{ template "siteSummary" . }} {{ if .Site.ID }} - {{ template "timerange" . }} + {{ template "filter" . }} {{ end }} {{ if .Hits }} {{ template "hitView" . }} diff --git a/tmpl/worldMap.tmpl b/tmpl/worldMap.tmpl index 2da8c17..c476157 100644 --- a/tmpl/worldMap.tmpl +++ b/tmpl/worldMap.tmpl @@ -41,7 +41,7 @@ <style> {{ $max := .YMax }} {{ range .XSeries }} - #{{ .Label }} { fill: hsla(230, {{ percent .Count $max }}%, 50%, 1) !important; } + #{{ .Label }} { fill: hsla(230, 50%, 50%, {{ percent .Count $max }}%) !important; } {{ end }} </style> <defs |
