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
Tatuya Kamada
gitlab-ce
Commits
a468bf34
Commit
a468bf34
authored
Dec 07, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gsmethells/gitlab-ce-sort-by-due-date'
parents
359d9460
ff08ce9c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
10 deletions
+48
-10
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
+29
-0
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 @
a468bf34
...
@@ -8,6 +8,7 @@ v 8.3.0 (unreleased)
...
@@ -8,6 +8,7 @@ v 8.3.0 (unreleased)
- Add ignore whitespace change option to commit view
- Add ignore whitespace change option to commit view
- Fire update hook from GitLab
- Fire update hook from GitLab
- Style warning about mentioning many people in a comment
- Style warning about mentioning many people in a comment
- Fix: sort milestones by due date once again (Greg Smethells)
- Don't show project fork event as "imported"
- Don't show project fork event as "imported"
- Add API endpoint to fetch merge request commits list
- Add API endpoint to fetch merge request commits list
- Expose events API with comment information and author info
- Expose events API with comment information and author info
...
...
app/controllers/concerns/global_milestones.rb
View file @
a468bf34
...
@@ -2,8 +2,10 @@ module GlobalMilestones
...
@@ -2,8 +2,10 @@ module GlobalMilestones
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
def
milestones
def
milestones
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
GlobalMilestone
.
build_collection
(
@milestones
)
@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
)
@milestones
=
Kaminari
.
paginate_array
(
@milestones
).
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
end
end
...
...
app/finders/milestones_finder.rb
View file @
a468bf34
class
MilestonesFinder
class
MilestonesFinder
def
execute
(
projects
,
params
)
def
execute
(
projects
,
params
)
milestones
=
Milestone
.
of_projects
(
projects
)
milestones
=
Milestone
.
of_projects
(
projects
)
milestones
=
milestones
.
order
(
"due_date ASC"
)
milestones
=
milestones
.
re
order
(
"due_date ASC"
)
case
params
[
:state
]
case
params
[
:state
]
when
'closed'
then
milestones
.
closed
when
'closed'
then
milestones
.
closed
...
...
app/helpers/milestones_helper.rb
View file @
a468bf34
...
@@ -28,7 +28,9 @@ module MilestonesHelper
...
@@ -28,7 +28,9 @@ module MilestonesHelper
Milestone
.
where
(
project_id:
@projects
)
Milestone
.
where
(
project_id:
@projects
)
end
.
active
end
.
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
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
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
...
...
app/models/global_milestone.rb
View file @
a468bf34
...
@@ -19,6 +19,14 @@ class GlobalMilestone
...
@@ -19,6 +19,14 @@ class GlobalMilestone
@title
.
to_slug
.
to_s
@title
.
to_slug
.
to_s
end
end
def
expired?
if
due_date
due_date
.
past?
else
false
end
end
def
projects
def
projects
milestones
.
map
{
|
milestone
|
milestone
.
project
}
milestones
.
map
{
|
milestone
|
milestone
.
project
}
end
end
...
@@ -98,4 +106,25 @@ class GlobalMilestone
...
@@ -98,4 +106,25 @@ class GlobalMilestone
def
complete?
def
complete?
total_items_count
==
closed_items_count
total_items_count
==
closed_items_count
end
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
end
app/views/dashboard/milestones/_milestone.html.haml
View file @
a468bf34
...
@@ -16,7 +16,10 @@
...
@@ -16,7 +16,10 @@
=
milestone_progress_bar
(
milestone
)
=
milestone_progress_bar
(
milestone
)
.row
.row
.col-sm-6
.col-sm-6
-
milestone
.
milestones
.
each
do
|
milestone
|
.expiration
=
link_to
milestone_path
(
milestone
)
do
=
render
'shared/milestone_expired'
,
milestone:
milestone
%span
.label.label-gray
.projects
=
milestone
.
project
.
name_with_namespace
-
milestone
.
milestones
.
each
do
|
milestone
|
=
link_to
milestone_path
(
milestone
)
do
%span
.label.label-gray
=
milestone
.
project
.
name_with_namespace
app/views/projects/milestones/_milestone.html.haml
View file @
a468bf34
...
@@ -18,11 +18,7 @@
...
@@ -18,11 +18,7 @@
.row
.row
.col-sm-6
.col-sm-6
-
if
milestone
.
expired?
and
not
milestone
.
closed?
=
render
'shared/milestone_expired'
,
milestone:
milestone
%span
.cred
(Expired)
-
if
milestone
.
expires_at
%span
=
milestone
.
expires_at
.col-sm-6
.col-sm-6
-
if
can?
(
current_user
,
:admin_milestone
,
milestone
.
project
)
and
milestone
.
active?
-
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
=
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 @
a468bf34
-
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