X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ang%2FcrmUi.js;h=4ea687c32964e87a5d0dad35ac30c3bcb92e454f;hb=2c0f8c6797d810bc6a3202b7d0c18e762f5f22ec;hp=a900f45a3ae71661dfea7498c0be4dcb0dd46781;hpb=a5b08a92f51c39c668edf05a5db3b199a300ddde;p=civicrm-core.git diff --git a/ang/crmUi.js b/ang/crmUi.js index a900f45a3a..4ea687c329 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -5,7 +5,7 @@ pageTitle = 'CiviCRM', documentTitle = 'CiviCRM'; - angular.module('crmUi', []) + angular.module('crmUi', CRM.angRequires('crmUi')) // example
...content...
// WISHLIST: crmCollapsed should support two-way/continuous binding @@ -588,7 +588,12 @@ $timeout(function () { // ex: msg_template_id adds new item then selects it; use $timeout to ensure that // new item is added before selection is made - element.select2('val', ngModel.$modelValue); + var newVal = _.cloneDeep(ngModel.$modelValue); + // Fix possible data-type mismatch + if (typeof newVal === 'string' && element.select2('container').hasClass('select2-container-multi')) { + newVal = newVal.length ? newVal.split(',') : []; + } + element.select2('val', newVal); }); }; } @@ -631,7 +636,12 @@ $timeout(function () { // ex: msg_template_id adds new item then selects it; use $timeout to ensure that // new item is added before selection is made - element.select2('val', ngModel.$modelValue); + var newVal = _.cloneDeep(ngModel.$modelValue); + // Fix possible data-type mismatch + if (typeof newVal === 'string' && element.select2('container').hasClass('select2-container-multi')) { + newVal = newVal.length ? newVal.split(',') : []; + } + element.select2('val', newVal); }); }; function refreshModel() { @@ -680,7 +690,8 @@ return { restrict: 'EA', scope: { - crmUiTabSet: '@' + crmUiTabSet: '@', + tabSetOptions: '@' }, templateUrl: '~/crmUi/tabset.html', transclude: true, @@ -732,6 +743,7 @@ }) // example:
...
...
+ // example with custom nav classes:
...
// Note: "myWizardCtrl" has various actions/properties like next() and $first(). // WISHLIST: Allow each step to determine if it is "complete" / "valid" / "selectable" // WISHLIST: Allow each step to enable/disable (show/hide) itself @@ -739,7 +751,8 @@ return { restrict: 'EA', scope: { - crmUiWizard: '@' + crmUiWizard: '@', + crmUiWizardNavClass: '@' // string, A list of classes that will be added to the nav items }, templateUrl: '~/crmUi/wizard.html', transclude: true, @@ -869,6 +882,7 @@ // example:
...content...
// If there are any conditional steps, then be sure to set a weight explicitly on *all* steps to maintain ordering. // example:
...content...
+ // example with custom classes:
...content...
.directive('crmUiWizardStep', function() { var nextWeight = 1; return { @@ -876,9 +890,10 @@ restrict: 'EA', scope: { crmTitle: '@', // expression, evaluates to a printable string - crmUiWizardStep: '@' // int, a weight which determines the ordering of the steps + crmUiWizardStep: '@', // int, a weight which determines the ordering of the steps + crmUiWizardStepClass: '@' // string, A list of classes that will be added to the template }, - template: '
', + template: '
', transclude: true, link: function (scope, element, attrs, ctrls) { var crmUiWizardCtrl = ctrls[0], form = ctrls[1]; @@ -891,7 +906,7 @@ return form.$valid; }; crmUiWizardCtrl.add(scope); - element.on('$destroy', function(){ + scope.$on('$destroy', function(){ crmUiWizardCtrl.remove(scope); }); }