aboutsummaryrefslogtreecommitdiff
path: root/layouts/issues/issue.html
blob: acc3fb3c36334b23ddc916628ec5826674ed197b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{{ $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" }}

<div class="article">
  {{ if .Params.Resolved }}
    <span class="ok">✓ Resolved after

      {{ $t := (time .Params.ResolvedWhen) }}
      {{ $timeDiff := (sub $t.Unix .Date.Unix) }}
      {{ $diffInMin := (div $timeDiff 60) }}

      {{ if gt $timeDiff 3600 }}
        {{ $minutesForCalc := (mod $diffInMin 60) }}

        {{ div (sub $diffInMin $minutesForCalc) 60 }}h
        {{ $minutesForCalc }}m of downtime
      {{ else }}
        {{ $secsForCalc := (mod $timeDiff 60) }}

        {{ div (sub $timeDiff $secsForCalc) 60 }}m
        <!-- {{ $secsForCalc }}s --> of downtime
      {{ end }}
    </span>
  {{ else }}
    <em>Ongoing, services {{ if eq .Params.severity "notice" }}on notice{{ else }}{{ .Params.severity }}{{ end }}</em>
  {{ end }}
  <h3>
    <a href="{{ .Permalink }}">{{ .Title }}</a>
  </h3>

  <small class="date">
    {{ .Date.Format "January 02, 2006 at 3:04 PM" }}
  </small>

  <hr>

  {{ .Content }}
</div>
<div class="padding"></div>