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 ''; + } + ?> + + + + - + id() ) ) : + ?> + +
+ Manage Attendees +
+ +
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 @@ + +
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..3e47c754 --- /dev/null +++ b/themes/wporg-translate-events-2024/blocks/event-nav-links/index.php @@ -0,0 +1,48 @@ + function ( $attributes ) { + $page_block_name = esc_html( $attributes['page_block_name'] ); + ob_start(); + ?> + +
+
+ + + Deleted Events + + + + + | + + My Events + + + + + + + + +
+
+ + 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() ) : + ?> + + + + + + + + -
\ 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 ac599d50..b761156c 100644 --- a/themes/wporg-translate-events-2024/functions.php +++ b/themes/wporg-translate-events-2024/functions.php @@ -31,6 +31,9 @@ function register_blocks(): void { include_once __DIR__ . '/blocks/event-form/index.php'; include_once __DIR__ . '/blocks/pages/events/event-edit/index.php'; include_once __DIR__ . '/blocks/remote-attendance-icon/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 { @@ -196,8 +199,14 @@ function render_page( string $template_path, string $title, array $attributes ): BLOCKS ); - - $header_json = wp_json_encode( array( 'title' => $title ) ); + // get block name from template path. + $page_block_name = basename( dirname( $template_path ) ) === 'events' ? pathinfo( $template_path, PATHINFO_FILENAME ) : basename( dirname( $template_path ) ); + $header_json = wp_json_encode( + array( + 'title' => $title, + 'page_block_name' => $page_block_name, + ) + ); echo do_blocks( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped << diff --git a/themes/wporg-translate-events-2024/style.css b/themes/wporg-translate-events-2024/style.css index e533fe71..fcfd2af3 100644 --- a/themes/wporg-translate-events-2024/style.css +++ b/themes/wporg-translate-events-2024/style.css @@ -161,6 +161,16 @@ 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); +} +.event-nav-link { + text-decoration: none; +} span.user-remote-icon.dashicons-video-alt2 { margin-left: -8.8%; @@ -194,6 +204,9 @@ span.user-remote-icon.dashicons-video-alt2 { margin: 5px 3px 0 0; } +.event-nav-link:hover { + text-decoration: underline; +} @media (min-width: 960px) { .wporg-marker-list__container .wporg-marker-list-item {