minimumInputLength: 1,
formatResult: CRM.utils.formatSelect2Result,
formatSelection: function(row) {
- return row.label;
+ return (row.prefix !== undefined ? row.prefix + ' ' : '') + row.label + (row.suffix !== undefined ? ' ' + row.suffix : '');
},
escapeMarkup: function (m) {return m;},
initSelection: function($el, callback) {
else if (row.icon_class) {
markup += '<div class="crm-select2-icon"><div class="crm-icon ' + row.icon_class + '-icon"></div></div>';
}
- markup += '<div><div class="crm-select2-row-label '+(row.label_class || '')+'">' + row.label + '</div>';
- markup += '<div class="crm-select2-row-description">';
+ markup += '<div><div class="crm-select2-row-label '+(row.label_class || '')+'">' +
+ (row.prefix !== undefined ? row.prefix + ' ' : '') + row.label + (row.suffix !== undefined ? ' ' + row.suffix : '') +
+ '</div>' +
+ '<div class="crm-select2-row-description">';
$.each(row.description || [], function(k, text) {
markup += '<p>' + text + '</p>';
});
$('form[data-warn-changes] :input', e.target).each(function() {
$(this).data('crm-initial-value', $(this).is(':checkbox, :radio') ? $(this).prop('checked') : $(this).val());
});
+ $('textarea.crm-form-wysiwyg', e.target)
+ .not('.crm-wysiwyg-enabled')
+ .addClass('crm-wysiwyg-enabled')
+ .each(function() {
+ if ($(this).hasClass("collapsed")) {
+ CRM.wysiwyg.createCollapsed(this);
+ } else {
+ CRM.wysiwyg.create(this);
+ }
+ });
})
.on('dialogopen', function(e) {
var $el = $(e.target);
$().crmtooltip();
});
- /**
- * @deprecated
- */
- $.fn.crmAccordions = function () {
- CRM.console('warn', 'Warning: $.crmAccordions was called. This function is deprecated and should not be used.');
- };
+
/**
* Collapse or expand an accordion
* @param speed
/**
* Clientside currency formatting
* @param number value
- * @param [optional] boolean onlyNumber - if true, we return formated amount without currency sign
+ * @param [optional] boolean onlyNumber - if true, we return formatted amount without currency sign
* @param [optional] string format - currency representation of the number 1234.56
* @return string
*/
};
// Round while preserving sigfigs
- CRM.sigfig = function(n, digits) {
+ CRM.utils.sigfig = function(n, digits) {
var len = ("" + n).length;
var scale = Math.pow(10.0, len-digits);
return Math.round(n / scale) * scale;