From 7e909ff980981a2a27b71640fbf38ccee3c70a8a Mon Sep 17 00:00:00 2001 From: "Gowri sankar.R" Date: Wed, 20 May 2015 18:16:38 +0530 Subject: [PATCH 1/2] includePreviousButton option added includePreviousButton option added, default value is true, if we don't want to show the previous button we can set option value false. Based on ticket #40, it's more worth to keep the option in side the plugin --- js/jquery.smartWizard.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/js/jquery.smartWizard.js b/js/jquery.smartWizard.js index 2e6b753..f24dead 100644 --- a/js/jquery.smartWizard.js +++ b/js/jquery.smartWizard.js @@ -10,6 +10,8 @@ * http://www.techlaboratory.net * http://tech-laboratory.blogspot.com */ + +(function($){ function SmartWizard(target, options) { this.target = target; @@ -285,17 +287,23 @@ function SmartWizard(target, options) { var _adjustButton = function($this) { if (! $this.options.cycleSteps){ - if (0 >= $this.curStepIdx) { - $($this.buttons.previous).addClass("buttonDisabled"); - if ($this.options.hideButtonsOnDisabled) { - $($this.buttons.previous).hide(); - } - }else{ - $($this.buttons.previous).removeClass("buttonDisabled"); - if ($this.options.hideButtonsOnDisabled) { - $($this.buttons.previous).show(); + if($this.options.includePreviousButton){ + if (0 >= $this.curStepIdx) { + $($this.buttons.previous).addClass("buttonDisabled"); + if ($this.options.hideButtonsOnDisabled) { + $($this.buttons.previous).hide(); + } + }else{ + $($this.buttons.previous).removeClass("buttonDisabled"); + if ($this.options.hideButtonsOnDisabled) { + $($this.buttons.previous).show(); + } } } + else{ + $($this.buttons.previous).hide(); + } + if (($this.steps.length-1) <= $this.curStepIdx){ $($this.buttons.next).addClass("buttonDisabled"); if ($this.options.hideButtonsOnDisabled) { @@ -434,7 +442,7 @@ function SmartWizard(target, options) { -(function($){ + $.fn.smartWizard = function(method) { var args = arguments; @@ -483,7 +491,8 @@ function SmartWizard(target, options) { onLeaveStep: null, // triggers when leaving a step onShowStep: null, // triggers when showing a step onFinish: null, // triggers when Finish button is clicked - includeFinishButton : true // Add the finish button + includeFinishButton : true, // Add the finish button + includePreviousButton: true // Add the prevous button }; })(jQuery); From f6216984251460e1da473b445098fadcd2a08db3 Mon Sep 17 00:00:00 2001 From: "Gowri sankar.R" Date: Wed, 20 May 2015 18:19:11 +0530 Subject: [PATCH 2/2] includePreviousButton documenting --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91326f5..d42ab32 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ $('#wizard').smartWizard({ onLeaveStep: null, // triggers when leaving a step onShowStep: null, // triggers when showing a step onFinish: null, // triggers when Finish button is clicked - includeFinishButton : true // Add the finish button + includeFinishButton : true, // Add the finish button + includePreviousButton: true // Add the prevous button }); ``` @@ -431,6 +432,16 @@ example: true + + includePreviousButton + If true, adds a previous button + + true = show +
+ false= don't show + + true +