[FIX] website tour: create a stub for bootstrap tour in automatic/test mode (need for full test and hide real bug for tour test)

bzr revid: chm@openerp.com-20140317083442-imylv9v5fafjxhwr
This commit is contained in:
chm@openerp.com 2014-03-17 09:34:42 +01:00
commit 89eb355069
1 changed files with 16 additions and 0 deletions

View File

@ -3,9 +3,22 @@
var website = openerp.website;
// don't need template to use bootstrap Tour in automatic mode
if (typeof QWeb2 !== "undefined")
website.add_template_file('/website/static/src/xml/website.tour.xml');
// don't need to use bootstrap Tour to launch an automatic tour
function bootstrap_tour_stub () {
if (typeof Tour === "undefined") {
window.Tour = function Tour() {};
Tour.prototype.addSteps = function () {};
Tour.prototype.end = function () {};
Tour.prototype.goto = function () {};
}
}
if (website.EditorBar)
website.EditorBar.include({
tours: [],
@ -175,6 +188,9 @@ website.Tour = openerp.Class.extend({
},
registerTour: function () {
if (this.automatic) {
bootstrap_tour_stub();
}
this.tour = new Tour({
name: this.id,
storage: this.tourStorage,