[IMP] Shop tour scaffholding

bzr revid: ddm@openerp.com-20131114171736-090vctn8zr30ne8g
This commit is contained in:
ddm
2013-11-14 18:17:36 +01:00
parent bf5fcc7b13
commit a07adbfc5d
2 changed files with 54 additions and 0 deletions
@@ -0,0 +1,49 @@
(function () {
'use strict';
var website = openerp.website;
var render = website.tour.render;
website.EditorShopTour = website.EditorTour.extend({
id: 'shop_tour',
name: "Shop",
init: function (editor) {
var self = this;
var $body = $(document.body);
self.steps = [
{
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.",
template: render('website.tour_popover', { next: "Start Tutorial", end: "Skip It" }),
},
];
return this._super();
},
});
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);
return this._super();
},
});
}());
@@ -14,6 +14,11 @@
</a>
</li>
</xpath>
<xpath expr="//head" position="inside">
<t t-if="editable">
<script type="text/javascript" src="/website_sale/static/src/js/website.tour.shop.js"></script>
</t>
</xpath>
</template>
<!-- List of categories -->