card.twig 10.3 KB
Newer Older
1
{% import '@base/macros/uw.macro.twig' as macros %}
2

3
4
5
6
7
8
9
10
{% set show_title = 'yes' %}
{% if title or sub_title %}
  {% if card_type == 'node' and featured_image == 'no' %}
    {% set show_title = 'no' %}
  {% endif %}
{% endif %}

<article class="card {{ modifier_classes }} {% if show_hover %} card--show-hover {% endif %} {{ card_type }}" >
11

12
13
  {% if featured_image == 'yes' and hero.img_element %}
    <div class="card__featured-image" style="background-image: url({{ hero.img_element }});" role="img" aria-label="{{ hero.alt }}">
14
15
16
    </div>
  {%  endif %}

17
  <div class="card__body">
18
    {% if title or author or date or sub_title or position %}
19
20
21
      <div class="card__header">
        {% if date %}
          <div class="card__date">
22
23
24
25
            {% include '@components/date/date.twig' with {
              'date_format': date_format,
              'date': date,
            } %}
26
27
          </div>
        {% endif %}
28
29
30
31

        {% if show_title == 'yes' %}
          <h{{ header_level }} class="card__title">
            {% if url %}
32
              <a href="{{ url }}">
33
34
35
            {% endif %}
            {{ title }}
            {% if url %}
36
              </a>
37
38
            {% endif %}
          </h{{ header_level }}>
39
40
41
          {% if sub_title %}
            <span class="sub-title">{{ sub_title }}</span>
          {% endif %}
42
        {% endif %}
43

44
45
46
47
        {% if position %}
          <div class="card__position">
            {{ position }}
          </div>
48
        {% endif %}
49
50

        {% if author %}
51
52
          <div class="card__author">
            by
53
54
55
56
            {% if author.link %}
              <a href="{{ author.link }}">{{ author.name }}</a>
            {% else %}
              {{ author.name }}
57
58
59
60
61
            {% endif %}
          </div>
        {% endif %}
      </div>
    {% endif %}
62
    {% if not featured_image and (sources or img_element) %}
63
64
      <div class="card__media">
        {% if url %}
65
66
67
68
69
70
71
72
73
74
75
          <a href="{{ url }}">
        {% endif %}

        {% include "@components/responsive-image/responsive-image.twig" with {
          sources: sources,
          img_element: img_element,
          alt: alt
        }%}

        {% if url %}
          </a>
76
77
78
        {% endif %}
      </div>
    {% endif %}
79

Kevin Paxman's avatar
Kevin Paxman committed
80
    {% if image and not card_type == 'banner' %}
81
      <div class="card__image">
82
        <img src="{{ image }}" alt="{{ alt }}" />
83
84
85
      </div>
    {% endif %}

86
    {% if content %}
87
      <div class="card__content">
88
89
90
        {{ content }}
      </div>
    {% endif %}
91
92

  </div>
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

  <div class="card__footer">
    {{ footer }}

    {% if additional_info %}
      <div class="card__additional-info">
        {% embed '@components/details/details.twig' %}
          {% block details_summary %}
            Additional Information
          {% endblock %}

          {% block details_content %}
            <div class="card__additional-info-content">
              {{ additional_info }}
            </div>
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

    {% if email or phone or location %}
      <div class="card__contact-info">
        {% embed '@components/details/details.twig' %}
          {% block details_summary %}
            Contact Information
          {% endblock %}

          {% block details_content %}
            {% if email %}
              <div class="card__email">
                <a href="mailto:{{ email }}">{{ email }}</a>
              </div>
            {% endif %}
            {% if phone %}
              <div class="card__phone">
                {{ phone }}
              </div>
            {% endif %}
            {% if location %}
              <div class="card__location">
133
                <span class="uw-label">Location:</span> {{ location }}
134
135
136
137
138
139
140
              </div>
            {% endif %}
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

141
    {% if link_profile or personal_webpage %}
142
143
144
145
146
147
148
149
      <div class="card__contact-links">
        {% embed '@components/details/details.twig' %}
          {% block details_summary %}
            Links
          {% endblock %}

          {% block details_content %}
            {% if link_profile %}
150
              <div class="card__link-profile">Link to Profile:<br />
151
152
153
154
                <a href="{{ link_profile.uri }}">{{ link_profile.title }}</a>
              </div>
            {% endif %}
            {% if personal_webpage %}
155
156
              <div class="card__personal-webpage">
                <span class="uw-label">Link to personal webpage:</span>
157
158
159
160
161
162
163
164
                <a href="{{ personal_webpage.uri }}">{{ personal_webpage.title }}</a>
              </div>
            {% endif %}
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

165
166
167
168
169
170
171
172
173
174
175
    {% if host or event_website or cost %}
      <div class="card__additional-info">
        {% embed '@components/details/details.twig' with {
          is_open: TRUE,
        } %}
          {% block details_summary %}
            Additional Information
          {% endblock %}

          {% block details_content %}
            {% if host %}
176
177
              <div class="card__host">
                <span class="uw-label"> Host:</span>
178
179
180
181
182
183
184
185
186
187
                <a href="{{ host.uri }}">
                  {% if host.title %}
                    {{ host.title }}
                  {% else %}
                    {{ host.uri }}
                  {% endif %}
                </a>
              </div>
            {% endif %}
            {% if event_website %}
188
189
              <div class="card__event-website">
                <span class="uw-label"> Event website:</span>
190
191
192
193
194
195
196
197
198
199
                <a href="{{ event_website.uri }}">
                  {% if event_website.title %}
                    {{ event_website.title }}
                  {% else %}
                    {{ event_website.uri }}
                  {% endif %}
                </a>
              </div>
            {% endif %}
            {% if cost %}
200
201
              <div class="card__cost">
                <span class="uw-label">Cost:</span>
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
                ${{ cost }}
              </div>
            {% endif %}
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

    {% if address or map or map_link %}
      <div class="card__location">
        {% embed '@components/details/details.twig' with {
          is_open: TRUE,
        } %}
          {% block details_summary %}
            Location Information
          {% endblock %}

          {% block details_content %}
            {% if address %}
221
222
              <div class="card__address">
                <span class="uw-label">Location Address:</span>
223
224
225
                {% if address.organization %}
                  {{ address.organization }}<br />
                {% endif %}
226
227
228
229
230
231
                {% if address.address_line1 %}
                  {{ address.address_line1 }}<br />
                {% endif %}
                {% if address.address_line2 %}
                  {{ address.address_line2 }}<br />
                {% endif %}
232
233
                {% if address.locality or address.administrative_area or address.country_code or address.postal_code %}
                  {% if address.locality %}{{ address.locality }}{% if address.administrative_area %}, {% endif %}{% endif %}{% if address.administrative_area %}{{ address.administrative_area }}{% endif %}{% if address.country_code and (address.locality or address.administrative_area) %}, {% endif %}{% if address.country_code %}{{ address.country_code }}{% endif %}{% if address.postal_code and (address.locality or address.administrative_area or address.country_code) %}&nbsp; {% endif %}{% if address.postal_code %}{{ address.postal_code }}{% endif %}
234
235
236
237
                {% endif %}
              </div>
            {% endif %}
            {% if map %}
238
239
              <div class="card__map">
                <span class="uw-label">Location coordinates:</span>
240
241
242
243
                {{ map }}
              </div>
            {% endif %}
            {% if map_link %}
244
245
              <div class="card__map-link">
                <span class="uw-label"> Link to map:</span>
246
247
248
249
250
251
252
253
                <a href="{{ map_link.uri }}">{{ map_link.uri }}</a>
              </div>
            {% endif %}
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
    {% if contact_for %}
      <div class="card__contact-for">
        {% embed '@components/details/details.twig' %}
          {% block details_summary %}
            Contact for
          {% endblock %}

          {% block details_content %}
            <div class="card__contact-for-content">
              {{ contact_for }}
            </div>
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

    {% if groups %}
      <div class="card__groups">
        {% embed '@components/details/details.twig' %}
          {% block details_summary %}
            Groups
          {% endblock %}

          {% block details_content %}
            <div class="card__groups-list">
              {% for group in groups %}
                {% if loop.index0 > 0 %}
                  , {{ group.title }}
                {% else %}
                  {{ group.title }}
                {% endif %}
              {% endfor %}
            </div>
          {% endblock %}
        {% endembed %}
      </div>
    {% endif %}

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    {% if catalog_tags %}
      <div class="card__catalog-tags">
        {% embed '@components/details/details.twig' with {
          'is_open': TRUE,
        } %}
          {% block details_summary %}
            Additional Information
          {% endblock %}

          {% block details_content %}
            {% for key, tag in catalog_tags %}
              <div class="card__catalog-tags card__tags-{{ key }}">
                <strong>{{ key }}:</strong><br />
                {% include "@components/tag-list/tag-list.twig" with {
                  items: tag
                } %}
              </div>
            {% endfor %}
          {% endblock %}
        {% endembed %}
    {% endif %}

314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
    {% if tags %}
      <div class="card__tags">
        {% for tag in tags %}
          {% include "@components/tag-list/tag-list.twig" with {
            items: tag
          } %}
        {% endfor %}
      </div>
    {% endif %}

    {% if read_more and url %}
      <div class="card__readmore">
        {{ macros.readmore(url, title) }}
      </div>
    {% endif %}

    {%  if social_media %}
      <div class="card__social {{ social_media_placement }}">
        {% include "@components/menu/menu--social/menu--social.twig" %}
      </div>
    {% endif %}
  </div>
336
</article>