Merge branch '33833-issue-and-mr-state-tabs-don-t-work-on-dashboard' into 'master'
Resolve "Issue and MR state tabs don't work on dashboard" Closes #33833 See merge request !12278
This commit is contained in:
commit
340b8a10bb
5 changed files with 21 additions and 34 deletions
|
@ -487,6 +487,7 @@ class FilteredSearchManager {
|
|||
}
|
||||
|
||||
searchState(e) {
|
||||
e.preventDefault();
|
||||
const target = e.currentTarget;
|
||||
// remove focus outline after click
|
||||
target.blur();
|
||||
|
|
|
@ -45,8 +45,7 @@
|
|||
li {
|
||||
display: flex;
|
||||
|
||||
a,
|
||||
.btn-link {
|
||||
a {
|
||||
padding: $gl-btn-padding;
|
||||
padding-bottom: 11px;
|
||||
font-size: 14px;
|
||||
|
@ -68,29 +67,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.btn-link {
|
||||
padding-top: 16px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
border-radius: 0;
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&:focus {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
&:active {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.active a,
|
||||
&.active .btn-link {
|
||||
&.active a {
|
||||
border-bottom: 2px solid $link-underline-blue;
|
||||
color: $black;
|
||||
font-weight: 600;
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
- type = local_assigns.fetch(:type, :issues)
|
||||
- page_context_word = type.to_s.humanize(capitalize: false)
|
||||
- issuables = @issues || @merge_requests
|
||||
- closed_title = 'Filter by issues that are currently closed.'
|
||||
|
||||
%ul.nav-links.issues-state-filters
|
||||
%li{ class: active_when(params[:state] == 'opened') }>
|
||||
%button.btn.btn-link{ id: 'state-opened', title: "Filter by #{page_context_word} that are currently opened.", type: 'button', data: { state: 'opened' } }
|
||||
= link_to page_filter_path(state: 'opened', label: true), id: 'state-opened', title: "Filter by #{page_context_word} that are currently opened.", data: { state: 'opened' } do
|
||||
#{issuables_state_counter_text(type, :opened)}
|
||||
|
||||
- if type == :merge_requests
|
||||
%li{ class: active_when(params[:state] == 'merged') }>
|
||||
%button.btn.btn-link{ id: 'state-merged', title: 'Filter by merge requests that are currently merged.', type: 'button', data: { state: 'merged' } }
|
||||
= link_to page_filter_path(state: 'merged', label: true), id: 'state-merged', title: 'Filter by merge requests that are currently merged.', data: { state: 'merged' } do
|
||||
#{issuables_state_counter_text(type, :merged)}
|
||||
|
||||
- closed_title = 'Filter by merge requests that are currently closed and unmerged.'
|
||||
|
||||
%li{ class: active_when(params[:state] == 'closed') }>
|
||||
%button.btn.btn-link{ id: 'state-closed', title: closed_title, type: 'button', data: { state: 'closed' } }
|
||||
#{issuables_state_counter_text(type, :closed)}
|
||||
%li{ class: active_when(params[:state] == 'closed') }>
|
||||
= link_to page_filter_path(state: 'closed', label: true), id: 'state-closed', title: 'Filter by merge requests that are currently closed and unmerged.', data: { state: 'closed' } do
|
||||
#{issuables_state_counter_text(type, :closed)}
|
||||
- else
|
||||
%li{ class: active_when(params[:state] == 'closed') }>
|
||||
= link_to page_filter_path(state: 'closed', label: true), id: 'state-closed', title: 'Filter by issues that are currently closed.', data: { state: 'closed' } do
|
||||
#{issuables_state_counter_text(type, :closed)}
|
||||
|
||||
%li{ class: active_when(params[:state] == 'all') }>
|
||||
%button.btn.btn-link{ id: 'state-all', title: "Show all #{page_context_word}.", type: 'button', data: { state: 'all' } }
|
||||
= link_to page_filter_path(state: 'all', label: true), id: 'state-all', title: "Show all #{page_context_word}.", data: { state: 'all' } do
|
||||
#{issuables_state_counter_text(type, :all)}
|
||||
|
|
|
@ -59,6 +59,11 @@ RSpec.describe 'Dashboard Issues', feature: true do
|
|||
expect(page).to have_content(other_issue.title)
|
||||
end
|
||||
|
||||
it 'state filter tabs work' do
|
||||
find('#state-closed').click
|
||||
expect(page).to have_current_path(issues_dashboard_url(assignee_id: current_user.id, scope: 'all', state: 'closed'), url: true)
|
||||
end
|
||||
|
||||
it_behaves_like "it has an RSS button with current_user's RSS token"
|
||||
it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
|
||||
end
|
||||
|
|
|
@ -106,6 +106,7 @@ describe('Filtered Search Manager', () => {
|
|||
|
||||
it('should blur button', () => {
|
||||
const e = {
|
||||
preventDefault: () => {},
|
||||
currentTarget: {
|
||||
blur: () => {},
|
||||
},
|
||||
|
@ -118,6 +119,7 @@ describe('Filtered Search Manager', () => {
|
|||
|
||||
it('should not call search if there is no state', () => {
|
||||
const e = {
|
||||
preventDefault: () => {},
|
||||
currentTarget: {
|
||||
blur: () => {},
|
||||
},
|
||||
|
@ -129,6 +131,7 @@ describe('Filtered Search Manager', () => {
|
|||
|
||||
it('should call search when there is state', () => {
|
||||
const e = {
|
||||
preventDefault: () => {},
|
||||
currentTarget: {
|
||||
blur: () => {},
|
||||
dataset: {
|
||||
|
|
Loading…
Reference in a new issue