Commit 340b8a10 authored by Jacob Schatz's avatar Jacob Schatz

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
parents 759a38d6 92950217
...@@ -487,6 +487,7 @@ class FilteredSearchManager { ...@@ -487,6 +487,7 @@ class FilteredSearchManager {
} }
searchState(e) { searchState(e) {
e.preventDefault();
const target = e.currentTarget; const target = e.currentTarget;
// remove focus outline after click // remove focus outline after click
target.blur(); target.blur();
......
...@@ -45,8 +45,7 @@ ...@@ -45,8 +45,7 @@
li { li {
display: flex; display: flex;
a, a {
.btn-link {
padding: $gl-btn-padding; padding: $gl-btn-padding;
padding-bottom: 11px; padding-bottom: 11px;
font-size: 14px; font-size: 14px;
...@@ -68,29 +67,7 @@ ...@@ -68,29 +67,7 @@
} }
} }
.btn-link { &.active a {
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 {
border-bottom: 2px solid $link-underline-blue; border-bottom: 2px solid $link-underline-blue;
color: $black; color: $black;
font-weight: 600; font-weight: 600;
......
- type = local_assigns.fetch(:type, :issues) - type = local_assigns.fetch(:type, :issues)
- page_context_word = type.to_s.humanize(capitalize: false) - page_context_word = type.to_s.humanize(capitalize: false)
- issuables = @issues || @merge_requests - issuables = @issues || @merge_requests
- closed_title = 'Filter by issues that are currently closed.'
%ul.nav-links.issues-state-filters %ul.nav-links.issues-state-filters
%li{ class: active_when(params[:state] == 'opened') }> %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)} #{issuables_state_counter_text(type, :opened)}
- if type == :merge_requests - if type == :merge_requests
%li{ class: active_when(params[:state] == 'merged') }> %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)} #{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') }>
= 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
%li{ class: active_when(params[:state] == 'closed') }> #{issuables_state_counter_text(type, :closed)}
%button.btn.btn-link{ id: 'state-closed', title: closed_title, type: 'button', data: { state: 'closed' } } - else
#{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 issues that are currently closed.', data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed)}
%li{ class: active_when(params[:state] == 'all') }> %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)} #{issuables_state_counter_text(type, :all)}
...@@ -59,6 +59,11 @@ RSpec.describe 'Dashboard Issues', feature: true do ...@@ -59,6 +59,11 @@ RSpec.describe 'Dashboard Issues', feature: true do
expect(page).to have_content(other_issue.title) expect(page).to have_content(other_issue.title)
end 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 "it has an RSS button with current_user's RSS token"
it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
end end
......
...@@ -106,6 +106,7 @@ describe('Filtered Search Manager', () => { ...@@ -106,6 +106,7 @@ describe('Filtered Search Manager', () => {
it('should blur button', () => { it('should blur button', () => {
const e = { const e = {
preventDefault: () => {},
currentTarget: { currentTarget: {
blur: () => {}, blur: () => {},
}, },
...@@ -118,6 +119,7 @@ describe('Filtered Search Manager', () => { ...@@ -118,6 +119,7 @@ describe('Filtered Search Manager', () => {
it('should not call search if there is no state', () => { it('should not call search if there is no state', () => {
const e = { const e = {
preventDefault: () => {},
currentTarget: { currentTarget: {
blur: () => {}, blur: () => {},
}, },
...@@ -129,6 +131,7 @@ describe('Filtered Search Manager', () => { ...@@ -129,6 +131,7 @@ describe('Filtered Search Manager', () => {
it('should call search when there is state', () => { it('should call search when there is state', () => {
const e = { const e = {
preventDefault: () => {},
currentTarget: { currentTarget: {
blur: () => {}, blur: () => {},
dataset: { dataset: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment