[IMP] website editor: better rendering of the popover when failure write raise by...
[odoo/odoo.git] / addons / website / static / src / js / website.tour.menu-editor.js
1 (function () {
2     'use strict';
3
4     var website = openerp.website;
5
6     var render = website.tour.render;
7
8     website.EditorBuilderTour = website.EditorTour.extend({
9         id: 'menu-editor',
10         name: "Add a new page",
11         init: function (editor) {
12             var self = this;
13             var $body = $(document.body);
14             self.steps = [
15                 {
16                     stepId: 'welcome-menu-editor',
17                     orphan: true,
18                     backdrop: true,
19                     title: "Menu editor",
20                     content: "We will show how to edit your website's menu.",
21                     template: render('website.tour_popover', { next: "Start Tutorial", end: "Skip It" }),
22                 },
23                 {
24                     stepId: 'content-menu',
25                     element: '#content-menu-button',
26                     placement: 'left',
27                     reflex: true,
28                     title: "Edit the content",
29                     content: "Click here to edit the menu.",
30                     template: render('website.tour_popover'),
31                 },
32                 {
33                     stepId: 'edit-entry',
34                     element: 'a[data-action=edit-structure]',
35                     placement: 'left',
36                     title: "Edit menu",
37                     content: "Click here to create a new menu entry and manage options.",
38                     template: render('website.tour_popover'),
39                     onShow: function () {
40                         editor.on('tour:menu_editor_dialog_ready', editor, function () {
41                             self.movetoStep('add-menu-entry');
42                         });
43                     },
44                 },
45                 {
46                     stepId: 'add-menu-entry',
47                     element: 'a.js_add_menu',
48                     placement: 'left',
49                     title: "Add menu entry",
50                     content: "Click here to create a new menu entry.",
51                     template: render('website.tour_popover'),
52                     onShow: function () {
53                         editor.on('tour:new_menu_entry_dialog_ready', editor, function () {
54                             self.movetoStep('enter-entry-name');
55                         });
56                     },
57                 },
58                 {
59                     stepId: 'enter-entry-name',
60                     element: '#link-text',
61                     placement: 'left',
62                     title: "Choose a label",
63                     content: "This label will appear in the top menu and will be visible by all your audience.\nGive a meaningful name to help your visitors. For instance, 'Photos Gallery'.",
64                     template: render('website.tour_popover', { next: "Continue" }),
65                 },
66                 {
67                     stepId: 'enter-page-name',
68                     element: '#link-new',
69                     placement: 'left',
70                     title: "Link your menu to a 'gallery' page",
71                     content: "This page does not exist. Create it by filling the name here. For instance, 'gallery'.",
72                     template: render('website.tour_popover', { next: "Continue" }),
73                 },
74                 {
75                     stepId: 'save-page',
76                     element: '.modal-footer:last button.btn-primary',
77                     placement: 'right',
78                     title: "Save the page",
79                     content: "Save your new page.",
80                     template: render('website.tour_popover'),
81                     onShow: function () {
82                         editor.on('tour:new_menu_entry_dialog_closed', editor, function () {
83                             self.movetoStep('save-menu');
84                         });
85                     },
86                 },
87                 {
88                     stepId: 'save-menu',
89                     element: '.modal-footer button.btn-primary',
90                     placement: 'right',
91                     reflex: true,
92                     title: "Save the menu",
93                     content: "Save the menu to edit the Gallery content directly from the interface.",
94                     template: render('website.tour_popover'),
95                 },
96             ];
97             return this._super();
98         },
99     });
100
101     website.EditorBar.include({
102         start: function () {
103             this.registerTour(new website.EditorBuilderTour(this));
104             return this._super();
105         },
106     });
107
108 }());