Skip to content

Commit 1229b7d

Browse files
authored
Merge pull request #527 from devgeniem/TMS-1100
TMS-1100: Show multiple locations for events if available
2 parents e466b34 + 37e5146 commit 1229b7d

File tree

10 files changed

+134
-55
lines changed

10 files changed

+134
-55
lines changed

CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
- TMS-1100: Show multiple locations for events if available
11+
1012
## [1.59.6] - 2025-02-18
1113

1214
- Add scripts to be ignored by Cookiebot
1315

16+
1417
## [1.59.5] - 2025-01-22
1518

1619
- TMS-1091: Remove align-wide class from accordion block

lang/fi.mo

63 Bytes
Binary file not shown.

lang/fi.po

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
msgid ""
22
msgstr ""
33
"Project-Id-Version: TMS Theme Base\n"
4-
"POT-Creation-Date: 2024-11-13 20:00+0200\n"
5-
"PO-Revision-Date: 2024-11-13 20:01+0200\n"
4+
"POT-Creation-Date: 2025-01-30 19:55+0200\n"
5+
"PO-Revision-Date: 2025-01-30 19:55+0200\n"
66
"Last-Translator: \n"
77
"Language-Team: \n"
88
"Language: fi\n"
@@ -284,7 +284,7 @@ msgstr "Edellinen"
284284
msgid "Purchase tickets"
285285
msgstr "Osta liput"
286286

287-
#: lib/Eventz.php:122 lib/Eventz.php:171
287+
#: lib/Eventz.php:122 lib/Eventz.php:172
288288
msgid "Sign up"
289289
msgstr "Ilmoittaudu"
290290

@@ -304,35 +304,39 @@ msgstr "Aika"
304304
msgid "Location"
305305
msgstr "Sijainti"
306306

307-
#: lib/Eventz.php:158
307+
#: lib/Eventz.php:159
308308
msgid "Price"
309309
msgstr "Hinta"
310310

311-
#: lib/Eventz.php:160
311+
#: lib/Eventz.php:161
312312
msgid "Organizer"
313313
msgstr "Järjestäjä"
314314

315-
#: lib/Eventz.php:161
315+
#: lib/Eventz.php:162
316316
msgid "Area"
317317
msgstr ""
318318

319-
#: lib/Eventz.php:163
319+
#: lib/Eventz.php:164
320320
msgid "Target"
321321
msgstr ""
322322

323-
#: lib/Eventz.php:165
323+
#: lib/Eventz.php:166
324324
msgid "Tags"
325325
msgstr ""
326326

327-
#: lib/Eventz.php:169
327+
#: lib/Eventz.php:170
328328
msgid "Links"
329329
msgstr "Linkit"
330330

331-
#: lib/Eventz.php:389
331+
#: lib/Eventz.php:367
332+
msgid "and other locations"
333+
msgstr "ja muita tapahtumapaikkoja"
334+
335+
#: lib/Eventz.php:411
332336
msgid "Additional information"
333337
msgstr "Lisätiedot"
334338

335-
#: lib/Eventz.php:406
339+
#: lib/Eventz.php:428
336340
msgid "Free"
337341
msgstr "Maksuton"
338342

@@ -638,7 +642,7 @@ msgstr "Päättymispäivä"
638642
msgid "No search term given"
639643
msgstr "Hakusanaa ei annettu"
640644

641-
#: models/page-events-search.php:212 models/search.php:228
645+
#: models/page-events-search.php:212 models/search.php:239
642646
#, php-format
643647
msgctxt "search results summary"
644648
msgid "%1$1s result found for \"%2$2s\""
@@ -666,7 +670,7 @@ msgstr "Rajaa hakua"
666670
msgid "Looking for events? Use the event search!"
667671
msgstr "Etsitkö tapahtumia? Käytä tapahtumahakua!"
668672

669-
#: models/search.php:239
673+
#: models/search.php:250
670674
msgid "No search results"
671675
msgstr "Ei hakutuloksia"
672676

lang/tms-theme-base.pot

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
msgid ""
33
msgstr ""
44
"Project-Id-Version: TMS Theme Base\n"
5-
"POT-Creation-Date: 2024-11-13 20:00+0200\n"
5+
"POT-Creation-Date: 2025-01-30 19:55+0200\n"
66
"PO-Revision-Date: 2022-01-12 10:08+0200\n"
77
"Last-Translator: \n"
88
"Language-Team: \n"
@@ -284,7 +284,7 @@ msgstr ""
284284
msgid "Purchase tickets"
285285
msgstr ""
286286

287-
#: lib/Eventz.php:122 lib/Eventz.php:171
287+
#: lib/Eventz.php:122 lib/Eventz.php:172
288288
msgid "Sign up"
289289
msgstr ""
290290

@@ -304,35 +304,39 @@ msgstr ""
304304
msgid "Location"
305305
msgstr ""
306306

307-
#: lib/Eventz.php:158
307+
#: lib/Eventz.php:159
308308
msgid "Price"
309309
msgstr ""
310310

311-
#: lib/Eventz.php:160
311+
#: lib/Eventz.php:161
312312
msgid "Organizer"
313313
msgstr ""
314314

315-
#: lib/Eventz.php:161
315+
#: lib/Eventz.php:162
316316
msgid "Area"
317317
msgstr ""
318318

319-
#: lib/Eventz.php:163
319+
#: lib/Eventz.php:164
320320
msgid "Target"
321321
msgstr ""
322322

323-
#: lib/Eventz.php:165
323+
#: lib/Eventz.php:166
324324
msgid "Tags"
325325
msgstr ""
326326

327-
#: lib/Eventz.php:169
327+
#: lib/Eventz.php:170
328328
msgid "Links"
329329
msgstr ""
330330

331-
#: lib/Eventz.php:389
331+
#: lib/Eventz.php:367
332+
msgid "and other locations"
333+
msgstr ""
334+
335+
#: lib/Eventz.php:411
332336
msgid "Additional information"
333337
msgstr ""
334338

335-
#: lib/Eventz.php:406
339+
#: lib/Eventz.php:428
336340
msgid "Free"
337341
msgstr ""
338342

@@ -632,7 +636,7 @@ msgstr ""
632636
msgid "No search term given"
633637
msgstr ""
634638

635-
#: models/page-events-search.php:212 models/search.php:228
639+
#: models/page-events-search.php:212 models/search.php:239
636640
#, php-format
637641
msgctxt "search results summary"
638642
msgid "%1$1s result found for \"%2$2s\""
@@ -660,7 +664,7 @@ msgstr ""
660664
msgid "Looking for events? Use the event search!"
661665
msgstr ""
662666

663-
#: models/search.php:239
667+
#: models/search.php:250
664668
msgid "No search results"
665669
msgstr ""
666670

lib/Eventz.php

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public static function normalize_event( $event ) : array {
155155
'end_date_raw' => static::get_as_datetime( $event->event->end ),
156156
'location_title' => __( 'Location', 'tms-theme-base' ),
157157
'location' => static::get_event_location( $event ),
158+
'multiple_locations' => static::get_event_multiple_locations( $event ),
159+
'location_count' => static::count_locations( $event ),
158160
'price_title' => __( 'Price', 'tms-theme-base' ),
159161
'price' => static::get_event_price_info( $event, $lang_key ),
160162
'provider_title' => __( 'Organizer', 'tms-theme-base' ),
@@ -334,16 +336,50 @@ public static function get_event_time( $event ) {
334336
/**
335337
* Get event location.
336338
*
337-
* @param object $event Event object.
339+
* @param object $event Event object.
338340
*
339341
* @return array
340342
*/
341343
public static function get_event_location( $event ) {
342-
343344
return [
344345
'name' => $event->locations[0]->address ?? null,
345346
];
347+
}
348+
349+
/**
350+
* Get all event locations if more than one exists.
351+
*
352+
* @param object $event Event object.
353+
*
354+
* @return array
355+
*/
356+
public static function get_event_multiple_locations( $event ) {
357+
$event_locations = [];
346358

359+
if ( count( $event->locations ) <= 1 ) {
360+
return $event_locations;
361+
}
362+
363+
foreach ( $event->locations as $location ) {
364+
$event_locations[] = [
365+
'name' => $location->address ?? null
366+
];
367+
}
368+
369+
return $event_locations;
370+
}
371+
372+
/**
373+
* Get event location.
374+
*
375+
* @param object $event Event object.
376+
*
377+
* @return array
378+
*/
379+
public static function count_locations( $event ) {
380+
return [
381+
'other_locations_string' => count( $event->locations ) > 1 ? \__( 'and other locations', 'tms-theme-base' ) : null,
382+
];
347383
}
348384

349385
/**

partials/ui/event-highlight.dust

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
{>"ui/icon" icon="date" class="icon--large is-primary mr-4 {classes.event_item_icon|attr}" /}
2323
</span>
2424

25-
{date|kses}
25+
<p class="mt-0 mb-0">{date|kses}</p>
2626
</div>
2727

2828
<div class="is-flex is-align-items-center mt-2 mb-2 {classes.event_item_text|attr}">
2929
<span class="is-flex" aria-label="{Strings.s.event.time|attr}">
3030
{>"ui/icon" icon="time" class="icon--large is-primary mr-4 {classes.event_item_icon|attr}" /}
3131
</span>
3232

33-
{time|kses}
33+
<p class="mt-0 mb-0">{time|kses}</p>
3434
</div>
3535

3636
{?location.name}
@@ -39,7 +39,12 @@
3939
{>"ui/icon" icon="location" class="icon--large is-primary mr-4 {classes.event_item_icon|attr}" /}
4040
</span>
4141

42-
{location.name|html}
42+
<p class="mt-0 mb-0">
43+
{location.name|html}
44+
{?location_count.other_locations_string}
45+
{location_count.other_locations_string|html}
46+
{/location_count.other_locations_string}
47+
</p>
4348
</div>
4449
{/location.name}
4550

@@ -50,7 +55,7 @@
5055
{>"ui/icon" icon="euro" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /}
5156
</span>
5257

53-
{price|html}
58+
<p class="mt-0 mb-0">{price|html}</p>
5459
</div>
5560
{/is_free}
5661
{/price}

partials/views/page-events-calendar/page-events-calendar-item-grid.dust

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
{>"ui/icon" icon="date" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /}
3131
</span>
3232

33-
{date|html}
33+
<p class="mt-0 mb-0">{date|html}</p>
3434
</div>
3535

3636
<div class="is-flex is-align-items-center mt-2 mb-2">
3737
<span class="is-flex" aria-label="{Strings.s.event.time|attr}">
3838
{>"ui/icon" icon="time" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /}
3939
</span>
4040

41-
{time|html}
41+
<p class="mt-0 mb-0">{time|html}</p>
4242
</div>
4343

4444
{?location.name}
@@ -47,7 +47,12 @@
4747
{>"ui/icon" icon=location_icon class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /}
4848
</span>
4949

50-
{location.name|html}
50+
<p class="mt-0 mb-0">
51+
{location.name|html}
52+
{?location_count.other_locations_string}
53+
{location_count.other_locations_string|html}
54+
{/location_count.other_locations_string}
55+
</p>
5156
</div>
5257
{/location.name}
5358

@@ -58,7 +63,7 @@
5863
{>"ui/icon" icon="euro" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /}
5964
</span>
6065

61-
{price|html}
66+
<p class="mt-0 mb-0">{price|html}</p>
6267
</div>
6368
{/is_free}
6469
{/price}

partials/views/page-events-calendar/page-events-calendar-item-list.dust

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
{>"ui/icon" icon="date" class="icon--large is-primary mr-2 {item_classes.list.icon|attr}" /}
3434
</span>
3535

36-
{date|html}
36+
<p class="mt-0 mb-0">{date|html}</p>
3737
</div>
3838

3939
<div class="is-flex is-align-items-center mt-2 mb-2 mr-4 {item_classes.list.meta_label|attr}">
4040
<span class="is-flex" aria-label="{Strings.s.event.time|attr}">
4141
{>"ui/icon" icon="time" class="icon--large is-primary mr-2 {item_classes.list.icon|attr}" /}
4242
</span>
4343

44-
{time|html}
44+
<p class="mt-0 mb-0">{time|html}</p>
4545
</div>
4646

4747
{?location.name}
@@ -50,7 +50,12 @@
5050
{>"ui/icon" icon=location_icon class="icon--large is-primary mr-2 {item_classes.list.icon|attr}" /}
5151
</span>
5252

53-
{location.name|html}
53+
<p class="mt-0 mb-0">
54+
{location.name|html}
55+
{?location_count.other_locations_string}
56+
{location_count.other_locations_string|html}
57+
{/location_count.other_locations_string}
58+
</p>
5459
</div>
5560
{/location.name}
5661
</div>

partials/views/single-dynamic-event/single-dynamic-event-hero-meta.dust

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="is-flex is-flex-wrap-wrap is-justify-content-space-between">
22
{?event.normalized.date}
33
<div class="is-flex is-align-items-center has-width-100-until-desktop mb-3 mb-0-desktop">
4-
{>"ui/icon" icon="date" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|s}" /}
4+
{>"ui/icon" icon="date" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|attr}" /}
55
<p class="mt-0 mb-0">
66
{event.normalized.date|html}
77
</p>
@@ -10,7 +10,7 @@
1010

1111
{?event.normalized.time}
1212
<div class="is-flex is-align-items-center has-width-100-until-desktop mb-3 mb-0-desktop">
13-
{>"ui/icon" icon="time" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|s}" /}
13+
{>"ui/icon" icon="time" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|attr}" /}
1414
<p class="mt-0 mb-0">
1515
{event.normalized.time|html}
1616
</p>
@@ -19,9 +19,12 @@
1919

2020
{?event.normalized.location}
2121
<div class="is-flex is-align-items-center has-width-100-until-desktop">
22-
{>"ui/icon" icon="location" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|s}" /}
22+
{>"ui/icon" icon="location" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|attr}" /}
2323
<p class="mt-0 mb-0">
2424
{event.normalized.location.name|html}
25+
{?event.normalized.location_count.other_locations_string}
26+
{event.normalized.location_count.other_locations_string|html}
27+
{/event.normalized.location_count.other_locations_string}
2528
</p>
2629
</div>
2730
{/event.normalized.location}

0 commit comments

Comments
 (0)