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
Kazuhiko Shiozaki
gitlab-ce
Commits
b9d13c11
Commit
b9d13c11
authored
Mar 10, 2016
by
tiagonbotelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implements upcoming filter in milstones
parent
5a586f36
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+8
-0
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+1
-0
app/models/milestone.rb
app/models/milestone.rb
+1
-0
No files found.
app/finders/issuable_finder.rb
View file @
b9d13c11
...
@@ -94,6 +94,10 @@ class IssuableFinder
...
@@ -94,6 +94,10 @@ class IssuableFinder
params
[
:milestone_title
].
present?
params
[
:milestone_title
].
present?
end
end
def
upcoming?
params
[
:milestone_title
]
==
'Upcoming'
end
def
filter_by_no_milestone?
def
filter_by_no_milestone?
milestones?
&&
params
[
:milestone_title
]
==
Milestone
::
None
.
title
milestones?
&&
params
[
:milestone_title
]
==
Milestone
::
None
.
title
end
end
...
@@ -248,6 +252,10 @@ class IssuableFinder
...
@@ -248,6 +252,10 @@ class IssuableFinder
if
milestones?
if
milestones?
if
filter_by_no_milestone?
if
filter_by_no_milestone?
items
=
items
.
where
(
milestone_id:
[
-
1
,
nil
])
items
=
items
.
where
(
milestone_id:
[
-
1
,
nil
])
elsif
upcoming?
upcoming
=
Milestone
.
where
(
project_id:
projects
)
.
where
(
'due_date > ?'
,
Time
.
now
).
order
(
due_date: :asc
).
first
items
=
items
.
joins
(
:milestone
).
where
(
milestone:
{
title:
upcoming
.
title
})
else
else
items
=
items
.
joins
(
:milestone
).
where
(
milestones:
{
title:
params
[
:milestone_title
]
})
items
=
items
.
joins
(
:milestone
).
where
(
milestones:
{
title:
params
[
:milestone_title
]
})
...
...
app/helpers/milestones_helper.rb
View file @
b9d13c11
...
@@ -59,6 +59,7 @@ module MilestonesHelper
...
@@ -59,6 +59,7 @@ module MilestonesHelper
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
grouped_milestones
.
unshift
(
Milestone
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
grouped_milestones
.
unshift
(
Milestone
::
Upcoming
)
options_from_collection_for_select
(
grouped_milestones
,
'name'
,
'title'
,
params
[
:milestone_title
])
options_from_collection_for_select
(
grouped_milestones
,
'name'
,
'title'
,
params
[
:milestone_title
])
end
end
...
...
app/models/milestone.rb
View file @
b9d13c11
...
@@ -19,6 +19,7 @@ class Milestone < ActiveRecord::Base
...
@@ -19,6 +19,7 @@ class Milestone < ActiveRecord::Base
MilestoneStruct
=
Struct
.
new
(
:title
,
:name
,
:id
)
MilestoneStruct
=
Struct
.
new
(
:title
,
:name
,
:id
)
None
=
MilestoneStruct
.
new
(
'No Milestone'
,
'No Milestone'
,
0
)
None
=
MilestoneStruct
.
new
(
'No Milestone'
,
'No Milestone'
,
0
)
Any
=
MilestoneStruct
.
new
(
'Any Milestone'
,
''
,
-
1
)
Any
=
MilestoneStruct
.
new
(
'Any Milestone'
,
''
,
-
1
)
Upcoming
=
MilestoneStruct
.
new
(
'Upcoming'
,
''
,
-
2
)
include
InternalId
include
InternalId
include
Sortable
include
Sortable
...
...
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