Skip to content

Commit

Permalink
make sure plugin doesn't mess up other markup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndp committed Apr 8, 2010
1 parent 65102cf commit c463297
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 136 deletions.
8 changes: 4 additions & 4 deletions public/javascripts/jquery/jquery.wizardize.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ $.fn.wizardize = function(options) {
var $fieldsets = $('fieldset', $context);

// Build the status buttons
var $statusButtonArea = $('<ol />').prependTo($context);
var titles = $fieldsets.map(function(n) {
var title = (config.statusButtonsTemplate) ?
config.statusButtonsTemplate.replace(/\$#/, n + 1).replace(/\$TITLE/, this.title) :
config.statusButtonTemplateFunction(n + 1, this.title);
return "<li>" + title + "</li>";
});
titles = $.makeArray(titles).join(config.statusButtonsSpacer ? '<li class="wzdr_spacer">' + config.statusButtonsSpacer + '</li>' : '');
var $statusButtonArea = $('<ol />').prependTo($context);
$statusButtonArea.html(titles);
$statusButtonArea.find('li:first').addClass('active');

Expand Down Expand Up @@ -167,9 +167,9 @@ $.fn.wizardize.next = function(e) {

$.fn.wizardizeMarkFieldsetAsComplete = function(index) {
$("li:not(.wzdr_spacer):nth(" + (index + 1) + ")", this).addClass("enabled");
$("fieldset:nth(" + (index + 1) + ")", $(this)).removeClass("disabled").addClass("enabled");
$("li:not(.wzdr_spacer):nth(" + index + ")", $(this)).addClass("enabled").addClass('complete');
$("fieldset:nth(" + index + ")", $(this)).addClass("complete");
$("fieldset:nth(" + (index + 1) + ")", this).removeClass("disabled").addClass("enabled");
$("li:not(.wzdr_spacer):nth(" + index + ")", this).addClass("enabled").addClass('complete');
$("fieldset:nth(" + index + ")", this).addClass("complete");
return this;
};

Expand Down
10 changes: 9 additions & 1 deletion spec/javascripts/fixtures/wizardize.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

<body>
<div id="fixture">
<form>
<form id="main">
<fieldset title="Row">
<label>Where do you want to be?</label>
<input type="text" />
Expand All @@ -88,6 +88,14 @@
</fieldset>
<input type="submit" value="Submit Me"/>
</form>
<form id="control">
<fieldset title="a">
<input type="text" />
</fieldset>
<fieldset title="b">
<input type="text" />
</fieldset>
</form>
</div>
</body>
</html>
Loading

0 comments on commit c463297

Please sign in to comment.