mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-05 18:35:46 +03:00
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:
parent
0111c36db4
commit
0f675ae6c3
13 changed files with 313 additions and 127 deletions
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||
|
||||
/** @var bool $editable */
|
||||
/** @var array $data */
|
||||
/** @var bool $readonly */
|
||||
?>
|
||||
|
||||
<div class="form-field">
|
||||
|
@ -11,12 +11,24 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
|||
</label>
|
||||
<input
|
||||
type="text"
|
||||
class="large-text"
|
||||
id="5ftf-org-name"
|
||||
name="org-name"
|
||||
value="<?php echo esc_attr( $data['org-name'] ); ?>"
|
||||
required
|
||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
||||
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-field form-field__logo">
|
||||
<label for="5ftf-org-logo">
|
||||
<?php esc_html_e( 'Logo', 'wordpressorg' ); ?>
|
||||
</label>
|
||||
<br />
|
||||
<?php /* @todo Display existing logo here */ ?>
|
||||
<input
|
||||
type="file"
|
||||
id="5ftf-org-logo"
|
||||
name="org-logo"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -26,26 +38,39 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
|||
</label>
|
||||
<input
|
||||
type="url"
|
||||
class="large-text"
|
||||
id="5ftf-org-url"
|
||||
name="org-url"
|
||||
value="<?php echo esc_attr( $data['org-url'] ); ?>"
|
||||
required
|
||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
||||
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="5ftf-org-description">
|
||||
<?php _e( 'Organization Blurb', 'wordpressorg' ); ?>
|
||||
<?php esc_html_e( 'Organization Blurb', 'wordpressorg' ); ?>
|
||||
</label>
|
||||
<textarea
|
||||
class="large-text"
|
||||
id="5ftf-org-description"
|
||||
name="org-description"
|
||||
rows="5"
|
||||
required
|
||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
||||
>
|
||||
<?php echo esc_html( $data['org-description'] ); ?>
|
||||
</textarea>
|
||||
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||
><?php /* phpcs:ignore -- php tags should be on the same line as textarea to prevent extra whitespace */
|
||||
echo esc_html( $data['org-description'] );
|
||||
/* phpcs:ignore */ ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="5ftf-org-number-employees">
|
||||
<?php esc_html_e( 'Number of Employees Being Contributed', 'wordpressorg' ); ?>
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="5ftf-org-number-employees"
|
||||
name="org-number-employees"
|
||||
value="<?php echo esc_attr( $data['org-number-employees'] ); ?>"
|
||||
required
|
||||
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue