5a4d0c0493922a8825f9510a550bfaa527901773
[odoo/odoo.git] / addons / website_sale / static / src / js / website.tour.shop.js
1 (function () {
2     'use strict';
3
4     var website = openerp.website;
5
6     website.EditorBar.include({
7         start: function () {
8             this.registerTour(new website.EditorShopTour(this));
9             return this._super();
10         },
11     });
12
13     website.EditorShopTour = website.Tour.extend({
14         id: 'shop',
15         name: "Create a product",
16         init: function (editor) {
17             var self = this;
18             self.steps = [
19                 {
20                     stepId: 'welcome-shop',
21                     title: "Welcome to your shop",
22                     content: "You successfully installed the e-commerce. This guide will help you to create your product and promote your sales.",
23                     template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
24                     backdrop: true,
25                 },
26                 {
27                     stepId: 'content-menu',
28                     element: '#content-menu-button',
29                     placement: 'left',
30                     title: "Create your first product",
31                     content: "Click here to add a new product.",
32                     trigger: 'click',
33                 },
34                 {
35                     stepId: 'edit-entry',
36                     element: '#create-new-product',
37                     placement: 'left',
38                     title: "Create a new product",
39                     content: "Select 'New Product' to create it and manage its properties to boost your sales.",
40                     trigger: {
41                         modal: {
42                             stopOnClose: true,
43                             afterSubmit: 'product-page',
44                         },
45                     },
46                 },
47                 {
48                     stepId: 'enter-name',
49                     element: '.modal input[type=text]',
50                     placement: 'right',
51                     title: "Choose name",
52                     content: "Enter a name for your new product then click 'Continue'.",
53                 },
54                 {
55                     stepId: 'product-page',
56                     title: "New product created",
57                     content: "This page contains all the information related to the new product.",
58                     template: self.popover({ next: "OK" }),
59                     backdrop: true,
60                 },
61                 {
62                     stepId: 'edit-price',
63                     element: '.product_price',
64                     placement: 'left',
65                     title: "Change the public price",
66                     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.",
67                     template: self.popover({ next: "OK" }),
68                 },
69                 {
70                     stepId: 'update-image',
71                     element: '#wrap img.img:first',
72                     placement: 'top',
73                     title: "Update image",
74                     content: "Click here to set an image describing your product.",
75                     triggers: function () {
76                         function registerClick () {
77                             $('button.hover-edition-button').one('click', function () {
78                                 $('#wrap img.img:first').off('hover', registerClick);
79                                 self.moveToNextStep();
80                             });
81                         }
82                         $('#wrap img.img:first').on('hover', registerClick);
83
84                     },
85                 },
86                 {
87                     stepId: 'upload-image',
88                     element: 'button.filepicker',
89                     placement: 'left',
90                     title: "Upload image",
91                     content: "Click on 'Upload an image from your computer' to pick an image describing your product.",
92                     template: self.popover({ next: "OK" }),
93                     triggers: function () {
94                         $(document).on('hide.bs.modal', function () {
95                             self.moveToStep('add-block');
96                         });
97                     }
98                 },
99                 {
100                     stepId: 'save-image',
101                     element: 'button.save',
102                     placement: 'right',
103                     title: "Save the image",
104                     content: "Click 'Save Changes' to add the image to the product decsription.",
105                 },
106                 {
107                     stepId: 'add-block',
108                     element: 'button[data-action=snippet]',
109                     placement: 'bottom',
110                     title: "Describe the product for your audience",
111                     content: "Insert blocks like text-image, or gallery to fully describe the product and make your visitors want to buy this product.",
112                     trigger: 'click',
113                 },
114                 {
115                     stepId: 'drag-big-picture',
116                     snippet: 'big-picture',
117                     placement: 'bottom',
118                     title: "Drag & Drop a block",
119                     content: "Drag the 'Big Picture' block and drop it in your page.",
120                     trigger: 'drag',
121                 },
122                 {
123                     stepId: 'save-changes',
124                     element: 'button[data-action=save]',
125                     placement: 'right',
126                     title: "Save your modifications",
127                     content: "Once you click on save, your product is updated.",
128                     trigger: 'click',
129
130                 },
131                 {
132                     stepId: 'publish-product',
133                     element: 'button.js_publish_btn',
134                     placement: 'top',
135                     title: "Publish your product",
136                     content: "Click to publish your product so your customers can see it.",
137                     trigger: 'click',
138                 },
139             ];
140             return this._super();
141         },
142         trigger: function () {
143             return (this.resume() && this.testUrl(/^\/shop\/product\/[0-9]+\//)) || this._super();
144         },
145     });
146
147 }());