From 7dc413070c396c7ad3318ccde9c1415d91c20e3f Mon Sep 17 00:00:00 2001 From: "Darshan Kalola (OpenERP)" Date: Tue, 25 Feb 2014 10:21:42 +0530 Subject: [PATCH] [IMP]mail_follower:closed dropdown when there is no child element in ul. bzr revid: dka@tinyerp.com-20140225045142-fg6qbnlvl4ylys0k --- addons/mail/static/src/js/mail_followers.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 947667627d7..955049f2e25 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -73,8 +73,12 @@ openerp_mail_followers = function(session, mail) { this.$el.on('click', '.oe_subtype_list input', function(event) { self.do_update_subscription(event); var $list = self.$('.oe_subtype_list'); - if(!$list.hasClass('open')) + if(!$list.hasClass('open')) { $list.addClass('open'); + } + if(self.$('.oe_subtype_list ul')[0].children.length < 1) { + $list.removeClass('open'); + } event.stopPropagation(); }); // event: click on 'invite' button, that opens the invite wizard @@ -296,6 +300,7 @@ openerp_mail_followers = function(session, mail) { }, do_unfollow: function (user_pid) { + var self = this; if (confirm(_t("Warning! \nYou won't be notified of any email or discussion on this document. Do you really want to unfollow this document ?"))) { _(this.$('.oe_msg_subtype_check')).each(function (record) { $(record).attr('checked',false); @@ -334,6 +339,8 @@ openerp_mail_followers = function(session, mail) { if (!checklist.length) { if (!this.do_unfollow(user_pid)) { $(event.target).attr("checked", "checked"); + } else { + self.$('.oe_subtype_list ul').empty(); } } else { var context = new session.web.CompoundContext(this.build_context(), {});