Commit fa79e06f authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch '249800-update-tooltip-for-boards' into 'master'

Update the tooltip to use GlTooltip

See merge request gitlab-org/gitlab!45283
parents c6fe16f2 3635baaa
import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { GlTooltip, GlButton } from '@gitlab/ui';
import 'ee_else_ce/boards/models/issue'; import 'ee_else_ce/boards/models/issue';
import 'ee_else_ce/boards/models/list'; import 'ee_else_ce/boards/models/list';
...@@ -299,6 +299,10 @@ export default () => { ...@@ -299,6 +299,10 @@ export default () => {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Vue({ new Vue({
el: issueBoardsModal, el: issueBoardsModal,
components: {
GlTooltip,
GlButton,
},
mixins: [modalMixin], mixins: [modalMixin],
data() { data() {
return { return {
...@@ -323,26 +327,7 @@ export default () => { ...@@ -323,26 +327,7 @@ export default () => {
return ''; return '';
}, },
}, },
watch: {
disabled() {
this.updateTooltip();
},
},
mounted() {
this.updateTooltip();
},
methods: { methods: {
updateTooltip() {
const $tooltip = $(this.$refs.addIssuesButton);
this.$nextTick(() => {
if (this.disabled) {
$tooltip.tooltip();
} else {
$tooltip.tooltip('dispose');
}
});
},
openModal() { openModal() {
if (!this.disabled) { if (!this.disabled) {
this.toggleModal(true); this.toggleModal(true);
...@@ -351,20 +336,25 @@ export default () => { ...@@ -351,20 +336,25 @@ export default () => {
}, },
template: ` template: `
<div class="board-extra-actions"> <div class="board-extra-actions">
<button <span ref="addIssuesButtonTooltip" class="gl-ml-3">
class="btn btn-success gl-ml-3" <gl-button
type="button" type="button"
data-placement="bottom" data-placement="bottom"
data-track-event="click_button" data-track-event="click_button"
data-track-label="board_add_issues" data-track-label="board_add_issues"
ref="addIssuesButton" :disabled="disabled"
:class="{ 'disabled': disabled }" :aria-disabled="disabled"
:title="tooltipTitle" v-if="canAdminList"
:aria-disabled="disabled" @click="openModal">
v-if="canAdminList" Add issues
@click="openModal"> </button>
Add issues </span>
</button> <gl-tooltip
v-if="disabled"
:target="() => $refs.addIssuesButtonTooltip"
placement="bottom">
{{tooltipTitle}}
</gl-tooltip>
</div> </div>
`, `,
}); });
......
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