CRM-16007 - Consistently represent primary address/email/etc in contactSummary
authorColeman Watts <coleman@civicrm.org>
Fri, 27 Feb 2015 19:53:09 +0000 (14:53 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 27 Feb 2015 19:53:09 +0000 (14:53 -0500)
css/contactSummary.css
templates/CRM/Contact/Page/Inline/Address.tpl
templates/CRM/Contact/Page/Inline/Email.tpl
templates/CRM/Contact/Page/Inline/IM.tpl
templates/CRM/Contact/Page/Inline/OpenID.tpl
templates/CRM/Contact/Page/Inline/Phone.tpl
templates/CRM/Contact/Page/View/Summary.js

index e1efff24eb32770f52791b48b95709465778d2ca..311fb1b4d5f1af7093933dd807d51da4ff7d8e30 100644 (file)
@@ -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;
index dc767a934ba89fdc16bf3ac55812d4f3618f5996..6345c299dd2ef6df5622fed06bb1760b70f47c94 100644 (file)
@@ -24,7 +24,7 @@
  +--------------------------------------------------------------------+
 *}
 {* template for a single address block*}
-<div id="address-block-{$locationIndex}" class="address {if $add}crm-address_type_{$add.location_type}{else}add-new{/if}{if $permission EQ 'edit'} crm-inline-edit" data-dependent-fields='["#crm-contactinfo-content"]' data-edit-params='{ldelim}"cid": "{$contactId}", "class_name": "CRM_Contact_Form_Inline_Address", "locno": "{$locationIndex}", "aid": "{if $add}{$add.id}{else}0{/if}"{rdelim}' data-location-type-id="{if $add}{$add.location_type_id}{else}0{/if}{/if}">
+<div id="address-block-{$locationIndex}" class="address {if $add}crm-address_type_{$add.location_type}{else}add-new{/if}{if $permission EQ 'edit'} crm-inline-edit" data-dependent-fields='["#crm-contactinfo-content", ".crm-inline-edit.address:not(.add-new)"]' data-edit-params='{ldelim}"cid": "{$contactId}", "class_name": "CRM_Contact_Form_Inline_Address", "locno": "{$locationIndex}", "aid": "{if $add}{$add.id}{else}0{/if}"{rdelim}' data-location-type-id="{if $add}{$add.location_type_id}{else}0{/if}{/if}">
   <div class="crm-clear crm-inline-block-content" {if $permission EQ 'edit'}title="{if $add}{ts}Edit address{/ts}{else}{ts}Add address{/ts}{/if}"{/if}>
     {if $permission EQ 'edit'}
       <div class="crm-edit-help">
@@ -32,7 +32,7 @@
       </div>
     {/if}
     {if $add }
-      <div class="crm-summary-row">
+      <div class="crm-summary-row {if $add.is_primary eq 1} primary{/if}">
         <div class="crm-label">
           {ts 1=$add.location_type}%1 Address{/ts}
           {if $privacy.do_not_mail}<span class="icon privacy-flag do-not-mail" title="{ts}Privacy flag: Do Not Mail{/ts}"></span>{/if}
index 6bdb3b641ae4c37dcbbc13c89a3e5d62688cf66f..e81feb1b18d633ed54077d5b23959bdb696d6319 100644 (file)
@@ -47,7 +47,7 @@
         {$item.location_type} {ts}Email{/ts}
         {if $privacy.do_not_email}<span class="icon privacy-flag do-not-email" title="{ts}Privacy flag: Do Not Email{/ts}"></span>{elseif $item.on_hold}<span class="icon privacy-flag email-hold" title="{ts}Email on hold - generally due to bouncing.{/ts}"></span>{/if}
       </div>
-      <div class="crm-content crm-contact_email {if $item.is_primary eq 1}primary{/if}">
+      <div class="crm-content crm-contact_email">
         {if !$item.on_hold and !$privacy.do_not_email}
           <a href="{crmURL p="civicrm/activity/email/add" q="action=add&reset=1&email_id=`$item.id`"}" class="crm-popup" title="{ts 1=$item.email}Send email to %1{/ts}">
             {$item.email}
index d199399f0761a898e4859e14dcc2b685fd6faee9..69827767340a11706069b3b6f90770c57f3d6238 100644 (file)
@@ -40,9 +40,9 @@
     {foreach from=$im item=item}
       {if $item.name or $item.provider}
         {if $item.name}
-        <div class="crm-summary-row">
+        <div class="crm-summary-row {if $item.is_primary eq 1} primary{/if}">
           <div class="crm-label">{$item.provider}&nbsp;({$item.location_type})</div>
-          <div class="crm-content crm-contact_im {if $item.is_primary eq 1} primary{/if}">{$item.name}</div>
+          <div class="crm-content crm-contact_im">{$item.name}</div>
         </div>
         {/if}
       {/if}
index e15a52c33c0985002cd318aea681f896e1a025b0..d96954d37995a53151a8f52e0d7ef4868b05f076 100644 (file)
@@ -39,9 +39,9 @@
     {/if}
     {foreach from=$openid item=item}
       {if $item.openid}
-      <div class="crm-summary-row">
+      <div class="crm-summary-row {if $item.is_primary eq 1} primary{/if}">
         <div class="crm-label">{$item.location_type}&nbsp;{ts}OpenID{/ts}</div>
-        <div class="crm-content crm-contact_openid {if $item.is_primary eq 1} primary{/if}">
+        <div class="crm-content crm-contact_openid">
           <a href="{$item.openid}">{$item.openid|mb_truncate:40}</a>
         </div>
       </div>
index 465188be427b38064a52fe751697686fe4e46656..7c6cdac52f199f488c48899f7f90b0f4ee784e5c 100644 (file)
     {/if}
     {foreach from=$phone item=item}
       {if $item.phone || $item.phone_ext}
-        <div class="crm-summary-row">
+        <div class="crm-summary-row {if $item.is_primary eq 1}primary{/if}">
           <div class="crm-label">
             {if $privacy.do_not_phone}<span class="icon privacy-flag do-not-phone" title="{ts}Privacy flag: Do Not Phone{/ts}"></span>{/if}
             {$item.location_type} {$item.phone_type}
           </div>
-          <div class="crm-content crm-contact_phone {if $item.is_primary eq 1}primary{/if}">
+          <div class="crm-content crm-contact_phone">
             {$item.phone}{if $item.phone_ext}&nbsp;&nbsp;{ts}ext.{/ts} {$item.phone_ext}{/if}
           </div>
         </div>
index 00b979f34efd4db3cae9c60d1bb896986e4d3b57..7fa6837a4ac9c1cdc7343dad559ce5ddccf99278 100644 (file)
@@ -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'));
       }
     }
         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) {
         }
         // Refresh dependent blocks
         if (data && data.reloadBlocks) {
-          _.each(data.reloadBlocks, reloadBlock);
+          reloadBlock(data.reloadBlocks.join(','));
         }
       });
   });