Skip to content

Commit

Permalink
integrate skip to correct step, updated version in source
Browse files Browse the repository at this point in the history
  • Loading branch information
LostCrew committed Sep 1, 2013
1 parent aca2f52 commit 920a4b8
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 30 deletions.
17 changes: 9 additions & 8 deletions build/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ===========================================================
# bootstrap-tour - v0.5.1
# bootstrap-tour - v0.6.0
# http://bootstraptour.com
# ==============================================================
# Copyright 2012-2013 Ulrich Sossou
Expand Down Expand Up @@ -226,12 +226,13 @@
};

Tour.prototype.showStep = function(i) {
var promise, showStepHelper, step,
var promise, showStepHelper, skipToPrevious, step,
_this = this;
step = this.getStep(i);
if (!step) {
return;
}
skipToPrevious = i < this._current;
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
showStepHelper = function(e) {
var current_path, path;
Expand All @@ -245,7 +246,11 @@
if (_this._isOrphan(step)) {
if (!step.orphan) {
_this._debug("Skip the orphan step " + (_this._current + 1) + ". Orphan option is false and the element doesn't exist or is hidden.");
_this._showNextStep();
if (skipToPrevious) {
_this._showPrevStep();
} else {
_this._showNextStep();
}
return;
}
_this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true.");
Expand All @@ -268,11 +273,7 @@
return this.setState("current_step", value);
} else {
this._current = this.getState("current_step");
if (this._current === null) {
return this._current = 0;
} else {
return this._current = parseInt(this._current);
}
return this._current = this._current === null ? 0 : parseInt(this._current, 10);
}
};

Expand Down
4 changes: 2 additions & 2 deletions build/js/bootstrap-tour.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-tour",
"version": "0.5.1",
"version": "0.6.0",
"main": ["./build/js/bootstrap-tour.js", "./build/css/bootstrap-tour.css"],
"dependencies": {
"bootstrap": "3.0.0",
Expand Down
17 changes: 9 additions & 8 deletions docs/assets/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ===========================================================
# bootstrap-tour - v0.5.1
# bootstrap-tour - v0.6.0
# http://bootstraptour.com
# ==============================================================
# Copyright 2012-2013 Ulrich Sossou
Expand Down Expand Up @@ -226,12 +226,13 @@
};

Tour.prototype.showStep = function(i) {
var promise, showStepHelper, step,
var promise, showStepHelper, skipToPrevious, step,
_this = this;
step = this.getStep(i);
if (!step) {
return;
}
skipToPrevious = i < this._current;
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
showStepHelper = function(e) {
var current_path, path;
Expand All @@ -245,7 +246,11 @@
if (_this._isOrphan(step)) {
if (!step.orphan) {
_this._debug("Skip the orphan step " + (_this._current + 1) + ". Orphan option is false and the element doesn't exist or is hidden.");
_this._showNextStep();
if (skipToPrevious) {
_this._showPrevStep();
} else {
_this._showNextStep();
}
return;
}
_this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true.");
Expand All @@ -268,11 +273,7 @@
return this.setState("current_step", value);
} else {
this._current = this.getState("current_step");
if (this._current === null) {
return this._current = 0;
} else {
return this._current = parseInt(this._current);
}
return this._current = this._current === null ? 0 : parseInt(this._current, 10);
}
};

Expand Down
4 changes: 2 additions & 2 deletions docs/assets/js/bootstrap-tour.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
});
tour.addSteps([
{
element: "#download",
placement: "bottom",
title: "Welcome to Bootstrap Tour!",
content: "Introduce new users to your product by walking them through it step by step. Built" + "on the awesome <a href='http://twitter.github.com/bootstrap' target='_blank'>Bootstrap " + "from Twitter.</a>"
}, {
element: "#usage",
placement: "top",
title: "Setup in four easy steps",
content: "Easy is better, right? Easy like Bootstrap."
Expand Down
2 changes: 2 additions & 0 deletions docs/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ $ ->
)

tour.addSteps [
element: "#download"
placement: "bottom"
title: "Welcome to Bootstrap Tour!"
content: "Introduce new users to your product by walking them through it step by step. Built" +
"on the awesome <a href='http://twitter.github.com/bootstrap' target='_blank'>Bootstrap " +
"from Twitter.</a>"
,
element: "#usage"
placement: "top"
title: "Setup in four easy steps"
content: "Easy is better, right? Easy like Bootstrap."
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h1 id="reflex">Bootstrap Tour</h1>
<a href="#demo">Demo</a>
</li>
<li>
Version 0.5.1
Version 0.6.0
</li>
<li>
Bootstrap version <= 3.0.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bootstrap-tour",
"description": "Quick and easy way to build your product tours with Twitter Bootstrap Popovers.",
"version": "0.5.1",
"version": "0.6.0",
"keywords": [
"tour",
"bootstrap",
Expand Down
13 changes: 6 additions & 7 deletions src/coffee/bootstrap-tour.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
hideStep: (i) ->
step = @getStep(i)

# If onHide returns a promise, lets wait until it's done to execute
# If onHide returns a promise, let's wait until it's done to execute
promise = @_makePromise(step.onHide(@, i) if step.onHide?)

hideStepHelper = (e) =>
Expand All @@ -203,7 +203,9 @@
step = @getStep(i)
return unless step

# If onShow returns a promise, lets wait until it's done to execute
skipToPrevious = i < @_current

# If onShow returns a promise, let's wait until it's done to execute
promise = @_makePromise(step.onShow(@, i) if step.onShow?)

showStepHelper = (e) =>
Expand All @@ -222,7 +224,7 @@
if @_isOrphan(step)
if ( ! step.orphan)
@_debug "Skip the orphan step #{@_current + 1}. Orphan option is false and the element doesn't exist or is hidden."
@_showNextStep()
if skipToPrevious then @_showPrevStep() else @_showNextStep()
return

@_debug "Show the orphan step #{@_current + 1}. Orphans option is true."
Expand All @@ -243,10 +245,7 @@
@setState("current_step", value)
else
@_current = @getState("current_step")
if @_current == null
@_current = 0
else
@_current = parseInt(@_current)
@_current = if @_current == null then 0 else parseInt(@_current, 10)

# Show next step
_showNextStep: ->
Expand Down

0 comments on commit 920a4b8

Please sign in to comment.