diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-02-22 20:17:19 +0000 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-02-22 20:17:19 +0000 |
commit | 1d667e03d291a5169ebfe7509364c49553509374 (patch) | |
tree | 127b5484598216d14ced8c1fd3add537f6d0c97f /app/assets | |
parent | fb81291ee00a18e12ff290ae8b4caa63bb90e556 (diff) | |
parent | 8ed25c80003b327b359079d600f7207db46846b4 (diff) | |
download | gitlab-ce-1d667e03d291a5169ebfe7509364c49553509374.tar.gz |
Merge branch 'add-issues-tooltip' into 'master'
Added tooltip to add issues button on issue boards
Closes #27985
See merge request !9142
Diffstat (limited to 'app/assets')
-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 0c5177ced2f..55d13be6e5f 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -97,17 +97,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> `, |