From 10bf3572d0cf07faa8ee23204eb52380a5c6709b Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 24 Feb 2017 20:33:32 -0700 Subject: [PATCH] CRM-20179 - Upgrade jstree on contact summary screen --- CRM/Contact/Page/View/Summary.php | 2 - CRM/Core/Smarty/plugins/function.crmStyle.php | 3 + CRM/Tag/Form/Tag.php | 11 --- css/contactSummary.css | 16 ++-- templates/CRM/Tag/Form/Tag.tpl | 90 +++++++++---------- templates/CRM/Tag/Form/Tagtree.tpl | 9 +- 6 files changed, 53 insertions(+), 78 deletions(-) diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index 7a633d1e49..fe0cb5338a 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -119,8 +119,6 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { CRM_Core_Resources::singleton() ->addScriptFile('civicrm', 'templates/CRM/Contact/Page/View/Summary.js', 2, 'html-header') ->addStyleFile('civicrm', 'css/contactSummary.css', 2, 'html-header') - ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE) - ->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header') ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header') ->addSetting(array( 'summaryPrint' => array('mode' => $this->_print), diff --git a/CRM/Core/Smarty/plugins/function.crmStyle.php b/CRM/Core/Smarty/plugins/function.crmStyle.php index b38e7f3c67..3f5f6b6fb8 100644 --- a/CRM/Core/Smarty/plugins/function.crmStyle.php +++ b/CRM/Core/Smarty/plugins/function.crmStyle.php @@ -56,6 +56,9 @@ function smarty_function_crmStyle($params, &$smarty) { if (empty($params['region'])) { $params['region'] = CRM_Core_Resources::DEFAULT_REGION; } + if (empty($params['ext'])) { + $params['ext'] = 'civicrm'; + } if (array_key_exists('file', $params)) { $res->addStyleFile($params['ext'], $params['file'], $params['weight'], $params['region']); diff --git a/CRM/Tag/Form/Tag.php b/CRM/Tag/Form/Tag.php index 55ccd7514f..231fb43db0 100644 --- a/CRM/Tag/Form/Tag.php +++ b/CRM/Tag/Form/Tag.php @@ -99,17 +99,6 @@ class CRM_Tag_Form_Tag extends CRM_Core_Form { $tags = new CRM_Core_BAO_Tag(); $tree = $tags->getTree($this->_entityTable, TRUE); - - // let's not load jstree if there are not children. This also fixes blank - // display at the beginning of checkboxes - $loadJsTree = CRM_Utils_Array::retrieveValueRecursive($tree, 'children'); - $this->assign('loadjsTree', FALSE); - if (!empty($loadJsTree)) { - CRM_Core_Resources::singleton() - ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE) - ->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header'); - $this->assign('loadjsTree', TRUE); - } $this->assign('tree', $tree); $this->assign('allTags', $allTags); diff --git a/css/contactSummary.css b/css/contactSummary.css index 6a957989da..c29270bac9 100644 --- a/css/contactSummary.css +++ b/css/contactSummary.css @@ -349,14 +349,7 @@ div#crm-contact-thumbnail { max-height: 500px; overflow: auto; } -#tagtree, -#tagtree li.highlighted ul { - background-color: white; -} -#tagtree li.highlighted, -#tagtree li.highlighted-child.jstree-closed { - background-color: #fefcb0; -} + #tagtree li { margin-top: 5px; } @@ -365,8 +358,11 @@ div#crm-contact-thumbnail { position: relative; top: -3px; } -#tagtree input { - margin: 0; +#tagtree .jstree-disabled { + cursor: not-allowed; +} +#tagtree .jstree-disabled > .jstree-checkbox { + opacity: .2; } #tagGroup table .label { diff --git a/templates/CRM/Tag/Form/Tag.tpl b/templates/CRM/Tag/Form/Tag.tpl index b83dffad9c..64ccc9707e 100644 --- a/templates/CRM/Tag/Form/Tag.tpl +++ b/templates/CRM/Tag/Form/Tag.tpl @@ -24,6 +24,7 @@ +--------------------------------------------------------------------+ *} {* this template is used for adding/editing tags *} +{crmStyle file='bower_components/jstree/dist/themes/default/style.min.css'} {literal}