Sha256: f935e29d483735e9a9d48dfe0065d69ea8684c179c936e630a8f458e1d02baf2
Contents?: true
Size: 780 Bytes
Versions: 31
Compression:
Stored size: 780 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-dismiss": "alert", class: "close", "aria-label": "Close" do wrap_with :span, "×", "aria-hidden" => true end end end
Version data entries
31 entries across 31 versions & 2 rubygems