From 3f0da4519e5dc7cc8334ca76f43904b640f9baf8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 23 Jan 2015 21:22:37 -0800 Subject: [PATCH] CRM-15856 - crmUiWizard - Disable "Next" button until the step is complete. Update wizards. --- js/angular-crm-ui.js | 13 ++++++++++--- partials/crmMailing/edit-wizard.html | 8 ++++---- partials/crmMailing/edit.html | 4 ++-- partials/crmMailingAB/edit.html | 12 ++++++------ partials/crmUi/wizard.html | 4 ++-- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/js/angular-crm-ui.js b/js/angular-crm-ui.js index 4ead37a3e8..1d18f714c2 100644 --- a/js/angular-crm-ui.js +++ b/js/angular-crm-ui.js @@ -511,6 +511,9 @@ /// @return bool whether the current step is last this.$last = function() { return this.$index() === steps.length -1; }; this.$maxVisit = function() { return maxVisited; }; + this.$validStep = function() { + return steps[selectedIndex].isStepValid(); + }; this.iconFor = function(index) { if (index < this.$index()) return '√'; if (index === this.$index()) return '»'; @@ -584,13 +587,13 @@ }; }) - // example:
...content...
+ // example:
...content...
// If there are any conditional steps, then be sure to set a weight explicitly on *all* steps to maintain ordering. // example:
...content...
.directive('crmUiWizardStep', function() { var nextWeight = 1; return { - require: '^crmUiWizard', + require: ['^crmUiWizard', 'form'], restrict: 'EA', scope: { crmTitle: '@', // expression, evaluates to a printable string @@ -598,12 +601,16 @@ }, template: '
', transclude: true, - link: function (scope, element, attrs, crmUiWizardCtrl) { + link: function (scope, element, attrs, ctrls) { + var crmUiWizardCtrl = ctrls[0], form = ctrls[1]; if (scope.crmUiWizardStep) { scope.crmUiWizardStep = parseInt(scope.crmUiWizardStep); } else { scope.crmUiWizardStep = nextWeight++; } + scope.isStepValid = function() { + return form.$valid; + }; crmUiWizardCtrl.add(scope); element.on('$destroy', function(){ crmUiWizardCtrl.remove(scope); diff --git a/partials/crmMailing/edit-wizard.html b/partials/crmMailing/edit-wizard.html index b9ee637196..84baec755f 100644 --- a/partials/crmMailing/edit-wizard.html +++ b/partials/crmMailing/edit-wizard.html @@ -11,11 +11,11 @@
-
+
-
+
@@ -34,7 +34,7 @@
-
+
@@ -50,7 +50,7 @@
-
+
diff --git a/partials/crmMailing/edit.html b/partials/crmMailing/edit.html index 3cdda25c78..eb65d0117b 100644 --- a/partials/crmMailing/edit.html +++ b/partials/crmMailing/edit.html @@ -10,7 +10,7 @@
-
+
@@ -44,7 +44,7 @@
-
+
diff --git a/partials/crmMailingAB/edit.html b/partials/crmMailingAB/edit.html index f68d87a6c6..177bbdf63d 100644 --- a/partials/crmMailingAB/edit.html +++ b/partials/crmMailingAB/edit.html @@ -16,7 +16,7 @@
-
+
-
+
-
+
-
+
-
+
-
+
- +
-
\ No newline at end of file +
-- 2.25.1