mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-03 09:41:19 +03:00
Switch inputs to default editable
Use `$readonly` variable to toggle on readonly state
This commit is contained in:
parent
61ef972391
commit
001c8ee243
|
@ -38,6 +38,7 @@ function render_form_new() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
$readonly = false;
|
||||||
require FiveForTheFuture\PATH . 'views/form-pledge-new.php';
|
require FiveForTheFuture\PATH . 'views/form-pledge-new.php';
|
||||||
|
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
@ -108,6 +109,7 @@ function render_form_manage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
$readonly = false;
|
||||||
require FiveForTheFuture\PATH . 'views/form-pledge-manage.php';
|
require FiveForTheFuture\PATH . 'views/form-pledge-manage.php';
|
||||||
|
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|
|
@ -135,7 +135,7 @@ function add_meta_boxes() {
|
||||||
* @param array $box
|
* @param array $box
|
||||||
*/
|
*/
|
||||||
function render_meta_boxes( $pledge, $box ) {
|
function render_meta_boxes( $pledge, $box ) {
|
||||||
$editable = current_user_can( 'edit_pledge', $pledge->ID );
|
$readonly = ! current_user_can( 'edit_page', $pledge->ID );
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
foreach ( get_pledge_meta_config() as $key => $config ) {
|
foreach ( get_pledge_meta_config() as $key => $config ) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
|
|
||||||
/** @var bool $editable */
|
|
||||||
/** @var array $data */
|
|
||||||
/** @var array $contributors */
|
/** @var array $contributors */
|
||||||
|
/** @var array $data */
|
||||||
|
/** @var bool $readonly */
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( empty( $contributors ) ) : ?>
|
<?php if ( empty( $contributors ) ) : ?>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
|
|
||||||
/** @var bool $editable */
|
|
||||||
/** @var array $data */
|
/** @var array $data */
|
||||||
|
/** @var bool $readonly */
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
|
|
||||||
/** @var bool $editable */
|
|
||||||
/** @var array $data */
|
/** @var array $data */
|
||||||
|
/** @var bool $readonly */
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
|
@ -16,7 +16,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
name="org-pledge-email"
|
name="org-pledge-email"
|
||||||
value="<?php echo esc_attr( $data['pledge-email'] ); ?>"
|
value="<?php echo esc_attr( $data['pledge-email'] ); ?>"
|
||||||
required
|
required
|
||||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<?php if ( is_admin() ) : ?>
|
<?php if ( is_admin() ) : ?>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
|
|
||||||
/** @var bool $editable */
|
|
||||||
/** @var array $data */
|
/** @var array $data */
|
||||||
|
/** @var bool $readonly */
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
|
@ -16,7 +16,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
name="org-name"
|
name="org-name"
|
||||||
value="<?php echo esc_attr( $data['org-name'] ); ?>"
|
value="<?php echo esc_attr( $data['org-name'] ); ?>"
|
||||||
required
|
required
|
||||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -31,20 +31,20 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
name="org-url"
|
name="org-url"
|
||||||
value="<?php echo esc_attr( $data['org-url'] ); ?>"
|
value="<?php echo esc_attr( $data['org-url'] ); ?>"
|
||||||
required
|
required
|
||||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="5ftf-org-description">
|
<label for="5ftf-org-description">
|
||||||
<?php _e( 'Organization Blurb', 'wordpressorg' ); ?>
|
<?php esc_html_e( 'Organization Blurb', 'wordpressorg' ); ?>
|
||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
class="large-text"
|
class="large-text"
|
||||||
id="5ftf-org-description"
|
id="5ftf-org-description"
|
||||||
name="org-description"
|
name="org-description"
|
||||||
required
|
required
|
||||||
<?php echo ( $editable ) ? '' : 'readonly'; ?>
|
<?php echo $readonly ? 'readonly' : ''; ?>
|
||||||
>
|
>
|
||||||
<?php echo esc_html( $data['org-description'] ); ?>
|
<?php echo esc_html( $data['org-description'] ); ?>
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
|
|
||||||
/** @var bool $editable */
|
|
||||||
/** @var array $data */
|
/** @var array $data */
|
||||||
|
/** @var bool $readonly */
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
|
|
Loading…
Reference in a new issue