summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorchm@openerp.com <>2014-04-24 14:47:03 +0200
committerchm@openerp.com <>2014-04-24 14:47:03 +0200
commit90d0139ae1eee3ccd92140090847cb26dcd2aaa2 (patch)
treeb9f1691668092bc9c23ec5e9b111d1d67efc7f47 /addons/website/static/src
parentee7ff4bd07d8d84ed2ebb0e2e3f5eb437f158e5b (diff)
[FIX] website tour: must retry running tour because in test mode some files are added after the first running try
bzr revid: chm@openerp.com-20140424124703-qeft3n8xjmb1mvxn
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.tour.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js
index 03b449479c4..2a661b4cc9b 100644
--- a/addons/website/static/src/js/website.tour.js
+++ b/addons/website/static/src/js/website.tour.js
@@ -87,6 +87,7 @@ var localStorage = window.localStorage;
var T = website.Tour = {
tours: {},
defaultDelay: 50,
+ retryRunningDelay: 1000,
errorDelay: 5000,
state: null,
$element: null,
@@ -129,6 +130,7 @@ var T = website.Tour = {
step.waitFor = '.oe_overlay_options .oe_options:visible';
}
+
var snippet = step.element && step.element.match(/#oe_snippets (.*) \.oe_snippet_thumbnail/);
if (snippet) {
step.snippet = snippet[1];
@@ -145,6 +147,7 @@ var T = website.Tour = {
if (tour.steps[index-1] &&
tour.steps[index-1].popover && tour.steps[index-1].popover.next) {
var step = {
+ _title: "",
id: index,
waitNot: '.popover.tour.fade.in:visible'
};
@@ -310,11 +313,11 @@ var T = website.Tour = {
console.log("Tour Begin from url hash");
T.saveState(state.id, state.mode, state.step_id);
}
- if (!state.id || !T.tours[state.id]) {
+ if (!state.id) {
return;
}
state.tour = T.tours[state.id];
- state.step = state.tour.steps[state.step_id === -1 ? 0 : state.step_id];
+ state.step = state.tour && state.tour.steps[state.step_id === -1 ? 0 : state.step_id];
return state;
},
error: function (step, message) {
@@ -353,14 +356,17 @@ var T = website.Tour = {
clearTimeout(T.testtimer);
T.closePopover();
},
- testRunning: 0,
running: function () {
function run () {
var state = T.getState();
- if (state) {
+ if (!state) return;
+ if (state.tour) {
console.log("Tour '"+state.id+"' is running");
T.registerSteps(state.tour);
T.nextStep();
+ } else {
+ console.log("Tour '"+state.id+"' wait for running (tour undefined)");
+ setTimeout(T.running, state.mode === "test" ? T.defaultDelay : T.retryRunningDelay);
}
}
setTimeout(function () {