class NfgUi::Bootstrap::Components::CarouselIndicators
Bootstrap
Carousel
Indicators Component getbootstrap.com/docs/4.1/components/carousel/#with-indicators
Public Instance Methods
active()
click to toggle source
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 9 def active options.fetch(:active, 1) # allow nil so that no indicator is active if desired end
body()
click to toggle source
Carousel
Indicators do not accept a body
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 14 def body nil end
carousel()
click to toggle source
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 26 def carousel options.fetch(:carousel, nil) end
component_family()
click to toggle source
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 18 def component_family :carousel end
count()
click to toggle source
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 22 def count options[:count] || 0 # return 0 when nil end
render()
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Components::Base#render
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 30 def render super do capture do count.times do |i| concat(content_tag(:li, nil, class: ('active' if active == i + 1), data: { target: carousel, slide_to: i })) end end end end
Private Instance Methods
base_element()
click to toggle source
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 42 def base_element :ol end
non_html_attribute_options()
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Components::Base#non_html_attribute_options
# File lib/nfg_ui/bootstrap/components/carousel_indicators.rb, line 46 def non_html_attribute_options super.push(:active, :count, :carousel) end