Module: RailsBootstrapHelpers::Helpers::AlertHelper
- Defined in:
- lib/rails-bootstrap-helpers/helpers/alert_helper.rb
Instance Method Summary collapse
-
#bs_alert(text, options = {}) ⇒ Object
Renders a Bootstrap alert with the given text.
Instance Method Details
#bs_alert(text, options = {}) ⇒ Object
Renders a Bootstrap alert with the given text.
Options
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rails-bootstrap-helpers/helpers/alert_helper.rb', line 13 def bs_alert (text, = {}) cls = "alert" if type = [:type] type = type.to_s if type == "notice" type = "success" end unless type == "warning" || type == "default" cls << " alert-#{type}" end end if type = [:block] cls << " alert-block" end if = [:dismiss_button] content_tag :div, class: cls do = content_tag :button, "×", type: "button", class: "close", :"data-dismiss" => "alert" + text end else content_tag :div, text, class: cls end end |