Sha256: 19088f3ca5106076be90eca64249eccf1f461daefd44fc1770668e3faf2db5d9
Contents?: true
Size: 702 Bytes
Versions: 11
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true module Decidim # # Decorator for notifications. # class NotificationPresenter < SimpleDelegator include ActionView::Helpers::DateHelper delegate :resource_text, to: :event_class_instance def created_at_in_words if created_at.between?(1.month.ago, Time.current) I18n.t("decidim.user_conversations.index.time_ago", time: time_ago_in_words(created_at)) else format = created_at.year == Time.current.year ? :ddmm : :ddmmyyyy I18n.l(created_at, format: format) end end def display_resource_text? event_class.constantize.included_modules.include?(Decidim::Comments::CommentEvent) end end end
Version data entries
11 entries across 11 versions & 1 rubygems