Class: NfgUi::Bootstrap::Components::Card
Overview
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary
collapse
#outlined, #theme
Methods inherited from Base
#data, #href, #html_options, #id, #initialize, #style
Instance Method Details
#component_family ⇒ Object
11
12
13
|
# File 'lib/nfg_ui/bootstrap/components/card.rb', line 11
def component_family
:card
end
|
15
16
17
|
# File 'lib/nfg_ui/bootstrap/components/card.rb', line 15
def
options.fetch(:footer, '')
end
|
#heading ⇒ Object
19
20
21
|
# File 'lib/nfg_ui/bootstrap/components/card.rb', line 19
def heading
options.fetch(:heading, '')
end
|
#render ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/nfg_ui/bootstrap/components/card.rb', line 31
def render
content_tag(:div, html_options) do
capture do
if heading.present?
concat(NfgUi::Bootstrap::Components::CardHeader.new({ heading: heading }, view_context).render)
end
concat(NfgUi::Bootstrap::Components::CardBody.new({}, view_context).render {
capture do
concat(content_tag(:h5, title, class: 'card-title')) if title.present?
concat(content_tag(:h6, subtitle, class: 'card-subtitle')) if subtitle.present?
concat(block_given? ? yield : body)
end
})
if .present?
concat(NfgUi::Bootstrap::Components::CardFooter.new({ body: }, view_context).render)
end
end
end
end
|
#subtitle ⇒ Object
23
24
25
|
# File 'lib/nfg_ui/bootstrap/components/card.rb', line 23
def subtitle
options.fetch(:subtitle, '')
end
|
#title ⇒ Object
27
28
29
|
# File 'lib/nfg_ui/bootstrap/components/card.rb', line 27
def title
options.fetch(:title, '')
end
|