class Bootstrap4RailsComponents::Bootstrap::Components::CarouselControl

Bootstrap Carousel Control Component getbootstrap.com/docs/4.1/components/carousel/#with-controls

Public Instance Methods

body() click to toggle source

CarouselControl does not get adjustable body content

# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 10
def body
  nil
end
component_family() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 14
def component_family
  :carousel
end
control() click to toggle source

Options for control are :prev and :next control's value sets up the rest of the carousel control attributes in HTML

# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 24
def control
  options.fetch(:control, nil)
end
data() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 28
def data
  control ? super.merge!(slide: control) : super
end
href() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 32
def href
  carousel ? carousel : '#'
end
icon_html_options() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 36
def icon_html_options
  return {} unless control
  { class: "carousel-control-#{control}-icon", aria: { hidden: true } }
end
render() click to toggle source
# File lib/bootstrap4_rails_components/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

Private Instance Methods

assistive_html_attributes() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 58
def assistive_html_attributes
  super.merge!(role: 'button')
end
base_element() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 54
def base_element
  :a
end
component_css_class() click to toggle source

next is a reserved word, for here, we'll refer to options

# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 63
def component_css_class
  control ? "#{super}-#{control}" : super
end
non_html_attribute_options() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb, line 67
def non_html_attribute_options
  super.push(:control, :carousel)
end