aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/index/incidents.html
blob: d627997f0da989e9591dbe1d8ee90a2a59035fac (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
{{ $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" }}

<!-- Pagination is also included with incidents -->

{{ if not $incidents }}
  <div class="padding"></div>
  <h3>{{ T "calmBeforeTheStorm" }}</h3>
  <p>{{ T "noIncidentsDesc" }}</p>
  <div class="padding"></div>
  <div class="padding"></div>
  <div class="padding"></div>
{{ else }}
  {{ $paginator := .Paginate $incidents .Site.Params.incidentPostsPerPage }}
  {{ range $paginator.Pages }}
    {{ .Render "small" }}
  {{ end }}

  <!-- If there are more than 2 pages, show pagination -->
  {{ if gt $paginator.TotalPages 1 }}
    <hr>

    <div class="center">
      {{ if $paginator.HasPrev }}
        <a href="{{ $paginator.Prev.URL }}#incidents">
          ← &nbsp;
          {{ T "prev" }}
        </a>
      {{ else }}
        <span class="faded">
          ← &nbsp;
          {{ T "prev" }}
        </span>
      {{ end }}


      &nbsp; &nbsp;
      {{ $paginator.PageNumber }}
      /
      {{ $paginator.TotalPages }}
      &nbsp; &nbsp;


      {{ if $paginator.HasNext }}
        <a href="{{ $paginator.Next.URL }}#incidents">
          {{ T "next" }} &nbsp;
          →
        </a>
      {{ else }}
        <span class="faded">
          {{ T "next" }} &nbsp;
          →
        </span>
      {{ end }}
    </div>
  {{ end }}
{{ end }}