public
Created

Add page css to form in jquery-form-wizard.

  • Download Gist
wizard.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
 
eb31fd63a313757ad25c032248a28944d375959f
.../jquery-ui-wizard/jquery.form.wizard.js | 27 +++++++++++++++++---
1 files changed, 23 insertions(+), 4 deletions(-)
 
diff --git a/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js b/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js
index 39a2397..c5525a9 100644
--- a/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js
+++ b/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js
@@ -13,7 +13,7 @@
(function($){
- $.widget("ui.formwizard", {
+ $.widget("ui.formwizard", {
_init: function() {
@@ -141,10 +141,25 @@
this.backButton.addClass("ui-helper-reset ui-state-default");
this.nextButton.addClass("ui-helper-reset ui-state-default");
}
- this._show(undefined);
+ this._show(undefined);
return $(this);
},
+ _updateFormWizardClass: function() {
+ var newClass = this.currentStep;
+ var prefix = "formwizard-";
+
+ // Remove earlier classes
+ $.each(wizard[0].classList, function(i, className){
+ if (className.startsWith(prefix)) {
+ wizard.removeClass(className);
+ }
+ });
+
+ // Add new class
+ wizard.addClass(prefix + newClass);
+ },
+
_next : function(){
if(this.options.validationEnabled){
if(!this.element.valid()){
@@ -185,7 +200,7 @@
}
}
- return this._continueToNextStep();
+ return this._continueToNextStep();
},
_back : function(){
@@ -334,10 +349,14 @@
}
if(this.currentStep !== step || step === this.firstStep){
- this.previousStep = this.currentStep;
+ this.previousStep = this.currentStep;
this._checkIflastStep(step);
this.currentStep = step;
var stepShownCallback = function(){if(triggerStepShown)$(this.element).trigger('step_shown', $.extend({"isBackNavigation" : backwards},this._state()));};
+
+ // Ron Gross
+ this._updateFormWizardClass();
+
this._animate(this.previousStep, step, stepShownCallback);
}
},

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.