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}
{time|kses}
+ {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}
{time|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}
{?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|html}
@@ -10,7 +10,7 @@ {?event.normalized.time}{event.normalized.time|html}
@@ -19,9 +19,12 @@ {?event.normalized.location}{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}
{date|html}
{date|html}
{event.normalized.date|html}
{event.normalized.time|html}
{event.normalized.location.name|html}
+{name|html}
+ {/event.normalized.multiple_locations}+ {price|html} +
{/event.normalized.price}{event.normalized.provider.name|html}
{?event.normalized.provider.email} {/event.normalized.provider.email} @@ -111,7 +125,7 @@ {/event.normalized.provider.phone}