Module: RailsBootstrapHelpers::Helpers::LabelHelper
- Includes:
- OptionsHelper
- Defined in:
- lib/rails-bootstrap-helpers/helpers/label_helper.rb
Instance Method Summary collapse
-
#bs_label(text, style = :default, options = {}) ⇒ Object
Renders a Bootstrap label.
Methods included from OptionsHelper
Instance Method Details
#bs_label(text, style = :default, options = {}) ⇒ Object
Renders a Bootstrap label.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails-bootstrap-helpers/helpers/label_helper.rb', line 11 def bs_label (text, style = :default, = {}) normalize_style = lambda do |style| style = style.to_s case style when "inactive" then "default" when "active" then "success" when "error" then "important" else style end end = .dup style = normalize_style.call(style) cls = [:class] cls ||= "label" cls << " label-" + style unless style == "default" [:class] = cls content_tag :span, text, () end |