Sha256: 64e6dce4d7da93cb38a996845fb8be5d24663fc76a922807e6fac4b1f16041b7

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

require 'action_view/helpers'

module ActionView
  module Helpers
    # = Action View I18n Datetime Span Tag Helper
    module DatetimeTagHelper
      # Creates a span tag of the given +time+ with I18n time_ago_in_words format.
      def datetime_tag(time)
        content_tag(:span, time_ago_in_words(time), title: time.to_s(:db), class: (time.to_time > Time.now ? 'datetime datetime_from_now' : 'datetime datetime_ago')) if time.respond_to?(:to_time)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datetime_tag_helper-0.1.0 lib/action_view/helpers/datetime_tag_helper.rb
datetime_tag_helper-0.0.1 lib/action_view/helpers/datetime_tag_helper.rb