class Bootstrap::ViewHelpers::Components::Alert
Public Instance Methods
alert_link_to(name = nil, opts = nil, html_options = nil, &block)
click to toggle source
# File lib/bootstrap/view_helpers/components/alert.rb, line 13 def alert_link_to(name = nil, opts = nil, html_options = nil, &block) link_to(name, opts, html_options.merge({ class: 'alert-link' }), &block) end
dismissible?()
click to toggle source
Defaults to false
# File lib/bootstrap/view_helpers/components/alert.rb, line 19 def dismissible? options[:dismissible] end
fade?()
click to toggle source
Defaults to true
# File lib/bootstrap/view_helpers/components/alert.rb, line 24 def fade? return true if options[:fade].nil? options[:fade] end
to_html()
click to toggle source
# File lib/bootstrap/view_helpers/components/alert.rb, line 5 def to_html content_tag(:div, options) do concat(options[:content]) if options[:content] concat close_button block.call(self) if block.present? end end
Protected Instance Methods
container_options()
click to toggle source
# File lib/bootstrap/view_helpers/components/alert.rb, line 50 def container_options default = { class: "alert alert-#{style}#{' fade show' if fade?} " } default[:class] << 'alert-dismissible ' if dismissible? default[:class] << options.delete(:class) if options[:class] default.merge(options) end
defaults()
click to toggle source
# File lib/bootstrap/view_helpers/components/alert.rb, line 31 def defaults { style: ContextualClasses::SECONDARY } end
inject_class_name()
click to toggle source
# File lib/bootstrap/view_helpers/components/alert.rb, line 42 def inject_class_name class_name = "alert alert-#{style} " class_name << 'alert-dismissible ' if dismissible? class_name << 'fade show ' if fade? class_name << options.delete(:class) if options[:class] options[:class] = class_name end
parse_options(_)
click to toggle source
Calls superclass method
Bootstrap::ViewHelpers::Component#parse_options
# File lib/bootstrap/view_helpers/components/alert.rb, line 35 def parse_options(_) super inject_class_name options[:role] = 'alert' options[:style] = options[:html_style] end