From 6e043bca3b6ba090db1281d467d8565dde9d7c6b Mon Sep 17 00:00:00 2001 From: ddm Date: Wed, 20 Nov 2013 11:39:07 +0100 Subject: [PATCH] [IMP] Blog tour code cleanup bzr revid: ddm@openerp.com-20131120103907-06dfmxjhq7ad18wz --- .../static/src/js/website.tour.blog.js | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) 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 25a4cc8a302..5cb78dd122e 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -5,6 +5,13 @@ var render = website.tour.render; + website.EditorBar.include({ + start: function () { + this.registerTour(new website.BlogTour(this)); + return this._super(); + }, + }); + website.BlogTour = website.EditorTour.extend({ id: 'blog-tutorial', name: "Create a blog post", @@ -74,25 +81,13 @@ ]; return this._super(); }, - postPage: function () { - var currentStepIndex = this.currentStepIndex(); - var postPageIndex = this.indexOfStep('post-page'); - return (currentStepIndex === postPageIndex) && !this.tour.ended(); - }, continueTour: function () { - return this.postPage(); + return (this.currentStepIndex() === this.indexOfStep('post-page')) && !this.tour.ended(); }, isTriggerUrl: function (url) { url = url || new website.UrlParser(window.location.href); var addPostPattern = /^\/blog\/[0-9]+\/\?enable_editor=1/; - return (this.postPage && addPostPattern.test(url.pathname+url.search)) || this._super(); - }, - }); - - website.EditorBar.include({ - start: function () { - this.registerTour(new website.BlogTour(this)); - return this._super(); + return (this.continueTour() && addPostPattern.test(url.pathname+url.search)) || this._super(); }, });