diff options
author | Valery Sizov <valery@gitlab.com> | 2016-11-15 20:48:30 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-11-23 14:41:04 +0300 |
commit | 3789cfe056c1d8a5fb91267cc2b1dd0f9f5902a9 (patch) | |
tree | 45314bfcb16ba7095e209d3a1f3eb9be2016b2a6 /app/helpers/milestones_helper.rb | |
parent | d7eeb6df51ffe2ad864ef49d0e465b88ab158520 (diff) |
Add a starting date to milestones
Diffstat (limited to 'app/helpers/milestones_helper.rb')
-rw-r--r-- | app/helpers/milestones_helper.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 83a2a4ad3ec..729928ce1dd 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -86,6 +86,30 @@ module MilestonesHelper days = milestone.remaining_days content = content_tag(:strong, days) content << " #{'day'.pluralize(days)} remaining" + elsif milestone.upcoming? + content_tag(:strong, 'Upcoming') + elsif milestone.start_date && milestone.start_date.past? + days = milestone.elapsed_days + content = content_tag(:strong, days) + content << " #{'day'.pluralize(days)} elapsed" + end + end + + def milestone_date_range(milestone) + if milestone.start_date && milestone.due_date + "#{milestone.start_date.to_s(:medium)} - #{milestone.due_date.to_s(:medium)}" + elsif milestone.due_date + if milestone.due_date.past? + "expired on #{milestone.due_date.to_s(:medium)}" + else + "expires on #{milestone.due_date.to_s(:medium)}" + end + elsif milestone.start_date + if milestone.start_date.past? + "started on #{milestone.start_date.to_s(:medium)}" + else + "starts on #{milestone.start_date.to_s(:medium)}" + end end end end |