Sha256: 849b2702937e1db8b71a7e04e336eab383ea9ef2aa21e2b3caa567f345892b2d

Contents?: true

Size: 985 Bytes

Versions: 10

Compression:

Stored size: 985 Bytes

Contents

module TimelineHelper

  def render_timeline_gap_for(date_range)
    days = date_range.end - date_range.begin
    if days < 3
      date_range.to_a.reverse.inject("") { |html, date| html << render_timeline_date(date) }.html_safe
    else
      <<-HTML.html_safe
      <div class="timeline-date-gap"></div>
      #{render_timeline_date(date_range.begin)}
      HTML
    end
  end

  def icon_for_resolution(resolution)
    case resolution
    when nil, "", "fixed" then "fa fa-ok"
    else "fa fa-minus"
    end
  end

  def format_timeline_time(event)
    event.time.strftime("%-I:%M %p")
      .gsub(/ AM/, "a")
      .gsub(/ PM/, "p")
  end

  def render_timeline_date(date)
    <<-HTML.html_safe
    <div class="timeline-date">
      <span class="weekday">#{date.strftime("%a")}</span>
      <span class="month">#{date.strftime("%b")}</span>
      <span class="day">#{date.strftime("%e")}</span>
      <span class="year">#{date.strftime("%Y")}</span>
    </div>
    HTML
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/helpers/timeline_helper.rb
houston-core-0.7.0 app/helpers/timeline_helper.rb
houston-core-0.7.0.beta4 app/helpers/timeline_helper.rb
houston-core-0.7.0.beta3 app/helpers/timeline_helper.rb
houston-core-0.7.0.beta2 app/helpers/timeline_helper.rb
houston-core-0.7.0.beta app/helpers/timeline_helper.rb
houston-core-0.6.3 app/helpers/timeline_helper.rb
houston-core-0.6.2 app/helpers/timeline_helper.rb
houston-core-0.6.1 app/helpers/timeline_helper.rb
houston-core-0.6.0 app/helpers/timeline_helper.rb