Class: NfgUi::Bootstrap::Components::CarouselControl
- Inherits:
-
Base
- Object
- Base
- NfgUi::Bootstrap::Components::CarouselControl
show all
- Defined in:
- lib/nfg_ui/bootstrap/components/carousel_control.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#options, #view_context
Instance Method Summary
collapse
Methods inherited from Base
#html_options, #id, #initialize, #style
Instance Method Details
#body ⇒ Object
CarouselControl does not get adjustable body content
10
11
12
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 10
def body
nil
end
|
#carousel ⇒ Object
18
19
20
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 18
def carousel
options.fetch(:carousel, nil)
end
|
#component_family ⇒ Object
14
15
16
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 14
def component_family
:carousel
end
|
#control ⇒ Object
Options for control are :prev and :next control’s value sets up the rest of the carousel control attributes in HTML
24
25
26
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 24
def control
options.fetch(:control, nil)
end
|
#data ⇒ Object
28
29
30
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 28
def data
control ? super.merge!(slide: control) : super
end
|
#href ⇒ Object
32
33
34
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 32
def href
carousel ? carousel : '#'
end
|
#icon_html_options ⇒ Object
36
37
38
39
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 36
def icon_html_options
return {} unless control
{ class: "carousel-control-#{control}-icon", aria: { hidden: true } }
end
|
#render ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/nfg_ui/bootstrap/components/carousel_control.rb', line 41
def render
super do
capture do
if control
concat(content_tag(:span, nil, icon_html_options))
concat(content_tag(:span, control.to_s, class: 'sr-only'))
end
end
end
end
|