4 var website = openerp.website;
6 website.EditorBar.include({
8 this.registerTour(new website.BlogTour(this));
13 website.BlogTour = website.Tour.extend({
15 name: "Create a blog post",
16 startPath: '/blog/cat/1/',
17 init: function (editor) {
21 stepId: 'welcome-blog',
25 content: "We will show how to create a new blog post.",
26 template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
29 stepId: 'content-menu',
30 element: '#content-menu-button',
33 title: "Edit the content",
34 content: "Click here to add content to your site.",
37 stepId: 'new-post-entry',
38 element: 'a[data-action=new_blog_post]',
40 title: "New blog post",
41 content: "Click here to create a blog post.",
43 $(document).one('shown.bs.modal', function () {
44 $('.modal button.btn-primary').click(function () {
45 self.movetoStep('post-page');
47 self.movetoStep('choose-category');
52 stepId: 'choose-category',
53 element: '.modal select',
55 title: "Choose the post category",
56 content: "Select the 'News' category and click 'Continue'.",
62 title: "New blog post created",
63 content: "You just created a new blog post. We are now going to edit it.",
64 template: self.popover({ next: "OK" }),
68 element: 'h1[data-oe-expression="blog_post.name"]',
70 title: "Pick a title",
71 content: "Choose a catchy title for your blog post.",
72 template: self.popover({ next: "OK" }),
76 element: 'button[data-action=snippet]',
78 title: "Layout your blog post",
79 content: "Insert blocks like text-image to layout the body of your blog post.",
81 $('button[data-action=snippet]').click(function () {
82 self.movetoStep('drag-image-text');
87 stepId: 'drag-image-text',
88 element: '#website-top-navbar [data-snippet-id=image-text].ui-draggable',
90 title: "Drag & Drop a block",
91 content: "Drag the 'Image Text' block and drop it in your page.",
93 var $body = $(document.body);
94 function beginDrag () {
95 $('.popover.tour').remove();
96 function goToNextStep () {
97 $('#snippets').toggle();
99 $body.off('mouseup', goToNextStep);
101 $body.off('mousedown', beginDrag);
102 $body.on('mouseup', goToNextStep);
104 $body.on('mousedown', beginDrag);
108 return this._super();
110 continue: function () {
111 return this.isCurrentStep('post-page') && !this.tour.ended();
113 trigger: function () {
114 return (this.continue() && this.testUrl(/^\/blog\/[0-9]+\/\?enable_editor=1/)) || this._super();