diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-04-09 14:44:12 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-04-23 12:22:08 +0300 |
commit | 2f57341bf6af2543c1d92b34edd15f7c4bc47bef (patch) | |
tree | a33514b66a05d0c887a91727796a97e932d8f18c /app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue | |
parent | a011667788fc64602d0755abb6c457bb278d066b (diff) |
Emit `toggleCollapse`, `onDropdownClose` on component
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue index 5ede53d8d01..70b46a9c2bb 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue @@ -1,4 +1,5 @@ <script> +import $ from 'jquery'; import { __ } from '~/locale'; import LabelsSelect from '~/labels_select'; import LoadingIcon from '../../loading_icon.vue'; @@ -98,11 +99,18 @@ export default { this.labelsDropdown = new LabelsSelect(this.$refs.dropdownButton, { handleClick: this.handleClick, }); + $(this.$refs.dropdown).on('hidden.gl.dropdown', this.handleDropdownHidden); }, methods: { handleClick(label) { this.$emit('onLabelClick', label); }, + handleCollapsedValueClick() { + this.$emit('toggleCollapse'); + }, + handleDropdownHidden() { + this.$emit('onDropdownClose'); + }, }, }; </script> @@ -112,6 +120,7 @@ export default { <dropdown-value-collapsed v-if="showCreate" :labels="context.labels" + @onValueClick="handleCollapsedValueClick" /> <dropdown-title :can-edit="canEdit" @@ -133,7 +142,10 @@ export default { :name="hiddenInputName" :label="label" /> - <div class="dropdown"> + <div + class="dropdown" + ref="dropdown" + > <dropdown-button :ability-name="abilityName" :field-name="hiddenInputName" |