blob: d0d7a1e64e546aa7fbeb38be44dfb2a9bb8ef448 (
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
|
{{/* Get the number of columns from config */}}
{{ $nb_col_lg := 6 }}
{{ $nb_col_sm := 4 }}
{{ $nb_col_xs := 2 }}
{{ with .data }}
{{ with .nb_columns }}
{{ $nb_col_lg = int . }}
{{ end }}
{{ with .nb_columns_small }}
{{ $nb_col_sm = int . }}
{{ end }}
{{ with .nb_columns_xsmall }}
{{ $nb_col_xs = int . }}
{{ end }}
{{ end }}
{{ $col_lg := print "col-lg-" (div 12 (int $nb_col_lg)) }}
{{ $col_sm := print "col-sm-" (div 12 (int $nb_col_sm)) }}
{{ $col_xs := print "col-xs-" (div 12 (int $nb_col_xs)) }}
{{ $class_hide := "" }}
{{ if .fit }}
{{ $nb_rows := int (div .nb $nb_col_lg) }}
{{ if and (ge .nb $nb_col_lg) (gt .index (mul $nb_rows $nb_col_lg)) }}
{{ $class_hide = print $class_hide " hide_lg" }}
{{ end }}
{{ $nb_rows = int (div .nb $nb_col_sm) }}
{{ if and (ge .nb $nb_col_sm) (gt .index (mul $nb_rows $nb_col_sm)) }}
{{ $class_hide = print $class_hide " hide_sm" }}
{{ end }}
{{ $nb_rows = int (div .nb $nb_col_xs) }}
{{ if and (ge .nb $nb_col_xs) (gt .index (mul $nb_rows $nb_col_xs)) }}
{{ $class_hide = print $class_hide " hide_xs" }}
{{ end }}
{{ end }}
{{ $class := print $col_lg " " $col_sm " " $col_xs $class_hide }}
<div class="{{ $class }}">
{{ $path := replace .context.File.Dir "\\" "/" }}
<a href="/{{ $path }}" class="project-box project-link">
{{ $image_file := or .context.Params.cover_image .context.Params.small_image }}
{{ if $image_file }}
{{ $image := .context.Resources.GetMatch $image_file }}
{{ with $image }}
<img src="{{ .Permalink }}" class="img-responsive" alt="{{ .Name }}">
{{ end }}
{{ end }}
<div class="project-box-caption">
<div class="project-box-caption-content">
{{ with .context.Title }}
<div class="project-name">
{{ . }}
</div>
{{ end }}
{{ with .context.Params.subtitle }}
<div class="project-category">
{{ . }}
</div>
{{ end }}
{{ with .context.Params.subtitle2 }}
<div class="project-category2">
{{ . }}
</div>
{{ end }}
{{ if .context.Params.startDate }}
<div class="project-date">
{{ partial "time-period.html" (dict "startDate" .context.Params.startDate "endDate" .context.Params.endDate) }}
</div>
{{ end }}
</div>
</div>
</a>
</div>
|