Class: NfgUi::Bootstrap::Components::CarouselItem
Overview
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary
collapse
#active
Methods inherited from Base
#data, #href, #html_options, #id, #initialize, #style
Instance Method Details
#caption ⇒ Object
11
12
13
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 11
def caption
options.fetch(:caption, nil)
end
|
#component_family ⇒ Object
15
16
17
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 15
def component_family
:carousel
end
|
#image ⇒ Object
19
20
21
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 19
def image
options.fetch(:image, nil)
end
|
#label ⇒ Object
23
24
25
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 23
def label
options.fetch(:label, nil)
end
|
#render ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 27
def render
super do
capture do
concat(image_tag(image, class: 'd-block w-100')) if image
if caption || label
concat(NfgUi::Bootstrap::Components::CarouselCaption.new({ body: caption, label: label }, view_context).render)
end
concat(block_given? ? yield : body)
end
end
end
|