Sha256: 07eba6ff4a2eb32e667dc2b43baa41b233d424e136c4f46bf6ee5c45e543a3a1

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

module NotificationsHelper
  include SubjectsHelper, ActionView::Helpers::TextHelper
  def decode_notification notification_text, activity
    return if activity.nil?
    notification_text = notification_text.gsub(/\%\{sender\}/, link_to(truncate_name(activity.sender.name), activity.sender.subject))
    notification_text = notification_text.gsub(/\%\{sender.name\}/,truncate_name(activity.sender.name))

    if activity.direct_object.present?
      object = activity.direct_object
      object = object.subject if object.is_a? Actor
      notification_text=notification_text.gsub(/\%\{object\}/,link_to(object.class.to_s.downcase,object))
      notification_text=notification_text.gsub(/\%\{object.name\}/,object.class.to_s.downcase)
    else
      notification_text=notification_text.gsub(/\%\{object\}/,"nilclass")
      notification_text=notification_text.gsub(/\%\{object.name\}/,"nilclass")
    end

    notification_text
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
social_stream-base-0.6.6 app/helpers/notifications_helper.rb
social_stream-base-0.6.5 app/helpers/notifications_helper.rb