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
4eec96eb
Commit
4eec96eb
authored
Mar 02, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue_13623' into 'master'
Show days remaining instead of elapsed time for Milestone. Closes #13623 See merge request !2978
parents
ca8a44be
03d58f56
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
14 deletions
+15
-14
milestone.scss
app/assets/stylesheets/pages/milestone.scss
+1
-1
milestones_helper.rb
app/helpers/milestones_helper.rb
+10
-0
milestone.rb
app/models/milestone.rb
+3
-10
show.html.haml
app/views/projects/milestones/show.html.haml
+1
-3
No files found.
app/assets/stylesheets/pages/milestone.scss
View file @
4eec96eb
...
@@ -39,7 +39,7 @@ li.milestone {
...
@@ -39,7 +39,7 @@ li.milestone {
margin-right
:
10px
;
margin-right
:
10px
;
}
}
.
time-elapsed
{
.
remaining-days
{
color
:
$orange-light
;
color
:
$orange-light
;
}
}
}
}
...
...
app/helpers/milestones_helper.rb
View file @
4eec96eb
...
@@ -36,4 +36,14 @@ module MilestonesHelper
...
@@ -36,4 +36,14 @@ module MilestonesHelper
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
def
milestone_remaining_days
(
milestone
)
if
milestone
.
expired?
content_tag
(
:strong
,
'expired'
)
elsif
milestone
.
due_date
days
=
milestone
.
remaining_days
content
=
content_tag
(
:strong
,
days
)
content
<<
"
#{
'day'
.
pluralize
(
days
)
}
remaining"
end
end
end
end
app/models/milestone.rb
View file @
4eec96eb
...
@@ -110,17 +110,10 @@ class Milestone < ActiveRecord::Base
...
@@ -110,17 +110,10 @@ class Milestone < ActiveRecord::Base
0
0
end
end
# Returns the elapsed time (in percent) since the Milestone creation date until today.
def
remaining_days
# If the Milestone doesn't have a due_date then returns 0 since we can't calculate the elapsed time.
return
0
if
!
due_date
||
expired?
# If the Milestone is overdue then it returns 100%.
def
percent_time_used
return
0
unless
due_date
return
100
if
expired?
duration
=
((
created_at
-
due_date
.
to_datetime
)
/
1
.
day
)
(
due_date
-
Date
.
today
).
to_i
days_elapsed
=
((
created_at
-
Time
.
now
)
/
1
.
day
)
((
days_elapsed
.
to_f
/
duration
)
*
100
).
floor
end
end
def
expires_at
def
expires_at
...
...
app/views/projects/milestones/show.html.haml
View file @
4eec96eb
...
@@ -60,9 +60,7 @@
...
@@ -60,9 +60,7 @@
%strong
==
#{
@milestone
.
percent_complete
}
%
%strong
==
#{
@milestone
.
percent_complete
}
%
complete
complete
%span
.milestone-stat
%span
.milestone-stat
%span
.time-elapsed
%span
.remaining-days
=
milestone_remaining_days
(
@milestone
)
%strong
==
#{
@milestone
.
percent_time_used
}
%
time elapsed
%span
.pull-right.tab-issues-buttons
%span
.pull-right.tab-issues-buttons
-
if
can?
(
current_user
,
:create_issue
,
@project
)
-
if
can?
(
current_user
,
:create_issue
,
@project
)
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn btn-grouped"
,
title:
"New Issue"
do
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn btn-grouped"
,
title:
"New Issue"
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