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
761e950c
Commit
761e950c
authored
Feb 09, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new filters and fixed spec
parent
e8b5d816
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
9 deletions
+19
-9
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+17
-3
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+1
-5
spec/features/issues/filter_by_weight_spec.rb
spec/features/issues/filter_by_weight_spec.rb
+1
-1
No files found.
app/finders/issuable_finder.rb
View file @
761e950c
...
...
@@ -268,11 +268,25 @@ class IssuableFinder
end
def
by_weight
(
items
)
if
params
[
:weight
].
present?
items
=
items
.
where
(
weight:
params
[
:weight
])
return
items
if
filter_by_any_weight?
||
!
weights?
if
filter_by_no_weight?
items
.
where
(
weight:
[
-
1
,
nil
])
else
items
.
where
(
weight:
params
[
:weight
])
end
end
items
def
weights?
params
[
:weight
].
present?
end
def
filter_by_no_weight?
params
[
:weight
]
==
Issue
::
WEIGHT_NONE
end
def
filter_by_any_weight?
params
[
:weight
]
==
Issue
::
WEIGHT_ANY
end
def
current_user_related?
...
...
app/helpers/issues_helper.rb
View file @
761e950c
...
...
@@ -140,11 +140,7 @@ module IssuesHelper
end
def
projects_weight_options
(
selected
=
nil
)
options
=
(
Issue
::
WEIGHT_RANGE
).
map
do
|
i
|
[
i
,
i
]
end
options
.
unshift
([
'Any'
,
nil
])
options
=
Issue
.
weight_options
.
map
{
|
op
|
[
op
]
*
2
}
options_for_select
(
options
,
selected
||
params
[
:weight
])
end
...
...
spec/features/issues/filter_by_weight_spec.rb
View file @
761e950c
...
...
@@ -24,7 +24,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues
(
project
)
filter_by_weight
(
Issue
::
WEIGHT_ANY
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
3
)
end
scenario
'filters by a specific Weight'
,
js:
true
do
...
...
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