941a8c6c5f6483ad57e99bb1898cce20ccc4a33d
[odoo/odoo.git] / addons / website_event / static / src / js / website.tour.event.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.EventTour(this));
9             return this._super();
10         },
11     });
12
13     website.EventTour = website.Tour.extend({
14         id: 'event-tutorial',
15         name: "Create an event",
16         startPath: '/event',
17         init: function (editor) {
18             var self = this;
19             self.steps = [
20                 {
21                     stepId: 'welcome-event',
22                     orphan: true,
23                     backdrop: true,
24                     title: "Event",
25                     content: "We will show how to create a new event.",
26                     template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
27                 },
28                 {
29                     stepId: 'content-menu',
30                     element: '#content-menu-button',
31                     placement: 'left',
32                     reflex: true,
33                     title: "Edit the content",
34                     content: "Click here to add content to your site.",
35                 },
36                 {
37                     stepId: 'new-post-entry',
38                     element: 'a[data-action=new_event]',
39                     placement: 'left',
40                     title: "New event",
41                     content: "Click here to create an event.",
42                     onShow: function () {
43                         $(document).one('shown.bs.modal', function () {
44                             $('.modal button.btn-primary').click(function () {
45                                 self.movetoStep('event-page');
46                             });
47                             self.movetoStep('choose-category');
48                         });
49                     },
50                 },
51                 {
52                     stepId: 'choose-name',
53                     element: '.modal input',
54                     placement: 'right',
55                     title: "Choose the event name",
56                     content: "Choose a name for the new event and click 'Continue'.",
57                 },
58                 {
59                     stepId: 'event-page',
60                     orphan: true,
61                     backdrop: true,
62                     title: "New event created",
63                     content: "You just created a new event. We are now going to edit it.",
64                     template: self.popover({ next: "OK" }),
65                 },
66                 {
67                     stepId: 'add-block',
68                     element: 'button[data-action=snippet]',
69                     placement: 'bottom',
70                     reflex: true,
71                     title: "Layout your event",
72                     content: "Insert blocks like text-image to layout the body of your event.",
73                 },
74             ];
75             return this._super();
76         },
77         continue: function () {
78             return this.isCurrentStep('event-page') && !this.tour.ended();
79         },
80         trigger: function () {
81             return (this.continue() && this.testUrl(/^\/event\/[0-9]+\/\?enable_editor=1/)) || this._super();
82         },
83     });
84
85 }());