Making WordPress.org


Ignore:
Timestamp:
04/16/2024 12:41:37 PM (19 months ago)
Author:
amieiro
Message:

Translate: Sync "Translation Events" from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php

    r13529 r13541  
    1212use Wporg\TranslationEvents\Event\Event_End_Date;
    1313use Wporg\TranslationEvents\Event\Event_Start_Date;
     14use Wporg\TranslationEvents\Stats\Event_Stats;
     15use Wporg\TranslationEvents\Stats\Stats_Row;
    1416
    1517/** @var Attendee_Repository $attendee_repo */
     
    4648                    <?php foreach ( $contributors as $contributor ) : ?>
    4749                        <li class="event-contributor" title="<?php echo esc_html( implode( ', ', $contributor->locales ) ); ?>">
    48                             <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>"><?php echo get_avatar( $contributor->ID, 48 ); ?></a>
    49                             <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $contributor->ID ) ); ?></a>
     50                            <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>" class="avatar"><?php echo get_avatar( $contributor->ID, 48 ); ?></a>
     51                            <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>" class="name"><?php echo esc_html( get_the_author_meta( 'display_name', $contributor->ID ) ); ?></a>
    5052                            <?php if ( $stats_calculator->is_first_time_contributor( $event_start, $contributor->ID ) ) : ?>
    51                                 <span class="first-time-contributor-tada"></span>
     53                                <span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span>
    5254                            <?php endif; ?>
    5355                            <?php
    5456                            if ( ! $event->end()->is_in_the_past() ) :
    55                                 if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) ) :
    56                                     if ( $user->ID !== $contributor->ID ) :
    57                                         $_attendee = $attendee_repo->get_attendee( $event_id, $contributor->ID );
    58                                         if ( $_attendee instanceof Attendee ) :
    59                                             echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$contributor->ID" ) ) . '">';
    60                                             if ( $_attendee->is_host() ) :
    61                                                 if ( 1 === count( $attendee_repo->get_hosts( $event_id ) ) ) :
    62                                                     echo '<input type="submit" class="button is-primary remove-as-host" disabled value="Remove as host"/>';
    63                                                 else :
    64                                                     echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>';
    65                                                 endif;
    66                                             else :
    67                                                 echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>';
    68                                             endif;
    69                                             echo '</form>';
     57                                if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) :
     58                                    $_attendee = $attendee_repo->get_attendee( $event_id, $contributor->ID );
     59                                    if ( $_attendee instanceof Attendee ) :
     60                                        echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$contributor->ID" ) ) . '">';
     61                                        if ( $_attendee->is_host() ) :
     62                                            echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>';
     63                                        else :
     64                                            echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>';
    7065                                        endif;
    71                                     elseif ( ( $attendee instanceof Attendee && $attendee->is_host() ) ) :
    72                                             echo '<span class="event-you">' . esc_html__( 'You (host)', 'gp-translation-events' ) . '</span>';
    73                                         else :
    74                                             echo '<span class="event-you">' . esc_html__( 'You (event creator)', 'gp-translation-events' ) . '</span>';
     66                                        echo '</form>';
     67                                    else :
     68                                        echo '<span class="event-not-attending">' . esc_html__( 'Not attending', 'gp-translation-events' ) . '</span>';
    7569                                    endif;
    7670                                endif;
     
    8276            </div>
    8377        <?php endif; ?>
    84         <?php if ( ! empty( $attendees ) && ( ! $event->end()->is_in_the_past() || ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) ) ) ) : ?>
     78        <?php if ( ! empty( $attendees ) && ( ! $event->end()->is_in_the_past() || ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) ) ) : ?>
    8579            <div class="event-attendees">
    8680                <h2><?php esc_html_e( 'Attendees', 'gp-translation-events' ); ?></h2>
     
    8882                    <?php foreach ( $attendees as $_user ) : ?>
    8983                        <li class="event-attendee">
    90                             <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>"><?php echo get_avatar( $_user->ID, 48 ); ?></a>
    91                             <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $_user->ID ) ); ?></a>
     84                            <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>" class="avatar"><?php echo get_avatar( $_user->ID, 48 ); ?></a>
     85                            <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>" class="name"><?php echo esc_html( get_the_author_meta( 'display_name', $_user->ID ) ); ?></a>
    9286                            <?php if ( $stats_calculator->is_first_time_contributor( $event_start, $_user->ID ) ) : ?>
    93                                 <span class="first-time-contributor-tada"></span>
     87                                <span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span>
    9488                            <?php endif; ?>
    9589                            <?php
    9690                            if ( ! $event->end()->is_in_the_past() ) :
    97                                 if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) ) :
    98                                     if ( $user->ID !== $_user->ID ) :
    99                                         $_attendee = $attendee_repo->get_attendee( $event_id, $_user->ID );
    100                                         if ( $_attendee instanceof Attendee ) :
    101                                             echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$_user->ID" ) ) . '">';
    102                                             if ( $_attendee->is_host() ) :
    103                                                 if ( 1 === count( $attendee_repo->get_hosts( $event_id ) ) ) :
    104                                                     echo '<input type="submit" class="button is-primary remove-as-host" disabled value="Remove as host"/>';
    105                                                 else :
    106                                                     echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>';
    107                                                 endif;
    108                                             else :
    109                                                 echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>';
    110                                             endif;
    111                                             echo '</form>';
     91                                if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) :
     92                                    $_attendee = $attendee_repo->get_attendee( $event_id, $_user->ID );
     93                                    if ( $_attendee instanceof Attendee ) :
     94                                        echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$_user->ID" ) ) . '">';
     95                                        if ( $_attendee->is_host() ) :
     96                                            echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>';
     97                                        else :
     98                                            echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>';
    11299                                        endif;
    113                                     elseif ( ( $attendee instanceof Attendee && $attendee->is_host() ) ) :
    114                                             echo '<span class="event-you">' . esc_html__( 'You (host)', 'gp-translation-events' ) . '</span>';
    115                                         else :
    116                                             echo '<span class="event-you">' . esc_html__( 'You (event creator)', 'gp-translation-events' ) . '</span>';
     100                                        echo '</form>';
    117101                                    endif;
    118102                                endif;
     
    215199                                array_map(
    216200                                    function ( $contributor ) use ( $stats_calculator, $event_start ) {
    217                                         $append_tada = $stats_calculator->is_first_time_contributor( $event_start, $contributor->ID ) ? '<span class="first-time-contributor-tada"></span>' : '';
     201                                        $append_tada = '';
     202                                        if ( $stats_calculator->is_first_time_contributor( $event_start, $contributor->ID ) ) {
     203                                            $append_tada = '<span class="first-time-contributor-tada" title="' . esc_html__( 'New Translation Contributor', 'gp-translation-events' ) . '"></span>';
     204                                        }
    218205                                        return '@' . $contributor->user_login . $append_tada;
    219206                                    },
     
    225212                            'span' => array(
    226213                                'class' => array(),
     214                                'title' => array(),
    227215                            ),
    228216                        )
     
    258246                <form class="event-details-attend" method="post" action="<?php echo esc_url( gp_url( "/events/attend/$event_id" ) ); ?>">
    259247                    <?php if ( $attendee instanceof Attendee ) : ?>
    260                         <?php if ( $attendee->is_host() && ( 1 === count( $attendee_repo->get_hosts( $event_id ) ) ) ) : ?>
    261                             <input type="submit" class="button is-secondary attending-btn" disabled value="You're attending" />
    262                         <?php else : ?>
    263                             <input type="submit" class="button is-secondary attending-btn" value="You're attending" />
    264                         <?php endif; ?>
     248                        <input type="submit" class="button is-secondary attending-btn" value="You're attending" />
    265249                    <?php else : ?>
    266250                        <input type="submit" class="button is-primary attend-btn" value="Attend Event"/>
Note: See TracChangeset for help on using the changeset viewer.