Sha256: ffd3f0281e9b993af0522a86f09999ed9d39966325b44b613de3cffc773ab0ba
Contents?: true
Size: 849 Bytes
Versions: 13
Compression:
Stored size: 849 Bytes
Contents
format :html do view :progress_bar do value = card.content if value.number? progress_bar value: value else "Only card with numeric content can be shown as progress bar." end end def progress_bar *sections wrap_with :div, class: "progress" do Array.wrap(sections).map do |section_args| progress_bar_section section_args end.join end end def progress_bar_section 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 end
Version data entries
13 entries across 13 versions & 1 rubygems