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-1.99.4 mod/standard/set/all/rich_html/alert.rb
card-1.99.3 mod/standard/set/all/rich_html/alert.rb
card-1.99.2 mod/standard/set/all/rich_html/alert.rb
card-1.99.1 mod/standard/set/all/rich_html/alert.rb
card-1.99.0 mod/standard/set/all/rich_html/alert.rb
card-1.98.3 mod/standard/set/all/rich_html/alert.rb
card-1.98.2 mod/standard/set/all/rich_html/alert.rb
card-1.98.1 mod/standard/set/all/rich_html/alert.rb
card-1.98.0 mod/standard/set/all/rich_html/alert.rb
card-1.97.0.1 mod/standard/set/all/rich_html/alert.rb
card-1.97.0 mod/standard/set/all/rich_html/alert.rb