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

Version Path
card-mod-layout-0.18.1 set/all/alert.rb
card-mod-layout-0.18.0 set/all/alert.rb
card-mod-layout-0.17.0 set/all/alert.rb
card-mod-layout-0.16.0 set/all/alert.rb
card-mod-layout-0.15.6 set/all/alert.rb
card-mod-layout-0.15.5 set/all/alert.rb
card-mod-layout-0.15.4 set/all/alert.rb
card-mod-layout-0.15.3 set/all/alert.rb
card-mod-layout-0.15.2.pre1 set/all/alert.rb
card-mod-layout-0.15.1.1 set/all/alert.rb
card-mod-layout-0.15.1 set/all/alert.rb
card-mod-layout-0.15.0 set/all/alert.rb