diff options
author | Dan Rowden <hello@danrowden.com> | 2016-07-22 12:18:38 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-09-07 23:27:14 +0300 |
commit | bb5a7ef08c1f7bcb2a1ef2c930a443014c3ac084 (patch) | |
tree | b95193a1ddaf0faa77be825d80a7f40350adfce5 | |
parent | 13a91b560e74b457eab20fe2c48e0af5afcf41b3 (diff) |
Show badges in Milestone tabs and padding in Milestone list (both to match Issues page)
-rw-r--r-- | app/assets/stylesheets/pages/milestone.scss | 16 | ||||
-rw-r--r-- | app/helpers/milestones_helper.rb | 13 | ||||
-rw-r--r-- | app/views/shared/_milestones_filter.html.haml | 3 |
3 files changed, 26 insertions, 6 deletions
diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index b94f524b513..94b2a0d88a1 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -2,13 +2,17 @@ max-width: 90%; } -li.milestone { - h4 { - font-weight: bold; - } +.milestones { + .milestone { + padding: 10px 16px; + + h4 { + font-weight: bold; + } - .progress { - height: 6px; + .progress { + height: 6px; + } } } diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index b3e6e468ecd..9a71761a55c 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -35,6 +35,19 @@ module MilestonesHelper milestone.issues.with_label(label.title).send(state).size end + def milestone_count_by_state(project, state) + if project.nil? + nil + else + case state + when 'all' then @project.milestones.size + when 'closed' then @project.milestones.closed.size + when 'opened' then @project.milestones.active.size + else nil + end + end + end + def milestone_progress_bar(milestone) options = { class: 'progress-bar progress-bar-success', diff --git a/app/views/shared/_milestones_filter.html.haml b/app/views/shared/_milestones_filter.html.haml index cf16c203f9c..ba9e2881017 100644 --- a/app/views/shared/_milestones_filter.html.haml +++ b/app/views/shared/_milestones_filter.html.haml @@ -2,9 +2,12 @@ %li{class: ("active" if params[:state].blank? || params[:state] == 'opened')} = link_to milestones_filter_path(state: 'opened') do Open + %span.badge #{milestone_count_by_state(@project, 'opened')} %li{class: ("active" if params[:state] == 'closed')} = link_to milestones_filter_path(state: 'closed') do Closed + %span.badge #{milestone_count_by_state(@project, 'closed')} %li{class: ("active" if params[:state] == 'all')} = link_to milestones_filter_path(state: 'all') do All + %span.badge #{milestone_count_by_state(@project, 'all')} |