From 05f53732ee3f3ae32b0b5fdd05f220f332cb9212 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 3 Jul 2018 12:40:23 -0400 Subject: [PATCH] Add custom field to profile edit Now contact profile edit has the custom fields. --- models/admin/profile/index.php | 30 +++++++++++++-------- views/admin/contacts/edit.html | 4 +-- views/admin/profile/index.html | 48 +++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 15 deletions(-) diff --git a/models/admin/profile/index.php b/models/admin/profile/index.php index 6357d39..bce842e 100644 --- a/models/admin/profile/index.php +++ b/models/admin/profile/index.php @@ -121,8 +121,8 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts $contactUpdated = false; $contactMembers = false; $membersList = false; - $newEmail = false; - $newEmailError = false; + $newEmail = false; + $newEmailError = false; $customFieldResults = false; $view = 'admin/profile/index.html'; @@ -168,6 +168,9 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts // If the submission was a success if ($this->contactInfo['status']) { + $this->contactInfo = $this->editEntry(($_REQUEST['id']-0)); + + $customFieldResults = apply_filters( 'glm-member-db-save-custom-fields', $_REQUEST['id']-0 ); $contactUpdated = true; @@ -240,6 +243,9 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts $this->contactInfo = $this->editEntry($this->contactID); + $contactInfoID = $this->contactInfo['fieldData']['id']; + $customFieldResults = apply_filters( 'glm-member-db-save-custom-fields', $contactInfoID ); + // If the contact wasn't found, then set ID to false if (!$this->contactInfo['status']) { $this->contactID = false; @@ -261,15 +267,17 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts // Compile template data $templateData = array( - 'option' => $option, - 'contactID' => $this->contactID, - 'contactInfo' => $this->contactInfo, - 'contactUpdated' => $contactUpdated, - 'contactMembers' => $contactMembers, - 'membersList' => $membersList, - 'EntityManagerRole' => $this->config['contact_role_numb']['EntityManager'], - 'new_email' => $newEmail, - 'newEmailError' => $newEmailError + 'option' => $option, + 'contactID' => $this->contactID, + 'contactInfo' => $this->contactInfo, + 'contactUpdated' => $contactUpdated, + 'contactMembers' => $contactMembers, + 'membersList' => $membersList, + 'EntityManagerRole' => $this->config['contact_role_numb']['EntityManager'], + 'new_email' => $newEmail, + 'newEmailError' => $newEmailError, + 'customFieldResults' => $customFieldResults, + 'slug' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG, ); // Return status, any suggested view, and any data to controller diff --git a/views/admin/contacts/edit.html b/views/admin/contacts/edit.html index 3b6ba83..4d0fcc1 100644 --- a/views/admin/contacts/edit.html +++ b/views/admin/contacts/edit.html @@ -131,14 +131,12 @@
- - {if $option == 'create'} {apply_filters('glm-members-custom-fields-form', '', $slug,'','')} {else} diff --git a/views/admin/profile/index.html b/views/admin/profile/index.html index 58f3d9a..79201e0 100644 --- a/views/admin/profile/index.html +++ b/views/admin/profile/index.html @@ -23,7 +23,18 @@ - + + +
+ {$prefix = $slug|cat:'_'} + {$uid = $prefix|cat:$contactInfo.fieldData.id} + {apply_filters('glm-members-custom-fields-form', '', $slug,$contactInfo.fieldData.id,'')} + {apply_filters('glm-members-custom-fields-form', '', $uid,$contactInfo.fieldData.id,'')} +
+
@@ -350,6 +361,41 @@ jQuery(document).ready(function($) { + /* + * Edit area tabs + */ + $('.glm-contact-info-tab').click( function() { + glmSetupAreaTab($(this)); + }); + + // Do inital setup on load for first tab + glmSetupAreaTab($('#glm-contact-info-profile')); + + // Setup edit area selected + function glmSetupAreaTab(t) { + + // Clear table highlights and hide all tables + $('.glm-contact-info-tab').removeClass('nav-tab-active'); + $('.glm-contact-info-table').addClass('glm-hidden'); + + // Highlight selected tab + t.addClass('nav-tab-active'); + + // Show selected table + var table = t.attr('data-show-table'); + $('#' + table).removeClass('glm-hidden'); + + // Count remaining characters in field + $('.glm-char-count').keyup( function() { + glmCharsRemaining($(this)); + }); + + $('.glm-char-count').each( function() { + glmCharsRemaining($(this)); + }); + + } + /* * New City Dialog */ -- 2.17.1
Contact For: {$contactInfo.fieldData.ref_type.name} - {$contactInfo.fieldData.ref_dest_name}