Render milestone progress with one helper method

This commit is contained in:
Dmitriy Zaporozhets 2015-03-09 15:20:32 -07:00
parent e89ffd546e
commit c6b2421127
7 changed files with 17 additions and 12 deletions

View file

@ -8,4 +8,15 @@ module MilestonesHelper
dashboard_milestones_path(opts) dashboard_milestones_path(opts)
end end
end end
def milestone_progress_bar(milestone)
options = {
class: 'progress-bar progress-bar-success',
style: "width: #{milestone.percent_complete}%;"
}
content_tag :div, class: 'progress' do
content_tag :div, nil, options
end
end
end end

View file

@ -28,8 +28,7 @@
= pluralize milestone.merge_requests_count, 'Merge Request' = pluralize milestone.merge_requests_count, 'Merge Request'
   
%span.light #{milestone.percent_complete}% complete %span.light #{milestone.percent_complete}% complete
.progress.progress-info = milestone_progress_bar(milestone)
.progress-bar{style: "width: #{milestone.percent_complete}%;"}
%div %div
%br %br
- milestone.milestones.each do |milestone| - milestone.milestones.each do |milestone|

View file

@ -39,8 +39,7 @@
#{@dashboard_milestone.closed_items_count} closed #{@dashboard_milestone.closed_items_count} closed
– –
#{@dashboard_milestone.open_items_count} open #{@dashboard_milestone.open_items_count} open
.progress.progress-info = milestone_progress_bar(@dashboard_milestone)
.progress-bar{style: "width: #{@dashboard_milestone.percent_complete}%;"}
%ul.nav.nav-tabs %ul.nav.nav-tabs
%li.active %li.active

View file

@ -36,8 +36,7 @@
= pluralize milestone.merge_requests_count, 'Merge Request' = pluralize milestone.merge_requests_count, 'Merge Request'
   
%span.light #{milestone.percent_complete}% complete %span.light #{milestone.percent_complete}% complete
.progress.progress-info = milestone_progress_bar(milestone)
.progress-bar{style: "width: #{milestone.percent_complete}%;"}
%div %div
%br %br
- milestone.milestones.each do |milestone| - milestone.milestones.each do |milestone|

View file

@ -45,8 +45,7 @@
#{@group_milestone.closed_items_count} closed #{@group_milestone.closed_items_count} closed
– –
#{@group_milestone.open_items_count} open #{@group_milestone.open_items_count} open
.progress.progress-info = milestone_progress_bar(@group_milestone)
.progress-bar{style: "width: #{@group_milestone.percent_complete}%;"}
%ul.nav.nav-tabs %ul.nav.nav-tabs
%li.active %li.active

View file

@ -23,5 +23,4 @@
= pluralize milestone.merge_requests.count, 'Merge Request' = pluralize milestone.merge_requests.count, 'Merge Request'
   
%span.light #{milestone.percent_complete}% complete %span.light #{milestone.percent_complete}% complete
.progress.progress-info = milestone_progress_bar(milestone)
.progress-bar{style: "width: #{milestone.percent_complete}%;"}

View file

@ -43,8 +43,7 @@
   
%span.light #{@milestone.percent_complete}% complete %span.light #{@milestone.percent_complete}% complete
%span.pull-right= @milestone.expires_at %span.pull-right= @milestone.expires_at
.progress.progress-info = milestone_progress_bar(@milestone)
.progress-bar{style: "width: #{@milestone.percent_complete}%;"}
%ul.nav.nav-tabs %ul.nav.nav-tabs