Module: Card::Set::All::RichHtml::Alert::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- tmpsets/set/mod021-standard/all/rich_html/alert.rb
Instance Method Summary collapse
-
#alert(alert_type, dismissable = false, disappear = false, args = {}) ⇒ Object
alert_types: 'success', 'info', 'warning', 'danger'.
- #alert_classes(alert_type, dismissable, disappear) ⇒ Object
- #alert_close_button ⇒ Object
Instance Method Details
#alert(alert_type, dismissable = false, disappear = false, args = {}) ⇒ Object
alert_types: 'success', 'info', 'warning', 'danger'
10 11 12 13 14 15 |
# File 'tmpsets/set/mod021-standard/all/rich_html/alert.rb', line 10 def alert alert_type, dismissable=false, disappear=false, args={} add_class args, alert_classes(alert_type, dismissable, disappear) wrap_with :div, args.merge(role: "alert") do [( if dismissable), output(yield)] end end |
#alert_classes(alert_type, dismissable, disappear) ⇒ Object
17 18 19 20 21 22 |
# File 'tmpsets/set/mod021-standard/all/rich_html/alert.rb', line 17 def alert_classes alert_type, dismissable, disappear classes = ["alert", "alert-#{alert_type}"] classes << "alert-dismissible " if dismissable classes << "_disappear" if disappear classy classes end |
#alert_close_button ⇒ Object
24 25 26 27 28 29 |
# File 'tmpsets/set/mod021-standard/all/rich_html/alert.rb', line 24 def wrap_with :button, type: "button", "data-dismiss": "alert", class: "close", "aria-label": "Close" do wrap_with :span, "×", "aria-hidden" => true end end |