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
iv
gitlab-ce
Commits
dbbd2b86
Commit
dbbd2b86
authored
Nov 30, 2015
by
Greg Smethells
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sort milestones by due_date
parent
76b2250c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
11 deletions
+49
-11
CHANGELOG
CHANGELOG
+1
-0
app/controllers/concerns/global_milestones.rb
app/controllers/concerns/global_milestones.rb
+2
-0
app/finders/milestones_finder.rb
app/finders/milestones_finder.rb
+1
-1
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+2
-0
app/models/global_milestone.rb
app/models/global_milestone.rb
+30
-1
app/views/dashboard/milestones/_milestone.html.haml
app/views/dashboard/milestones/_milestone.html.haml
+7
-4
app/views/projects/milestones/_milestone.html.haml
app/views/projects/milestones/_milestone.html.haml
+1
-5
app/views/shared/_milestone_expired.html.haml
app/views/shared/_milestone_expired.html.haml
+5
-0
No files found.
CHANGELOG
View file @
dbbd2b86
...
...
@@ -6,6 +6,7 @@ v 8.3.0 (unreleased)
- Trim leading and trailing whitespace of milestone and issueable titles (Jose Corcuera)
- Add ignore whitespace change option to commit view
- Fire update hook from GitLab
- Fix: sort milestones by due date once again (Greg Smethells)
v 8.2.2
- Fix 404 in redirection after removing a project (Stan Hu)
...
...
app/controllers/concerns/global_milestones.rb
View file @
dbbd2b86
...
...
@@ -2,8 +2,10 @@ module GlobalMilestones
extend
ActiveSupport
::
Concern
def
milestones
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
GlobalMilestone
.
build_collection
(
@milestones
)
@milestones
=
@milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
@milestones
=
Kaminari
.
paginate_array
(
@milestones
).
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
end
...
...
app/finders/milestones_finder.rb
View file @
dbbd2b86
class
MilestonesFinder
def
execute
(
projects
,
params
)
milestones
=
Milestone
.
of_projects
(
projects
)
milestones
=
milestones
.
order
(
"due_date ASC"
)
milestones
=
milestones
.
re
order
(
"due_date ASC"
)
case
params
[
:state
]
when
'closed'
then
milestones
.
closed
...
...
app/helpers/milestones_helper.rb
View file @
dbbd2b86
...
...
@@ -28,7 +28,9 @@ module MilestonesHelper
Milestone
.
where
(
project_id:
@projects
)
end
.
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
grouped_milestones
.
unshift
(
Milestone
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
...
...
app/models/global_milestone.rb
View file @
dbbd2b86
...
...
@@ -19,6 +19,14 @@ class GlobalMilestone
@title
.
parameterize
end
def
expired?
if
due_date
due_date
.
past?
else
false
end
end
def
projects
milestones
.
map
{
|
milestone
|
milestone
.
project
}
end
...
...
@@ -98,4 +106,25 @@ class GlobalMilestone
def
complete?
total_items_count
==
closed_items_count
end
def
due_date
return
@due_date
if
defined?
(
@due_date
)
@due_date
=
if
@milestones
.
all?
{
|
x
|
x
.
due_date
==
@milestones
.
first
.
due_date
}
@milestones
.
first
.
due_date
else
nil
end
end
def
expires_at
if
due_date
if
due_date
.
past?
"expired at
#{
due_date
.
stamp
(
"Aug 21, 2011"
)
}
"
else
"expires at
#{
due_date
.
stamp
(
"Aug 21, 2011"
)
}
"
end
end
end
end
\ No newline at end of file
app/views/dashboard/milestones/_milestone.html.haml
View file @
dbbd2b86
...
...
@@ -16,6 +16,9 @@
=
milestone_progress_bar
(
milestone
)
.row
.col-sm-6
.expiration
=
render
'shared/milestone_expired'
,
milestone:
milestone
.projects
-
milestone
.
milestones
.
each
do
|
milestone
|
=
link_to
milestone_path
(
milestone
)
do
%span
.label.label-gray
...
...
app/views/projects/milestones/_milestone.html.haml
View file @
dbbd2b86
...
...
@@ -18,11 +18,7 @@
.row
.col-sm-6
-
if
milestone
.
expired?
and
not
milestone
.
closed?
%span
.cred
(Expired)
-
if
milestone
.
expires_at
%span
=
milestone
.
expires_at
=
render
'shared/milestone_expired'
,
milestone:
milestone
.col-sm-6
-
if
can?
(
current_user
,
:admin_milestone
,
milestone
.
project
)
and
milestone
.
active?
=
link_to
edit_namespace_project_milestone_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
),
class:
"btn btn-xs edit-milestone-link btn-grouped"
do
...
...
app/views/shared/_milestone_expired.html.haml
0 → 100644
View file @
dbbd2b86
-
if
milestone
.
expired?
and
not
milestone
.
closed?
%span
.cred
(Expired)
-
if
milestone
.
expires_at
%span
=
milestone
.
expires_at
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