2019-10-25 06:06:47 +03:00
|
|
|
<?php
|
|
|
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
|
|
|
|
|
|
|
/** @var array $contributors */
|
|
|
|
/** @var array $data */
|
|
|
|
/** @var bool $readonly */
|
|
|
|
?>
|
|
|
|
|
2019-11-12 23:18:16 +02:00
|
|
|
<div id="5ftf-contributors">
|
2019-10-25 06:06:47 +03:00
|
|
|
<?php if ( ! empty( $contributors ) ) : ?>
|
|
|
|
<?php foreach ( $contributors as $contributor_status => $group ) : ?>
|
|
|
|
<?php if ( ! empty( $group ) ) : ?>
|
|
|
|
<h3 class="contributor-list-heading">
|
|
|
|
<?php
|
|
|
|
switch ( $contributor_status ) {
|
|
|
|
case 'pending':
|
|
|
|
esc_html_e( 'Unconfirmed', 'wporg' );
|
|
|
|
break;
|
|
|
|
case 'publish':
|
|
|
|
esc_html_e( 'Confirmed', 'wporg' );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<ul class="contributor-list <?php echo esc_attr( $contributor_status ); ?>">
|
|
|
|
<?php foreach ( $group as $contributor_post ) :
|
2019-11-12 23:17:29 +02:00
|
|
|
$name = $contributor_post->post_title;
|
|
|
|
$contributor = get_user_by( 'login', $name );
|
|
|
|
$remove_confirm = sprintf( __( 'Remove %s from this pledge?', 'wporg-5ftf' ), $name );
|
|
|
|
$remove_label = sprintf( __( 'Remove %s', 'wporg' ), $name );
|
2019-10-25 06:06:47 +03:00
|
|
|
?>
|
|
|
|
<li>
|
2019-11-12 23:17:29 +02:00
|
|
|
<button
|
|
|
|
class="button-link button-link-delete"
|
|
|
|
data-action="remove-contributor"
|
|
|
|
data-pledge-post="<?php the_ID(); ?>"
|
|
|
|
data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>"
|
|
|
|
data-confirm="<?php echo esc_attr( $remove_confirm ); ?>"
|
|
|
|
aria-label="<?php echo esc_attr( $remove_label ); ?>"
|
|
|
|
>
|
2019-11-12 19:33:32 +02:00
|
|
|
<span class="dashicons dashicons-no-alt" aria-hidden="true"></span>
|
2019-10-25 06:06:47 +03:00
|
|
|
</button>
|
2019-11-12 19:33:32 +02:00
|
|
|
<?php echo get_avatar( $contributor->user_email, 32 ); ?>
|
|
|
|
<span class="contributor-list__name">
|
2019-11-12 23:17:29 +02:00
|
|
|
<?php echo esc_html( $name ); ?>
|
2019-11-12 19:33:32 +02:00
|
|
|
</span>
|
2019-10-25 06:06:47 +03:00
|
|
|
<?php if ( 'pending' === $contributor_post->post_status ) : ?>
|
2019-11-12 23:17:29 +02:00
|
|
|
<button
|
|
|
|
class="button"
|
|
|
|
data-action="resend-contributor-confirmation"
|
|
|
|
data-pledge-post="<?php the_ID(); ?>"
|
|
|
|
data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>"
|
|
|
|
>
|
2019-11-12 19:33:32 +02:00
|
|
|
<?php esc_html_e( 'Resend Confirmation', 'wporg' ); ?>
|
|
|
|
</button>
|
2019-10-25 06:06:47 +03:00
|
|
|
<?php endif; ?>
|
|
|
|
</li>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</ul>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
<?php else : ?>
|
|
|
|
<p><?php esc_html_e( 'There are no contributors added to this pledge yet.', 'wporg' ); ?></p>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<!-- TODO This button doesn't do anything yet.
|
|
|
|
<button class="button-primary" data-action="add-contributor">
|
|
|
|
<?php esc_html_e( 'Add new contributor', 'wporg' ); ?>
|
|
|
|
</button>
|
|
|
|
-->
|
|
|
|
</div>
|