summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2014-06-19 17:14:37 +0200
committerChristophe Matthieu <chm@odoo.com>2014-06-19 17:14:37 +0200
commit148a332b4a4ad30a42b21da617f5fbc0fa0725d2 (patch)
tree12dbfd8278732a18c76d5f2cb8e8a557d8dddf63 /addons/web/static/src
parent14e29ce321afa6967892c1a93f39c6caab5081d7 (diff)
[FIX] tour.js: don't throw error in tutorial mode; error with multi ajax request (change page, data...)
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/tour.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/addons/web/static/src/js/tour.js b/addons/web/static/src/js/tour.js
index 14908e56f5e..ba9f71a9a35 100644
--- a/addons/web/static/src/js/tour.js
+++ b/addons/web/static/src/js/tour.js
@@ -77,7 +77,7 @@ var Tour = {
}
this.time = new Date().getTime();
if (tour.path && !window.location.href.match(new RegExp("("+Tour.getLang()+")?"+tour.path+"#?$", "i"))) {
- var href = "/"+Tour.getLang()+tour.path;
+ var href = Tour.getLang()+tour.path;
console.log("Tour Begin from run method (redirection to "+href+")");
Tour.saveState(tour.id, mode || tour.mode, -1, 0);
window.location.href = href;
@@ -87,7 +87,7 @@ var Tour = {
Tour.running();
}
},
- registerSteps: function (tour) {
+ registerSteps: function (tour, mode) {
if (tour.register) {
return;
}
@@ -130,7 +130,7 @@ var Tour = {
}
// rendering bootstrap tour and popover
- if (tour.mode !== "test") {
+ if (mode !== "test") {
for (var index=0, len=tour.steps.length; index<len; index++) {
var step = tour.steps[index];
step._title = step._title || step.title;
@@ -287,7 +287,7 @@ var Tour = {
return typeof QWeb2 !== "undefined" ? openerp.qweb.render('tour.popover', options) : options.title;
},
getLang: function () {
- return $("html").attr("lang").replace(/-/, '_');
+ return $("html").attr("lang") ? "/" + $("html").attr("lang").replace(/-/, '_') : "";
},
getState: function () {
var state = JSON.parse(localStorage.getItem("tour") || 'false') || {};
@@ -322,7 +322,9 @@ var Tour = {
+ "\n localStorage: " + JSON.stringify(localStorage)
+ '\n\n' + $("body").html();
Tour.reset();
- throw new Error(message);
+ if (state.mode === "test") {
+ throw new Error(message);
+ }
},
lists: function () {
var tour_ids = [];
@@ -357,20 +359,21 @@ var Tour = {
function run () {
var state = Tour.getState();
if (!state) return;
- if (!Tour._load_template) {
- Tour.load_template().then(Tour.running);
- }
else if (state.tour) {
+ if (!Tour._load_template) {
+ Tour.load_template().then(run);
+ return;
+ }
console.log("Tour '"+state.id+"' is running");
- Tour.registerSteps(state.tour);
+ Tour.registerSteps(state.tour, state.mode);
Tour.nextStep();
} else {
- if (state.wait >= 10) {
+ if (state.mode === "test" && state.wait >= 10) {
Tour.error(state.step, "Tour '"+state.id+"' undefined");
}
Tour.saveState(state.id, state.mode, state.step_id, state.number-1, state.wait+1);
console.log("Tour '"+state.id+"' wait for running (tour undefined)");
- setTimeout(Tour.running, state.mode === "test" ? Tour.defaultDelay : Tour.retryRunningDelay);
+ setTimeout(run, state.mode === "test" ? Tour.defaultDelay : Tour.retryRunningDelay);
}
}
setTimeout(function () {