Sha256: b7e073fa4e976356d1a2bac1e106ebcacef55409a87f557ba5f476bc4837e247
Contents?: true
Size: 1.55 KB
Versions: 35
Compression:
Stored size: 1.55 KB
Contents
# frozen_string_literal: true module NfgUi module Bootstrap module Components # Bootstrap Carousel Slide / Carousel Item Component # https://getbootstrap.com/docs/4.1/components/carousel/#slides-only class CarouselItem < NfgUi::Bootstrap::Components::Base include Bootstrap::Utilities::Activatable def caption options.fetch(:caption, nil) end def component_family :carousel end def data return super unless interval super.merge!(interval: interval) end def image options.fetch(:image, nil) end # manually pass in an interval numerical value # which translates to miliseconds between carousel item # slide transitions. # ex: interval: 5000 def interval options[:interval] || nil end def label options.fetch(:label, nil) end def render super do capture do concat(image_tag(image, class: 'd-block w-100')) if image if caption || label concat(NfgUi::Bootstrap::Components::CarouselCaption.new({ body: caption, label: label }, view_context).render) end concat(block_given? ? yield : body) end end end private def non_html_attribute_options super.push(:image, :caption, :label, :interval) end end end end end
Version data entries
35 entries across 35 versions & 1 rubygems