From 085fa05fc0ff56e50bc8759bad1a7f507a458ba0 Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Wed, 2 Oct 2024 23:32:26 +0100 Subject: [PATCH 1/9] Add link to Manage attendees page --- .../blocks/event-form/index.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/themes/wporg-translate-events-2024/blocks/event-form/index.php b/themes/wporg-translate-events-2024/blocks/event-form/index.php index 629a91f0..9110841c 100644 --- a/themes/wporg-translate-events-2024/blocks/event-form/index.php +++ b/themes/wporg-translate-events-2024/blocks/event-form/index.php @@ -43,7 +43,15 @@ ob_start(); ?> - + id() ) ) : + ?> + +
+ Manage Attendees +
+ +
From c96549d1c7f95928282c29639c473d63ff9e3032 Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Thu, 3 Oct 2024 14:34:47 +0100 Subject: [PATCH 2/9] Add event-edit-link block --- .../blocks/event-edit-link/index.php | 35 +++++++++++++++++++ .../wporg-translate-events-2024/functions.php | 1 + 2 files changed, 36 insertions(+) create mode 100644 themes/wporg-translate-events-2024/blocks/event-edit-link/index.php diff --git a/themes/wporg-translate-events-2024/blocks/event-edit-link/index.php b/themes/wporg-translate-events-2024/blocks/event-edit-link/index.php new file mode 100644 index 00000000..7e30a662 --- /dev/null +++ b/themes/wporg-translate-events-2024/blocks/event-edit-link/index.php @@ -0,0 +1,35 @@ + function ( array $attributes, $content, $block ) { + if ( ! isset( $block->context['postId'] ) ) { + return ''; + } + $event_id = $block->context['postId']; + $event = Translation_Events::get_event_repository()->get_event( $event_id ); + if ( ! $event ) { + return ''; + } + + ob_start(); + if ( ! current_user_can( 'edit_translation_event', $event->id() ) ) { + return ''; + } + ?> + + + + Date: Thu, 3 Oct 2024 17:39:38 +0100 Subject: [PATCH 3/9] Add event-trash-link block --- .../blocks/event-trash-link/index.php | 43 +++++++++++++++++++ .../wporg-translate-events-2024/functions.php | 1 + 2 files changed, 44 insertions(+) create mode 100644 themes/wporg-translate-events-2024/blocks/event-trash-link/index.php diff --git a/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php b/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php new file mode 100644 index 00000000..eb9c63fc --- /dev/null +++ b/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php @@ -0,0 +1,43 @@ + function ( array $attributes, $content, $block ) { + if ( ! isset( $block->context['postId'] ) ) { + return ''; + } + $event_id = $block->context['postId']; + $event = Translation_Events::get_event_repository()->get_event( $event_id ); + if ( ! $event ) { + return ''; + } + + ob_start(); + if ( ! current_user_can( 'trash_translation_event', $event->id() ) ) { + return ''; + } + if ( $event->is_trashed() ) : + ?> + + + + + + + + Date: Thu, 3 Oct 2024 17:40:23 +0100 Subject: [PATCH 4/9] Include trash and edit event blocks to event list items --- themes/wporg-translate-events-2024/blocks/event-list/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/wporg-translate-events-2024/blocks/event-list/index.php b/themes/wporg-translate-events-2024/blocks/event-list/index.php index a73badd6..8c91dca6 100644 --- a/themes/wporg-translate-events-2024/blocks/event-list/index.php +++ b/themes/wporg-translate-events-2024/blocks/event-list/index.php @@ -33,6 +33,8 @@ + +
From 003bedec7c12bb8c84b22e62ec5d5c3de7c13ad6 Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Thu, 3 Oct 2024 17:40:37 +0100 Subject: [PATCH 5/9] Style edit and trash icons --- themes/wporg-translate-events-2024/style.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/themes/wporg-translate-events-2024/style.css b/themes/wporg-translate-events-2024/style.css index 805d4754..cf6af5fe 100644 --- a/themes/wporg-translate-events-2024/style.css +++ b/themes/wporg-translate-events-2024/style.css @@ -161,6 +161,13 @@ select.wp-block-form-input__input { color: #fff; background-color: #46b450; } +a.event-list-item-button:any-link { + text-decoration: none; + vertical-align: text-top; +} +.event-list-item-button.is-destructive { + color: var(--wp--preset--color--vivid-red); +} @media (min-width: 960px) { From 0f9be62b02dda3925132ecc1cf0517b8015ea261 Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Fri, 4 Oct 2024 18:53:35 +0100 Subject: [PATCH 6/9] Create and add event-nav-link block to site-header --- .../blocks/event-nav-links/index.php | 33 +++++++++++++++++++ .../blocks/header/site-header.php | 1 + .../wporg-translate-events-2024/functions.php | 1 + 3 files changed, 35 insertions(+) create mode 100644 themes/wporg-translate-events-2024/blocks/event-nav-links/index.php diff --git a/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php new file mode 100644 index 00000000..59d705da --- /dev/null +++ b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php @@ -0,0 +1,33 @@ + function () { + + ob_start(); + ?> + +
+
+ + + Deleted Events + + My Events + + Create Event + + +
+
+ + +
\ No newline at end of file diff --git a/themes/wporg-translate-events-2024/functions.php b/themes/wporg-translate-events-2024/functions.php index 6cf43a1d..c2dcb8e7 100644 --- a/themes/wporg-translate-events-2024/functions.php +++ b/themes/wporg-translate-events-2024/functions.php @@ -32,6 +32,7 @@ function register_blocks(): void { include_once __DIR__ . '/blocks/pages/events/event-edit/index.php'; include_once __DIR__ . '/blocks/event-edit-link/index.php'; include_once __DIR__ . '/blocks/event-trash-link/index.php'; + include_once __DIR__ . '/blocks/event-nav-links/index.php'; } function register_patterns(): void { From 60d72037205dc008222a9db14fc2b8ae383ec299 Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Mon, 7 Oct 2024 15:10:19 +0100 Subject: [PATCH 7/9] Style nav links --- .../blocks/event-nav-links/index.php | 13 +++++++++---- themes/wporg-translate-events-2024/style.css | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php index 59d705da..2e6475e6 100644 --- a/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php +++ b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php @@ -13,14 +13,19 @@ ?>
-
+ diff --git a/themes/wporg-translate-events-2024/style.css b/themes/wporg-translate-events-2024/style.css index cf6af5fe..2aac0df7 100644 --- a/themes/wporg-translate-events-2024/style.css +++ b/themes/wporg-translate-events-2024/style.css @@ -168,7 +168,13 @@ a.event-list-item-button:any-link { .event-list-item-button.is-destructive { color: var(--wp--preset--color--vivid-red); } +.event-nav-link { + text-decoration: none; +} +.event-nav-link:hover { + text-decoration: underline; +} @media (min-width: 960px) { .wporg-marker-list__container .wporg-marker-list-item { From cc2de331a50672648acecfabe7a40cacfb119c16 Mon Sep 17 00:00:00 2001 From: Tosin Oguntuyi Date: Mon, 7 Oct 2024 15:10:26 +0100 Subject: [PATCH 8/9] Fix lint errors --- .../blocks/event-trash-link/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php b/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php index eb9c63fc..8e422540 100644 --- a/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php +++ b/themes/wporg-translate-events-2024/blocks/event-trash-link/index.php @@ -23,7 +23,7 @@ return ''; } if ( $event->is_trashed() ) : - ?> + ?> @@ -35,9 +35,9 @@ class="event-list-item-button is-destructive" title=""> - Date: Mon, 7 Oct 2024 15:15:15 +0100 Subject: [PATCH 9/9] Remove unused code --- .../wporg-translate-events-2024/blocks/event-nav-links/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php index 2e6475e6..1647d70f 100644 --- a/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php +++ b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php @@ -25,7 +25,6 @@ Create Event
-