[FIX] Shop tour

bzr revid: ddm@openerp.com-20131211181410-rfy68dlqps8oldll
This commit is contained in:
ddm 2013-12-11 19:14:10 +01:00
parent 083e88167e
commit e84d9a7f85
2 changed files with 23 additions and 16 deletions

View File

@ -265,10 +265,6 @@
var test = {
id: tour.id,
run: function (force) {
var url = new website.UrlParser(window.location.href);
if (tour.startPath && url.pathname !== tour.startPath) {
throw new Error(tour.startPath);
}
if (force === true) {
this.reset();
}
@ -296,6 +292,7 @@
} else if (step.trigger.id === 'change') {
var currentValue = $element.val();
var options = $element[0].options;
// FIXME: It may be necessary to set a particular value
var newValue = _.find(options, function (option) {
return option.value !== currentValue;
}).value;
@ -304,14 +301,22 @@
$element.trigger($.Event("click", { srcElement: $element }));
}
}
var lastStepId = window.localStorage.getItem(testId);
var currentStep = actionSteps.shift();
if (lastStepId) {
while (currentStep && lastStepId !== currentStep.stepId) {
currentStep = actionSteps.shift();
var url = new website.UrlParser(window.location.href);
if (tour.startPath && url.pathname !== tour.startPath) {
window.localStorage.setItem(testId, actionSteps[0].stepId);
window.location.href = tour.startPath;
} else {
var lastStepId = window.localStorage.getItem(testId);
var currentStep = actionSteps.shift();
if (lastStepId) {
while (currentStep && lastStepId !== currentStep.stepId) {
currentStep = actionSteps.shift();
}
}
setTimeout(function () {
executeStep(currentStep);
}, 0);
}
executeStep(currentStep);
},
reset: function () {
window.localStorage.removeItem(testId);

View File

@ -109,11 +109,7 @@
placement: 'bottom',
title: "Describe the product for your audience",
content: "Insert blocks like text-image, or gallery to fully describe the product and make your visitors want to buy this product.",
trigger: {
emitter: editor,
type: 'openerp',
id: 'rte:ready',
},
trigger: 'click',
},
{
stepId: 'drag-big-picture',
@ -134,12 +130,18 @@
},
{
stepId: 'publish-product',
element: 'button.js_publish_btn',
element: '.js_publish_management button.js_publish_btn.btn-danger',
placement: 'top',
title: "Publish your product",
content: "Click to publish your product so your customers can see it.",
trigger: 'click',
},
{
stepId: 'congratulations',
title: "Congratulations",
content: "Congratulations! You just created and published your first product.",
template: self.popover({ end: "Ok" }),
},
];
return this._super();
},