From 001c8ee243d6968383ea8de64e2a36ae1ba351f9 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Tue, 8 Oct 2019 13:12:11 -0400 Subject: [PATCH] Switch inputs to default editable Use `$readonly` variable to toggle on readonly state --- plugins/wporg-5ftf/includes/pledge-form.php | 2 ++ plugins/wporg-5ftf/includes/pledge-meta.php | 2 +- .../wporg-5ftf/views/inputs-pledge-contributors.php | 4 ++-- plugins/wporg-5ftf/views/inputs-pledge-new-misc.php | 2 +- plugins/wporg-5ftf/views/inputs-pledge-org-email.php | 4 ++-- plugins/wporg-5ftf/views/inputs-pledge-org-info.php | 10 +++++----- plugins/wporg-5ftf/views/inputs-pledge-org-logo.php | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/wporg-5ftf/includes/pledge-form.php b/plugins/wporg-5ftf/includes/pledge-form.php index 70c1bdd..f5961ea 100755 --- a/plugins/wporg-5ftf/includes/pledge-form.php +++ b/plugins/wporg-5ftf/includes/pledge-form.php @@ -38,6 +38,7 @@ function render_form_new() { } ob_start(); + $readonly = false; require FiveForTheFuture\PATH . 'views/form-pledge-new.php'; return ob_get_clean(); @@ -108,6 +109,7 @@ function render_form_manage() { } ob_start(); + $readonly = false; require FiveForTheFuture\PATH . 'views/form-pledge-manage.php'; return ob_get_clean(); diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php index 0b9bf7c..d5f7a2e 100755 --- a/plugins/wporg-5ftf/includes/pledge-meta.php +++ b/plugins/wporg-5ftf/includes/pledge-meta.php @@ -135,7 +135,7 @@ function add_meta_boxes() { * @param array $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(); foreach ( get_pledge_meta_config() as $key => $config ) { diff --git a/plugins/wporg-5ftf/views/inputs-pledge-contributors.php b/plugins/wporg-5ftf/views/inputs-pledge-contributors.php index f4f7aed..bb40982 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-contributors.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-contributors.php @@ -1,9 +1,9 @@ diff --git a/plugins/wporg-5ftf/views/inputs-pledge-new-misc.php b/plugins/wporg-5ftf/views/inputs-pledge-new-misc.php index edb3ca6..96b0158 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-new-misc.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-new-misc.php @@ -1,8 +1,8 @@
diff --git a/plugins/wporg-5ftf/views/inputs-pledge-org-email.php b/plugins/wporg-5ftf/views/inputs-pledge-org-email.php index 654f170..c30343d 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-org-email.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-org-email.php @@ -1,8 +1,8 @@
@@ -16,7 +16,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View; name="org-pledge-email" value="" required - + /> diff --git a/plugins/wporg-5ftf/views/inputs-pledge-org-info.php b/plugins/wporg-5ftf/views/inputs-pledge-org-info.php index aa87d0a..1864449 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-org-info.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-org-info.php @@ -1,8 +1,8 @@
@@ -16,7 +16,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View; name="org-name" value="" required - + />
@@ -31,20 +31,20 @@ namespace WordPressDotOrg\FiveForTheFuture\View; name="org-url" value="" required - + />
diff --git a/plugins/wporg-5ftf/views/inputs-pledge-org-logo.php b/plugins/wporg-5ftf/views/inputs-pledge-org-logo.php index 50f842d..fba40fc 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-org-logo.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-org-logo.php @@ -1,8 +1,8 @@