From e82fdbbed6ca208ced96dd897e58f0f7299fc11b Mon Sep 17 00:00:00 2001 From: tahaa karim Date: Mon, 6 Jun 2016 16:29:54 +0530 Subject: [PATCH] close popover fix close popover fix close popover fix close popover fix close popover fix --- CHANGELOG.md | 4 ++++ js/views/account.js | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b981f04a..5fdbcbcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. ## 0.5.2 - unreleased +### Fixed +- Close popover on clicking somewhere else + [#1521](https://github.com/owncloud/mail/pull/1521) @tahaalibra + ## 0.5.1 – 2016-05-30 ### Fixed diff --git a/js/views/account.js b/js/views/account.js index f1ae3257..231a2097 100644 --- a/js/views/account.js +++ b/js/views/account.js @@ -65,14 +65,6 @@ define(function(require) { toggleCollapse: function() { this.collapsed = !this.collapsed; this.render(); - this.listenTo(Radio.ui, 'document:click', function(event) { - var target = $(event.target); - if (!this.$el.is(target.closest('.navigation-account'))) { - // Click was not triggered by this element -> close menu - this.menuShown = false; - this.toggleMenuClass(); - } - }); }, toggleMenu: function(e) { e.preventDefault(); @@ -104,6 +96,17 @@ define(function(require) { OC.Notification.show(t('mail', 'Error while deleting account.')); } }); + }, + onShow: function() { + this.listenTo(Radio.ui, 'document:click', function(event) { + var target = $(event.target); + if (!this.$el.is(target.closest('.navigation-account'))) { + // Click was not triggered by this element -> close menu + this.menuShown = false; + this.toggleMenuClass(); + } + }); } + }); });