Module: ProgressBarSnapshotHelper
- Defined in:
- lib/progress_bar_snapshot_helper.rb
Overview
need a controler action to actually do the image generation and sending of the image blob. See README for examples.
Instance Method Summary collapse
Instance Method Details
#progress_bar_png_tag(percent, colors, opts = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/progress_bar_snapshot_helper.rb', line 8 def (percent, colors, opts = {}) url = { :percentages => percent.join(","), :colors => colors.join(","), } = url.merge(opts) # extra html attributes for the image tag attributes = %(class="#{options[:class] || 'progressbar'}" alt="#{percent.sum.round}%" ) attributes << %(title="#{options[:title]}" ) if [:title] %(<img src="#{ url_for options }" #{attributes}/>) end |