Commit 34dae228 authored by Phil Hughes's avatar Phil Hughes

fixed spacing

removed need for custom dropdown stuff
parent 64360f4f
<script> <script>
import $ from 'jquery';
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import ProjectAvatarImage from '~/vue_shared/components/project_avatar/image.vue'; import ProjectAvatarImage from '~/vue_shared/components/project_avatar/image.vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -70,19 +71,31 @@ export default { ...@@ -70,19 +71,31 @@ export default {
this.showTooltip = this.$refs.branchId.scrollWidth > this.$refs.branchId.offsetWidth; this.showTooltip = this.$refs.branchId.scrollWidth > this.$refs.branchId.offsetWidth;
}); });
}, },
showMergeRequestsDropdown() { loading() {
if (this.showMergeRequestsDropdown) { if (!this.loading) {
document.addEventListener('click', this.hideMergeRequestDropdown); this.$nextTick(() => {
} else { this.addDropdownListeners();
document.removeEventListener('click', this.hideMergeRequestDropdown); });
} }
}, },
}, },
mounted() {
this.addDropdownListeners();
},
beforeDestroy() {
$(this.$refs.mergeRequestDropdown)
.off('show.bs.dropdown')
.off('hide.bs.dropdown');
},
methods: { methods: {
hideMergeRequestDropdown(e) { addDropdownListeners() {
if (this.$refs.mergeRequestDropdown.contains(e.target)) return; $(this.$refs.mergeRequestDropdown)
.on('show.bs.dropdown', () => {
this.showMergeRequestsDropdown = false; this.toggleMergeRequestDropdown();
})
.on('hide.bs.dropdown', () => {
this.toggleMergeRequestDropdown();
});
}, },
toggleMergeRequestDropdown() { toggleMergeRequestDropdown() {
this.showMergeRequestsDropdown = !this.showMergeRequestsDropdown; this.showMergeRequestsDropdown = !this.showMergeRequestsDropdown;
...@@ -113,15 +126,12 @@ export default { ...@@ -113,15 +126,12 @@ export default {
<template v-else> <template v-else>
<div <div
class="context-header ide-context-header dropdown" class="context-header ide-context-header dropdown"
:class="{
show: showMergeRequestsDropdown
}"
ref="mergeRequestDropdown" ref="mergeRequestDropdown"
> >
<a <a
href="#" href="#"
role="button" role="button"
@click.prevent="toggleMergeRequestDropdown" data-toggle="dropdown"
> >
<div <div
v-if="currentProject.avatar_url" v-if="currentProject.avatar_url"
...@@ -178,7 +188,7 @@ export default { ...@@ -178,7 +188,7 @@ export default {
/> />
</a> </a>
<merge-request-dropdown <merge-request-dropdown
v-if="showMergeRequestsDropdown" :show="showMergeRequestsDropdown"
@hide="toggleMergeRequestDropdown" @hide="toggleMergeRequestDropdown"
/> />
</div> </div>
......
...@@ -10,23 +10,27 @@ export default { ...@@ -10,23 +10,27 @@ export default {
Tab, Tab,
List, List,
}, },
props: {
show: {
type: Boolean,
required: true,
},
},
computed: { computed: {
...mapGetters('mergeRequests', ['assignedData', 'createdData']), ...mapGetters('mergeRequests', ['assignedData', 'createdData']),
createdMergeRequestLength() { createdMergeRequestLength() {
return this.createdData.mergeRequests.length; return this.createdData.mergeRequests.length;
}, },
}, },
methods: {
hideDropdown() {
this.$emit('hide');
},
},
}; };
</script> </script>
<template> <template>
<div class="dropdown-menu ide-merge-requests-dropdown p-0"> <div class="dropdown-menu ide-merge-requests-dropdown p-0">
<tabs stop-propagation> <tabs
v-if="show"
stop-propagation
>
<tab active> <tab active>
<template slot="title"> <template slot="title">
{{ __('Created by me') }} {{ __('Created by me') }}
...@@ -37,7 +41,6 @@ export default { ...@@ -37,7 +41,6 @@ export default {
<list <list
type="created" type="created"
:empty-text="__('You have not created any merge requests')" :empty-text="__('You have not created any merge requests')"
@hide="hideDropdown"
/> />
</tab> </tab>
<tab> <tab>
...@@ -50,7 +53,6 @@ export default { ...@@ -50,7 +53,6 @@ export default {
<list <list
type="assigned" type="assigned"
:empty-text="__('You do not have any assigned merge requests')" :empty-text="__('You do not have any assigned merge requests')"
@hide="hideDropdown"
/> />
</tab> </tab>
</tabs> </tabs>
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
<strong> <strong>
{{ item.title }} {{ item.title }}
</strong> </strong>
<span class="d-block mt-1"> <span class="ide-merge-request-project-path d-block mt-1">
{{ pathWithID }} {{ pathWithID }}
</span> </span>
</span> </span>
......
...@@ -58,7 +58,6 @@ export default { ...@@ -58,7 +58,6 @@ export default {
this.fetchMergeRequests({ type: this.type, search: this.search }); this.fetchMergeRequests({ type: this.type, search: this.search });
}, },
viewMergeRequest(item) { viewMergeRequest(item) {
this.$emit('hide');
this.openMergeRequest({ this.openMergeRequest({
projectPath: item.projectPathWithNamespace, projectPath: item.projectPathWithNamespace,
id: item.iid, id: item.iid,
......
...@@ -1137,7 +1137,7 @@ ...@@ -1137,7 +1137,7 @@
} }
.ide-merge-requests-dropdown.dropdown-menu { .ide-merge-requests-dropdown.dropdown-menu {
width: 350px; width: 385px;
max-height: initial; max-height: initial;
} }
} }
...@@ -1298,6 +1298,16 @@ ...@@ -1298,6 +1298,16 @@
} }
} }
} }
.dropdown-input {
padding-left: $gl-padding;
padding-right: $gl-padding;
}
.btn-link {
padding-top: $gl-padding;
padding-bottom: $gl-padding;
}
} }
.ide-merge-request-current-icon { .ide-merge-request-current-icon {
...@@ -1312,3 +1322,9 @@ ...@@ -1312,3 +1322,9 @@
min-height: 230px; min-height: 230px;
max-height: 470px; max-height: 470px;
} }
.ide-merge-request-project-path {
font-size: 12px;
line-height: 16px;
color: $gl-text-color-secondary;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment