BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
10 deletions
+48
-10
CHANGELOG
CHANGELOG
+1
-0
global_milestones.rb
app/controllers/concerns/global_milestones.rb
+2
-0
milestones_finder.rb
app/finders/milestones_finder.rb
+1
-1
milestones_helper.rb
app/helpers/milestones_helper.rb
+2
-0
global_milestone.rb
app/models/global_milestone.rb
+29
-0
_milestone.html.haml
app/views/dashboard/milestones/_milestone.html.haml
+7
-4
_milestone.html.haml
app/views/projects/milestones/_milestone.html.haml
+1
-5
_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)
- Add ignore whitespace change option to commit view
- Fire update hook from GitLab
- 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"
- Add API endpoint to fetch merge request commits list
- Expose events API with comment information and author info
...
...
app/controllers/concerns/global_milestones.rb
View file @
a468bf34
...
...
@@ -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 @
a468bf34
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 @
a468bf34
...
...
@@ -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 @
a468bf34
...
...
@@ -19,6 +19,14 @@ class GlobalMilestone
@title
.
to_slug
.
to_s
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
app/views/dashboard/milestones/_milestone.html.haml
View file @
a468bf34
...
...
@@ -16,7 +16,10 @@
=
milestone_progress_bar
(
milestone
)
.row
.col-sm-6
-
milestone
.
milestones
.
each
do
|
milestone
|
=
link_to
milestone_path
(
milestone
)
do
%span
.label.label-gray
=
milestone
.
project
.
name_with_namespace
.expiration
=
render
'shared/milestone_expired'
,
milestone:
milestone
.projects
-
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 @@
.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 @
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