From b2ebae427cd63466385580434ffb68687f62fcb4 Mon Sep 17 00:00:00 2001 From: ddm Date: Mon, 25 Nov 2013 17:36:22 +0100 Subject: [PATCH] [FIX] Tour: modal bug fixes bzr revid: ddm@openerp.com-20131125163622-4e6o0gzr2gocrcej --- addons/website_blog/static/src/js/website.tour.blog.js | 8 +++++++- addons/website_event/static/src/js/website.tour.event.js | 8 +++++++- addons/website_sale/static/src/js/website.tour.shop.js | 6 ++++++ 3 files changed, 20 insertions(+), 2 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 a8094ccf0cc..a37715dcc20 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -39,8 +39,14 @@ title: "New blog post", content: "Click here to create a blog post.", triggers: function () { - $(document).one('shown.bs.modal', function () { + var $doc = $(document); + function stopNewBlog () { + self.stop(); + } + $doc.on('hide.bs.modal', stopNewBlog); + $doc.one('shown.bs.modal', function () { $('.modal button.btn-primary').one('click', function () { + $doc.off('hide.bs.modal', stopNewBlog); self.moveToStep('post-page'); }); self.moveToNextStep(); 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 e61b5771715..796e748197e 100644 --- a/addons/website_event/static/src/js/website.tour.event.js +++ b/addons/website_event/static/src/js/website.tour.event.js @@ -39,8 +39,14 @@ title: "New event", content: "Click here to create an event.", triggers: function () { - $(document).one('shown.bs.modal', function () { + var $doc = $(document); + function stopNewEvent () { + self.stop(); + } + $doc.on('hide.bs.modal', stopNewEvent); + $doc.one('shown.bs.modal', function () { $('.modal button.btn-primary').one('click', function () { + $doc.off('hide.bs.modal', stopNewEvent); self.moveToStep('event-page'); }); self.moveToNextStep(); 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 6a4d774f1b3..561f9286734 100644 --- a/addons/website_sale/static/src/js/website.tour.shop.js +++ b/addons/website_sale/static/src/js/website.tour.shop.js @@ -39,12 +39,18 @@ title: "Create a new product", content: "Select 'New Product' to create it and manage its properties to boost your sales.", triggers: function () { + function stopIfModalClosed () { + self.stop(); + } + $(document).one('hidden.bs.modal', stopIfModalClosed); $(document).one('shown.bs.modal', function () { $('.modal button.btn-primary').one('click', function () { + $(document).off('hidden.bs.modal', stopIfModalClosed); self.moveToStep('product-page'); }); self.moveToNextStep(); }); + }, }, {