From cbef8ac39bde80737e13d89a2ab21905502d5c0d Mon Sep 17 00:00:00 2001 From: ddm Date: Tue, 26 Nov 2013 12:22:46 +0100 Subject: [PATCH] [FIX] Various tour fixes and imps bzr revid: ddm@openerp.com-20131126112246-tuj0wvruy2668fyi --- .../website/static/src/js/website.tour.app.js | 50 --------- .../static/src/js/website.tour.banner.js | 10 +- addons/website/static/src/js/website.tour.js | 5 +- .../static/src/js/website.tour.page.js | 106 ------------------ addons/website/views/website_templates.xml | 2 - .../static/src/js/website.tour.blog.js | 22 ++-- .../static/src/js/website.tour.event.js | 20 ++-- .../static/src/js/website.tour.shop.js | 26 +++-- 8 files changed, 47 insertions(+), 194 deletions(-) delete mode 100644 addons/website/static/src/js/website.tour.app.js delete mode 100644 addons/website/static/src/js/website.tour.page.js diff --git a/addons/website/static/src/js/website.tour.app.js b/addons/website/static/src/js/website.tour.app.js deleted file mode 100644 index 40d968e78f3..00000000000 --- a/addons/website/static/src/js/website.tour.app.js +++ /dev/null @@ -1,50 +0,0 @@ -(function () { - 'use strict'; - - var website = openerp.website; - - website.EditorBar.include({ - start: function () { - this.registerTour(new website.AppTour(this)); - return this._super(); - }, - }); - - website.AppTour = website.Tour.extend({ - id: 'app-tutorial', - name: "Install an application", - init: function (editor) { - var self = this; - self.steps = [ - { - stepId: 'welcome-install-app', - orphan: true, - backdrop: true, - title: "Install an App", - content: "You can intall some apps to manage your website content.", - template: self.popover({ next: "Start Tutorial", end: "Skip It" }), - }, - { - stepId: 'customize', - element: '#customize-menu-button', - placement: 'left', - title: "Install an app", - content: "Add new apps by customizing your website.", - triggers: function () { - editor.on('rte:customize_menu_ready', self, self.moveToNextStep); - }, - }, - { - stepId: 'install-app', - element: '#customize-menu li:last a', - placement: 'left', - orphan: true, - title: "Install an app", - content: "Click 'Install Apps' to select and install the application you would like to manage from your website.", - }, - ]; - return this._super(); - }, - }); - -}()); diff --git a/addons/website/static/src/js/website.tour.banner.js b/addons/website/static/src/js/website.tour.banner.js index 42e7a9cbcec..864c46c2c7d 100644 --- a/addons/website/static/src/js/website.tour.banner.js +++ b/addons/website/static/src/js/website.tour.banner.js @@ -86,7 +86,7 @@ title: "Add Another Block", content: "Let's add another building block to your page.", triggers: function () { - $('button[data-action=snippet]').on('click', function () { + $('button[data-action=snippet]').one('click', function () { self.moveToNextStep(); }); } @@ -140,9 +140,13 @@ stepId: 'show-mobile', element: 'a[data-action=show-mobile-preview]', placement: 'bottom', - reflex: true, title: "Test Your Mobile Version", content: "Let's check how your homepage looks like on mobile devices.", + triggers: function () { + $(document).one('shown.bs.modal', function () { + self.moveToNextStep(); + }); + } }, { stepId: 'show-mobile-close', @@ -165,7 +169,7 @@ return this._super(); }, resume: function () { - return (this.isCurrentStep('show-tutorials')) && !this.tour.ended(); + return this.isCurrentStep('part-2') && this._super(); }, }); diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 49da97085e8..ad0280b0b35 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -73,9 +73,12 @@ window.location.replace(newUrl); } }, + ended: function () { + return this.tourStorage.getItem(this.id+'_end') === "yes"; + }, resume: function () { // Override if necessary - return this.currentStepIndex() === 0; + return !this.ended(); }, trigger: function (url) { // Override if necessary diff --git a/addons/website/static/src/js/website.tour.page.js b/addons/website/static/src/js/website.tour.page.js deleted file mode 100644 index 275848be123..00000000000 --- a/addons/website/static/src/js/website.tour.page.js +++ /dev/null @@ -1,106 +0,0 @@ -(function () { - 'use strict'; - - var website = openerp.website; - - website.EditorBar.include({ - start: function () { - this.registerTour(new website.PageTour(this)); - return this._super(); - }, - }); - - website.PageTour = website.Tour.extend({ - id: 'page-tutorial', - name: "Add a page", - init: function (editor) { - var self = this; - self.steps = [ - { - stepId: 'welcome-menu-editor', - orphan: true, - backdrop: true, - title: "Menu editor", - content: "We will show how to edit your website's menu.", - template: self.popover({ next: "Start Tutorial", end: "Skip It" }), - }, - { - stepId: 'content-menu', - element: '#content-menu-button', - placement: 'left', - reflex: true, - title: "Edit the content", - content: "Click here to edit the menu.", - }, - { - stepId: 'edit-entry', - element: 'a[data-action=edit-structure]', - placement: 'left', - title: "Edit menu", - content: "Click here to create a new menu entry and manage options.", - triggers: function () { - $(document).one('shown.bs.modal', function () { - $('.modal-header:first button.close').one('click', function () { - self.stop(); - }); - self.moveToNextStep(); - }); - }, - }, - { - stepId: 'add-menu-entry', - element: 'a.js_add_menu', - placement: 'left', - title: "Add menu entry", - content: "Click here to create a new menu entry.", - triggers: function () { - $(document).one('shown.bs.modal', function () { - $('.modal-header:last button.close').one('click', function () { - self.stop(); - }); - self.moveToNextStep(); - }); - }, - }, - { - stepId: 'enter-entry-name', - element: '#link-text', - placement: 'left', - title: "Choose a label", - 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'.", - template: self.popover({ next: "Continue" }), - }, - { - stepId: 'enter-page-name', - element: '.modal .select2-container', - placement: 'left', - title: "Link your menu to a 'gallery' page", - content: "This page does not exist. Create it by filling the name here. For instance, 'gallery'.", - template: self.popover({ next: "Continue" }), - }, - { - stepId: 'save-page', - element: '.modal-footer:last button.btn-primary', - placement: 'right', - title: "Save the page", - content: "Save your new page.", - triggers: function () { - $(document).one('hidden.bs.modal', function () { - self.moveToNextStep(); - }); - }, - }, - { - stepId: 'save-menu', - element: '.modal-footer button.btn-primary', - placement: 'right', - reflex: true, - title: "Save the menu", - content: "Save the menu to edit the Gallery content directly from the interface.", - }, - ]; - return this._super(); - }, - }); - -}()); diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index c9628f2498a..375cac64dfb 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -102,8 +102,6 @@ - - diff --git a/addons/website_blog/static/src/js/website.tour.blog.js b/addons/website_blog/static/src/js/website.tour.blog.js index ba681972d0f..2da68a89819 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -156,14 +156,6 @@ title: "Delete the Title", content: "From this toolbar you can move, duplicate or delete the selected zone. Click on the cross to delete the title.", }, - { - stepId: 'publish-post', - element: 'button.js_publish_btn', - placement: 'right', - reflex: true, - title: "Publish Your Post", - content: "Your blog post is not yet published. You can update this draft version and publish it once you are ready.", - }, { stepId: 'save-changes', element: 'button[data-action=save]', @@ -172,22 +164,30 @@ title: "Save Your Blog", content: "Click the Save button to record changes on the page.", }, + { + stepId: 'publish-post', + element: 'button.js_publish_btn', + placement: 'right', + reflex: true, + title: "Publish Your Post", + content: "Your blog post is not yet published. You can update this draft version and publish it once you are ready.", + }, { stepId: 'end-tutorial', orphan: true, backdrop: true, title: "Thanks!", content: "This tutorial is finished. To discover more features, improve the content of this page and try the Promote button in the top right menu.", - template: self.popover({ next: "Close Tutorial" }), + template: self.popover({ end: "Close Tutorial" }), }, ]; return this._super(); }, resume: function () { - return this.isCurrentStep('post-page') && !this.tour.ended(); + return (this.isCurrentStep('post-page') || this.isCurrentStep('publish-post')) && this._super(); }, trigger: function () { - return (this.resume() && this.testUrl(/^\/blog\/[0-9]+\/\?enable_editor=1/)) || this._super(); + return (this.resume() && this.testUrl(/^\/blog\/[0-9]+\//)) || this._super(); }, }); diff --git a/addons/website_event/static/src/js/website.tour.event.js b/addons/website_event/static/src/js/website.tour.event.js index 4a3c22af337..b11f3ec6a89 100644 --- a/addons/website_event/static/src/js/website.tour.event.js +++ b/addons/website_event/static/src/js/website.tour.event.js @@ -99,14 +99,6 @@ self.onSnippetDraggedAdvance('text-block'); }, }, - { - stepId: 'publish-post', - element: 'button.js_publish_btn', - placement: 'right', - reflex: true, - title: "Publish your event", - content: "Click to publish your event.", - }, { stepId: 'save-changes', element: 'button[data-action=save]', @@ -115,14 +107,22 @@ title: "Save your modifications", content: "Once you click on save, your event is updated.", }, + { + stepId: 'publish-post', + element: 'button.js_publish_btn', + placement: 'right', + reflex: true, + title: "Publish your event", + content: "Click to publish your event.", + }, ]; return this._super(); }, resume: function () { - return this.isCurrentStep('event-page') && !this.tour.ended(); + return (this.isCurrentStep('event-page') || this.isCurrentStep('publish-post')) && this._super(); }, trigger: function () { - return (this.resume() && this.testUrl(/^\/event\/register\/[0-9]+/)) || this._super(); + return (this.resume() && this.testUrl(/^\/event\/[0-9]+\/register/)) || this._super(); }, }); diff --git a/addons/website_sale/static/src/js/website.tour.shop.js b/addons/website_sale/static/src/js/website.tour.shop.js index 5d7455b2c0a..98add0d8bd8 100644 --- a/addons/website_sale/static/src/js/website.tour.shop.js +++ b/addons/website_sale/static/src/js/website.tour.shop.js @@ -101,12 +101,16 @@ title: "Upload image", content: "Click on 'Upload an image from your computer' to pick an image describing your product.", template: self.popover({ next: "OK" }), + triggers: function () { + $(document).on('hide.bs.modal', function () { + self.moveToStep('add-block'); + }); + } }, { stepId: 'save-image', element: 'button.save', placement: 'right', - reflex: true, title: "Save the image", content: "Click 'Save Changes' to add the image to the product decsription.", }, @@ -132,14 +136,6 @@ self.onSnippetDraggedAdvance('big-picture'); }, }, - { - stepId: 'publish-post', - element: 'button.js_publish_btn', - placement: 'right', - reflex: true, - title: "Publish your product", - content: "Click to publish your product so your customers can see it.", - }, { stepId: 'save-changes', element: 'button[data-action=save]', @@ -148,14 +144,22 @@ title: "Save your modifications", content: "Once you click on save, your product is updated.", }, + { + stepId: 'publish-product', + element: 'button.js_publish_btn', + placement: 'right', + reflex: true, + title: "Publish your product", + content: "Click to publish your product so your customers can see it.", + }, ]; return this._super(); }, resume: function () { - return this.isCurrentStep('product-page') && !this.tour.ended(); + return (this.isCurrentStep('product-page') || this.isCurrentStep('publish-product')) && this._super(); }, trigger: function (url) { - return (this.resume() && this.testUrl(/^\/shop\/product\/[0-9]+\/\?enable_editor=1/)) || this._super(); + return (this.resume() && this.testUrl(/^\/shop\/product\/[0-9]+\//)) || this._super(); }, });