Class: ElementComponent::Components::Carousel

Inherits:
Element
  • Object
show all
Defined in:
lib/element_component/components/carousel.rb

Instance Attribute Summary

Attributes inherited from Element

#attributes, #contents, #element, #html

Instance Method Summary collapse

Methods inherited from Element

#add_attribute, #add_attribute!, #add_content, #add_content!, #new_element, #remove_attribute, #remove_attribute_value, #render, #reset_attributes!, #reset_contents!

Constructor Details

#initialize(id: "carousel", fade: false, indicators: true, controls: true, **attributes, &block) ⇒ Carousel

Returns a new instance of Carousel.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/element_component/components/carousel.rb', line 9

def initialize(id: "carousel", fade: false, indicators: true, controls: true, **attributes, &block)
  @carousel_id = id
  @show_indicators = indicators
  @show_controls = controls
  super("div", &block)

  add_attribute(id: id)
  add_attribute(class: "carousel")
  add_attribute(class: "slide")
  add_attribute(class: "carousel-fade") if fade
  add_attribute(attributes) unless attributes.empty?
end