[IMP] Simplify tour declaration II

bzr revid: ddm@openerp.com-20131120110233-1hoc40q2wrs0739d
This commit is contained in:
ddm 2013-11-20 12:02:33 +01:00
parent 10e7a76ae4
commit e8858b02a6
6 changed files with 28 additions and 34 deletions

View File

@ -5,7 +5,14 @@
var render = website.tour.render;
website.EditorBannerTour = website.EditorTour.extend({
website.EditorBar.include({
start: function () {
this.registerTour(new website.AddBannerTour(this));
return this._super();
},
});
website.AddBannerTour = website.Tour.extend({
id: 'banner-tutorial',
name: "Insert a banner",
startPath: '/page/website.homepage',
@ -127,21 +134,8 @@
];
return this._super();
},
startOfPart2: function () {
var currentStepIndex = this.currentStepIndex();
var secondPartIndex = this.indexOfStep('part-2');
var showTutorialsIndex = this.indexOfStep('show-tutorials');
return (currentStepIndex === secondPartIndex || currentStepIndex === showTutorialsIndex) && !this.tour.ended();
},
continueTour: function () {
return this.startOfPart2() || this._super();
},
});
website.EditorBar.include({
start: function () {
this.registerTour(new website.EditorBannerTour(this));
return this._super();
return (this.isCurrentStep('part-2') || this.isCurrentStep('show-tutorials')) && !this.tour.ended();
},
});

View File

@ -5,7 +5,14 @@
var render = website.tour.render;
website.InstallAppTour = website.EditorTour.extend({
website.EditorBar.include({
start: function () {
this.registerTour(new website.InstallAppTour(this));
return this._super();
},
});
website.InstallAppTour = website.Tour.extend({
id: 'install-app',
name: "Install a new App",
init: function (editor) {
@ -47,11 +54,4 @@
},
});
website.EditorBar.include({
start: function () {
this.registerTour(new website.InstallAppTour(this));
return this._super();
},
});
}());

View File

@ -10,7 +10,7 @@
}
};
website.EditorTour = openerp.Class.extend({
website.Tour = openerp.Class.extend({
tour: undefined,
steps: [],
tourStorage: window.localStorage,

View File

@ -5,7 +5,14 @@
var render = website.tour.render;
website.EditorBuilderTour = website.EditorTour.extend({
website.EditorBar.include({
start: function () {
this.registerTour(new website.EditorBuilderTour(this));
return this._super();
},
});
website.EditorBuilderTour = website.Tour.extend({
id: 'menu-editor',
name: "Add a new page",
init: function (editor) {
@ -98,11 +105,4 @@
},
});
website.EditorBar.include({
start: function () {
this.registerTour(new website.EditorBuilderTour(this));
return this._super();
},
});
}());

View File

@ -12,7 +12,7 @@
},
});
website.BlogTour = website.EditorTour.extend({
website.BlogTour = website.Tour.extend({
id: 'blog-tutorial',
name: "Create a blog post",
startPath: '/blog/cat/1/',

View File

@ -12,7 +12,7 @@
},
});
website.EditorShopTour = website.EditorTour.extend({
website.EditorShopTour = website.Tour.extend({
id: 'shop-tutorial',
name: "Create a product",
startPath: '/shop',