-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.twig
54 lines (45 loc) · 1.93 KB
/
index.twig
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
{% include 'partials/_header.twig' %}
<body>
{% include 'partials/_navbar.twig' %}
{# fetching content #}
{# ---------------- #}
{% setcontent cards = '('~theme.contenttypes~')' orderby theme.orderby limit theme.limit allowpaging %}
{# example for mixed content #}
{#{% setcontent cards = '('~theme.contenttypes~')' orderby theme.orderby limit theme.limit %}#}
{# getting the magic with rows and columns #}
{# i.e. 10 entries should give = 3/3/2/2, not 3/3/3/1 #}
{# -------------------------------------------------- #}
{% if cards|length > 4 %}
{% set rows = (cards|length)//4 %}
{% set d = (cards|length)-(rows*4) %}
{% set magic = [ [0,rows+(d//d)], [rows+(d//d), rows+(d//2)|round(0,'floor')], [2*rows+(d//1.5|round(0,'ceil'))+(d//d), rows+(d//3|round(0,'floor'))], [(3*rows)+d, rows] ] %}
{% else %}
{% set magic = [ [0,1], [1,1], [2,1], [3,1] ] %}
{% endif %}
{# container #}
{# --------- #}
<div class="container-fluid">
<div class="row">
{# get the 4 columns #}
{% for key in magic|keys %}
<div id="column-{{key}}" class="col-sm-12 col-md-6 col-lg-4 col-xl-3">
{# push rows in columns #}
{% for card in cards|slice(magic[key][0],magic[key][1]) %}
{% include 'partials/_card_full.twig' %}
{% endfor %}
{# pager desktop #}
{% if loop.last %}
{% if theme.pagerdesktop %}
{% include 'partials/_sub_pager_desktop.twig' %}
{% endif %}
{% endif %}
</div>
{% endfor %}
</div>
</div>
{# pager mobile #}
{% if theme.pagermobile %}
{{ pager('', '', 'partials/_sub_pager_mobile.twig') }}
{% endif %}
</div>
{% include 'partials/_footer.twig' %}