blob: daded4ad3c4b7f816c0537a7166d75e0555c450d (
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
|
{{/* Get the number of columns from config */}}
{{ $col_lg := "col-lg-2" }}
{{ with $.Site.Params.projects.nb_columns }}
{{ $nb_cols := div 12 (int .) }}
{{ $col_lg = print "col-lg-" $nb_cols }}
{{ end }}
{{ $col_sm := "col-sm-3" }}
{{ with $.Site.Params.projects.nb_columns_small }}
{{ $nb_cols := div 12 (int .) }}
{{ $col_sm = print "col-sm-" $nb_cols }}
{{ end }}
{{ $col_xs := "col-xs-6" }}
{{ with $.Site.Params.projects.nb_columns_xsmall }}
{{ $nb_cols := div 12 (int .) }}
{{ $col_xs = print "col-xs-" $nb_cols }}
{{ end }}
{{ $class := print $col_lg " " $col_sm " " $col_xs }}
<div class="{{ $class }}">
{{ $path := replace .File.Dir "\\" "/" }}
<a href="/{{ $path }}" class="project-box project-link">
{{ $image_file := or .Params.cover_image .Params.small_image }}
{{ if $image_file }}
{{ $image := .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 .Title }}
<div class="project-name">
{{ . }}
</div>
{{ end }}
{{ with .Params.subtitle }}
<div class="project-category">
{{ . }}
</div>
{{ end }}
{{ if .Params.startDate }}
<div class="project-date">
{{/* TODO: rewrite shorter/cleaner */}}
{{ $start := dateFormat .Site.Params.projects.date_format .Params.startDate }}
{{ $period := "" }}
{{ if .Site.Params.projects.period_format }}
{{ if .Params.endDate }}
{{ $end := dateFormat .Site.Params.projects.date_format .Params.endDate }}
{{ $period = replace .Site.Params.projects.period_format "{start}" $start }}
{{ $period = replace $period "{end}" $end }}
{{ else }}
{{ if .Site.Params.projects.period_format_startonly }}
{{ $period = replace .Site.Params.projects.period_format_startonly "{start}" $start }}
{{ else }}
{{ $period = replace .Site.Params.projects.period_format "{start}" $start }}
{{ $period = replace $period "{end}" "..." }}
{{ end }}
{{ end }}
{{ else }}
{{ if .Params.endDate }}
{{ $end := dateFormat .Site.Params.projects.date_format .Params.endDate }}
{{ $period = print "From " $start " to " $end }}
{{ else }}
{{ $period = print "From " $start }}
{{ end }}
{{ end }}
{{ $period }}
</div>
{{ end }}
</div>
</div>
</a>
</div>
|