Skip to content

Commit

Permalink
cState v5.6.0 #300
Browse files Browse the repository at this point in the history
cState v5.6.0
  • Loading branch information
mistermantas committed Dec 1, 2023
2 parents ed2321e + 1674bfc commit 627b76a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 14 deletions.
16 changes: 15 additions & 1 deletion layouts/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $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" }}{
"is": "index",
"cStateVersion": "5.5.2",
"cStateVersion": "5.6",
"apiVersion": "2.0",
"title": "{{ .Site.Title }}",
"languageCodeHTML": "{{ .Site.LanguageCode }}",
Expand All @@ -17,6 +17,20 @@
}
{{ end }}
],
{{ $informationals := where $incidents "Params.informational" "=" true }}{{ $pinnedIssues := where $informationals "Params.pin" "=" true }}
{{ if not $pinnedIssues }}
"pinnedIssues": []{{ else }}
"pinnedIssues": [{{ range $i, $e := $pinnedIssues }}{{ if $i }},{{ end }}
{
"is": "issue",
"title": "{{ .Title }}",
"createdAt": "{{ .Date }}",
"lastMod": "{{ .Lastmod }}",
"permalink": "{{ .Permalink }}",
"affected": [{{ range $i, $e := .Params.Affected }}{{ if $i }}, {{ end }}"{{ . }}"{{ end }}],
"filename": "{{ .File.LogicalName }}"
}{{ end }}
]{{ end }},
"systems": [
{{ range $i, $e := .Site.Params.systems }}{{ if $i }},{{ end }}
{
Expand Down
2 changes: 1 addition & 1 deletion layouts/issues/issue.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class="clean">

<small class="date">
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/issues/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<p>{{ T "lastChecked" }}:

{{ if .Site.Params.dateFormat }}
{{ .Lastmod.Format .Site.Params.dateFormat }}
{{ dateFormat .Site.Params.dateFormat .Lastmod }}
{{ else }}
{{ .Lastmod.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
Expand Down
1 change: 1 addition & 0 deletions layouts/issues/single.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"is": "issue",
"title": "{{ .Title }}",
"body": {{ jsonify .Content }},
"createdAt": "{{ .Date }}",
"lastMod": "{{ .Lastmod }}",
"permalink": "{{ .Permalink }}",
Expand Down
14 changes: 7 additions & 7 deletions layouts/issues/small.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<a href="{{ .Permalink }}" class="issue no-underline">
{{ if .Params.informational }}

<small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
<small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ dateFormat .Site.Params.dateFormat .Params.date }}" data-date="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
Expand All @@ -23,9 +23,9 @@ <h3>
</span>

{{ else if .Params.Resolved }}
<small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
<small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ dateFormat .Site.Params.dateFormat .Params.date }}" data-date="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
Expand Down Expand Up @@ -73,11 +73,11 @@ <h3>

{{ else }}
<!-- If not resolved -->
<small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
<small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ dateFormat .Site.Params.dateFormat .Params.date }}" data-date="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">

{{ if .Date.Before now }}
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
Expand All @@ -99,7 +99,7 @@ <h3>
{{ T "downtimeOngoing" }}
{{ else }}
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ dateFormat .Site.Params.dateFormat .Params.date }}
{{ else }}
{{ .Date.Format "January 2, 2006 at 3:04 PM" }}
{{ end }}
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/index/announcements.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{{ $allPosts := where .Site.RegularPages "Params.section" "issue" }}
{{ $active := where $allPosts "Params.resolved" "=" false }}
{{ $allActive := where $allPosts "Params.resolved" "=" false }}
{{ $active := where $allActive "Params.pin" "!=" false }}
{{/* this $active checks if pin is explicitely set to false */}}

{{ $informationals := where $allPosts "Params.informational" "=" true }}
{{ $pinned := where $informationals "Params.pin" "=" true }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Dev toolset
*/

console.log('cState v5.5.2 - https://github.com/cstate/cstate');
console.log('cState v5.6 - https://github.com/cstate/cstate');
document.getElementsByTagName('html')[0].className = 'js';

/**
Expand Down Expand Up @@ -103,7 +103,7 @@
var elements = document.querySelectorAll('.relative-time');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
var time = Date.parse(element.getAttribute('title'));
var time = Date.parse(element.dataset.date);
var html = element.getAttribute('data-time-prefix') || '';


Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 v5.5.2 - https://github.com/cstate/cstate">
<meta name="generator" content="cState v5.6 - https://github.com/cstate/cstate">
<meta name="theme-color" content="{{ .Site.Params.brand }}">
<script>
var themeBrandColor = '{{ .Site.Params.brand }}';
Expand Down

0 comments on commit 627b76a

Please sign in to comment.