Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
}
$event_id = $attributes['id'];
$user_is_attending = $attributes['user_is_attending'];
$user_is_contributor = $attributes['user_is_contributor'];
$event = Translation_Events::get_event_repository()->get_event( $event_id );
if ( ! $event ) {
return '';
Expand All @@ -24,31 +23,20 @@
if ( is_user_logged_in() ) :
?>
<div class="event-details-join">
<?php if ( $event->end()->is_in_the_past() ) : ?>
<?php if ( $user_is_attending ) : ?>
<p class="has-charcoal-4-color has-text-color has-small-font-size" style="margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--20)"><?php esc_html_e( 'You attended this event.', 'wporg-translate-events-2024' ); ?></p>
<?php endif; ?>
<?php elseif ( $user_is_contributor ) : ?>
<?php // Contributors can't un-attend so don't show anything. ?>
<?php else : ?>
<form class="event-details-attend" method="post" action="<?php echo esc_url( Urls::event_toggle_attendee( $event->id() ) ); ?>">
<?php if ( ! $event->end()->is_in_the_past() ) : ?>
<form class="event-details-attend" method="post" action="<?php echo esc_url( Urls::event_toggle_attendee( $event->id() ) ); ?>">
<?php wp_nonce_field( '_attendee_nonce', '_attendee_nonce' ); ?>
<?php if ( $user_is_attending ) : ?>
<input type="submit" class="wp-block-button__link" value="<?php esc_attr_e( "You're attending", 'gp-translation-events' ); ?>" />
<?php else : ?>
<?php if ( ! $event->is_remote() ) : ?>
<input type="submit" class="wp-block-button__link" value="<?php esc_attr_e( 'Attend Event On-site', 'gp-translation-events' ); ?>"/>
<?php if ( ! $event->is_hybrid() ) : ?>
<p class="onsite-btn-note">
<?php echo wp_kses_post( __( '<strong>Note:</strong> This is an onsite-only event. Please only click attend if you are at the event. The host might otherwise remove you.', 'gp-translation-events' ) ); ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $event->is_remote() || $event->is_hybrid() ) : ?>
<input type="submit" name="attend_remotely" class="wp-block-button__link" value="<?php esc_attr_e( 'Attend Event Remotely', 'gp-translation-events' ); ?>"/>
<?php endif; ?>
<input type="submit" class="wp-block-button__link" value="<?php esc_attr_e( "You're attending", 'gp-translation-events' ); ?>" />
<?php else : ?>
<?php if ( ! $event->is_remote() ) : ?>
<input type="submit" class="wp-block-button__link" value="<?php esc_attr_e( 'Attend Event On-site', 'gp-translation-events' ); ?>"/>
<?php endif; ?>
<?php if ( $event->is_remote() || $event->is_hybrid() ) : ?>
<input type="submit" name="attend_remotely" class="wp-block-button__link" value="<?php esc_attr_e( 'Attend Event Remotely', 'gp-translation-events' ); ?>"/>
<?php endif; ?>
</form>
<?php endif; ?>
</form>
<?php endif; ?>
</div>
<?php else : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function ( $breadcrumbs ) use( $event ): array {
return '';
}
$attributes['event'] = $event;
$attributes['use_custom_page_title'] = true;

render_page(
__DIR__ . '/render.php',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,92 @@
<?php
namespace Wporg\TranslationEvents\Theme_2024;

use Wporg\TranslationEvents\Attendee\Attendee;
use Wporg\TranslationEvents\Urls;

$event = $attributes['event'];
$user_is_attending = $attributes['user_is_attending'];
$user_is_contributor = $attributes['user_is_contributor'];

?>
<!-- wp:wporg-translate-events-2024/event-attend-button
<?php
echo wp_json_encode(
array(
'id' => $event->id(),
'user_is_attending' => $user_is_attending,
'user_is_contributor' => $user_is_contributor,
)
);
?>

/-->
<?php
if ( $event->is_past() ) :
?>
<!-- wp:wporg/notice {"type":"alert", "style":{"spacing":{"margin":{"top":"var:preset|spacing|20"}}}} -->
<div class="wp-block-wporg-notice is-alert-notice" style="margin-top:var(--wp--preset--spacing--20)">
<div class="wp-block-wporg-notice__icon"></div>
<div class="wp-block-wporg-notice__content">
<p>
<?php echo esc_html__( 'This event has ended.', 'wporg-translate-events-2024' ); ?>
</p>
<div class="wp-block-grid is-layout-grid details-page-title">
<div>
<h2 class="wp-block-heading"><?php echo esc_html( $event->title() ); ?></h2>
</div>
<?php if ( current_user_can( 'edit_translation_event', $event->id() ) ) : ?>
<div>
<div class="wp-block-buttons details-edit-event-btn">
<div class="wp-block-button is-style-outline">
<a class="wp-block-button__link wp-element-button" href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>">
<?php echo esc_html__( 'Edit Event', 'wporg-translate-events-2024' ); ?>
</a>
</div>
</div>
</div>
<?php endif; ?>
</div>
<!-- /wp:wporg/notice -->

<?php if ( $event->is_past() ) : ?>
<!-- wp:wporg/notice {"type":"alert"} -->
<div class="wp-block-wporg-notice is-alert-notice">
<div class="wp-block-wporg-notice__icon"></div>
<div class="wp-block-wporg-notice__content">
<p>
<?php echo esc_html__( 'This event has ended.', 'wporg-translate-events-2024' ); ?>
</p>
</div>
</div>
<!-- /wp:wporg/notice -->

<?php else : ?>
<!-- wp:wporg-translate-events-2024/event-attend-button
<?php
echo wp_json_encode(
array(
'id' => $event->id(),
'user_is_attending' => $user_is_attending,
'user_is_contributor' => $user_is_contributor,
)
);
?>

/-->
<?php endif; ?>

<?php
if ( is_user_logged_in() ) :
if ( $event->is_past() ) :
if ( $user_is_attending ) :
?>
<!-- wp:wporg/notice {"type":"info", "style":{"spacing":{"margin":{"top":"var:preset|spacing|20"}}}} -->
<div class="wp-block-wporg-notice is-info-notice" style="margin-top:var(--wp--preset--spacing--20)">
<div class="wp-block-wporg-notice__icon"></div>
<div class="wp-block-wporg-notice__content">
<p>
<?php esc_html_e( 'You attended this event.', 'wporg-translate-events-2024' ); ?>
</p>
</div>
</div>
<!-- /wp:wporg/notice -->
<?php endif; ?>
<?php else : ?>
<?php if ( ! $event->is_hybrid() && ! $event->is_remote() ) : ?>
<!-- wp:wporg/notice {"type":"tip","style":{"spacing":{"margin":{"top":"var:preset|spacing|20"}}}} -->
<div class="wp-block-wporg-notice is-tip-notice" style="margin-top:var(--wp--preset--spacing--20)">
<div class="wp-block-wporg-notice__icon"></div>
<div class="wp-block-wporg-notice__content">
<p>
<?php echo wp_kses_post( __( 'This is an onsite-only event. Please only click attend if you are at the event. The host might otherwise remove you.', 'wporg-translate-events-2024' ) ); ?>
</p>
</div>
</div>
<!-- /wp:wporg/notice -->
<?php endif; ?>
<?php
endif;
endif;
?>

<!-- wp:paragraph -->
<p>
<!-- wp:wporg-translate-events-2024/event-host-list <?php echo wp_json_encode( array( 'id' => $event->id() ) ); ?> /-->
Expand Down
19 changes: 12 additions & 7 deletions themes/wporg-translate-events-2024/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,23 @@ function render_page( string $template_path, string $title, array $attributes ):
require $template_path;
$rendered_template = ob_get_clean();
$page_title = esc_html( $title );
$page_content = do_blocks(
$page_title_block = ( empty( $attributes['use_custom_page_title'] ) ) ? do_blocks( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
<<<BLOCKS
<!-- wp:group {"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}} -->
<div class="wp-block-group page-upcoming-title-past-wrapper">
<!-- wp:heading --><h2 class="wp-block-heading">$page_title </h2><!-- /wp:heading -->
</div>
<!-- /wp:group -->
BLOCKS
) : '';

$page_content = do_blocks(
<<<BLOCKS
<!-- wp:group {"tagName":"main","style":{"spacing":{"blockGap":"0px"}},"className":"entry-content","layout":{"type":"constrained"}} -->
<main class="wp-block-group entry-content">
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|20","left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space","bottom":"var:preset|spacing|50"}}},"layout":{"type":"default"}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--edge-space)">
<!-- wp:group {"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}} -->
<div class="wp-block-group page-upcoming-title-past-wrapper">
<!-- wp:heading --><h2 class="wp-block-heading">$page_title</h2><!-- /wp:heading -->
</div>
<!-- /wp:group -->

$page_title_block
<!-- wp:group {"layout":{"type":"inherit","flexWrap":"nowrap","justifyContent":"space-between"}} -->
<div class="wp-block-group">$rendered_template</div>
<!-- /wp:group -->
Expand Down
21 changes: 20 additions & 1 deletion themes/wporg-translate-events-2024/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,26 @@ span.user-remote-icon.dashicons-video-alt2 {
.event-nav-link:hover {
text-decoration: underline;
}
@media (min-width: 960px) {

.event-details-join {
display: inline-block;
}

div.details-edit-event-btn {
float: right;
text-decoration: none;
}

.details-page-title {
grid-template-columns: 85% 15%;
gap: 0;
align-items: baseline;

}
.details-page-title h2.wp-block-heading {
margin-bottom: 10px;
}
@media (min-width: 960px) {

.wporg-marker-list__container .wporg-marker-list-item {
display: grid;
Expand Down