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
#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
|
#data ⇒ Object
19
20
21
22
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 19
def data
return super unless interval
super.merge!(interval: interval)
end
|
#image ⇒ Object
24
25
26
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 24
def image
options.fetch(:image, nil)
end
|
#interval ⇒ Object
manually pass in an interval numerical value which translates to miliseconds between carousel item slide transitions. ex: interval: 5000
32
33
34
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 32
def interval
options[:interval] || nil
end
|
#label ⇒ Object
36
37
38
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 36
def label
options.fetch(:label, nil)
end
|
#render ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/nfg_ui/bootstrap/components/carousel_item.rb', line 40
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
|