Class: Para::Markup::Modal

Inherits:
Component show all
Defined in:
lib/para/markup/modal.rb

Instance Attribute Summary

Attributes inherited from Component

#view

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Para::Markup::Component

Instance Method Details

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



35
36
37
38
39
40
41
# File 'lib/para/markup/modal.rb', line 35

def body(options = {}, &block)
  merge_class!(options, "modal-body")

  (:div, options) do
    capture { block.call }
  end
end

#container(options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/para/markup/modal.rb', line 4

def container(options = {}, &block)
  merge_class!(options, "modal")
  merge_class!(options, "fade") unless options.delete(:fade) == false
  merge_class!(options, "in") if options.delete(:displayed)

  options.reverse_merge!(
    tabindex: "-1", role: "dialog", "aria-hidden" => "true", "aria-labelledby" => (options[:id] || "modal")
  )

  (:div, options) do
    (:div, class: "modal-dialog") do
      (:div, class: "modal-content") do
        capture { block.call(self) }
      end
    end
  end
end


43
44
45
46
47
48
49
# File 'lib/para/markup/modal.rb', line 43

def footer(options = {}, &block)
  merge_class!(options, "modal-footer")

  (:div, options) do
    capture { block.call }
  end
end

#header(options = {}, &block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/para/markup/modal.rb', line 22

def header(options = {}, &block)
  merge_class!(options, "modal-header")

  (:div, options) do
    (:button, "×".html_safe, class: "close", type: "button",
      "data-dismiss" => "modal", "aria-hidden" => "true"
    ) +
    (:h4, class: "modal-title") do
      capture { block.call }
    end
  end
end