Module: Card::Set::All::Alert::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod031-layout/all/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 'platypus/tmp/set/gem-defaults/mod031-layout/all/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 'platypus/tmp/set/gem-defaults/mod031-layout/all/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 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/alert.rb', line 24 def wrap_with :button, "", type: "button", "data-bs-dismiss": "alert", class: "btn-close", "aria-label": "Close" end |