diff options
author | Phil Hughes <me@iamphill.com> | 2017-02-10 16:13:13 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-02-21 08:37:17 +0000 |
commit | 7e648110ed09bd12e1d405fbeba8dcb0590de602 (patch) | |
tree | 9fe59047dd897e72771cc30a2af04b501b18cf1d /app | |
parent | b596dd8fedd9dc8f9487e1e67a52a7b211bd956b (diff) | |
download | gitlab-ce-7e648110ed09bd12e1d405fbeba8dcb0590de602.tar.gz |
Added tooltip to add issues button on issue boards
Closes #27985
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/boards/boards_bundle.js.es6 | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/app/assets/javascripts/boards/boards_bundle.js.es6 b/app/assets/javascripts/boards/boards_bundle.js.es6 index 878ad1b6031..d194dc9b188 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -93,17 +93,53 @@ $(() => { modal: ModalStore.store, store: Store.state, }, + watch: { + disabled() { + this.updateTooltip(); + }, + }, computed: { disabled() { return !this.store.lists.filter(list => list.type !== 'blank' && list.type !== 'done').length; }, + tooltipTitle() { + if (this.disabled) { + return 'Please add a list to your board first'; + } + + return ''; + }, + }, + methods: { + updateTooltip() { + const $tooltip = $(this.$el); + + this.$nextTick(() => { + if (this.disabled) { + $tooltip.tooltip(); + } else { + $tooltip.tooltip('destroy'); + } + }); + }, + openModal() { + if (!this.disabled) { + this.toggleModal(true); + } + }, + }, + mounted() { + this.updateTooltip(); }, template: ` <button - class="btn btn-create pull-right prepend-left-10 has-tooltip" + class="btn btn-create pull-right prepend-left-10" type="button" - :disabled="disabled" - @click="toggleModal(true)"> + data-placement="bottom" + :class="{ 'disabled': disabled }" + :title="tooltipTitle" + :aria-disabled="disabled" + @click="openModal"> Add issues </button> `, |