From a243158ec6762d4f5cadbf0c90fe8112745ec23a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 1 Apr 2014 12:21:33 -0400 Subject: [PATCH] Dialog & select2 improvements --- css/civicrm.css | 11 ++++++++++- js/Common.js | 18 ++++++++++++------ .../CRM/Activity/Form/Task/FileOnCase.tpl | 2 +- templates/CRM/Admin/Page/Tag.tpl | 2 +- templates/CRM/Case/Form/Activity/LinkCases.tpl | 2 +- templates/CRM/Case/Form/ActivityToCase.tpl | 9 ++++----- templates/CRM/Case/Form/CaseView.js | 1 + templates/CRM/Event/Form/Search/Common.tpl | 2 +- templates/CRM/Mailing/Form/InsertTokens.tpl | 2 +- 9 files changed, 32 insertions(+), 17 deletions(-) diff --git a/css/civicrm.css b/css/civicrm.css index 963990d80f..1901c8c72d 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3948,7 +3948,16 @@ div.m ul#civicrm-menu, .crm-container.ui-dialog { box-shadow: 0 0 10px rgba(0, 0, 0, 0.6); } - +.crm-container.ui-dialog.ui-draggable:before { + display:block; + content: " "; + width: 16px; + height: 16px; + background: url("../i/icons/jquery-ui-3E3E3E.png") no-repeat -80px -224px; + position: absolute; + bottom: 0; + right: 0; +} .crm-container .ui-dialog-titlebar.ui-widget-header { background: url("../i/crm-button-bg.gif") repeat-x scroll left center #70716B; color: #F5F6F1; diff --git a/js/Common.js b/js/Common.js index 6fc8544268..403cef2e21 100644 --- a/js/Common.js +++ b/js/Common.js @@ -246,7 +246,7 @@ CRM.validate = CRM.validate || { return $(this).each(function () { var $el = $(this), - defaults = {allowClear: !$el.hasClass('required')}; + settings = {allowClear: !$el.hasClass('required')}; // quickform doesn't support optgroups so here's a hack :( $('option[value^=crm_optgroup]', this).each(function () { $(this).nextUntil('option[value^=crm_optgroup]').wrapAll(''); @@ -254,12 +254,16 @@ CRM.validate = CRM.validate || { }); // Defaults for single-selects if ($el.is('select:not([multiple])')) { - defaults.minimumResultsForSearch = 10; + settings.minimumResultsForSearch = 10; if ($('option:first', this).val() === '') { - defaults.placeholderOption = 'first'; + settings.placeholderOption = 'first'; } } - $el.select2($.extend(defaults, $el.data('select-params') || {}, options || {})); + $.extend(settings, $el.data('select-params') || {}, options || {}); + if (settings.ajax) { + $el.addClass('crm-ajax-select'); + } + $el.select2(settings); }); }; @@ -279,7 +283,7 @@ CRM.validate = CRM.validate || { $el.data('select-params', $.extend({}, $el.data('select-params') || {}, options.select)); $el.data('api-params', $.extend({}, $el.data('api-params') || {}, options.api)); $el.data('create-links', options.create || $el.data('create-links')); - $el.addClass('crm-ajax-select crm-' + entity + '-ref'); + $el.addClass('crm-form-entityref crm-' + entity + '-ref'); var settings = { // Use select2 ajax helper instead of CRM.api because it provides more value ajax: { @@ -427,7 +431,7 @@ CRM.validate = CRM.validate || { } $el.parent().find('.ui-dialog-titlebar-close').attr('title', ts('Close')); // Add resize button - if ($el.parent().hasClass('crm-container')) { + if ($el.parent().hasClass('crm-container') && $el.dialog('option', 'resizable')) { $el.parent().find('.ui-dialog-titlebar').append($('