From 9597c394cb590d56918ab5560417483445b652ac Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 15 Oct 2015 15:50:30 -0400 Subject: [PATCH] CRM-16415 - Convert action menu icons --- CRM/Case/Form/CaseView.php | 6 ++--- CRM/Contact/Form/GroupContact.php | 2 +- CRM/Core/Form/Search.php | 2 +- CRM/Report/Form.php | 2 +- ang/crmCaseType.js | 2 +- ang/crmMailing/BlockPreview.html | 4 +-- ang/crmMailing/Token.js | 2 +- css/civicrm.css | 25 ------------------- js/Common.js | 12 +++++++++ templates/CRM/Activity/Form/ActivityLinks.tpl | 2 +- templates/CRM/Mailing/Form/InsertTokens.tpl | 2 +- 11 files changed, 24 insertions(+), 37 deletions(-) diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index dc8d0fac6f..76bbe9a53b 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -269,17 +269,17 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { $activityLinks[$url] = $label; } - $this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-plus twenty')); + $this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, array('class' => 'crm-select2 crm-action-menu fa-calendar-check-o twenty')); if ($this->_hasAccessToAllCases) { $this->add('select', 'report_id', '', array('' => ts('Activity Audit')) + $reports, FALSE, - array('class' => 'crm-select2 crm-action-menu action-icon-clipboard') + array('class' => 'crm-select2 crm-action-menu fa-list-alt') ); $this->add('select', 'timeline_id', '', array('' => ts('Add Timeline')) + $reports, FALSE, - array('class' => 'crm-select2 crm-action-menu action-icon-play') + array('class' => 'crm-select2 crm-action-menu fa-list-ol') ); } $this->addElement('submit', $this->getButtonName('next'), ' ', array('class' => 'hiddenElement')); diff --git a/CRM/Contact/Form/GroupContact.php b/CRM/Contact/Form/GroupContact.php index 64e83e772c..c883232042 100644 --- a/CRM/Contact/Form/GroupContact.php +++ b/CRM/Contact/Form/GroupContact.php @@ -113,7 +113,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form { $msg = ts('Add to a group'); } - $this->addField('group_id', array('class' => 'crm-action-menu action-icon-plus', 'placeholder' => $msg, 'options' => $groupSelect)); + $this->addField('group_id', array('class' => 'crm-action-menu fa-plus', 'placeholder' => $msg, 'options' => $groupSelect)); $this->addButtons(array( array( diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 6d83b1c731..78b28418cb 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -146,7 +146,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { public function addTaskMenu($tasks) { if (is_array($tasks) && !empty($tasks)) { $tasks = array('' => ts('Actions')) + $tasks; - $this->add('select', 'task', NULL, $tasks, FALSE, array('class' => 'crm-select2 crm-action-menu huge crm-search-result-actions')); + $this->add('select', 'task', NULL, $tasks, FALSE, array('class' => 'crm-select2 crm-action-menu fa-check-circle-o huge crm-search-result-actions')); $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'hiddenElement crm-search-go-button')); // Radio to choose "All items" or "Selected items only" diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 5d5899a934..71d350778d 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1417,7 +1417,7 @@ class CRM_Report_Form extends CRM_Core_Form { $this->addElement('select', 'groups', ts('Group'), array('' => ts('Add Contacts to Group')) + CRM_Core_PseudoConstant::nestedGroup(), - array('class' => 'crm-select2 crm-action-menu action-icon-plus huge') + array('class' => 'crm-select2 crm-action-menu fa-plus huge') ); $this->assign('group', TRUE); } diff --git a/ang/crmCaseType.js b/ang/crmCaseType.js index 3e23ac1d3f..e5aae2a351 100644 --- a/ang/crmCaseType.js +++ b/ang/crmCaseType.js @@ -82,7 +82,7 @@ crmCaseType.directive('crmAddName', function() { return { restrict: 'AE', - template: '', + template: '', link: function(scope, element, attrs) { /// Format list of options for select2's "data" var getFormattedOptions = function() { diff --git a/ang/crmMailing/BlockPreview.html b/ang/crmMailing/BlockPreview.html index 71d7ff0baa..c7d86f94cc 100644 --- a/ang/crmMailing/BlockPreview.html +++ b/ang/crmMailing/BlockPreview.html @@ -46,11 +46,11 @@ Vars: mailing:obj, testContact:obj, testGroup:obj, crmMailing:FormController
diff --git a/ang/crmMailing/Token.js b/ang/crmMailing/Token.js index f5d94a5967..71131d21b7 100644 --- a/ang/crmMailing/Token.js +++ b/ang/crmMailing/Token.js @@ -9,7 +9,7 @@ }, template: '', link: function(scope, element, attrs, crmUiIdCtrl) { - $(element).addClass('crm-action-menu action-icon-token').select2({ + $(element).addClass('crm-action-menu fa-code').crmSelect2({ width: "12em", dropdownAutoWidth: true, data: CRM.crmMailing.mailTokens, diff --git a/css/civicrm.css b/css/civicrm.css index 3c89beb28b..cd7742647c 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3264,31 +3264,6 @@ div.m ul#civicrm-menu, .crm-container .crm-action-menu .select2-default span.select2-chosen { color: #2786C2; } -.crm-container .crm-action-menu .select2-default span.select2-chosen:before { - background: url("../i/icons/jquery-ui-2786C2.png") no-repeat scroll -64px -112px; - content: ""; - display: inline-block; - height: 16px; - width: 16px; - margin-right: 3px; - position: relative; - top: 3px; -} -.crm-container .crm-action-menu.action-icon-plus .select2-default span.select2-chosen:before { - background-position: 0 -192px; -} -.crm-container .crm-action-menu.action-icon-play .select2-default span.select2-chosen:before { - background-position: -48px -192px; -} -.crm-container .crm-action-menu.action-icon-clipboard .select2-default span.select2-chosen:before { - background-position: -160px -128px; -} -.crm-container .crm-action-menu.action-icon-token .select2-default span.select2-chosen:before { - background-position: -144px 0; -} -.crm-container .crm-action-menu.action-icon-mail-closed .select2-default span.select2-chosen:before { - background-position: -80px -96px; -} /* Restore this property otherwise our css overrides it */ .select2-search input { box-sizing: border-box; diff --git a/js/Common.js b/js/Common.js index 41634344ea..107981b9fe 100644 --- a/js/Common.js +++ b/js/Common.js @@ -373,6 +373,7 @@ if (!CRM.vars) CRM.vars = {}; return $(this).each(function () { var $el = $(this), + iconClass, settings = {allowClear: !$el.hasClass('required')}; // quickform doesn't support optgroups so here's a hack :( $('option[value^=crm_optgroup]', this).each(function () { @@ -384,6 +385,12 @@ if (!CRM.vars) CRM.vars = {}; // add disabled property for option values $('option[value^=crm_disabled_opt]', this).attr('disabled', 'disabled'); + // Placeholder icon + if ($el.is('[class*=fa-]')) { + iconClass = $el.attr('class').match(/(fa-\S*)/)[1]; + $el.removeClass(iconClass); + } + // Defaults for single-selects if ($el.is('select:not([multiple])')) { settings.minimumResultsForSearch = 10; @@ -396,6 +403,11 @@ if (!CRM.vars) CRM.vars = {}; $el.addClass('crm-ajax-select'); } $el.select2(settings); + if (iconClass) { + window.setTimeout(function() { + $el.select2('container').find('span.select2-chosen').prepend(' '); + }, 10); + } }); }; diff --git a/templates/CRM/Activity/Form/ActivityLinks.tpl b/templates/CRM/Activity/Form/ActivityLinks.tpl index 1e6cb720d2..140a84869e 100644 --- a/templates/CRM/Activity/Form/ActivityLinks.tpl +++ b/templates/CRM/Activity/Form/ActivityLinks.tpl @@ -30,7 +30,7 @@ {/if} {if $as_select} {* on 3.2, the activities can be either a drop down select (on the activity tab) or a list (on the action menu) *} - {foreach from=$activityTypes key=k item=link} diff --git a/templates/CRM/Mailing/Form/InsertTokens.tpl b/templates/CRM/Mailing/Form/InsertTokens.tpl index 6a3f143242..7ce110ea68 100644 --- a/templates/CRM/Mailing/Form/InsertTokens.tpl +++ b/templates/CRM/Mailing/Form/InsertTokens.tpl @@ -244,7 +244,7 @@ CRM.$(function($) { // Initialize token selector widgets var form = $('form.{/literal}{$form.formClass}{literal}'); $('input.crm-token-selector', form) - .addClass('crm-action-menu action-icon-token') + .addClass('crm-action-menu fa-code') .change(insertToken) .crmSelect2({ data: form.data('tokens'), -- 2.25.1