Class: Bootstrap::ViewHelpers::Components::Card
Instance Attribute Summary
#block, #options, #style, #view
Instance Method Summary
collapse
#initialize
Instance Method Details
#body(content_or_options = nil) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/bootstrap/view_helpers/components/card.rb', line 23
def body(content_or_options = nil)
opts = content_or_options.is_a?(Hash) ? content_or_options : {}
content = content_or_options.is_a?(String) ? content_or_options : nil
content_tag(:div, class: body_class(opts)) do
yield if block_given?
concat(content) if content.present?
end
end
|
32
33
34
35
36
37
38
|
# File 'lib/bootstrap/view_helpers/components/card.rb', line 32
def (content = nil, opts = {})
opts, content = content, nil if content.is_a? Hash
content_tag(:div, class: "card-footer #{opts[:class]}") do
yield if block_given?
concat(content) unless block_given? || content.present?
end
end
|
13
14
15
16
17
18
19
20
21
|
# File 'lib/bootstrap/view_helpers/components/card.rb', line 13
def (title_or_opts = nil, opts = {})
opts = title_or_opts if title_or_opts.is_a? Hash
opts[:title] = title_or_opts if title_or_opts.is_a? String
return if (opts[:title], block_given?)
content_tag(:div, class: "card-header #{opts[:class]}") do
yield if block_given?
concat(title_tag(opts[:title])) unless block_given?
end
end
|
#to_html ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/bootstrap/view_helpers/components/card.rb', line 5
def to_html
content_tag(:div, class: container_options[:class]) do
concat() if options[:title]
concat(body(&block)) if options[:body]
block.call(self) if block.present? && !options[:body]
end
end
|