class Card::Bootstrap::Component::Carousel

Public Instance Methods

control_next() click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 56
def control_next
  @html.a class: "carousel-control-next", href: "##{@id}", role: "button",
          "data-slide": "next"  do
    @html.span class: "carousel-control-next-icon", "aria-hidden" => "true"
    @html.span "Next", class: "sr-only"
  end
end
control_prev() click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 48
def control_prev
  @html.a class: "carousel-control-prev", href: "##{@id}", role: "button",
          "data-slide" => "prev" do
    @html.span class: "carousel-control-prev-icon", "aria-hidden" => "true"
    @html.span "Previous", class: "sr-only"
  end
end
indicator(index) click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 70
def indicator index
  html_opts = { "data-slide-to" => index, "data-target": "##{@id}" }
  add_class html_opts, "active" if index == @active_item_index
  @html.li html_opts
end
indicators() click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 64
def indicators
  @html.ol class: "carousel-indicators" do
    @items.size.times { |i| indicator i }
  end
end
item(content=nil, &block) click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 23
def item content=nil, &block
  @items << (content || block)
end
items() click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 27
def items
  @html.div class: "carousel-inner", role: "listbox" do
    @items.each_with_index do |item, index|
      carousel_item item, carousel_item_opts(index)
    end
  end
end
render_content() click to toggle source
# File lib/card/bootstrap/component/carousel.rb, line 5
def render_content
  carousel(*@args, &@build_block)
end