From 7d644ac8de7efb9c404898cbcf3907c6bc0e41cf Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 24 Dec 2013 15:56:37 -0800 Subject: [PATCH] CRM-14015 CRM-13863 - Fix enable/disable and crmEditable to work with groups datatable --- CRM/Contact/BAO/Group.php | 18 +++------ css/civicrm.css | 27 +++++++++---- js/jquery/jquery.crmeditable.js | 8 +--- templates/CRM/Admin/Page/ContactType.tpl | 2 +- templates/CRM/Admin/Page/Options.tpl | 2 +- templates/CRM/Badge/Page/Layout.tpl | 2 +- .../CRM/Financial/Page/FinancialAccount.tpl | 2 +- .../CRM/Financial/Page/FinancialType.tpl | 2 +- templates/CRM/Group/Form/Search.tpl | 39 +++++++++++++------ templates/CRM/common/enableDisableApi.tpl | 10 +++-- 10 files changed, 67 insertions(+), 45 deletions(-) diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index da200837d4..5fd0259a89 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -701,7 +701,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { foreach ($groups as $id => $value) { $groupList[$id]['group_id'] = $value['id']; $groupList[$id]['group_name'] = $value['title']; - $groupList[$id]['class'] = $value['class']; + $groupList[$id]['class'] = implode(' ', $value['class']); // append parent names if in search mode if ( !CRM_Utils_Array::value('parent_id', $params) && @@ -712,7 +712,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $title[] = $allGroups[$gId]; } $groupList[$id]['group_name'] .= '
'.ts('Child of').': ' . implode(', ', $title) . '
'; - $groupList[$id]['class'] = ''; + $groupList[$id]['class'] = in_array('disabled', $value['class']) ? 'disabled' : ''; } $groupList[$id]['group_description'] = CRM_Utils_Array::value('description', $value); @@ -813,7 +813,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { if ($permission) { $newLinks = $links; - $values[$object->id] = array(); + $values[$object->id] = array('class' => array()); CRM_Core_DAO::storeValues($object, $values[$object->id]); if ($object->saved_search_id) { $values[$object->id]['title'] .= ' (' . ts('Smart Group') . ')'; @@ -842,13 +842,12 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { } } - $values[$object->id]['class'] = ''; if (array_key_exists('is_active', $object)) { if ($object->is_active) { $action -= CRM_Core_Action::ENABLE; } else { - $values[$object->id]['class'] = 'disabled'; + $values[$object->id]['class'][] = 'disabled'; $action -= CRM_Core_Action::VIEW; $action -= CRM_Core_Action::DISABLE; } @@ -885,18 +884,13 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { // If group has children, add class for link to view children $values[$object->id]['is_parent'] = false; if (array_key_exists('children', $values[$object->id])) { - $values[$object->id]['class'] = "crm-group-parent"; + $values[$object->id]['class'][] = "crm-group-parent"; $values[$object->id]['is_parent'] = true; } // If group is a child, add child class if (array_key_exists('parents', $values[$object->id])) { - $values[$object->id]['class'] = "crm-group-child"; - } - - if (array_key_exists('children', $values[$object->id]) - && array_key_exists('parents', $values[$object->id])) { - $values[$object->id]['class'] = "crm-group-child crm-group-parent"; + $values[$object->id]['class'][] = "crm-group-child"; } if ($groupOrg) { diff --git a/css/civicrm.css b/css/civicrm.css index 58bc42cb18..e2381bf155 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -4017,19 +4017,30 @@ div.m ul#civicrm-menu, } /* in place edit */ -.crm-container .crm-editable-enabled, -.crm-container .crm-editable-textarea-enabled { +.crm-container .crm-editable-enabled { white-space: nowrap; - display: block; + padding-left: 2px; + border: 2px dashed transparent; +} +.crm-container .crm-editable-textarea-enabled { padding-left: 2px; border: 2px dashed transparent; } -.crm-container .crm-editable-enabled:hover { +.crm-container .crm-editable-enabled:hover, +.crm-container .crm-editable-textarea-enabled:hover { border: 2px dashed lightgrey; cursor: pointer; } +.crm-container span.crm-editable-textarea-enabled { + display: inline-block !important; + width: 96%; +} +.crm-container span.crm-editable-enabled { + display: inline-block !important; +} + .crm-container .crm-editable-placeholder { background: url("../i/icons/jquery-ui-2786C2.png") -66px -114px no-repeat; text-indent: -10000px; @@ -4051,9 +4062,8 @@ div.m ul#civicrm-menu, .crm-container h2.crm-editable-enabled input { min-height: 1.4em; } - -.crm-container td.crm-editable { - display: table-cell !important; +.crm-container .crm-editable-textarea-enabled textarea { + min-height: 5em; } /*crm-10345*/ @@ -4081,6 +4091,9 @@ div.m ul#civicrm-menu, padding-left: 60px; text-indent: -20px; } +#crm-container .crm-group-name span.crm-editable-enabled { + text-indent: 0; +} #crm-container div.crm-row-parent-name { padding: 3px 0px 0px .5em; diff --git a/js/jquery/jquery.crmeditable.js b/js/jquery/jquery.crmeditable.js index 1c37cbd592..3c1bf0fb1f 100644 --- a/js/jquery/jquery.crmeditable.js +++ b/js/jquery/jquery.crmeditable.js @@ -23,12 +23,8 @@ el = this[0], ret = {}, $row = this.first().closest('.crm-entity'); - ret.entity = $row.data('entity'); - ret.id = $row.data('id'); - if (!ret.entity || !ret.id) { - ret.entity = $row[0].id.split('-')[0]; - ret.id = $row[0].id.split('-')[1]; - } + ret.entity = $row.data('entity') || $row[0].id.split('-')[0]; + ret.id = $row.data('id') || $row[0].id.split('-')[1]; if (!ret.entity || !ret.id) { return false; } diff --git a/templates/CRM/Admin/Page/ContactType.tpl b/templates/CRM/Admin/Page/ContactType.tpl index 3220342843..79c5284a9a 100644 --- a/templates/CRM/Admin/Page/ContactType.tpl +++ b/templates/CRM/Admin/Page/ContactType.tpl @@ -51,7 +51,7 @@ {ts}{$row.label}{/ts} {if $row.parent}{ts}{$row.parent_label}{/ts}{else}{ts}(built-in){/ts}{/if} - {$row.description} + {$row.description} {$row.action|replace:'xx':$row.id} {/foreach} diff --git a/templates/CRM/Admin/Page/Options.tpl b/templates/CRM/Admin/Page/Options.tpl index e15baf7785..8deb152735 100644 --- a/templates/CRM/Admin/Page/Options.tpl +++ b/templates/CRM/Admin/Page/Options.tpl @@ -134,7 +134,7 @@ {if $row.filter eq 1}{ts}Counted{/ts}{/if} {/if} {if $showVisibility}{$row.visibility_label}{/if} - {$row.description} + {$row.description} {$row.order} {if $showIsDefault} {if $row.is_default eq 1}{ts}Default{/ts}{/if}  diff --git a/templates/CRM/Badge/Page/Layout.tpl b/templates/CRM/Badge/Page/Layout.tpl index c1e5648499..4aaaa99f1e 100644 --- a/templates/CRM/Badge/Page/Layout.tpl +++ b/templates/CRM/Badge/Page/Layout.tpl @@ -51,7 +51,7 @@ {foreach from=$rows item=row} {$row.title} - {$row.description} + {$row.description} {if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} diff --git a/templates/CRM/Financial/Page/FinancialAccount.tpl b/templates/CRM/Financial/Page/FinancialAccount.tpl index 421130bd80..22d60f1925 100644 --- a/templates/CRM/Financial/Page/FinancialAccount.tpl +++ b/templates/CRM/Financial/Page/FinancialAccount.tpl @@ -62,7 +62,7 @@ {foreach from=$rows item=row} {$row.name} - {$row.description} + {$row.description} {$row.accounting_code} {$row.financial_account_type_id}{if $row.account_type_code} ({$row.account_type_code}){/if} {if $row.is_deductible eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} diff --git a/templates/CRM/Financial/Page/FinancialType.tpl b/templates/CRM/Financial/Page/FinancialType.tpl index 64879a4da6..a8232871f7 100644 --- a/templates/CRM/Financial/Page/FinancialType.tpl +++ b/templates/CRM/Financial/Page/FinancialType.tpl @@ -55,7 +55,7 @@ {foreach from=$rows item=row} {$row.name} - {$row.description} + {$row.description} {$row.financial_account} {if $row.is_deductible eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} {if $row.is_reserved eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} diff --git a/templates/CRM/Group/Form/Search.tpl b/templates/CRM/Group/Form/Search.tpl index af6a6e6b53..1bd2086483 100644 --- a/templates/CRM/Group/Form/Search.tpl +++ b/templates/CRM/Group/Form/Search.tpl @@ -91,15 +91,25 @@ {literal}