Class: NfgUi::Bootstrap::Components::Carousel
- Inherits:
-
Base
- Object
- Base
- NfgUi::Bootstrap::Components::Carousel
show all
- Defined in:
- lib/nfg_ui/bootstrap/components/carousel.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary
collapse
Methods inherited from Base
#href, #html_options, #id, #initialize, #style
Instance Method Details
#component_family ⇒ Object
9
10
11
|
# File 'lib/nfg_ui/bootstrap/components/carousel.rb', line 9
def component_family
:carousel
end
|
#controls ⇒ Object
13
14
15
|
# File 'lib/nfg_ui/bootstrap/components/carousel.rb', line 13
def controls
options.fetch(:controls, false)
end
|
#data ⇒ Object
17
18
19
|
# File 'lib/nfg_ui/bootstrap/components/carousel.rb', line 17
def data
super.merge!(ride: 'carousel')
end
|
#indicators ⇒ Object
21
22
23
|
# File 'lib/nfg_ui/bootstrap/components/carousel.rb', line 21
def indicators
options[:indicators] || 0
end
|
#render ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/nfg_ui/bootstrap/components/carousel.rb', line 25
def render
super do
capture do
content_tag(:div, class: 'carousel-inner') do
if indicators > 0
concat(NfgUi::Bootstrap::Components::CarouselIndicators.new({ count: indicators, carousel: "##{id}" }, view_context).render)
end
concat(block_given? ? yield : body)
if controls
concat(NfgUi::Bootstrap::Components::CarouselControl.new({ control: :next, carousel: "##{id}" }, view_context).render)
concat(NfgUi::Bootstrap::Components::CarouselControl.new({ control: :prev, carousel: "##{id}" }, view_context).render)
end
end
end
end
end
|