Add the "Add Contributors" input to the form

This commit is contained in:
Kelly Dwan 2019-11-13 13:19:43 -05:00
parent eacd2bf3f2
commit aa79c8147e
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
4 changed files with 21 additions and 6 deletions

View file

@ -155,7 +155,8 @@ function render_form_manage() {
$updated = false;
// @todo Get pledge ID from somewhere.
$data = PledgeMeta\get_pledge_meta();
$data = PledgeMeta\get_pledge_meta();
$is_manage = true;
if ( 'Update Pledge' === $action ) {
$processed = process_form_manage();

View file

@ -203,6 +203,7 @@ function add_meta_boxes() {
*/
function render_meta_boxes( $pledge, $box ) {
$readonly = ! current_user_can( 'edit_page', $pledge->ID );
$is_manage = true;
$data = array();
foreach ( get_pledge_meta_config() as $key => $config ) {

View file

@ -2,7 +2,7 @@
namespace WordPressDotOrg\FiveForTheFuture\View;
/** @var array $data */
/** @var bool $readonly */
/** @var bool $is_manage */
?>
<div class="form-field">
@ -15,7 +15,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
name="pledge-contributors"
placeholder="sanguine.zoe206, captain-mal, kayleefixesyou"
value="<?php echo esc_attr( $data['pledge-contributors'] ); ?>"
required
<?php echo $is_manage ? '' : 'required'; ?>
aria-describedby="5ftf-pledge-contributors-help"
/>
<p id="5ftf-pledge-contributors-help">

View file

@ -1,6 +1,8 @@
<?php
namespace WordPressDotOrg\FiveForTheFuture\View;
use function WordPressDotOrg\FiveForTheFuture\get_views_path;
/** @var array $contributors */
/** @var array $data */
/** @var bool $readonly */
@ -64,9 +66,20 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
<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">
<hr />
<?php
$data = [ 'pledge-contributors' => '' ];
require get_views_path() . 'inputs-pledge-contributors.php';
?>
<div id="add-contrib-message"></div>
<button
class="button-primary"
data-action="add-contributor"
data-pledge-post="<?php the_ID(); ?>"
>
<?php esc_html_e( 'Add new contributor', 'wporg' ); ?>
</button>
-->
</div>