diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-02-22 23:17:19 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-02-28 07:44:27 +0300 |
commit | f656ebb095ad209e9eeddf2062736c867c01b7d8 (patch) | |
tree | 64fbfdc91be85af59b8e699ed35bc5cc897fbf6f /app | |
parent | 7efd5f8bfbf62d11999304acbb7baa30a876e9b0 (diff) |
Merge branch 'add-issues-tooltip' into 'master'
Added tooltip to add issues button on issue boards
Closes #27985
See merge request !9142
Conflicts:
app/assets/javascripts/boards/boards_bundle.js.es6
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 b05d01e178a..91d1bd6eec7 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -101,17 +101,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, false)"> + data-placement="bottom" + :class="{ 'disabled': disabled }" + :title="tooltipTitle" + :aria-disabled="disabled" + @click="openModal"> Add issues </button> `, |