Sha256: 461cc2a19f6e627e7a3eda9068b8590f361e920fbad91607b49c88a208d519d7

Contents?: true

Size: 630 Bytes

Versions: 25

Compression:

Stored size: 630 Bytes

Contents

module MessageTrain
  module ApplicationHelper

    def message_train_widget
      render partial: 'message_train/application/widget'
    end

    def fuzzy_date(date)
      time = Time.parse(date.strftime('%F %T'))
      # Don't get confused: ">" here means "after", not "more than"
      if time > 1.minute.ago
        :just_now.l
      elsif time > 1.day.ago
        l(time, format: :fuzzy_today)
      elsif time > 1.week.ago
        l(time, format: :fuzzy_this_week)
      elsif time > 1.year.ago
        l(time, format: :fuzzy_date_without_year)
      else
        l(time, format: :fuzzy_date)
      end

    end

  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
message_train-0.5.2 app/helpers/message_train/application_helper.rb
message_train-0.5.1 app/helpers/message_train/application_helper.rb
message_train-0.5.0 app/helpers/message_train/application_helper.rb
message_train-0.4.6 app/helpers/message_train/application_helper.rb
message_train-0.4.5 app/helpers/message_train/application_helper.rb
message_train-0.4.4 app/helpers/message_train/application_helper.rb
message_train-0.4.3 app/helpers/message_train/application_helper.rb
message_train-0.4.2 app/helpers/message_train/application_helper.rb
message_train-0.4.1 app/helpers/message_train/application_helper.rb
message_train-0.4.0 app/helpers/message_train/application_helper.rb
message_train-0.3.1 app/helpers/message_train/application_helper.rb
message_train-0.3.0 app/helpers/message_train/application_helper.rb
message_train-0.2.12 app/helpers/message_train/application_helper.rb
message_train-0.2.11 app/helpers/message_train/application_helper.rb
message_train-0.2.10 app/helpers/message_train/application_helper.rb
message_train-0.2.9 app/helpers/message_train/application_helper.rb
message_train-0.2.8 app/helpers/message_train/application_helper.rb
message_train-0.2.7 app/helpers/message_train/application_helper.rb
message_train-0.2.6 app/helpers/message_train/application_helper.rb
message_train-0.2.5 app/helpers/message_train/application_helper.rb