Module: Bootstrap::AlertHelper
- Defined in:
- app/helpers/bootstrap/alert_helper.rb
Overview
Rails helpers for producing Bootstrap alert boxes.
See: http://twitter.github.io/bootstrap/components.html#alerts
Constant Summary collapse
- InvalidAlertTypeError =
Class.new(StandardError)
- ALERT_ATTRIBUTES =
%w(default success info warning danger)
- COMPILED_ALERT_CLASSES =
ALERT_ATTRIBUTES.map{|a| "alert-#{a}"}
Instance Method Summary collapse
-
#alert(text, alert_type, options = {}) ⇒ String
Returns html for alert.
-
#alert_close(show = true) ⇒ String
Return an alert box close button.
-
#alert_heading(heading) ⇒ String
Return an alert heading.
Instance Method Details
#alert(text, alert_type, options = {}) ⇒ String
Returns html for alert
#alert_close(show = true) ⇒ String
Return an alert box close button
51 52 53 54 |
# File 'app/helpers/bootstrap/alert_helper.rb', line 51 def alert_close(show=true) return '' unless show content_tag(:button, '×'.html_safe, class: 'close', data: {dismiss: 'alert'}, aria: {label: "Close"}) end |
#alert_heading(heading) ⇒ String
Return an alert heading
59 60 61 62 |
# File 'app/helpers/bootstrap/alert_helper.rb', line 59 def alert_heading(heading) return '' unless heading.present? content_tag(:h4, heading) end |