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, "&times;", "aria-hidden" => true
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
card-mod-layout-0.14.2 set/all/alert.rb
card-mod-layout-0.14.1 set/all/alert.rb
card-mod-layout-0.14.0 set/all/alert.rb
card-mod-layout-0.13.4 set/all/alert.rb
card-mod-layout-0.13.3 set/all/alert.rb
card-mod-layout-0.13.2 set/all/alert.rb
card-mod-layout-0.13.1 set/all/alert.rb
card-mod-layout-0.13.0 set/all/alert.rb
card-mod-layout-0.11.7 set/all/alert.rb
card-mod-layout-0.12.0 set/all/alert.rb
card-mod-layout-0.11.6 set/all/alert.rb
card-mod-layout-0.11.5 set/all/alert.rb
card-mod-layout-0.11.4 set/all/alert.rb
card-mod-layout-0.11.3 set/all/alert.rb
card-mod-layout-0.11.2 set/all/alert.rb
card-mod-layout-0.11.1 set/all/alert.rb
card-mod-layout-0.11.0 set/all/alert.rb
card-1.100.0 mod/standard/set/all/rich_html/alert.rb
card-1.99.6 mod/standard/set/all/rich_html/alert.rb
card-1.99.5 mod/standard/set/all/rich_html/alert.rb