class Bootstrap::ViewHelpers::Components::Modal::Header

Attributes

dismiss[R]
title_text[R]

Public Instance Methods

close_button() click to toggle source
# File lib/bootstrap/view_helpers/components/modal/header.rb, line 21
def close_button
  Button::Close.new(view, {}).to_html
end
title(title = nil) click to toggle source
# File lib/bootstrap/view_helpers/components/modal/header.rb, line 14
def title(title = nil)
  title ||= title_text
  return title unless title_options[:tag]
  content_tag(title_options[:tag], title,
              class: title_options[:class])
end
to_html() click to toggle source
# File lib/bootstrap/view_helpers/components/modal/header.rb, line 6
def to_html
  content_tag(:div, class: options[:class]) do
    concat(block.call(self)) if block.present?
    concat title if block.blank?
    concat close_button if dismiss
  end
end

Protected Instance Methods

inject_class_name_to_options() click to toggle source
# File lib/bootstrap/view_helpers/components/modal/header.rb, line 33
def inject_class_name_to_options
  options[:class] = "modal-header #{options[:class]}"
  options[:class].strip!
end
parse_options(options) click to toggle source
# File lib/bootstrap/view_helpers/components/modal/header.rb, line 38
def parse_options(options)
  super
  @title_text = options.delete(:title)
  @dismiss = options.delete(:dismiss)
  inject_class_name_to_options
end
title_options() click to toggle source
# File lib/bootstrap/view_helpers/components/modal/header.rb, line 29
def title_options
  { tag: :h5, class: 'modal-title' }
end