From fba9e4ed7b47753c2bf260396522ffa1884b69ae Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 27 Feb 2015 14:53:09 -0500 Subject: [PATCH] CRM-16007 - Consistently represent primary address/email/etc in contactSummary --- css/contactSummary.css | 4 +-- templates/CRM/Contact/Page/Inline/Address.tpl | 4 +-- templates/CRM/Contact/Page/Inline/Email.tpl | 2 +- templates/CRM/Contact/Page/Inline/IM.tpl | 4 +-- templates/CRM/Contact/Page/Inline/OpenID.tpl | 4 +-- templates/CRM/Contact/Page/Inline/Phone.tpl | 4 +-- templates/CRM/Contact/Page/View/Summary.js | 29 ++++++++----------- 7 files changed, 23 insertions(+), 28 deletions(-) diff --git a/css/contactSummary.css b/css/contactSummary.css index e1efff24eb..311fb1b4d5 100644 --- a/css/contactSummary.css +++ b/css/contactSummary.css @@ -1,6 +1,6 @@ /* Styles specific to contact Summary/Edit/Inline-Edit pages */ -.crm-container .primary { +.crm-container .primary .crm-label { font-weight: bold; } @@ -186,7 +186,7 @@ div#crm-contact-thumbnail { #crm-container div.crm-summary-row div.crm-label { background-color: #FAFAFA; - color: #7A7A60; + color: #777760; text-align: left; width: 122px; float: left; diff --git a/templates/CRM/Contact/Page/Inline/Address.tpl b/templates/CRM/Contact/Page/Inline/Address.tpl index dc767a934b..6345c299dd 100644 --- a/templates/CRM/Contact/Page/Inline/Address.tpl +++ b/templates/CRM/Contact/Page/Inline/Address.tpl @@ -24,7 +24,7 @@ +--------------------------------------------------------------------+ *} {* template for a single address block*} -
+
{if $permission EQ 'edit'}
@@ -32,7 +32,7 @@
{/if} {if $add } -
+
{ts 1=$add.location_type}%1 Address{/ts} {if $privacy.do_not_mail}{/if} diff --git a/templates/CRM/Contact/Page/Inline/Email.tpl b/templates/CRM/Contact/Page/Inline/Email.tpl index 6bdb3b641a..e81feb1b18 100644 --- a/templates/CRM/Contact/Page/Inline/Email.tpl +++ b/templates/CRM/Contact/Page/Inline/Email.tpl @@ -47,7 +47,7 @@ {$item.location_type} {ts}Email{/ts} {if $privacy.do_not_email}{elseif $item.on_hold}{/if}
-
+
{if !$item.on_hold and !$privacy.do_not_email} {$item.email} diff --git a/templates/CRM/Contact/Page/Inline/IM.tpl b/templates/CRM/Contact/Page/Inline/IM.tpl index d199399f07..6982776734 100644 --- a/templates/CRM/Contact/Page/Inline/IM.tpl +++ b/templates/CRM/Contact/Page/Inline/IM.tpl @@ -40,9 +40,9 @@ {foreach from=$im item=item} {if $item.name or $item.provider} {if $item.name} -
+
{$item.provider} ({$item.location_type})
-
{$item.name}
+
{$item.name}
{/if} {/if} diff --git a/templates/CRM/Contact/Page/Inline/OpenID.tpl b/templates/CRM/Contact/Page/Inline/OpenID.tpl index e15a52c33c..d96954d379 100644 --- a/templates/CRM/Contact/Page/Inline/OpenID.tpl +++ b/templates/CRM/Contact/Page/Inline/OpenID.tpl @@ -39,9 +39,9 @@ {/if} {foreach from=$openid item=item} {if $item.openid} -
+
{$item.location_type} {ts}OpenID{/ts}
-
diff --git a/templates/CRM/Contact/Page/Inline/Phone.tpl b/templates/CRM/Contact/Page/Inline/Phone.tpl index 465188be42..7c6cdac52f 100644 --- a/templates/CRM/Contact/Page/Inline/Phone.tpl +++ b/templates/CRM/Contact/Page/Inline/Phone.tpl @@ -42,12 +42,12 @@ {/if} {foreach from=$phone item=item} {if $item.phone || $item.phone_ext} -
+
{if $privacy.do_not_phone}{/if} {$item.location_type} {$item.phone_type}
-
+
{$item.phone}{if $item.phone_ext}  {ts}ext.{/ts} {$item.phone_ext}{/if}
diff --git a/templates/CRM/Contact/Page/View/Summary.js b/templates/CRM/Contact/Page/View/Summary.js index 00b979f34e..7fa6837a4a 100644 --- a/templates/CRM/Contact/Page/View/Summary.js +++ b/templates/CRM/Contact/Page/View/Summary.js @@ -59,7 +59,7 @@ o.trigger('crmFormSuccess', [response]); $('.crm-inline-edit-container').addClass('crm-edit-ready'); var data = o.data('edit-params'); - var dependent = o.data('dependent-fields') || []; + var dependent = $((o.data('dependent-fields') || []).join(',')); // Clone the add-new link if replacing it, and queue the clone to be refreshed as a dependent block if (o.hasClass('add-new') && response.addressId) { data.aid = response.addressId; @@ -77,7 +77,7 @@ var locNo = clData.locno++; cl.attr('id', cl.attr('id').replace(locNo, clData.locno)).removeClass('form'); o.closest('.crm-summary-block').after(clone); - $.merge(dependent, $('.crm-inline-edit', clone)); + dependent = dependent.add($('.crm-inline-edit', clone)); } $('a.ui-notify-close', '#crm-notification-container').click(); // Delete an address @@ -87,8 +87,7 @@ } else { // Reload this block plus all dependent blocks - var update = $.merge([o], dependent); - _.each(update, reloadBlock); + reloadBlock(dependent.add(o)); CRM.status(ts('Saved')); } } @@ -245,22 +244,18 @@ e.preventDefault(); }) // Delete an address - .on('click', '.crm-inline-edit.address .delete-button', function() { + .on('click', '.crm-inline-edit.address .delete-button', function(e) { var $block = $(this).closest('.crm-inline-edit.address'); - CRM.confirm(function() { - CRM.api('address', 'delete', {id: $block.data('edit-params').aid}, {success: - function(data) { - CRM.status(ts('Address Deleted')); + CRM.confirm({message: ts('Are you sure you want to delete this address?')}) + .on('crmConfirm:yes', function() { + CRM.api3('address', 'delete', {id: $block.data('edit-params').aid}, true) + .done(function(data) { $('.crm-inline-edit-container').addClass('crm-edit-ready'); $block.remove(); - } + reloadBlock('.crm-inline-edit.address:not(.add-new)'); + }); }); - }, - { - message: ts('Are you sure you want to delete this address?') - } - ); - return false; + e.preventDefault(); }) // add more and set focus to new row .on('click', '.add-more-inline', function(e) { @@ -334,7 +329,7 @@ } // Refresh dependent blocks if (data && data.reloadBlocks) { - _.each(data.reloadBlocks, reloadBlock); + reloadBlock(data.reloadBlocks.join(',')); } }); }); -- 2.25.1