From 6e6ad3cab1175712e72432a612a6e9a351f8f792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= Date: Fri, 15 Nov 2024 11:30:22 +0200 Subject: [PATCH 1/4] TMS-1087: Event-page main image style change --- CHANGELOG.MD | 2 ++ assets/styles/views/_page-event.scss | 12 +++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 3621a4aa..a4d4bd67 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- TMS-1087: Event-page main image style change + ## [1.59.1] - 2024-10-28 - TMS-1075-fix: Early return added to ImageGalleryFormatter diff --git a/assets/styles/views/_page-event.scss b/assets/styles/views/_page-event.scss index d311a3bc..5d9ce425 100644 --- a/assets/styles/views/_page-event.scss +++ b/assets/styles/views/_page-event.scss @@ -5,15 +5,9 @@ .page-template-page-event { .entry { &__hero-image { - height: 18.25rem; - - @include from($tablet) { - height: 22rem; - } - - @include from($desktop) { - height: 31.25rem; - } + height: auto; + aspect-ratio: 16 / 9; + background-size: contain; } &__hero-info { From b1efe31bf0999630fef2cbc7fb540b2859de1d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= Date: Tue, 19 Nov 2024 11:08:58 +0200 Subject: [PATCH 2/4] TMS-1088: Add fields to redipress schema --- CHANGELOG.MD | 2 ++ models/search.php | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 3621a4aa..f3c162e3 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- TMS-1088: Add fields to redipress schema + ## [1.59.1] - 2024-10-28 - TMS-1075-fix: Early return added to ImageGalleryFormatter diff --git a/models/search.php b/models/search.php index d4d12d1f..6d1b81e3 100644 --- a/models/search.php +++ b/models/search.php @@ -191,6 +191,17 @@ public static function set_fields_weight( array $fields ) : array { $post_excerpt = array_search( 'post_excerpt', array_column( $fields, 'name' ), true ); $fields[ $post_excerpt ]->weight = 5; + // Include fields + $fields[] = new \Geniem\RediPress\Entity\NumericField( [ + 'name' => 'is_active', + ] ); + $fields[] = new \Geniem\RediPress\Entity\NumericField( [ + 'name' => 'apply_start', + ] ); + $fields[] = new \Geniem\RediPress\Entity\NumericField( [ + 'name' => 'apply_end', + ] ); + return $fields; } From 2eb4560e1c1002309d5ad1931fc4df86b0176492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= Date: Tue, 19 Nov 2024 11:19:27 +0200 Subject: [PATCH 3/4] 1.59.2 --- CHANGELOG.MD | 2 ++ style.css | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index f3c162e3..983e64c9 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.59.2] - 2024-11-19 + - TMS-1088: Add fields to redipress schema ## [1.59.1] - 2024-10-28 diff --git a/style.css b/style.css index 1e0132ce..b218ccf2 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ * Theme Name: TMS Theme Base * Description: Tampere Multisite Base Theme * Domain Path: /lang - * Version: 1.59.1 + * Version: 1.59.2 * Author: Geniem * Author URI: https://geniem.fi * Text Domain: tms-theme-base From 19fe2c6f6120bbe13c0643d924363afda9ede779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= Date: Wed, 20 Nov 2024 07:13:39 +0200 Subject: [PATCH 4/4] TMS-1083: Change event short description to be used from API --- CHANGELOG.MD | 2 ++ lib/Eventz.php | 26 ++------------------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 983e64c9..fb4481f6 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- TMS-1083: Change event short description to be used from API + ## [1.59.2] - 2024-11-19 - TMS-1088: Add fields to redipress schema diff --git a/lib/Eventz.php b/lib/Eventz.php index 59425c8f..8cf3736b 100644 --- a/lib/Eventz.php +++ b/lib/Eventz.php @@ -109,7 +109,7 @@ public static function normalize_event( $event ) : array { return [ 'name' => $event->name ?? null, - 'short_description' => static::get_short_description( $event ) ?? null, + 'short_description' => nl2br( $event->descriptionShort ) ?? null, 'description' => nl2br( $event->description ) ?? null, 'date_title' => __( 'Dates', 'tms-theme-base' ), 'date' => static::get_event_date( $event ), @@ -164,7 +164,7 @@ public static function normalize_event_title( $event ) : array { */ public static function normalize_event_description( $event ) : array { return [ - 'short_description' => static::get_short_description( $event ) ?? null, + 'short_description' => nl2br( $event->descriptionShort ) ?? null, ]; } @@ -607,26 +607,4 @@ public static function compare_dates( $start, $end ) { $end_time->format( 'H.i' ) ); } - - /** - * Generate short description. - * - * @param object $event Event object. - * - * @return string|null - */ - public static function get_short_description( $event ) { - - if ( empty( $event->description ) ) { - return null; - } - - // Define a regular expression pattern to match the first two sentences - $pattern = '/^(.*?[.!?])\s+(.*?[.!?])/'; - - // Use preg_match() to find the first two sentences - if ( preg_match( $pattern, $event->description, $matches ) ) { - return $matches[1] . ' ' . $matches[2]; - } - } }