@@ -609,15 +609,16 module ApplicationHelper | |||||
609 |
|
609 | |||
610 | def progress_bar(pcts, options={}) |
|
610 | def progress_bar(pcts, options={}) | |
611 | pcts = [pcts, pcts] unless pcts.is_a?(Array) |
|
611 | pcts = [pcts, pcts] unless pcts.is_a?(Array) | |
|
612 | pcts = pcts.collect(&:round) | |||
612 | pcts[1] = pcts[1] - pcts[0] |
|
613 | pcts[1] = pcts[1] - pcts[0] | |
613 | pcts << (100 - pcts[1] - pcts[0]) |
|
614 | pcts << (100 - pcts[1] - pcts[0]) | |
614 | width = options[:width] || '100px;' |
|
615 | width = options[:width] || '100px;' | |
615 | legend = options[:legend] || '' |
|
616 | legend = options[:legend] || '' | |
616 | content_tag('table', |
|
617 | content_tag('table', | |
617 | content_tag('tr', |
|
618 | content_tag('tr', | |
618 |
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0] |
|
619 | (pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : '') + | |
619 |
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1] |
|
620 | (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : '') + | |
620 |
(pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2] |
|
621 | (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : '') | |
621 | ), :class => 'progress', :style => "width: #{width};") + |
|
622 | ), :class => 'progress', :style => "width: #{width};") + | |
622 | content_tag('p', legend, :class => 'pourcent') |
|
623 | content_tag('p', legend, :class => 'pourcent') | |
623 | end |
|
624 | end |
General Comments 0
You need to be logged in to leave comments.
Login now