Module: Card::Set::Abstract::ProgressBar::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod024-bootstrap/abstract/progress_bar.rb
Instance Method Summary collapse
Instance Method Details
#progress_bar(*sections) ⇒ Object
18 19 20 21 22 23 24 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/abstract/progress_bar.rb', line 18 def *sections wrap_with :div, class: "progress" do Array.wrap(sections).map do |section_args| section_args end.join end end |
#progress_bar_section(args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/abstract/progress_bar.rb', line 26 def args add_class args, "progress-bar" value = args.delete :value label = args.delete(:label) || "#{value}%" wrap_value = wrap_with :span, label, class: "progress-value" body = args.delete(:body) || wrap_value wrap_with :div, body, args.reverse_merge( role: "progressbar", style: "width: #{value}%", "aria-valuenow" => value, "aria-valuemin" => 0, "aria-valuemax" => 100 ) end |
#view: progress_bar ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/abstract/progress_bar.rb', line 9 view :progress_bar do value = card.content if value.number? value: value else "Only card with numeric content can be shown as progress bar." end end |