aboutsummaryrefslogtreecommitdiff
path: root/backend/templates/components.html
blob: e49a8c4a565a86220bf041bc237f2bcd7072c557 (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
{{ define "pagination" }}
  <nav>
    {{ if ne .CurrentPage 1 }}
      <a href="?page={{ before .CurrentPage }}">Précédent</a>
    {{ else }}
      <p></p>
    {{ end }}
    <p>{{ .CurrentPage }}/{{ .PagesNumber }}</p>
    {{ if ne .CurrentPage .PagesNumber }}
      <a href="?page={{ next .CurrentPage }}">Suivant</a>
    {{ else }}
      <p></p>
    {{ end }}
  </nav>
{{ end }}
{{ define "section_display" }}
  <article>
    {{ $uri := .URI }}
    {{ range .Data }}
      <article>
        <h3><a href="/{{ $uri }}/{{ .Slug }}">{{ .DataTitle }}</a></h3>
        <figure>
          <a href="/{{ $uri }}/{{ .Slug }}"><img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" /></a>
          <figcaption>{{ .Img.Legend }}</figcaption>
        </figure>
        <p>{{ .Description }}</p>
      </article>
    {{ end }}
    <div class="pagination">
      {{ if .Paginate }}
        {{ template "pagination" . }}
      {{ else }}
        {{ if eq (len .Data) .LenMax }}
          <a href="/{{ $uri }}/">Voir plus</a>
        {{ end }}
      {{ end }}
    </div>
  </article>
{{ end }}