Sha256: e11970afa1e51988682c56b1774a9f047a437ce72dec4dfd855aef4cd27d435a
Contents?: true
Size: 728 Bytes
Versions: 12
Compression:
Stored size: 728 Bytes
Contents
format :html do # alert_types: 'success', 'info', 'warning', 'danger' 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 [(alert_close_button if dismissable), output(yield)] end end def alert_classes alert_type, dismissable, disappear classes = ["alert", "alert-#{alert_type}"] classes << "alert-dismissible " if dismissable classes << "_disappear" if disappear classy classes end def alert_close_button wrap_with :button, "", type: "button", "data-bs-dismiss": "alert", class: "btn-close", "aria-label": "Close" end end
Version data entries
12 entries across 12 versions & 1 rubygems