diff --git a/src/bootstrap-wizard.js b/src/bootstrap-wizard.js
index 276cd95..cee424c 100644
--- a/src/bootstrap-wizard.js
+++ b/src/bootstrap-wizard.js
@@ -119,15 +119,12 @@
return this;
},
- enable: function() {
+ enable: function(noActivate) {
this.log("enabling");
-
- // Issue #38 Hiding navigation link when hide card
- // Awaiting approval
- //
- // this.nav.removeClass('hide');
-
- this.nav.addClass("active");
+ this.nav.removeClass('hide');
+ if (noActivate !== undefined) {
+ this.nav.addClass("active");
+ }
this._disabled = false;
this.trigger("enabled");
return this;
@@ -139,10 +136,7 @@
this.nav.removeClass("active already-visited");
if (hideCard) {
this.el.hide();
- // Issue #38 Hiding navigation link when hide card
- // Awaiting approval
- //
- // this.nav.addClass('hide');
+ this.nav.addClass('hide');
}
this.trigger("disabled");
return this;
@@ -597,7 +591,7 @@
errorPopover: function(el, msg, allowHtml) {
this.log("launching popover on", el);
allowHtml = typeof allowHtml !== "undefined" ? allowHtml : false;
- var popover = el.popover({
+ var popover = el.popover('destroy').popover({
content: msg,
trigger: "manual",
html: allowHtml,
@@ -845,15 +839,23 @@
* any validators that trigger errorPopovers can
* display correctly
*/
- if (cardToValidate.index != currentCard.index) {
- cardToValidate.prev.deselect();
- cardToValidate.prev.markVisited();
- cardToValidate.select();
- }
- ok = cardToValidate.validate();
- if (!ok) {
- return cardToValidate;
- }
+
+ if (cardToValidate.index != currentCard.index) {
+ cardToValidate.prev.deselect();
+ cardToValidate.prev.markVisited();
+ cardToValidate.select();
+ }
+ if (!cardToValidate.isDisabled()) {
+ ok = cardToValidate.validate();
+ }
+ else {
+ ok = true;
+ }
+
+ if (!ok) {
+ return cardToValidate;
+ }
+
cardToValidate = cardToValidate.next;
}
diff --git a/src/bootstrap-wizard.min.js b/src/bootstrap-wizard.min.js
index ae9bd43..cf3c2a1 100644
--- a/src/bootstrap-wizard.min.js
+++ b/src/bootstrap-wizard.min.js
@@ -1 +1 @@
-(function(e){e.fn.wizard=function(e){return new Wizard(this,e)};e.fn.wizard.logging=false;var t=function(e,t,n,r,i){this.wizard=e;this.index=n;this.prev=r;this.next=i;this.el=t;this.title=t.find("h3").first().text();this.name=t.data("cardname")||this.title;this.nav=this._createNavElement(this.title,n);this._disabled=false;this._loaded=false;this._events={}};t.prototype={select:function(){this.log("selecting");if(!this.isSelected()){this.nav.addClass("active");this.el.show();if(!this._loaded){this.trigger("loaded");this.reload()}this.trigger("selected")}var e=this.wizard;e.backButton.toggleClass("disabled",this.index==0);if(this.index>=e._cards.length-1){this.log("on last card, changing next button to submit");e.changeNextButton(e.args.buttons.submitText,"btn-success");e._readyToSubmit=true;e.trigger("readySubmit")}else{e._readyToSubmit=false;e.changeNextButton(e.args.buttons.nextText,"btn-primary")}return this},_createNavElement:function(t,n){var r=e('
');var i=e('');i.data("navindex",n);r.append(i);i.append(' ');i.append(t);return r},markVisited:function(){this.log("marking as visited");this.nav.addClass("already-visited");this.trigger("markVisited");return this},unmarkVisited:function(){this.log("unmarking as visited");this.nav.removeClass("already-visited");this.trigger("unmarkVisited");return this},deselect:function(){this.nav.removeClass("active");this.el.hide();this.trigger("deselect");return this},enable:function(){this.log("enabling");this.nav.addClass("active");this._disabled=false;this.trigger("enabled");return this},disable:function(e){this.log("disabling");this._disabled=true;this.nav.removeClass("active already-visited");if(e){this.el.hide()}this.trigger("disabled");return this},isDisabled:function(){return this._disabled},alreadyVisited:function(){return this.nav.hasClass("already-visited")},isSelected:function(){return this.nav.hasClass("active")},reload:function(){this._loaded=true;this.trigger("reload");return this},on:function(){return this.wizard.on.apply(this,arguments)},trigger:function(){this.callListener("on"+arguments[0]);return this.wizard.trigger.apply(this,arguments)},toggleAlert:function(t,n){this.log("toggling alert to: "+n);n=typeof n=="undefined"?true:n;if(n){this.trigger("showAlert")}else{this.trigger("hideAlert")}var r;var i=this.el.children("h3").first().next("div.alert");if(i.length==0){if(!n){return this}this.log("couldn't find existing alert div, creating one");r=e("");r.addClass("alert");r.addClass("hide");r.insertAfter(this.el.find("h3").first())}else{this.log("found existing alert div");r=i.first()}if(n){if(t!=null){this.log("setting alert msg to",t);r.html(t)}r.show()}else{r.hide()}return this},callListener:function(e){e=e.toLowerCase();this.log("looking for listener "+e);var t=window[this.el.data(e)];if(t){this.log("calling listener "+e);var n=this.wizard;try{var r=t(this)}catch(i){this.log("exception calling listener "+e+": ",i)}}else{this.log("didn't find listener "+e)}},problem:function(e){this.nav.find("a").toggleClass("wizard-step-error",e)},validate:function(){var t=false;var n=this;this.el.find("[data-validate]").each(function(r,i){n.log("validating individiual inputs");i=e(i);var s=i.data("validate");if(!s){return}var o={status:true,title:"Error",msg:""};var u=window[s](i);e.extend(o,u);if(e("#btn-"+i.attr("id")).length===1){i=e("#btn-"+i.attr("id"))}if(!o.status){t=true;i.parents("div.form-group").toggleClass("has-error",true);if(e("#btn-"+i.attr("id")).length===1){i=e("#btn-"+i.attr("id"))}n.wizard.errorPopover(i,o.msg)}else{i.parents("div.form-group").toggleClass("has-error",false);if(e("#btn-"+i.attr("id")).length===1){i=e("#btn-"+i.attr("id"))}try{i.popover("destroy")}catch(a){i.popover("hide")}}});this.log("after validating inputs, failures is",t);var r=window[this.el.data("validate")];if(r){this.log("running html-embedded card validator");var i=r(this);if(typeof i=="undefined"||i==null){i=true}if(!i)t=true;this.log("after running html-embedded card validator, failures is",t)}this.log("running listener validator");var s=this.trigger("validate");if(typeof s=="undefined"||s==null){s=true}if(!s)t=true;this.log("after running listener validator, failures is",t);var o=!t;if(o){this.log("validated, calling listeners");this.trigger("validated")}else{this.log("invalid");this.trigger("invalid")}return o},log:function(){if(!window.console||!e.fn.wizard.logging){return}var t="card '"+this.name+"': ";var n=[t];n.push.apply(n,arguments);console.log.apply(console,n)},isActive:function(){return this.nav.hasClass("active")}};Wizard=function(t,n){this.wizard_template=['"];this.args={keyboard:true,backdrop:true,show:false,submitUrl:"",showCancel:false,showClose:true,progressBarCurrent:false,increaseHeight:0,contentHeight:300,contentWidth:580,buttons:{cancelText:"Cancel",nextText:"Next",backText:"Back",submitText:"Submit",submittingText:"Submitting..."},formClass:"form-horizontal"};e.extend(this.args,n||{});this._create(t)};Wizard.prototype={log:function(){if(!window.console||!e.fn.wizard.logging){return}var t="wizard "+this.el.id+": ";var n=[t];n.push.apply(n,arguments);console.log.apply(console,n)},_create:function(t){this.markup=e(t);this.title=this.markup.data("title");this.submitCards=this.markup.find(".wizard-error,.wizard-failure,.wizard-success,.wizard-loading");this.el=e(this.wizard_template.join("\n"));e("body").append(this.el);this.modal=this.el.modal({keyboard:this.args.keyboard,show:this.args.show,backdrop:this.args.backdrop});this.dimensions={contentHeight:this.args.contentHeight,contentWidth:this.args.contentWidth};this.dialog=this.modal.find(".wizard-dialog");this.content=this.modal.find(".wizard-content");this.header=this.modal.find(".wizard-header");this.body=this.modal.find(".wizard-body");this.wizardSteps=this.modal.find(".wizard-steps");this.wizardCards=this.modal.find(".wizard-cards");this.wizardCardContainer=this.modal.find(".wizard-card-container");this.wizardCardContainer.append(this.markup.find(".wizard-card")).append(this.submitCards);this.navContainer=this.modal.find(".wizard-nav-container");this.navList=this.modal.find(".wizard-nav-list");this.progressContainer=this.modal.find(".wizard-progress-container");this.progress=this.progressContainer.find(".progress-bar");this.closeButton=this.modal.find("button.wizard-close");this.cardsContainer=this.modal.find("wizard-cards-container");this.form=this.modal.find("form");this.footer=this.modal.find(".wizard-footer");this.cancelButton=this.footer.find(".wizard-cancel");this.backButton=this.footer.find(".wizard-back");this.nextButton=this.footer.find(".wizard-next");this._cards=[];this.cards={};this._readyToSubmit=false;this.percentComplete=0;this._submitting=false;this._events={};this._firstShow=true;this._createCards();this.nextButton.click(this,this._handleNextClick);this.backButton.click(this,this._handleBackClick);this.cancelButton.text(this.args.buttons.cancelText);this.backButton.text(this.args.buttons.backText);this.nextButton.text(this.args.buttons.nextText);this.form.addClass(this.args.formClass);this.popovers=[];var n=this;this.closeButton.click(function(){n.reset();n.close();n.trigger("closed")});this.wizardSteps.on("click","li.already-visited a.wizard-nav-link",this,function(t){var n=parseInt(e(t.target).data("navindex"));t.data.setCard(n)});if(this.title.length!=0){this.setTitle(this.title)}this.on("submit",this._defaultSubmit);this.autoDimensions()},autoDimensions:function(){this.modal.css("display","block");this.dimensions.header=this.header.outerHeight(true);this.dimensions.navigation=this.wizardSteps.outerHeight(true);if(this.dimensions.navigationt.index){var r=t;var i=false;while(r.index!=n.index){if(r.index!=t.index){r.prev.deselect();r.prev.markVisited();r.select()}i=r.validate();if(!i){return r}r=r.next}r.prev.deselect();r.prev.markVisited()}t.deselect();t.markVisited()}n.select();if(this.args.progressBarCurrent){this.percentComplete=e*100/this._cards.length;this.updateProgressBar(this.percentComplete)}else{var s=this.percentComplete;this.percentComplete=e*100/this._cards.length;this.percentComplete=Math.max(s,this.percentComplete);this.updateProgressBar(this.percentComplete)}return n}else{this.log("couldn't find card "+e)}},updateProgressBar:function(e){this.log("updating progress to "+e+"%");this.progress.css({width:e+"%"});this.percentComplete=e;this.trigger("progressBar",e);if(e==100){this.log("progress is 100, animating progress bar");this.progressContainer.find(".progress").addClass("active")}else if(e==0){this.log("progress is 0, disabling animation");this.progressContainer.find(".progress").removeClass("active")}},getNextCard:function(){var e=this.getActiveCard();if(e)return e.next},lockCards:function(){this.log("locking nav cards");this.eachCard(function(e,t){t.unmarkVisited()});return this},disableCards:function(){this.log("disabling all nav cards");this.eachCard(function(e,t){t.disable()});return this},enableCards:function(){this.log("enabling all nav cards");this.eachCard(function(e,t){t.enable()});return this},hideCards:function(){this.log("hiding cards");this.eachCard(function(e,t){t.deselect()});this.hideSubmitCards();return this},hideButtons:function(){this.log("hiding buttons");this.cancelButton.hide();this.closeButton.hide();this.nextButton.hide();this.backButton.hide();return this},showButtons:function(){this.log("showing buttons");if(this.args.showCancel){this.cancelButton.show()}if(this.args.showClose){this.closeButton.show()}this.nextButton.show();this.backButton.show();return this},getCard:function(t){var n=e(t).parents(".wizard-card").first()[0];if(n){var r=null;this.eachCard(function(e,t){if(n==t.el[0]){r=t;return false}return true});return r}else{return null}},_createCards:function(){var n=null;var r=null;var i=null;var s=this;var o=this;o.log("Creating Cards");var u=this.modal.find(".wizard-cards .wizard-card");e.each(u,function(u,a){a=e(a);n=i;i=new t(s,a,u,n,r);o._cards.push(i);if(i.name){o.cards[i.name]=i}if(n){n.next=i}o.modal.find(".wizard-steps .wizard-nav-list").append(i.nav)})},showSubmitCard:function(e){this.log("showing "+e+" submit card");var t=this.el.find(".wizard-"+e);if(t.length){this.hideCards();this.el.find(".wizard-"+e).show()}else{this.log("couldn't find submit card "+e)}},hideSubmitCard:function(e){this.log("hiding "+e+" submit card");this.el.find(".wizard-"+e).hide()},hideSubmitCards:function(){var t=this;e.each(["success","error","failure","loading"],function(e,n){t.hideSubmitCard(n)})},enableNextButton:function(){this.log("enabling next button");this.nextButton.removeAttr("disabled");return this},disableNextButton:function(){this.log("disabling next button");this.nextButton.attr("disabled","disabled");return this},serializeArray:function(){var t=this.form.serializeArray();this.form.find('input[disabled][data-serialize="1"]').each(function(){formObj={name:e(this).attr("name"),value:e(this).val()};t.push(formObj)});return t},serialize:function(){var t=this.form.serialize();this.form.find('input[disabled][data-serialize="1"]').each(function(){t=t+"&"+e(this).attr("name")+"="+e(this).val()});return t},find:function(e){return this.modal.find(e)},submitSuccess:function(){this.log("submit success");this._submitting=false;this.showSubmitCard("success");this.trigger("submitSuccess")},submitFailure:function(){this.log("submit failure");this._submitting=false;this.showSubmitCard("failure");this.trigger("submitFailure")},submitError:function(){this.log("submit error");this._submitting=false;this.showSubmitCard("error");this.trigger("submitError")},_submit:function(){this.log("submitting wizard");this._submitting=true;this.lockCards();this.cancelButton.hide();this.closeButton.hide();this.backButton.hide();this.showSubmitCard("loading");this.updateProgressBar(100);this.changeNextButton(this.args.buttons.submittingText,false);this.disableNextButton();var e=this.trigger("submit");this.trigger("loading")},_onNextClick:function(){this.log("handling 'next' button click");var e=this.getActiveCard();if(this._readyToSubmit&&e.validate()){this._submit()}else{e=this.incrementCard()}},_onBackClick:function(){this.log("handling 'back' button click");var e=this.decrementCard()},_handleNextClick:function(e){var t=e.data;t._onNextClick.call(t)},_handleBackClick:function(e){var t=e.data;t._onBackClick.call(t)},_defaultSubmit:function(t){e.ajax({type:"POST",url:t.args.submitUrl,data:t.serialize(),dataType:"json"}).done(function(e){t.submitSuccess();t.hideButtons();t.updateProgressBar(0)}).fail(function(){t.submitFailure();t.hideButtons()})}}})(window.jQuery)
+(function(e){e.fn.wizard=function(e){return new Wizard(this,e)};e.fn.wizard.logging=false;var t=function(e,t,n,r,i){this.wizard=e;this.index=n;this.prev=r;this.next=i;this.el=t;this.title=t.find("h3").first().text();this.name=t.data("cardname")||this.title;this.nav=this._createNavElement(this.title,n);this._disabled=false;this._loaded=false;this._events={}};t.prototype={select:function(){this.log("selecting");if(!this.isSelected()){this.nav.addClass("active");this.el.show();if(!this._loaded){this.trigger("loaded");this.reload()}this.trigger("selected")}var e=this.wizard;e.backButton.toggleClass("hidden",this.index==0);if(this.index>=e._cards.length-1){this.log("on last card, changing next button to submit");e.changeNextButton(e.args.buttons.submitText,"btn-success");e._readyToSubmit=true;e.trigger("readySubmit")}else{e._readyToSubmit=false;e.changeNextButton(e.args.buttons.nextText,"btn-primary")}return this},_createNavElement:function(t,n){var r=e('');var i=e('');i.data("navindex",n);r.append(i);i.append(' ');i.append(t);return r},markVisited:function(){this.log("marking as visited");this.nav.addClass("already-visited");this.trigger("markVisited");return this},unmarkVisited:function(){this.log("unmarking as visited");this.nav.removeClass("already-visited");this.trigger("unmarkVisited");return this},deselect:function(){this.nav.removeClass("active");this.el.hide();this.trigger("deselect");return this},enable:function(e){this.log("enabling");this.nav.removeClass("hide");if(e!==undefined){this.nav.addClass("active")}this._disabled=false;this.trigger("enabled");return this},disable:function(e){this.log("disabling");this._disabled=true;this.nav.removeClass("active already-visited");if(e){this.el.hide();this.nav.addClass("hide")}this.trigger("disabled");return this},isDisabled:function(){return this._disabled},alreadyVisited:function(){return this.nav.hasClass("already-visited")},isSelected:function(){return this.nav.hasClass("active")},reload:function(){this._loaded=true;this.trigger("reload");return this},on:function(){return this.wizard.on.apply(this,arguments)},trigger:function(){this.callListener("on"+arguments[0]);return this.wizard.trigger.apply(this,arguments)},toggleAlert:function(t,n){this.log("toggling alert to: "+n);n=typeof n=="undefined"?true:n;if(n){this.trigger("showAlert")}else{this.trigger("hideAlert")}var r;var i=this.el.children("h3").first().next("div.alert");if(i.length==0){if(!n){return this}this.log("couldn't find existing alert div, creating one");r=e("");r.addClass("alert");r.addClass("hide");r.insertAfter(this.el.find("h3").first())}else{this.log("found existing alert div");r=i.first()}if(n){if(t!=null){this.log("setting alert msg to",t);r.html(t)}r.show()}else{r.hide()}return this},callListener:function(e){e=e.toLowerCase();this.log("looking for listener "+e);var t=window[this.el.data(e)];if(t){this.log("calling listener "+e);var n=this.wizard;try{var r=t(this)}catch(i){this.log("exception calling listener "+e+": ",i)}}else{this.log("didn't find listener "+e)}},problem:function(e){this.nav.find("a").toggleClass("wizard-step-error",e)},validate:function(){var t=false;var n=this;this.el.find("[data-validate]").each(function(r,i){n.log("validating individiual inputs");i=e(i);var s=i.data("validate");if(!s){return}var o={status:true,title:"Error",msg:""};var u=window[s](i);e.extend(o,u);if(e("#btn-"+i.attr("id")).length===1){i=e("#btn-"+i.attr("id"))}if(!o.status){t=true;i.parents("div.form-group").toggleClass("has-error",true);if(e("#btn-"+i.attr("id")).length===1){i=e("#btn-"+i.attr("id"))}n.wizard.errorPopover(i,o.msg)}else{i.parents("div.form-group").toggleClass("has-error",false);if(e("#btn-"+i.attr("id")).length===1){i=e("#btn-"+i.attr("id"))}try{i.popover("destroy")}catch(a){i.popover("hide")}}});this.log("after validating inputs, failures is",t);var r=window[this.el.data("validate")];if(r){this.log("running html-embedded card validator");var i=r(this);if(typeof i=="undefined"||i==null){i=true}if(!i)t=true;this.log("after running html-embedded card validator, failures is",t)}this.log("running listener validator");var s=this.trigger("validate");if(typeof s=="undefined"||s==null){s=true}if(!s)t=true;this.log("after running listener validator, failures is",t);var o=!t;if(o){this.log("validated, calling listeners");this.trigger("validated")}else{this.log("invalid");this.trigger("invalid")}return o},log:function(){if(!window.console||!e.fn.wizard.logging){return}var t="card '"+this.name+"': ";var n=[t];n.push.apply(n,arguments);console.log.apply(console,n)},isActive:function(){return this.nav.hasClass("active")}};Wizard=function(t,n){this.wizard_template=['"];this.args={keyboard:true,backdrop:true,show:false,submitUrl:"",showCancel:false,showClose:true,progressBarCurrent:false,increaseHeight:0,contentHeight:300,contentWidth:580,buttons:{cancelText:"Cancel",nextText:"Next",backText:"Back",submitText:"Submit",submittingText:"Submitting..."},formClass:"form-horizontal"};e.extend(this.args,n||{});this._create(t)};Wizard.prototype={log:function(){if(!window.console||!e.fn.wizard.logging){return}var t="wizard "+this.el.id+": ";var n=[t];n.push.apply(n,arguments);console.log.apply(console,n)},_create:function(t){this.markup=e(t);this.title=this.markup.data("title");this.submitCards=this.markup.find(".wizard-error,.wizard-failure,.wizard-success,.wizard-loading");this.el=e(this.wizard_template.join("\n"));e("body").append(this.el);this.modal=this.el.modal({keyboard:this.args.keyboard,show:this.args.show,backdrop:this.args.backdrop});this.dimensions={contentHeight:this.args.contentHeight,contentWidth:this.args.contentWidth};this.dialog=this.modal.find(".wizard-dialog");this.content=this.modal.find(".wizard-content");this.header=this.modal.find(".wizard-header");this.body=this.modal.find(".wizard-body");this.wizardSteps=this.modal.find(".wizard-steps");this.wizardCards=this.modal.find(".wizard-cards");this.wizardCardContainer=this.modal.find(".wizard-card-container");this.wizardCardContainer.append(this.markup.find(".wizard-card")).append(this.submitCards);this.navContainer=this.modal.find(".wizard-nav-container");this.navList=this.modal.find(".wizard-nav-list");this.progressContainer=this.modal.find(".wizard-progress-container");this.progress=this.progressContainer.find(".progress-bar");this.closeButton=this.modal.find("button.wizard-close");this.cardsContainer=this.modal.find("wizard-cards-container");this.form=this.modal.find("form");this.footer=this.modal.find(".wizard-footer");this.cancelButton=this.footer.find(".wizard-cancel");this.backButton=this.footer.find(".wizard-back");this.nextButton=this.footer.find(".wizard-next");this._cards=[];this.cards={};this._readyToSubmit=false;this.percentComplete=0;this._submitting=false;this._events={};this._firstShow=true;this._createCards();this.nextButton.click(this,this._handleNextClick);this.backButton.click(this,this._handleBackClick);this.cancelButton.text(this.args.buttons.cancelText);this.backButton.text(this.args.buttons.backText);this.nextButton.text(this.args.buttons.nextText);this.form.addClass(this.args.formClass);this.popovers=[];var n=this;this.closeButton.click(function(){n.reset();n.close();n.trigger("closed")});this.wizardSteps.on("click","li.already-visited a.wizard-nav-link",this,function(t){var n=parseInt(e(t.target).data("navindex"));t.data.setCard(n)});if(this.title.length!=0){this.setTitle(this.title)}this.on("submit",this._defaultSubmit);this.autoDimensions()},autoDimensions:function(){this.modal.css("display","block");this.dimensions.header=this.header.outerHeight(true);this.dimensions.navigation=this.wizardSteps.outerHeight(true);if(this.dimensions.navigationt.index){var r=t;var i=false;while(r.index!=n.index){if(r.index!=t.index){r.prev.deselect();r.prev.markVisited();r.select()}if(!r.isDisabled()){i=r.validate()}else{i=true}if(!i){return r}r=r.next}r.prev.deselect();r.prev.markVisited()}t.deselect();t.markVisited()}n.select();if(this.args.progressBarCurrent){this.percentComplete=e*100/this._cards.length;this.updateProgressBar(this.percentComplete)}else{var s=this.percentComplete;this.percentComplete=e*100/this._cards.length;this.percentComplete=Math.max(s,this.percentComplete);this.updateProgressBar(this.percentComplete)}return n}else{this.log("couldn't find card "+e)}},updateProgressBar:function(e){this.log("updating progress to "+e+"%");this.progress.css({width:e+"%"});this.percentComplete=e;this.trigger("progressBar",e);if(e==100){this.log("progress is 100, animating progress bar");this.progressContainer.find(".progress").addClass("active")}else if(e==0){this.log("progress is 0, disabling animation");this.progressContainer.find(".progress").removeClass("active")}},getNextCard:function(){var e=this.getActiveCard();if(e)return e.next},lockCards:function(){this.log("locking nav cards");this.eachCard(function(e,t){t.unmarkVisited()});return this},disableCards:function(){this.log("disabling all nav cards");this.eachCard(function(e,t){t.disable()});return this},enableCards:function(){this.log("enabling all nav cards");this.eachCard(function(e,t){t.enable()});return this},hideCards:function(){this.log("hiding cards");this.eachCard(function(e,t){t.deselect()});this.hideSubmitCards();return this},hideButtons:function(){this.log("hiding buttons");this.cancelButton.hide();this.closeButton.hide();this.nextButton.hide();this.backButton.hide();return this},showButtons:function(){this.log("showing buttons");if(this.args.showCancel){this.cancelButton.show()}if(this.args.showClose){this.closeButton.show()}this.nextButton.show();this.backButton.show();return this},getCard:function(t){var n=e(t).parents(".wizard-card").first()[0];if(n){var r=null;this.eachCard(function(e,t){if(n==t.el[0]){r=t;return false}return true});return r}else{return null}},_createCards:function(){var n=null;var r=null;var i=null;var s=this;var o=this;o.log("Creating Cards");var u=this.modal.find(".wizard-cards .wizard-card");e.each(u,function(u,a){a=e(a);n=i;i=new t(s,a,u,n,r);o._cards.push(i);if(i.name){o.cards[i.name]=i}if(n){n.next=i}o.modal.find(".wizard-steps .wizard-nav-list").append(i.nav)})},showSubmitCard:function(e){this.log("showing "+e+" submit card");var t=this.el.find(".wizard-"+e);if(t.length){this.hideCards();this.el.find(".wizard-"+e).show()}else{this.log("couldn't find submit card "+e)}},hideSubmitCard:function(e){this.log("hiding "+e+" submit card");this.el.find(".wizard-"+e).hide()},hideSubmitCards:function(){var t=this;e.each(["success","error","failure","loading"],function(e,n){t.hideSubmitCard(n)})},enableNextButton:function(){this.log("enabling next button");this.nextButton.removeAttr("disabled");return this},disableNextButton:function(){this.log("disabling next button");this.nextButton.attr("disabled","disabled");return this},serializeArray:function(){var t=this.form.serializeArray();this.form.find('input[disabled][data-serialize="1"]').each(function(){formObj={name:e(this).attr("name"),value:e(this).val()};t.push(formObj)});return t},serialize:function(){var t=this.form.serialize();this.form.find('input[disabled][data-serialize="1"]').each(function(){t=t+"&"+e(this).attr("name")+"="+e(this).val()});return t},find:function(e){return this.modal.find(e)},submitSuccess:function(){this.log("submit success");this._submitting=false;this.showSubmitCard("success");this.trigger("submitSuccess")},submitFailure:function(){this.log("submit failure");this._submitting=false;this.showSubmitCard("failure");this.trigger("submitFailure")},submitError:function(){this.log("submit error");this._submitting=false;this.showSubmitCard("error");this.trigger("submitError")},_submit:function(){this.log("submitting wizard");this._submitting=true;this.lockCards();this.cancelButton.hide();this.closeButton.hide();this.backButton.hide();this.showSubmitCard("loading");this.updateProgressBar(100);this.changeNextButton(this.args.buttons.submittingText,false);this.disableNextButton();var e=this.trigger("submit");this.trigger("loading")},_onNextClick:function(){this.log("handling 'next' button click");var e=this.getActiveCard();if(this._readyToSubmit&&e.validate()){this._submit()}else{e=this.incrementCard()}},_onBackClick:function(){this.log("handling 'back' button click");var e=this.decrementCard()},_handleNextClick:function(e){var t=e.data;t._onNextClick.call(t)},_handleBackClick:function(e){var t=e.data;t._onBackClick.call(t)},_defaultSubmit:function(t){e.ajax({type:"POST",url:t.args.submitUrl,data:t.serialize(),dataType:"json"}).done(function(e){t.submitSuccess();t.hideButtons();t.updateProgressBar(0)}).fail(function(){t.submitFailure();t.hideButtons()})}}})(window.jQuery)