Class: Bootstrap4RailsComponents::Bootstrap::Components::CarouselItem
- Inherits:
-
Base
- Object
- Base
- Bootstrap4RailsComponents::Bootstrap::Components::CarouselItem
show all
- Includes:
- Utilities::Activatable
- Defined in:
- lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary
collapse
#active
Methods inherited from Base
#component_initialize, #data, #href, #html_options, #id, #initialize, #style, #utility_initialize
Instance Method Details
#caption ⇒ Object
11
12
13
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb', line 11
def caption
options.fetch(:caption, nil)
end
|
#component_family ⇒ Object
15
16
17
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb', line 15
def component_family
:carousel
end
|
#image ⇒ Object
19
20
21
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb', line 19
def image
options.fetch(:image, nil)
end
|
#label ⇒ Object
23
24
25
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb', line 23
def label
options.fetch(:label, nil)
end
|
#render ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb', line 27
def render
super do
capture do
concat(image_tag(image, class: 'd-block w-100')) if image
if caption || label
concat(Bootstrap4RailsComponents::Bootstrap::Components::CarouselCaption.new({ body: caption, label: label }, view_context).render)
end
concat(block_given? ? yield : body)
end
end
end
|