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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f86432a2
Commit
f86432a2
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
ab85ad6d
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 @
f86432a2
...
@@ -124,6 +124,10 @@ module IssuablesHelper
...
@@ -124,6 +124,10 @@ module IssuablesHelper
end
end
end
end
def
issuable_filters_present
params
[
:search
]
||
params
[
:author_id
]
||
params
[
:assignee_id
]
||
params
[
:milestone_title
]
||
params
[
:label_name
]
||
params
[
:weight
]
end
def
issuables_count_for_state
(
issuable_type
,
state
)
def
issuables_count_for_state
(
issuable_type
,
state
)
issuables_finder
=
public_send
(
"
#{
issuable_type
}
_finder"
)
issuables_finder
=
public_send
(
"
#{
issuable_type
}
_finder"
)
issuables_finder
.
params
[
:state
]
=
state
issuables_finder
.
params
[
:state
]
=
state
...
...
app/views/shared/issuable/_filter.html.haml
View file @
f86432a2
...
@@ -41,8 +41,9 @@
...
@@ -41,8 +41,9 @@
%a
{
href:
"#"
,
data:
{
id:
weight
},
class:
(
"is-active"
if
params
[
:weight
]
==
weight
.
to_s
)}
%a
{
href:
"#"
,
data:
{
id:
weight
},
class:
(
"is-active"
if
params
[
:weight
]
==
weight
.
to_s
)}
=
weight
=
weight
.filter-item.inline.reset-filters
-
if
issuable_filters_present
%a
{
href:
page_filter_path
(
without:
[
:assignee_id
,
:author_id
,
:milestone_title
,
:label_name
,
:search
])}
Reset filters
.filter-item.inline.reset-filters
%a
{
href:
page_filter_path
(
without:
[
:assignee_id
,
:author_id
,
:milestone_title
,
:label_name
,
:weight
,
:search
])}
Reset filters
.pull-right
.pull-right
-
if
boards_page
-
if
boards_page
...
...
spec/features/issues/reset_filters_spec.rb
View file @
f86432a2
...
@@ -75,6 +75,14 @@ feature 'Issues filter reset button', feature: true, js: true do
...
@@ -75,6 +75,14 @@ feature 'Issues filter reset button', feature: true, js: true do
end
end
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
def
reset_filters
find
(
'.reset-filters'
).
click
find
(
'.reset-filters'
).
click
end
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