Class: Bootstrap::ViewHelpers::Components::Modal

Inherits:
Bootstrap::ViewHelpers::Component show all
Defined in:
lib/bootstrap/view_helpers/components/modal.rb,
lib/bootstrap/view_helpers/components/modal/body.rb,
lib/bootstrap/view_helpers/components/modal/footer.rb,
lib/bootstrap/view_helpers/components/modal/header.rb

Defined Under Namespace

Classes: Body, Footer, Header

Instance Attribute Summary

Attributes inherited from Bootstrap::ViewHelpers::Component

#block, #options, #style, #view

Instance Method Summary collapse

Methods inherited from Bootstrap::ViewHelpers::Component

#initialize

Constructor Details

This class inherits a constructor from Bootstrap::ViewHelpers::Component

Instance Method Details

#body(body_options = {}, &block) ⇒ Object



27
28
29
# File 'lib/bootstrap/view_helpers/components/modal.rb', line 27

def body(body_options = {}, &block)
  Body.new(view, body_options, &block).to_html
end


31
32
33
# File 'lib/bootstrap/view_helpers/components/modal.rb', line 31

def footer(footer_options = {}, &block)
  Footer.new(view, footer_options, &block).to_html
end

#header(title_or_options = nil, header_options = {}, &block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/bootstrap/view_helpers/components/modal.rb', line 19

def header(title_or_options = nil, header_options = {}, &block)
  header_options = title_or_options || {} if block.present?
  title_or_options = nil if block.blank?
  header_options[:title] ||= title_or_options || title_text
  header_options[:dismiss] ||= dismiss
  Header.new(view, header_options, &block).to_html
end

#to_htmlObject



11
12
13
14
15
16
17
# File 'lib/bootstrap/view_helpers/components/modal.rb', line 11

def to_html
  (:div, modal_options) do
    (:div, dialog_options) do
      (:div, content_options) { content_to_html(&block) }
    end
  end
end