Sha256: 4bdf6c5b3e41e588747cc37d5972c6edbbf329f023efead4065b3411a50e7142

Contents?: true

Size: 462 Bytes

Versions: 8

Compression:

Stored size: 462 Bytes

Contents

require 'thredded/at_notification_extractor'

module Thredded
  class AtUsers
    def self.render(content, messageboard)
      at_names = AtNotificationExtractor.new(content).extract
      members = messageboard.members_from_list(at_names)

      members.each do |member|
        member_path = Thredded.user_path(member)

        content.gsub!(/@#{member.to_s}/i,
          %Q{<a href="#{member_path}">@#{member}</a>})
      end

      content
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thredded-0.0.12 lib/thredded/at_users.rb
thredded-0.0.10 lib/thredded/at_users.rb
thredded-0.0.9 lib/thredded/at_users.rb
thredded-0.0.8 lib/thredded/at_users.rb
thredded-0.0.7 lib/thredded/at_users.rb
thredded-0.0.6 lib/thredded/at_users.rb
thredded-0.0.5 lib/thredded/at_users.rb
thredded-0.0.4 lib/thredded/at_users.rb