Merge branch 'add-issues-tooltip' into 'master'
Added tooltip to add issues button on issue boards Closes #27985 See merge request !9142
This commit is contained in:
commit
1d667e03d2
|
@ -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>
|
||||
`,
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Disabled tooltip on add issues button in usse boards
|
||||
merge_request:
|
||||
author:
|
|
@ -49,6 +49,12 @@ describe 'Issue Boards add issue modal', :feature, :js do
|
|||
|
||||
expect(page).not_to have_selector('.add-issues-modal')
|
||||
end
|
||||
|
||||
it 'does not show tooltip on add issues button' do
|
||||
button = page.find('.issue-boards-search button', text: 'Add issues')
|
||||
|
||||
expect(button[:title]).not_to eq("Please add a list to your board first")
|
||||
end
|
||||
end
|
||||
|
||||
context 'issues list' do
|
||||
|
|
|
@ -28,10 +28,10 @@ describe 'Issue Boards', feature: true, js: true do
|
|||
expect(page).to have_content('Welcome to your Issue Board!')
|
||||
end
|
||||
|
||||
it 'disables add issues button by default' do
|
||||
it 'shows tooltip on add issues button' do
|
||||
button = page.find('.issue-boards-search button', text: 'Add issues')
|
||||
|
||||
expect(button[:disabled]).to eq true
|
||||
expect(button[:"data-original-title"]).to eq("Please add a list to your board first")
|
||||
end
|
||||
|
||||
it 'hides the blank state when clicking nevermind button' do
|
||||
|
|
Loading…
Reference in New Issue