[FIX] website tour: test mode + add log
bzr revid: chm@openerp.com-20140415153734-5n2sz3xn01ydfeh6
This commit is contained in:
parent
a001e9c4bc
commit
9c0526b1bd
|
@ -98,15 +98,15 @@ var T = website.Tour = {
|
||||||
T.tours[tour.id] = tour;
|
T.tours[tour.id] = tour;
|
||||||
},
|
},
|
||||||
run: function (tour_id, mode) {
|
run: function (tour_id, mode) {
|
||||||
if (localStorage.getItem("tour") && mode === "test") { // only one test running
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var tour = T.tours[tour_id];
|
var tour = T.tours[tour_id];
|
||||||
this.time = new Date().getTime();
|
this.time = new Date().getTime();
|
||||||
if (tour.path && !window.location.href.match(new RegExp("("+T.getLang()+")?"+tour.path+"#?$", "i"))) {
|
if (tour.path && !window.location.href.match(new RegExp("("+T.getLang()+")?"+tour.path+"#?$", "i"))) {
|
||||||
|
var href = "/"+T.getLang()+tour.path;
|
||||||
|
console.log("Tour Begin from run method (redirection to "+href+")");
|
||||||
T.saveState(tour.id, mode || tour.mode, -1);
|
T.saveState(tour.id, mode || tour.mode, -1);
|
||||||
window.location.href = "/"+T.getLang()+tour.path;
|
window.location.href = href;
|
||||||
} else {
|
} else {
|
||||||
|
console.log("Tour Begin from run method");
|
||||||
T.saveState(tour.id, mode || tour.mode, 0);
|
T.saveState(tour.id, mode || tour.mode, 0);
|
||||||
T.running();
|
T.running();
|
||||||
}
|
}
|
||||||
|
@ -307,6 +307,7 @@ var T = website.Tour = {
|
||||||
"step_id": 0
|
"step_id": 0
|
||||||
};
|
};
|
||||||
window.location.hash = "";
|
window.location.hash = "";
|
||||||
|
console.log("Tour Begin from url hash");
|
||||||
T.saveState(state.id, state.mode, state.step_id);
|
T.saveState(state.id, state.mode, state.step_id);
|
||||||
}
|
}
|
||||||
if (!state.id || !T.tours[state.id]) {
|
if (!state.id || !T.tours[state.id]) {
|
||||||
|
@ -357,6 +358,7 @@ var T = website.Tour = {
|
||||||
function run () {
|
function run () {
|
||||||
var state = T.getState();
|
var state = T.getState();
|
||||||
if (state) {
|
if (state) {
|
||||||
|
console.log("Tour '"+state.id+"' is running");
|
||||||
T.registerSteps(state.tour);
|
T.registerSteps(state.tour);
|
||||||
T.nextStep();
|
T.nextStep();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue