aboutsummaryrefslogtreecommitdiff
path: root/layouts/issues/small.html
blob: 9349046492fb1687c1096509d7dc02916faf810b (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{{ $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" }}

<a href="{{ .Permalink }}" class="issue no-underline">
  {{ if .Params.informational }}
    
    <small class="date float-right">
      {{ if .Site.Params.dateFormat }}
        {{ .Date.Format .Site.Params.dateFormat }}
      {{ else }}
        {{ .Date.Format "January 2, 2006 at 3:04 PM" }}
      {{ end }}
    </small>

    <h3>
      {{ .Title }} &nbsp;ℹ
    </h3>
    <span class="faded">{{ .Summary | truncate 200 }}
    </span>
  
  {{ else if .Params.Resolved }}
    <small class="date float-right">
      {{ if .Site.Params.dateFormat }}
        {{ .Date.Format .Site.Params.dateFormat }}
      {{ else }}
        {{ .Date.Format "January 2, 2006 at 3:04 PM" }}
      {{ end }}
    </small>

    <h3>
      {{ .Title }}
    </h3>

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

    <!-- Marker -->
    {{ if lt $timeDiff 60 }}
    <div class="faded">
      {{ T "resolved" }} {{ T "inUnderAMinute" }}
    </div>
    {{ else }}
      {{ if gt $timeDiff 3600 }}
        <div class="warning">
          {{ T "resolvedAfter" }}

          {{ $minutesForCalc := (mod $diffInMin 60) }}

          {{ div (sub $diffInMin $minutesForCalc) 60 }}h
          {{ $minutesForCalc }}m {{ T "ofDowntime" }}
        </div>
      {{ else }}
        <div class="ok">
          {{ T "resolvedAfter" }}

          {{ $secsForCalc := (mod $timeDiff 60) }}

          {{ div (sub $timeDiff $secsForCalc) 60 }}m
          <!-- {{ $secsForCalc }}s --> {{ T "ofDowntime" }}
        </div>
      {{ end }}
    {{ end }}
  {{ else }}

    <small class="date float-right">
      {{ if .Site.Params.dateFormat }}
        {{ .Date.Format .Site.Params.dateFormat }}
      {{ else }}
        {{ .Date.Format "January 2, 2006 at 3:04 PM" }}
      {{ end }}
    </small>

    <h3>
      {{ .Title }}
    </h3>

    <!-- Marker -->
    <strong class="error">
      {{ if eq .Params.severity "down" }}
      ◼ 
      {{ else if eq .Params.severity "disrupted" }}
      ▲
      {{ else }}
      ◆
      {{ end }}
      {{ T "downtimeOngoing" }}</strong>

  {{ end }}
</a>