Module: Bh::ProgressBarHelper

Includes:
BaseHelper
Defined in:
lib/bh/helpers/progress_bar_helper.rb

Overview

Provides methods to include progress bars.

Instance Method Summary collapse

Instance Method Details

#progress_bar(options = {}) ⇒ Object

Returns an HTML block tag that follows the Bootstrap documentation on how to display progress bars.

Options Hash (options):

  • :label (Boolean, #to_s) — default: false

    the label to display on top of the progress bar. If set to false, the label is hidden. If set to true, the label is generated from the percentage value. Any other provided value is used directly as the label.

  • :striped (Boolean) — default: false

    whether to display a striped version of the progress bar (rather than solid color).

  • :animated (Boolean) — default: false

    whether to display an animated version of the progress bar (rather than solid color).

  • :context (#to_s) — default: :default

    the contextual alternative to apply to the progress bar depending on its importance. Can be :success, :info, :warning or :danger.



25
26
27
28
29
# File 'lib/bh/helpers/progress_bar_helper.rb', line 25

def progress_bar(options = {})
   :div, class: :progress do
    safe_join Array.wrap(options).map{|bar| progress_bar_string bar}, "\n"
  end
end