Module: Platformx::TimelineHelpers
- Defined in:
- lib/platformx/timeline.rb
Instance Method Summary collapse
-
#x_timeline(left_aligned: false, items: array) ⇒ Object
Init ############################.
Instance Method Details
#x_timeline(left_aligned: false, items: array) ⇒ Object
Init ############################
9 10 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 |
# File 'lib/platformx/timeline.rb', line 9 def x_timeline(left_aligned: false, items: array) timeline_items ="" total_items = items.count items.each_with_index do |item, index| inverted = "" if !left_aligned == false || index.even? inverted = "inverted" end item =<<EOS <li class="#{inverted}"> <div class="timeline-badge"><i class="fa #{item[:icon]}"></i></div> <div class="timeline-panel"> <div class="timeline-heading"> <h4 class="timeline-title">#{item[:title]}</h4> <p><small class="text-muted">#{item[:time]}</small></p> </div> <div class="timeline-body"> #{item[:body]} </div> </div> </li> EOS timeline_items << item end timeline =<<EOS <div class="timeline_wrapper"> <ul class="timeline"> #{timeline_items} </ul> </div> EOS return timeline end |