[IMP] Shop tutorial continued

bzr revid: ddm@openerp.com-20131119122319-45fu90nooiwb7so7
This commit is contained in:
ddm
2013-11-19 13:23:19 +01:00
parent 3951af2ab5
commit 1ec2cb9331
6 changed files with 61 additions and 26 deletions
@@ -6,9 +6,9 @@
var render = website.tour.render;
website.EditorBannerTour = website.EditorTour.extend({
id: 'add_banner_tour',
id: 'banner-tutorial',
name: "Insert a banner",
urlTrigger: '?banner-tutorial=true',
startPath: '/page/website.homepage',
init: function (editor) {
var self = this;
var $body = $(document.body);
@@ -134,17 +134,8 @@
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({
@@ -6,7 +6,7 @@
var render = website.tour.render;
website.InstallAppTour = website.EditorTour.extend({
id: 'install_app',
id: 'install-app',
name: "Install a new App",
init: function (editor) {
var self = this;
+10 -5
View File
@@ -53,7 +53,7 @@
}
},
canResume: function () {
return (this.currentStepIndex() === 0) && !this.tour.ended();
return this.continueTour() || ((this.currentStepIndex() === 0) && !this.tour.ended());
},
currentStepIndex: function () {
var index = this.tourStorage.getItem(this.id+'_current_step') || 0;
@@ -84,10 +84,14 @@
},
continueTour: function () {
// Override if necessary
return true;
return this.currentStepIndex() === 0;
},
redirect: function () {
// Override if necessary
redirect: function (url) {
url = url || new website.UrlParser(window.location.href);
if (this.startPath && url.pathname !== this.startPath) {
var newUrl = this.startPath + (url.search ? (url.search + "&") : "?") + this.id + "=true"
window.location.replace(newUrl);
}
},
});
@@ -123,7 +127,8 @@
tour.start();
});
menu.append($menuItem);
if (tour.urlTrigger && (url.search.indexOf(tour.urlTrigger) === 0 || tour.continueTour())) {
var urlTrigger = tour.id + "=true";
if (url.search.indexOf(urlTrigger) >= 0) {
tour.start();
}
});
@@ -6,7 +6,7 @@
var render = website.tour.render;
website.EditorBuilderTour = website.EditorTour.extend({
id: 'menu_editor',
id: 'menu-editor',
name: "Add a new page",
init: function (editor) {
var self = this;
@@ -6,9 +6,9 @@
var render = website.tour.render;
website.EditorShopTour = website.EditorTour.extend({
id: 'shop_tour',
id: 'shop-tutorial',
name: "Create a product",
urlTrigger: '?shop-tutorial=true',
startPath: '/shop',
init: function (editor) {
var self = this;
var $body = $(document.body);
@@ -30,14 +30,53 @@
content: "Click here to add a new product.",
template: render('website.tour_popover'),
},
{
stepId: 'edit-entry',
element: '#create-new-product',
placement: 'left',
title: "Create a new product",
content: "Select 'New Product' to create it and manage its properties to boost your sales.",
template: render('website.tour_popover'),
onShow: function () {
editor.on('tour:menu_editor_dialog_ready', editor, function () {
self.movetoStep('add-menu-entry');
});
},
},
{
stepId: 'product-page',
orphan: true,
backdrop: true,
title: "New product created",
content: "This page contains all the information related to the new product.",
template: render('website.tour_popover', { next: "OK" }),
},
{
stepId: 'edit-price',
element: '.product_price',
placement: 'left',
title: "Change the public price",
content: "Edit the sale price of this product by clicking on the amount. The price is the sale price used in all sale order when selling this product.",
template: render('website.tour_popover', { next: "OK" }),
},
{
stepId: 'add-block',
element: 'button[data-action=snippet]',
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.",
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');
}
productPage: function () {
var currentStepIndex = this.currentStepIndex();
var productPageIndex = this.indexOfStep('product-page');
return (currentStepIndex === productPageIndex) && !this.tour.ended();
},
continueTour: function () {
return this.productPage();
},
});
@@ -1,7 +1,7 @@
<templates id="template" xml:space="preserve">
<t t-extend="website.editorbar">
<t t-jquery="ul.oe_content_menu" t-operation="append">
<li><a href="#" data-action="new_product">New Product</a></li>
<li><a id="create-new-product href="#" data-action="new_product">New Product</a></li>
</t>
</t>
</templates>