forked from damnlie/bolt-theme-readonly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
record.twig
91 lines (64 loc) · 3.6 KB
/
record.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{% include '_header.twig' %}
<!-- Main -->
<div id="main">
<!-- One -->
<section id="one">
<div class="container">
<header class="major">
<h2>{{ record.title }}</h2>
{% if record.subtitle %}
<p>{{ record.subtitle }}</p>
{% endif %}
</header>
<p>
{% for key,value in record.values if key not in ['id', 'slug', 'datecreated', 'datechanged', 'datepublish', 'datedepublish', 'username', 'status', 'title', 'subtitle', 'ownerid', 'templatefields'] %}
{% if record.fieldtype(key) == "image" and value != "" %}
{% if record.image!="" %}
<div class="large-4 imageholder">
<a href="{{ image(value) }}">
<img src="{{ thumbnail(value, 640, 480) }}">
</a>
</div>
{% endif %}
{% elseif record.fieldtype(key) == "imagelist" and value != "" %}
{# We do something tricky here: we need to get value of the list in the proper
way, so the value in actually returned as a list. Using {{ record.key }}
won't work, because there is no value 'key'. In your own templates you
will be able to use {{ record.yourfieldname }}. #}
{% set list = attribute(record, key) %}
{% for item in list %}
<a href="{{ image(item.filename) }}">
<img src="{{ thumbnail(item.filename, 100,100) }}" alt="{{ item.title }}" title="{{ item.title }}">
</a>
{% endfor %}
{% elseif record.fieldtype(key) == "video" and value.responsive is defined %}
{{ value.responsive }}
{% elseif record.fieldtype(key) == "geolocation" and value.latitude is defined %}
<div class='imageholder-wide'>
<img src="http://maps.googleapis.com/maps/api/staticmap?center={{ value.latitude }},{{ value.longitude }}&zoom=14&size=617x300&sensor=false&markers={{ value.latitude }},{{ value.longitude }}">
</div>
<p>{{ value.formatted_address }}</p>
{% elseif record.fieldtype(key) in ['html', 'markdown', 'textarea'] %}
{{ attribute(record, key) }}
{% elseif record.fieldtype(key) == "select" %}
{# special case for 'select' fields.. If it's a multiple select, the value is an array. #}
<p><strong>{{ key }}: </strong>
{{ attribute(record, key)|join(", ") }}
</p>
{% elseif record.fieldtype(key) not in ['templateselect'] and value != "" %}
{# No special case defined for this type of field. We just output it, if it's
a simple scalar, and 'dump' it otherwise. #}
<p><strong>{{ key }}: </strong>
{% if attribute(record, key) is iterable %}
{{ dump(attribute(record, key)) }}
{% else %}
{{ attribute(record, key) }}
{% endif %}
</p>
{% endif %}
{% endfor %}
</p>
</div>
</section>
</div>
{% include '_footer.twig' %}