Module: FullstackCarouselHelper
- Defined in:
- app/helpers/fullstack_carousel_helper.rb
Instance Method Summary collapse
Instance Method Details
#carousel_page_part(key, options = {}, &block) ⇒ Object
<% end %>
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/fullstack_carousel_helper.rb', line 11 def carousel_page_part(key, = {}, &block) @_fullstack_carousel_counter ||= 0 @_fullstack_carousel_counter += 1 = { :arrows => true }.merge() htmlid = .delete(:id) || "carousel-#{key}-#{@_fullstack_carousel_counter}" htmlclass = ((.delete(:class) || "").split(/\s+/) + [ "carousel" ]).join(" ") [:class] = htmlclass [:id] = htmlid arrows = !!.delete(:arrows) arrows_html = !arrows ? "" : <<-eos <a class="carousel-control left" href="##{htmlid}" data-slide="prev">‹</a> <a class="carousel-control right" href="##{htmlid}" data-slide="next">›</a> eos items_html = "" part( key, :schema => :slideshow ) do || .items.each_with_index do |item, i| = capture do content_tag :div, :class => ( i == 0 ? "item active" : "item" ) do yield(item) end end items_html << end end content_tag :div, do raw <<-eos <div class="carousel-inner"> #{items_html} </div> #{arrows_html} eos end end |