diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 4dc90345..57e5da9d 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- TMS-1100: Show multiple locations for events if available + ## [1.59.6] - 2025-02-18 - Add scripts to be ignored by Cookiebot + ## [1.59.5] - 2025-01-22 - TMS-1091: Remove align-wide class from accordion block diff --git a/lang/fi.mo b/lang/fi.mo index 25b60acb..e21f650d 100644 Binary files a/lang/fi.mo and b/lang/fi.mo differ diff --git a/lang/fi.po b/lang/fi.po index 553e6012..fd59523f 100644 --- a/lang/fi.po +++ b/lang/fi.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: TMS Theme Base\n" -"POT-Creation-Date: 2024-11-13 20:00+0200\n" -"PO-Revision-Date: 2024-11-13 20:01+0200\n" +"POT-Creation-Date: 2025-01-30 19:55+0200\n" +"PO-Revision-Date: 2025-01-30 19:55+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: fi\n" @@ -284,7 +284,7 @@ msgstr "Edellinen" msgid "Purchase tickets" msgstr "Osta liput" -#: lib/Eventz.php:122 lib/Eventz.php:171 +#: lib/Eventz.php:122 lib/Eventz.php:172 msgid "Sign up" msgstr "Ilmoittaudu" @@ -304,35 +304,39 @@ msgstr "Aika" msgid "Location" msgstr "Sijainti" -#: lib/Eventz.php:158 +#: lib/Eventz.php:159 msgid "Price" msgstr "Hinta" -#: lib/Eventz.php:160 +#: lib/Eventz.php:161 msgid "Organizer" msgstr "Järjestäjä" -#: lib/Eventz.php:161 +#: lib/Eventz.php:162 msgid "Area" msgstr "" -#: lib/Eventz.php:163 +#: lib/Eventz.php:164 msgid "Target" msgstr "" -#: lib/Eventz.php:165 +#: lib/Eventz.php:166 msgid "Tags" msgstr "" -#: lib/Eventz.php:169 +#: lib/Eventz.php:170 msgid "Links" msgstr "Linkit" -#: lib/Eventz.php:389 +#: lib/Eventz.php:367 +msgid "and other locations" +msgstr "ja muita tapahtumapaikkoja" + +#: lib/Eventz.php:411 msgid "Additional information" msgstr "Lisätiedot" -#: lib/Eventz.php:406 +#: lib/Eventz.php:428 msgid "Free" msgstr "Maksuton" @@ -638,7 +642,7 @@ msgstr "Päättymispäivä" msgid "No search term given" msgstr "Hakusanaa ei annettu" -#: models/page-events-search.php:212 models/search.php:228 +#: models/page-events-search.php:212 models/search.php:239 #, php-format msgctxt "search results summary" msgid "%1$1s result found for \"%2$2s\"" @@ -666,7 +670,7 @@ msgstr "Rajaa hakua" msgid "Looking for events? Use the event search!" msgstr "Etsitkö tapahtumia? Käytä tapahtumahakua!" -#: models/search.php:239 +#: models/search.php:250 msgid "No search results" msgstr "Ei hakutuloksia" diff --git a/lang/tms-theme-base.pot b/lang/tms-theme-base.pot index db4ba6fa..947a5955 100644 --- a/lang/tms-theme-base.pot +++ b/lang/tms-theme-base.pot @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: TMS Theme Base\n" -"POT-Creation-Date: 2024-11-13 20:00+0200\n" +"POT-Creation-Date: 2025-01-30 19:55+0200\n" "PO-Revision-Date: 2022-01-12 10:08+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -284,7 +284,7 @@ msgstr "" msgid "Purchase tickets" msgstr "" -#: lib/Eventz.php:122 lib/Eventz.php:171 +#: lib/Eventz.php:122 lib/Eventz.php:172 msgid "Sign up" msgstr "" @@ -304,35 +304,39 @@ msgstr "" msgid "Location" msgstr "" -#: lib/Eventz.php:158 +#: lib/Eventz.php:159 msgid "Price" msgstr "" -#: lib/Eventz.php:160 +#: lib/Eventz.php:161 msgid "Organizer" msgstr "" -#: lib/Eventz.php:161 +#: lib/Eventz.php:162 msgid "Area" msgstr "" -#: lib/Eventz.php:163 +#: lib/Eventz.php:164 msgid "Target" msgstr "" -#: lib/Eventz.php:165 +#: lib/Eventz.php:166 msgid "Tags" msgstr "" -#: lib/Eventz.php:169 +#: lib/Eventz.php:170 msgid "Links" msgstr "" -#: lib/Eventz.php:389 +#: lib/Eventz.php:367 +msgid "and other locations" +msgstr "" + +#: lib/Eventz.php:411 msgid "Additional information" msgstr "" -#: lib/Eventz.php:406 +#: lib/Eventz.php:428 msgid "Free" msgstr "" @@ -632,7 +636,7 @@ msgstr "" msgid "No search term given" msgstr "" -#: models/page-events-search.php:212 models/search.php:228 +#: models/page-events-search.php:212 models/search.php:239 #, php-format msgctxt "search results summary" msgid "%1$1s result found for \"%2$2s\"" @@ -660,7 +664,7 @@ msgstr "" msgid "Looking for events? Use the event search!" msgstr "" -#: models/search.php:239 +#: models/search.php:250 msgid "No search results" msgstr "" diff --git a/lib/Eventz.php b/lib/Eventz.php index 84a26739..d6b25383 100644 --- a/lib/Eventz.php +++ b/lib/Eventz.php @@ -155,6 +155,8 @@ public static function normalize_event( $event ) : array { 'end_date_raw' => static::get_as_datetime( $event->event->end ), 'location_title' => __( 'Location', 'tms-theme-base' ), 'location' => static::get_event_location( $event ), + 'multiple_locations' => static::get_event_multiple_locations( $event ), + 'location_count' => static::count_locations( $event ), 'price_title' => __( 'Price', 'tms-theme-base' ), 'price' => static::get_event_price_info( $event, $lang_key ), 'provider_title' => __( 'Organizer', 'tms-theme-base' ), @@ -334,16 +336,50 @@ public static function get_event_time( $event ) { /** * Get event location. * - * @param object $event Event object. + * @param object $event Event object. * * @return array */ public static function get_event_location( $event ) { - return [ 'name' => $event->locations[0]->address ?? null, ]; + } + + /** + * Get all event locations if more than one exists. + * + * @param object $event Event object. + * + * @return array + */ + public static function get_event_multiple_locations( $event ) { + $event_locations = []; + if ( count( $event->locations ) <= 1 ) { + return $event_locations; + } + + foreach ( $event->locations as $location ) { + $event_locations[] = [ + 'name' => $location->address ?? null + ]; + } + + return $event_locations; + } + + /** + * Get event location. + * + * @param object $event Event object. + * + * @return array + */ + public static function count_locations( $event ) { + return [ + 'other_locations_string' => count( $event->locations ) > 1 ? \__( 'and other locations', 'tms-theme-base' ) : null, + ]; } /** diff --git a/partials/ui/event-highlight.dust b/partials/ui/event-highlight.dust index 68f1c97b..7244cccf 100644 --- a/partials/ui/event-highlight.dust +++ b/partials/ui/event-highlight.dust @@ -22,7 +22,7 @@ {>"ui/icon" icon="date" class="icon--large is-primary mr-4 {classes.event_item_icon|attr}" /} - {date|kses} +

{date|kses}

@@ -30,7 +30,7 @@ {>"ui/icon" icon="time" class="icon--large is-primary mr-4 {classes.event_item_icon|attr}" /} - {time|kses} +

{time|kses}

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

+ {location.name|html} + {?location_count.other_locations_string} + {location_count.other_locations_string|html} + {/location_count.other_locations_string} +

{/location.name} @@ -50,7 +55,7 @@ {>"ui/icon" icon="euro" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /} - {price|html} +

{price|html}

{/is_free} {/price} diff --git a/partials/views/page-events-calendar/page-events-calendar-item-grid.dust b/partials/views/page-events-calendar/page-events-calendar-item-grid.dust index e34cfa64..1a7f99d0 100644 --- a/partials/views/page-events-calendar/page-events-calendar-item-grid.dust +++ b/partials/views/page-events-calendar/page-events-calendar-item-grid.dust @@ -30,7 +30,7 @@ {>"ui/icon" icon="date" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /} - {date|html} +

{date|html}

@@ -38,7 +38,7 @@ {>"ui/icon" icon="time" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /} - {time|html} +

{time|html}

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

+ {location.name|html} + {?location_count.other_locations_string} + {location_count.other_locations_string|html} + {/location_count.other_locations_string} +

{/location.name} @@ -58,7 +63,7 @@ {>"ui/icon" icon="euro" class="icon--large is-primary mr-2 {item_classes.grid.icon|attr}" /} - {price|html} +

{price|html}

{/is_free} {/price} diff --git a/partials/views/page-events-calendar/page-events-calendar-item-list.dust b/partials/views/page-events-calendar/page-events-calendar-item-list.dust index 777612c1..d93956ae 100644 --- a/partials/views/page-events-calendar/page-events-calendar-item-list.dust +++ b/partials/views/page-events-calendar/page-events-calendar-item-list.dust @@ -33,7 +33,7 @@ {>"ui/icon" icon="date" class="icon--large is-primary mr-2 {item_classes.list.icon|attr}" /} - {date|html} +

{date|html}

@@ -41,7 +41,7 @@ {>"ui/icon" icon="time" class="icon--large is-primary mr-2 {item_classes.list.icon|attr}" /} - {time|html} +

{time|html}

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

+ {location.name|html} + {?location_count.other_locations_string} + {location_count.other_locations_string|html} + {/location_count.other_locations_string} +

{/location.name} diff --git a/partials/views/single-dynamic-event/single-dynamic-event-hero-meta.dust b/partials/views/single-dynamic-event/single-dynamic-event-hero-meta.dust index 91e6e0af..a9a743a1 100644 --- a/partials/views/single-dynamic-event/single-dynamic-event-hero-meta.dust +++ b/partials/views/single-dynamic-event/single-dynamic-event-hero-meta.dust @@ -1,7 +1,7 @@
{?event.normalized.date}
- {>"ui/icon" icon="date" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|s}" /} + {>"ui/icon" icon="date" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|attr}" /}

{event.normalized.date|html}

@@ -10,7 +10,7 @@ {?event.normalized.time}
- {>"ui/icon" icon="time" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|s}" /} + {>"ui/icon" icon="time" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|attr}" /}

{event.normalized.time|html}

@@ -19,9 +19,12 @@ {?event.normalized.location}
- {>"ui/icon" icon="location" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|s}" /} + {>"ui/icon" icon="location" class="icon--xlarge mr-4 mr-6-desktop {template_classes.hero_icon|attr}" /}

{event.normalized.location.name|html} + {?event.normalized.location_count.other_locations_string} + {event.normalized.location_count.other_locations_string|html} + {/event.normalized.location_count.other_locations_string}

{/event.normalized.location} diff --git a/partials/views/single-dynamic-event/single-dynamic-event-info.dust b/partials/views/single-dynamic-event/single-dynamic-event-info.dust index 0662948e..fbeeaa7f 100644 --- a/partials/views/single-dynamic-event/single-dynamic-event-info.dust +++ b/partials/views/single-dynamic-event/single-dynamic-event-info.dust @@ -7,7 +7,7 @@ {?event.normalized.dates} {#event.normalized.dates}
- {date|attr} +

{date|html}

{/event.normalized.dates} {/event.normalized.dates} @@ -15,7 +15,7 @@ {?event.normalized.entries} {#event.normalized.entries}
- {date|attr} +

{date|html}

{/event.normalized.entries} {/event.normalized.entries} @@ -28,7 +28,7 @@ {>"views/single-dynamic-event/single-dynamic-event-group-title" title=event.normalized.date_title template_classes=template_classes.info_group_title icon="date" /}
- {event.normalized.date|attr} +

{event.normalized.date|html}

{/event.normalized.date} @@ -37,21 +37,35 @@ {>"views/single-dynamic-event/single-dynamic-event-group-title" title=event.normalized.time_title template_classes=template_classes.info_group_title icon="time" /}
- {event.normalized.time|attr} +

{event.normalized.time|html}

{/event.normalized.time} {/event.normalized.recurring} -{?event.normalized.location} +{^event.normalized.multiple_locations} + {?event.normalized.location} +
+ {>"views/single-dynamic-event/single-dynamic-event-group-title" title=event.normalized.location_title template_classes=template_classes.info_group_title icon="location" /} + +
+

{event.normalized.location.name|html}

+
+
+ {/event.normalized.location} +{/event.normalized.multiple_locations} + +{?event.normalized.multiple_locations}
{>"views/single-dynamic-event/single-dynamic-event-group-title" title=event.normalized.location_title template_classes=template_classes.info_group_title icon="location" /}
-
{event.normalized.location.name|attr}
+ {#event.normalized.multiple_locations} +

{name|html}

+ {/event.normalized.multiple_locations}
-{/event.normalized.location} +{/event.normalized.multiple_locations} {?event.normalized.price}
@@ -59,9 +73,9 @@
{#event.normalized.price} -
- {price|attr} -
+

+ {price|html} +

{/event.normalized.price}
@@ -84,7 +98,7 @@
{#event.normalized.links} - {name|attr} + {name|html} {>"ui/link" link=url /} {/event.normalized.links}
@@ -96,13 +110,13 @@ {>"views/single-dynamic-event/single-dynamic-event-group-title" title=event.normalized.provider_title template_classes=template_classes.info_group_title icon="bullhorn" /}
-
{event.normalized.provider.name|attr}
+

{event.normalized.provider.name|html}

{?event.normalized.provider.email}
- {event.normalized.provider.email|attr} + {event.normalized.provider.email|html}
{/event.normalized.provider.email} @@ -111,7 +125,7 @@
- {event.normalized.provider.phone|attr} + {event.normalized.provider.phone|html}
{/event.normalized.provider.phone}