Create Pledge: Make form functional (#31)

This broadly enables & styles the pledge forms across the frontend and wp-admin.

- Switches field `readonly` control to a variable called `$readonly`
- Create `PledgeMeta\get_pledge_meta()` which will fetch data from `$_POST`, a pledge post, or defaults.
- Add Number of Employees field
- Update form content to match mockup:
  - fields now have help text
  - success message uses content from mockup
  - logo field is moved to the "org info" section
- Style form in theme, add some similar styles to the admin

Fixes #7, fixes #28
This commit is contained in:
Kelly Dwan 2019-10-08 18:29:35 -04:00 committed by GitHub
parent 0111c36db4
commit 0f675ae6c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 313 additions and 127 deletions

View file

@ -1,23 +1,26 @@
<?php
namespace WordPressDotOrg\FiveForTheFuture\View;
/** @var bool $editable */
/** @var array $data */
/** @var bool $readonly */
?>
<div class="form-field">
<label for="5ftf-pledge-email" class="screen-reader-text">
<?php esc_html_e( 'Email', 'wordpressorg' ); ?>
<label for="5ftf-pledge-email">
<?php esc_html_e( 'Administrator Email', 'wordpressorg' ); ?>
</label>
<input
type="email"
class="large-text"
id="5ftf-pledge-email"
name="org-pledge-email"
value="<?php echo esc_attr( $data['pledge-email'] ); ?>"
value="<?php echo esc_attr( $data['org-pledge-email'] ); ?>"
required
<?php echo ( $editable ) ? '' : 'readonly'; ?>
aria-describedby="5ftf-pledge-email-help"
<?php echo $readonly ? 'readonly' : ''; ?>
/>
<p id="5ftf-pledge-email-help">
<?php esc_html_e( 'This email will be used to verify your organizations contribution profile, and later manage any changes.', 'wordpressorg' ); ?>
</p>
<?php if ( is_admin() ) : ?>
<?php if ( $data['pledge-email-confirmed'] ) : ?>