From 6e08d5dc5ea3949ae2574e38e3e446c9c94dcd14 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 12 Jan 2017 10:22:51 -0500 Subject: Resets issue boards assignee dropdown Closes #26514 --- app/assets/javascripts/boards/components/board_sidebar.js.es6 | 4 ++++ app/assets/javascripts/gl_dropdown.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/javascripts/boards/components/board_sidebar.js.es6 b/app/assets/javascripts/boards/components/board_sidebar.js.es6 index 02459722bbf..2fadb4b293c 100644 --- a/app/assets/javascripts/boards/components/board_sidebar.js.es6 +++ b/app/assets/javascripts/boards/components/board_sidebar.js.es6 @@ -30,6 +30,10 @@ detail: { handler () { this.issue = this.detail.issue; + + if (this.showSidebar) { + $('.js-user-search', this.$el).data('glDropdown').clearMenu(); + } }, deep: true }, diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 7746535d9ed..9ac22f95330 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -512,12 +512,17 @@ // Append the menu into the dropdown GitLabDropdown.prototype.appendMenu = function(html) { + return this.clearMenu().append(html); + }; + + GitLabDropdown.prototype.clearMenu = function() { var selector; selector = '.dropdown-content'; if (this.dropdown.find(".dropdown-toggle-page").length) { selector = ".dropdown-page-one .dropdown-content"; } - return $(selector, this.dropdown).empty().append(html); + + return $(selector, this.dropdown).empty(); }; GitLabDropdown.prototype.renderItem = function(data, group, index) { -- cgit v1.2.1 From 2c521dd245f73f64deef952f98f5ced32c53e89f Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 19 Jan 2017 10:54:02 +0000 Subject: Clears all dropdown menus in issue sidebar when it opens --- app/assets/javascripts/boards/components/board_sidebar.js.es6 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/boards/components/board_sidebar.js.es6 b/app/assets/javascripts/boards/components/board_sidebar.js.es6 index 2fadb4b293c..75dfcb66bb0 100644 --- a/app/assets/javascripts/boards/components/board_sidebar.js.es6 +++ b/app/assets/javascripts/boards/components/board_sidebar.js.es6 @@ -29,11 +29,13 @@ watch: { detail: { handler () { - this.issue = this.detail.issue; - - if (this.showSidebar) { - $('.js-user-search', this.$el).data('glDropdown').clearMenu(); + if (this.issue.id !== this.detail.issue.id) { + $('.js-issue-board-sidebar', this.$el).each((i, el) => { + $(el).data('glDropdown').clearMenu(); + }); } + + this.issue = this.detail.issue; }, deep: true }, -- cgit v1.2.1