aboutsummaryrefslogtreecommitdiff
path: root/layouts/issues/small.html
blob: 97baec97db8108e85ff53631101bfaec835adc9b (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{{ $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 {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
      {{ 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 {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
      {{ 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
          {{ if eq .Params.severity "down" }}
            {{ T "ofDowntime" }}
          {{ end }}
        </div>
      {{ else }}
        <div class="ok">
          {{ T "resolvedAfter" }}

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

          {{ div (sub $timeDiff $secsForCalc) 60 }}m
          {{ if eq .Params.severity "down" }}
          <!-- {{ $secsForCalc }}s --> {{ T "ofDowntime" }}
          {{ end }}
        </div>
      {{ end }}
    {{ end }}

  {{ 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" }}">
        
      {{ if .Date.Before now }}
        {{ if .Site.Params.dateFormat }}
          {{ .Date.Format .Site.Params.dateFormat }}
        {{ else }}
          {{ .Date.Format "January 2, 2006 at 3:04 PM" }}
        {{ end }}
      {{ else }}
      {{ end }}
    </small>

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



    <!-- Marker -->
    {{ if eq .Params.severity "notice" }}
      <strong class="error">
        ◆
        {{ if .Date.Before now }}
          {{ T "downtimeOngoing" }}
        {{ else }}
          {{ if .Site.Params.dateFormat }}
            {{ .Date.Format .Site.Params.dateFormat }}
          {{ else }}
            {{ .Date.Format "January 2, 2006 at 3:04 PM" }}
          {{ end }}
        {{ end }}
      </strong>
    {{ else }}
    
      <strong class="error">
        {{ if eq .Params.severity "down" }}
        ■
        {{ else if eq .Params.severity "disrupted" }}
        ▲
        {{ else }}
        ◆
        {{ end }}
        {{ T "downtimeOngoing" }}
      </strong>
    {{ end }}

  {{ end }}
</a>