blob: bf555f0c2267d55fa8fe2c34e747d6bd075b3954 (
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
|
{{ 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 "data_display" }}
<article class="large">
<figure>
<a href="/{{ .URI }}/{{ .Slug }}"><img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" /></a>
<figcaption>{{ .Img.Legend }}</figcaption>
</figure>
<div>
<h3><a href="/{{ .URI }}/{{ .Slug }}">{{ .DataTitle }}</a></h3>
<p>{{ .Description }}</p>
</div>
</article>
{{ end }}
{{ define "section_pagination" }}
<div class="pagination">
{{ if .Paginate }}
{{ template "pagination" . }}
{{ else }}
{{ if eq (len .Data) .LenMax }}
<a href="/{{ .URI }}/">Voir plus</a>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ define "section_display--no-first" }}
<article class="article__list">
{{ range .Data }}
{{ template "data_display" . }}
{{ end }}
{{ template "section_pagination" . }}
</article>
{{ end }}
{{ define "section_display" }}
<article class="article__list">
{{ $first := firstData .Data }}
<article>
<h3>{{ $first.DataTitle }}</h3>
<figure>
<a href="/{{ .URI }}/{{ $first.Slug }}"><img src="{{ static $first.Img.Src }}" alt="{{ $first.Img.Alt }}" /></a>
<figcaption>{{ $first.Img.Legend }}</figcaption>
</figure>
<p>{{ $first.Description }}</p>
</article>
{{ range restData .Data }}
{{ template "data_display" . }}
{{ end }}
{{ template "section_pagination" . }}
</article>
{{ end }}
|