Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
44361930
Commit
44361930
authored
Sep 23, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added `issuable_filters_present` to check for active filters before rendering the reset button
Added tests
parent
49d6ca62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+4
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+3
-2
spec/features/issues/reset_filters_spec.rb
spec/features/issues/reset_filters_spec.rb
+8
-0
No files found.
app/helpers/issuables_helper.rb
View file @
44361930
...
...
@@ -124,6 +124,10 @@ module IssuablesHelper
end
end
def
issuable_filters_present
params
[
:search
]
||
params
[
:author_id
]
||
params
[
:assignee_id
]
||
params
[
:milestone_title
]
||
params
[
:label_name
]
end
def
issuables_count_for_state
(
issuable_type
,
state
)
issuables_finder
=
public_send
(
"
#{
issuable_type
}
_finder"
)
issuables_finder
.
params
[
:state
]
=
state
...
...
app/views/shared/issuable/_filter.html.haml
View file @
44361930
...
...
@@ -29,8 +29,9 @@
.filter-item.inline.labels-filter
=
render
"shared/issuable/label_dropdown"
,
selected:
finder
.
labels
.
select
(
:title
).
uniq
,
use_id:
false
,
selected_toggle:
params
[
:label_name
],
data_options:
{
field_name:
"label_name[]"
}
.filter-item.inline.reset-filters
%a
{
href:
page_filter_path
(
without:
[
:assignee_id
,
:author_id
,
:milestone_title
,
:label_name
,
:search
])}
Reset filters
-
if
issuable_filters_present
.filter-item.inline.reset-filters
%a
{
href:
page_filter_path
(
without:
[
:assignee_id
,
:author_id
,
:milestone_title
,
:label_name
,
:search
])}
Reset filters
.pull-right
-
if
boards_page
...
...
spec/features/issues/reset_filters_spec.rb
View file @
44361930
...
...
@@ -75,6 +75,14 @@ feature 'Issues filter reset button', feature: true, js: true do
end
end
context
'when no filters have been applied'
do
it
'the reset link should not be visible'
do
visit_issues
(
project
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
2
)
expect
(
page
).
not_to
have_css
'.reset_filters'
end
end
def
reset_filters
find
(
'.reset-filters'
).
click
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment