Skip to content

Commit

Permalink
New options added, updated to v4.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipu Raj committed Feb 1, 2017
1 parent 9f213a8 commit a554061
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Features

Version
-----
**SmartWizard v4.1.2**
**SmartWizard v4.1.5**

License
----
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartwizard",
"version": "v4.1.2",
"version": "v4.1.5",
"homepage": "https://github.com/techlab/SmartWizard",
"authors": [
"Dipu Raj <[email protected]>"
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"step",
"ui",
"jquery-plugin",
"jquery"
"jquery",
"wizard plugin"
],
"authors": [
{
Expand All @@ -25,6 +26,6 @@
],
"require": {
"components/jquery": ">=1.9",
"components/bootstrap": ">=3.0.0"
"components/bootstrap": ">=3.0.0"
}
}
43 changes: 18 additions & 25 deletions js/jquery.smartWizard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SmartWizard v4.1.2
/* SmartWizard v4.1.5
* jQuery Wizard Plugin
* http://www.techlaboratory.net/smartwizard
*
Expand Down Expand Up @@ -41,6 +41,7 @@
},
contentURL: null, // content url, Enables Ajax content loading. Can also set as data data-content-url on anchor
contentCache: true, // cache step contents, if false content is fetched always from ajax url
ajaxSettings: {}, // Ajax extra settings
disabledSteps: [], // Array Steps disabled
errorSteps: [], // Highlight step with errors
hiddenSteps: [], // Hidden steps
Expand Down Expand Up @@ -116,7 +117,6 @@
// Set content pages
this.pages.addClass('step-content');


// Disabled steps
var mi = this;
if(this.options.disabledSteps && this.options.disabledSteps.length > 0){
Expand Down Expand Up @@ -319,43 +319,34 @@
var mi = this;
// Get current step elements
var curTab = this.steps.eq(this.current_index);
var curPage = (curTab.length>0) ? $(curTab.attr("href"),this.main) : null;
// Get step to show elements
var selTab = this.steps.eq(idx);
var selPage = (selTab.length>0) ? $(selTab.attr("href"),this.main) : null;
// Get the direction of step navigation
var stepDirection = '';
var elm = this.steps.eq(idx);
var contentURL = (elm.data('content-url') && elm.data('content-url').length > 0) ? elm.data('content-url') : this.options.contentURL;

if(this.current_index !== null && this.current_index !== idx){
stepDirection = (this.current_index < idx) ? "forward" : "backward";
}

var stepPosition = 'middle';
if(idx === 0){
stepPosition = 'first';
}else if(idx === (this.steps.length-1)){
stepPosition = 'final';
}

// Trigger "leaveStep" event
if(this.current_index !== null && this._triggerEvent("leaveStep", [curTab, this.current_index, stepDirection]) === false){ return false; }

// check contentCache
if(!this.options.contentCache){
elm.data('has-content', false);
}
if(contentURL && contentURL.length > 0 && !elm.data('has-content')){

if(contentURL && contentURL.length > 0 && (!elm.data('has-content') || !this.options.contentCache)){
// Get ajax content and then show step
var selPage = (elm.length>0) ? $(elm.attr("href"),this.main) : null;
$.ajax({

var ajaxSettings = $.extend(true, {}, {
url: contentURL,
type: "POST",
data: ({step_number : idx}),
dataType: "text",
beforeSend: function(){ elm.parent('li').addClass('loading'); },
error: function(){ elm.parent('li').removeClass('loading'); },
beforeSend: function(){
elm.parent('li').addClass('loading');
},
error: function(jqXHR, status, message){
elm.parent('li').removeClass('loading');
$.error(message);
},
success: function(res){
if(res && res.length > 0){
elm.data('has-content',true);
Expand All @@ -364,7 +355,9 @@
elm.parent('li').removeClass('loading');
mi._transitPage(idx);
}
});
}, this.options.ajaxSettings);

$.ajax(ajaxSettings);
}else{
// Show step
this._transitPage(idx);
Expand All @@ -391,7 +384,7 @@
}else if(idx === (this.steps.length-1)){
stepPosition = 'final';
}

this.options.transitionEffect = this.options.transitionEffect.toLowerCase();
this.pages.finish();
if(this.options.transitionEffect === 'slide'){ // normal slide
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.smartWizard.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartwizard",
"version": "v4.1.2",
"version": "v4.1.5",
"author": "Dipu Raj <[email protected]>",
"description": "An awesome jQuery step wizard plugin with Bootstrap support",
"homepage": "http://techlaboratory.net/smartwizard",
Expand Down

0 comments on commit a554061

Please sign in to comment.