/* Styles specific to contact Summary/Edit/Inline-Edit pages */
-.crm-container .primary {
+.crm-container .primary .crm-label {
font-weight: bold;
}
#crm-container div.crm-summary-row div.crm-label {
background-color: #FAFAFA;
- color: #7A7A60;
+ color: #777760;
text-align: left;
width: 122px;
float: left;
+--------------------------------------------------------------------+
*}
{* 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">
</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}
{$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}
{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} ({$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}
{/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} {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>
{/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} {ts}ext.{/ts} {$item.phone_ext}{/if}
</div>
</div>
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;
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
}
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(','));
}
});
});