Skip to content

Instantly share code, notes, and snippets.

@marti1125
Created February 26, 2013 21:59
Show Gist options
  • Save marti1125/5042649 to your computer and use it in GitHub Desktop.
Save marti1125/5042649 to your computer and use it in GitHub Desktop.
add buttons.
if (this.index >= w._cards.length-1) {
this.log("on last card, changing next button to submit");
w.changeNextButton(w.args.buttons.submitText, "btn-success");
w.saveAndContinueButton.removeClass("hide");
w.saveAndAddAnotherButton.removeClass("hide");
w._readyToSubmit = true;
w.trigger("readySubmit");
}
else {
w._readyToSubmit = false;
if (this.index == 0) {
w.backButton.toggleClass("disabled", true);
}
else {
w.backButton.toggleClass("disabled", false);
}
w.changeNextButton(w.args.buttons.nextText, "btn-primary");
w.saveAndContinueButton.addClass("hide");
w.saveAndAddAnotherButton.addClass("hide");
}
var wizard_template = [
'<div class="modal hide wizard-modal" role="dialog">',
'<div class="wizard-modal-header modal-header">',
'<button class="wizard-close close" type="button">x</button>',
'<h3 class="wizard-title"></h3>',
'<span class="wizard-subtitle"></span>',
'</div>',
'<div class="pull-left wizard-steps">',
'<div class="wizard-nav-container">',
'<ul class="nav nav-list" style="padding-bottom:30px;">',
'</ul>',
'</div>',
'<div class="wizard-progress-container">',,
'<div class="progress progress-striped">',
'<div class="bar"></div>',
'</div>',
'</div>',
'</div>',
'<form>',
'<div class="wizard-cards">',
'<div class="wizard-card-container">',
'</div>',
'<div class="wizard-modal-footer">',
'<div class="wizard-buttons-container">',
'<button class="btn wizard-back" type="button">Back</button>',
'<button class="btn btn-primary wizard-next" type="button">Next</button>',
'<button class="btn btn-primary wizard-saveAndContinue hide" type="button">Save and Continue</button>',
'<button class="btn btn-primary wizard-saveAndAddAnother hide" type="button">Save and Add Another</button>',
'</div>',
'</div>',
'</div>',
'</form>',
'</div>'
];
this.args = {
submitUrl: "",
width: 750,
progressBarCurrent: false,
increaseHeight: 0,
buttons: {
nextText: "Next",
backText: "Back",
submitText: "Submit",
submittingText: "Submitting...",
saveAndContinue: "Save and Continue",
saveAndAddAnother: "Save and Add Another"
}
};
this.closeButton = this.el.find("button.wizard-close");
this.footer = this.el.find(".wizard-modal-footer");
this.backButton = this.footer.find(".wizard-back");
this.nextButton = this.footer.find(".wizard-next");
this.saveAndContinueButton = this.footer.find(".wizard-saveAndContinue");
this.saveAndAddAnotherButton = this.footer.find(".wizard-saveAndAddAnother");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment