aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas Vilčinskas <hi@mnts.lt>2019-10-06 10:28:21 +0300
committerMantas Vilčinskas <hi@mnts.lt>2019-10-06 10:28:21 +0300
commitae39ee1c2d48899e75acdecff7442b4ef8a4c49c (patch)
tree226e2d06ee3eea5f50a0712844e1388aadb9d9c6
parent19d5be70f84c21011869b6c8340a0589f353beb8 (diff)
Mostly finished API #27 for index, issue, page; remove autorefresh #80
-rw-r--r--layouts/_default/single.json8
-rw-r--r--layouts/index.json34
-rw-r--r--layouts/issues/single.json8
-rw-r--r--layouts/partials/index/autorefresh.html8
-rw-r--r--layouts/partials/js.html2
-rw-r--r--layouts/partials/meta.html2
6 files changed, 41 insertions, 21 deletions
diff --git a/layouts/_default/single.json b/layouts/_default/single.json
new file mode 100644
index 0000000..634e2bc
--- /dev/null
+++ b/layouts/_default/single.json
@@ -0,0 +1,8 @@
+{
+ "is": "page",
+ "title": "{{ .Title }}",
+ "createdAt": "{{ .Date }}",
+ "filename": "{{ .File.LogicalName }}",
+ "permalink": "{{ .Permalink }}",
+ "body": {{ jsonify .Content }}
+} \ No newline at end of file
diff --git a/layouts/index.json b/layouts/index.json
index 2495f60..c2a2c49 100644
--- a/layouts/index.json
+++ b/layouts/index.json
@@ -1,9 +1,15 @@
+{{ $incidents := where .Site.RegularPages "Params.section" "issue" }}
+{{ $active := where $incidents "Params.resolved" "=" false }}
+{{ $isNotice := where $active "Params.severity" "=" "notice" }}
+{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" }}
+{{ $isDown := where $active "Params.severity" "=" "down" }}
{
- "version": "4.0",
+ "is": "index",
+ "cStateVersion": "4.0",
+ "apiVersion": "1.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 }}",
@@ -12,8 +18,8 @@
{
"name": "{{ .name }}",{{ if .description }}
"description": "{{ .description }}",{{ end }}
- "hideTitle": "{{ .untitled }}",
- "closedByDefault": "{{ .closed }}"
+ "hideTitle": {{ if .untitled }}true{{ else }}false{{ end }},
+ "closedByDefault": {{ if .closed }}true{{ else }}false{{ end }}
}
{{ end }}
],
@@ -22,18 +28,32 @@
{
"name": "{{ .name }}",{{ if .description }}
"description": "{{ .description }}",{{ end }}
- "category": "{{ .category }}",
- "hideTitle": "{{ .untitled }}",
- "closedByDefault": "{{ .closed }}"
+ "category": "{{ .category }}"
}
{{ end }}
],
+
+ "buildDate": "{{ now.Format "2006-01-02" }}",
+ "buildTime": "{{ now.Format "15:04" }}",
+ "buildTimezone": "{{ now.Format "MST" }}",
+ "summaryStatus":{{ if $isDown }}
+ "down",
+ {{ else }}
+ {{ if $isDisrupted }}
+ "disrupted",
+ {{ else }}
+ {{ if $isNotice }}
+ "notice",
+ {{ else }}
+ "ok",
+ {{ end }}{{ end }}{{ 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 897998a..36b0f67 100644
--- a/layouts/issues/single.json
+++ b/layouts/issues/single.json
@@ -1,12 +1,12 @@
-
{
- "section": "{{ .Section }}",
+ "is": "issue",
"title": "{{ .Title }}",
- "created_at": "{{ .Date }}",
+ "createdAt": "{{ .Date }}",
+ "permalink": "{{ .Permalink }}",
"severity": "{{ .Params.severity }}",
"resolved": "{{ .Params.resolved }}",
"informational": "{{ .Params.informational }}",
- "resolved_at": "{{ .Params.resolvedWhen }}",
+ "resolvedAt": "{{ .Params.resolvedWhen }}",
"affected": [{{ range $i, $e := .Params.Affected }}{{ if $i }}, {{ end }}"{{ . }}"{{ end }}],
"filename": "{{ .File.LogicalName }}",
"body": {{ jsonify .Content }}
diff --git a/layouts/partials/index/autorefresh.html b/layouts/partials/index/autorefresh.html
index b419e2f..e69de29 100644
--- a/layouts/partials/index/autorefresh.html
+++ b/layouts/partials/index/autorefresh.html
@@ -1,8 +0,0 @@
-{{ if .Site.Params.autoRefresh }}
- <div class="faded right">
- <small><em>{{ T "autoRefreshNotice" }}</em></small>
- </div>
- <div class="padding-s"></div>
- {{ else }}
- <div class="padding"></div>
-{{ end }} \ No newline at end of file
diff --git a/layouts/partials/js.html b/layouts/partials/js.html
index 54909c2..54a0176 100644
--- a/layouts/partials/js.html
+++ b/layouts/partials/js.html
@@ -3,7 +3,7 @@
* Dev toolset
*/
- console.log('cState v4.0.0 - Dev 2019-10-04 - https://github.com/cstate/cstate');
+ console.log('cState v4.0.0 - Dev 2019-10-06 - https://github.com/cstate/cstate');
document.getElementsByTagName('html')[0].className = 'js';
/**
diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html
index 2dc58bf..277d250 100644
--- a/layouts/partials/meta.html
+++ b/layouts/partials/meta.html
@@ -12,7 +12,7 @@
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
- <meta name="generator" content="cState v4.0.0 - Dev 2019-10-04">
+ <meta name="generator" content="cState v4.0.0 - Dev 2019-10-06">
<meta name="theme-color" content="#{{ .Site.Params.brand }}">
<script>
var themeBrandColor = '#{{ .Site.Params.brand }}';