From c15e7c819b035637617a2953f3e98680cf5e245b Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 27 Jul 2018 15:11:47 -0400 Subject: [PATCH] Style updates to the custom field management. Givingc more padding for the row of fields. Separate each picklist option with background colors. Reverse order of edit delete use dashicons for edit and delete buttons. --- models/admin/management/fields.php | 53 ++++++++++++++++++------------ setup/adminHooks.php | 8 +++++ views/admin/management/fields.html | 41 +++++++++++++---------- 3 files changed, 63 insertions(+), 39 deletions(-) diff --git a/models/admin/management/fields.php b/models/admin/management/fields.php index 8b8413a..a6ac566 100644 --- a/models/admin/management/fields.php +++ b/models/admin/management/fields.php @@ -117,19 +117,23 @@ class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields */ public function modelAction($actionData = false) { - $glm_action = ''; - $option = false; - $settings_updated = false; - $settings_update_error = false; - $custom_fields = false; - $haveCustomFields = false; - $where = ' TRUE '; - $glm_field_tab_name = get_option( 'glm_field_tab_name' ); + $glm_action = ''; + $option = false; + $settings_updated = false; + $settings_update_error = false; + $custom_fields = false; + $haveCustomFields = false; + $where = ' TRUE '; + $glm_field_tab_name = get_option( 'glm_field_tab_name' ); + $glm_field_contact_tab_name = get_option( 'glm_field_contact_tab_name' ); // If tab name option is empty then set it. if ( !$glm_field_tab_name ) { update_option( 'glm_field_tab_name', 'Custom Fields', true ); } + if ( !$glm_field_contact_tab_name ) { + update_option( 'glm_field_contact_tab_name', 'Custom Fields', true ); + } if (isset($_REQUEST['option2'])) { $option = $_REQUEST['option2']; @@ -154,10 +158,16 @@ class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields switch ($option) { case 'updateTabNameOption': - // echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; $tab_name = filter_var( $_REQUEST['glm_field_tab_name'] ); - update_option( 'glm_field_tab_name', $tab_name, true ); - $glm_field_tab_name = get_option( 'glm_field_tab_name' ); + if ( $tab_name ) { + update_option( 'glm_field_tab_name', $tab_name, true ); + $glm_field_tab_name = get_option( 'glm_field_tab_name' ); + } + $contact_tab_name = filter_var( $_REQUEST['glm_field_contact_tab_name'] ); + if ( $contact_tab_name ) { + update_option( 'glm_field_contact_tab_name', $contact_tab_name, true ); + $glm_field_contact_tab_name = get_option( 'glm_field_contact_tab_name' ); + } break; case 'deleteOption': @@ -443,16 +453,17 @@ class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields // Compile template data $template_data = array( - 'option2' => $option, - 'settingsUpdated' => $settings_updated, - 'settingsUpdateError' => $settings_update_error, - 'custom_fields' => false,//$custom_fields, - 'field_types' => $this->config['custom_field_types'], - 'haveCustomFields' => $haveCustomFields, - 'uid' => $uid, - 'glm_action' => $glm_action, - 'groups' => $groups, - 'glm_field_tab_name' => $glm_field_tab_name, + 'option2' => $option, + 'settingsUpdated' => $settings_updated, + 'settingsUpdateError' => $settings_update_error, + 'custom_fields' => false,//$custom_fields, + 'field_types' => $this->config['custom_field_types'], + 'haveCustomFields' => $haveCustomFields, + 'uid' => $uid, + 'glm_action' => $glm_action, + 'groups' => $groups, + 'glm_field_tab_name' => $glm_field_tab_name, + 'glm_field_contact_tab_name' => $glm_field_contact_tab_name, ); // echo "
Template data:" . print_r($template_data, true) . "
"; diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 5eaeb01..4c93ad2 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -341,3 +341,11 @@ add_filter( 10, 2 ); + +add_filter( + 'glm-members-billing-contact-tab-name', + function( $content ){ + $content .= get_option( 'glm_field_contact_tab_name' ); + return $content; + }, 10 +); diff --git a/views/admin/management/fields.html b/views/admin/management/fields.html index 0a74884..0f5758a 100644 --- a/views/admin/management/fields.html +++ b/views/admin/management/fields.html @@ -1,3 +1,4 @@ +
{* Add Custom Field Group Button and Dialog Box *}
Add A Custom Field Group
@@ -141,7 +142,6 @@ {* Manage name for custom field tab *} -{if $uid == 'glm-member-db'}
@@ -150,7 +150,11 @@ Tab Name - + {if $uid == 'glm-member-db'} + + {else} + + {/if} @@ -158,7 +162,6 @@
-{/if} {* custom fields table *}
@@ -168,12 +171,11 @@
{$group.group_name} ( {if $group.publish}Published{else}Not Published{/if} ) - Delete - Edit + data-publish="{$group.publish}">  +  
@@ -192,7 +194,7 @@ {foreach $group.custom_fields as $field}
- +
{if $field.field_type.value == 'picklist'} -
{$field.field_name} @@ -201,21 +203,22 @@ {$field.required.name} {$field.admin_search.name} -
Delete
- -
Edit
+ >  + +
 
+
+ @@ -228,19 +231,20 @@ {if $field.options && !empty($field.options)} {foreach $field.options as $option} - + {/foreach} @@ -260,6 +264,7 @@ {/foreach} {/if} +
{$option.option_value} {$option.option_text} -
Delete
-
Edit
+ >  + +