aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorMantas Vilčinskas <hi@mnts.lt>2019-10-05 19:43:56 +0300
committerMantas Vilčinskas <hi@mnts.lt>2019-10-05 19:43:56 +0300
commit19d5be70f84c21011869b6c8340a0589f353beb8 (patch)
treec90c955e9ab6845d3e9c703622e6b7b974b2507e /layouts
parentf8bda4294a3fa9af533ca7ab8753663aed7aa7d1 (diff)
Added API for index, fully added #43 with tweaks to yrly archive
Diffstat (limited to 'layouts')
-rw-r--r--layouts/index.html4
-rw-r--r--layouts/index.json39
-rw-r--r--layouts/issues/single.json9
-rw-r--r--layouts/partials/index/incidents-monthly.html29
-rw-r--r--layouts/partials/index/incidents-yearly.html9
5 files changed, 81 insertions, 9 deletions
diff --git a/layouts/index.html b/layouts/index.html
index da6f6ad..c02224a 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -38,8 +38,10 @@
<!-- All incidents + pagination -->
<div class="contain contain--more" id="incidents">
- {{ if .Site.Params.enableYearlyIncidentHistory }}
+ {{ if eq .Site.Params.incidentHistoryFormat "yearly" }}
{{ partial "index/incidents-yearly" . }}
+ {{ else if eq .Site.Params.incidentHistoryFormat "monthly" }}
+ {{ partial "index/incidents-monthly" . }}
{{ else }}
{{ partial "index/incidents" . }}
{{ end }}
diff --git a/layouts/index.json b/layouts/index.json
new file mode 100644
index 0000000..2495f60
--- /dev/null
+++ b/layouts/index.json
@@ -0,0 +1,39 @@
+{
+ "version": "4.0",
+ "title": "{{ .Site.Title }}",
+ "languageCodeHTML": "{{ .Site.LanguageCode }}",
+ "languageCode": "{{ T "languageCode" }}",
+ "languageCode": "{{ T "languageCode" }}",
+ "baseURL": "{{ .Site.BaseURL }}",
+ "description": "{{ .Site.Params.Description }}",
+ "logo": "{{ .Site.Params.logo | absURL }}",
+ "categories": [
+ {{ range $i, $e := .Site.Params.categories }}{{ if $i }},{{ end }}
+ {
+ "name": "{{ .name }}",{{ if .description }}
+ "description": "{{ .description }}",{{ end }}
+ "hideTitle": "{{ .untitled }}",
+ "closedByDefault": "{{ .closed }}"
+ }
+ {{ end }}
+ ],
+ "systems": [
+ {{ range $i, $e := .Site.Params.systems }}{{ if $i }},{{ end }}
+ {
+ "name": "{{ .name }}",{{ if .description }}
+ "description": "{{ .description }}",{{ end }}
+ "category": "{{ .category }}",
+ "hideTitle": "{{ .untitled }}",
+ "closedByDefault": "{{ .closed }}"
+ }
+ {{ end }}
+ ],
+
+ "colorBrand": "{{ .Site.Params.Brand }}",
+ "colorOk": "{{ .Site.Params.Ok }}",
+ "colorDisrupted": "{{ .Site.Params.Disrupted }}",
+ "colorDown": "{{ .Site.Params.Down }}",
+ "colorNotice": "{{ .Site.Params.Notice }}",
+ "alwaysKeepBrandColor": "{{ .Site.Params.alwaysKeepBrandColor }}",
+ "googleAnalytics": "{{ .Site.Params.googleAnalytics }}"
+} \ No newline at end of file
diff --git a/layouts/issues/single.json b/layouts/issues/single.json
index 6287288..897998a 100644
--- a/layouts/issues/single.json
+++ b/layouts/issues/single.json
@@ -5,10 +5,9 @@
"created_at": "{{ .Date }}",
"severity": "{{ .Params.severity }}",
"resolved": "{{ .Params.resolved }}",
+ "informational": "{{ .Params.informational }}",
"resolved_at": "{{ .Params.resolvedWhen }}",
- "affected": [{{ range $i, $e := .Params.Affected }}{{ if $i }}, {{ end }}'{{ . }}'{{ end }}],
-
- "body": {{ jsonify .Content }},
-
- "filename": "{{ .File.LogicalName }}"
+ "affected": [{{ range $i, $e := .Params.Affected }}{{ if $i }}, {{ end }}"{{ . }}"{{ end }}],
+ "filename": "{{ .File.LogicalName }}",
+ "body": {{ jsonify .Content }}
} \ No newline at end of file
diff --git a/layouts/partials/index/incidents-monthly.html b/layouts/partials/index/incidents-monthly.html
new file mode 100644
index 0000000..263bc52
--- /dev/null
+++ b/layouts/partials/index/incidents-monthly.html
@@ -0,0 +1,29 @@
+{{ $incidents := where .Site.RegularPages "Params.section" "issue" }}
+
+
+
+{{ range ($incidents.GroupByDate "1") }}
+ <div class="padding"></div>
+ <hr>
+ <p class="center" id="archive-{{ range first 1 .Pages }}{{ .Date.Format "2006" }}{{ end }}-{{ .Key }}"><a href="#archive-{{ range first 1 .Pages }}{{ .Date.Format "2006" }}{{ end }}-{{ .Key }}" class="no-underline">
+ <b>
+ <!-- Hugo requires a '0' in the month
+ which is why this check exists -->
+ {{ if gt .Key 9 }}
+ {{ $month := printf "2006-%s-02" .Key }}
+ {{ $monthDate := $month | time }}
+ {{ $monthDate.Format "January" }}
+ {{ else }}
+ {{ $month := printf "2006-0%s-02" .Key }}
+ {{ $monthDate := $month | time }}
+ {{ $monthDate.Format "January" }}
+ {{ end }}
+ {{ range first 1 .Pages }}{{ .Date.Format "2006" }}{{ end }}
+ </b><small class="faded">({{ len .Pages }})</small>
+ </a></p>
+ <hr>
+
+ {{ range .Pages }}
+ {{ .Render "small" }}
+ {{ end }}
+{{ end }}
diff --git a/layouts/partials/index/incidents-yearly.html b/layouts/partials/index/incidents-yearly.html
index 5cc323a..d07be9d 100644
--- a/layouts/partials/index/incidents-yearly.html
+++ b/layouts/partials/index/incidents-yearly.html
@@ -1,9 +1,12 @@
{{ $incidents := where .Site.RegularPages "Params.section" "issue" }}
-{{ range ((where .Site.RegularPages "Params.section" "issue").GroupByDate "2006") }}
- <p class="center" id="{{ .Key }}"><a href="#{{ .Key }}" class="no-underline"><strong>{{ .Key }}</strong>
+
+{{ range ($incidents.GroupByDate "2006") }}
+ <div class="padding"></div>
+ <hr>
+ <p class="center" id="archive-{{ .Key }}"><a href="#archive-{{ .Key }}" class="no-underline"><strong>{{ .Key }}</strong>
<span class="faded">({{ len .Pages }})</span>
- </a></p>
+ </a></p><hr>
{{ range .Pages }}
{{ .Render "small" }}