website.EditorBannerTour = website.EditorTour.extend({
id: 'add_banner_tour',
name: "Insert a banner",
+ urlTrigger: '?banner-tutorial=true',
init: function (editor) {
var self = this;
var $body = $(document.body);
var showTutorialsIndex = this.indexOfStep('show-tutorials');
return (currentStepIndex === secondPartIndex || currentStepIndex === showTutorialsIndex) && !this.tour.ended();
},
+ continueTour: function () {
+ return this.startOfPart2();
+ },
canResume: function () {
return this.startOfPart2() || this._super();
},
+ redirect: function (url) {
+ url = url || new website.UrlParser(window.location.href);
+ if (url.pathname !== '/' && url.pathname !== '/page/website.homepage') {
+ window.location.replace('/page/website.homepage?banner-tutorial=true');
+ }
+ },
});
website.EditorBar.include({
start: function () {
- var menu = $('#help-menu');
- var bannerTour = new website.EditorBannerTour(this);
- var $menuItem = $($.parseHTML('<li><a href="#">'+bannerTour.name+'</a></li>'));
- $menuItem.click(function () {
- if (url.pathname !== '/' && url.pathname !== '/page/website.homepage') {
- window.location.replace('/page/website.homepage?banner-tutorial=true');
- }
- bannerTour.reset();
- bannerTour.start();
- });
- menu.append($menuItem);
- var url = new website.UrlParser(window.location.href);
- if (url.search.indexOf('?banner-tutorial=true') === 0 || bannerTour.startOfPart2()) {
- bannerTour.start();
- }
+ this.registerTour(new website.EditorBannerTour(this));
return this._super();
},
});
website.EditorBar.include({
start: function () {
- var menu = $('#help-menu');
- var installAppTour = new website.InstallAppTour(this);
- var $menuItem = $($.parseHTML('<li><a href="#">'+installAppTour.name+'</a></li>'));
- $menuItem.click(function () {
- installAppTour.reset();
- installAppTour.start();
- });
- menu.append($menuItem);
+ this.registerTour(new website.InstallAppTour(this));
return this._super();
},
});
stop: function () {
this.tour.end();
},
+ continueTour: function () {
+ // Override if necessary
+ return true;
+ },
+ redirect: function () {
+ // Override if necessary
+ },
});
website.UrlParser = openerp.Class.extend({
});
website.EditorBar.include({
+ tours: [],
start: function () {
$('.tour-backdrop').click(function (e) {
e.stopImmediatePropagation();
e.preventDefault();
});
+ var url = new website.UrlParser(window.location.href);
+ var menu = $('#help-menu');
+ _.each(this.tours, function (tour) {
+ var $menuItem = $($.parseHTML('<li><a href="#">'+tour.name+'</a></li>'));
+ $menuItem.click(function () {
+ tour.redirect(url);
+ tour.reset();
+ tour.start();
+ });
+ menu.append($menuItem);
+ if (tour.urlTrigger && (url.search.indexOf(tour.urlTrigger) === 0 || tour.continueTour())) {
+ tour.start();
+ }
+ });
return this._super();
},
+ registerTour: function (tour) {
+ this.tours.push(tour);
+ },
});
}());
website.EditorBar.include({
start: function () {
- var menu = $('#help-menu');
- var builderTour = new website.EditorBuilderTour(this);
- var $menuItem = $($.parseHTML('<li><a href="#">'+builderTour.name+'</a></li>'));
- $menuItem.click(function () {
- builderTour.reset();
- builderTour.start();
- });
- menu.append($menuItem);
+ this.registerTour(new website.EditorBuilderTour(this));
return this._super();
},
});
website.EditorShopTour = website.EditorTour.extend({
id: 'shop_tour',
name: "Create a product",
+ urlTrigger: '?shop-tutorial=true',
init: function (editor) {
var self = this;
var $body = $(document.body);
stepId: 'welcome-shop',
orphan: true,
backdrop: true,
- title: "e-commerce",
- content: "Welcome to the e-commerce. This tutorial will help you to create a product.",
+ title: "Welcome to your shop",
+ content: "You successfully installed the e-commerce. This guide will help you to create your product and promote your sales.",
template: render('website.tour_popover', { next: "Start Tutorial", end: "Skip It" }),
},
+ {
+ stepId: 'content-menu',
+ element: '#content-menu-button',
+ placement: 'left',
+ reflex: true,
+ title: "Create your first product",
+ content: "Click here to add a new product.",
+ template: render('website.tour_popover'),
+ },
];
return this._super();
},
+ redirect: function (url) {
+ url = url || new website.UrlParser(window.location.href);
+ if (url.pathname !== '/shop') {
+ window.location.replace('/shop?shop-tutorial=true');
+ }
+ },
});
website.EditorBar.include({
start: function () {
- var menu = $('#help-menu');
- var shopTour = new website.EditorShopTour(this);
- var $menuItem = $($.parseHTML('<li><a href="#">'+shopTour.name+'</a></li>'));
- var url = new website.UrlParser(window.location.href);
- $menuItem.click(function () {
- shopTour.reset();
- shopTour.start();
- if (url.pathname !== '/shop') {
- window.location.replace('/shop?shop-tutorial=true');
- }
- });
- if (url.search.indexOf('?shop-tutorial=true') === 0) {
- shopTour.start();
- }
- menu.append($menuItem);
+ this.registerTour(new website.EditorShopTour(this));
return this._super();
},
});