Sha256: 86f3e7815f451356306f73a9518e43aca42a9e9e976efb0466acedf1dce26bb7

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

module Chatroom
	module MessageHelper
		def new_communication(msg=nil)
			"<span class='message-line'>
				<div class='info-message'>
					<span class='sender'>:</span><span class='send-time'>#{msg.try(:send_time)}</span>
				</div>
				<span class='say'>#{sanitize(msg.try(:html_content), tags: %w(br img span p i b a), attributes: %w(id class style))}</span>
			</span>"
		end

		# Show all the communications in chatroom
		def show_communications(msgs=nil)
			msgs ||= []
			messages = msgs.collect do |msg|
			"<span class='message-line'>
				<div class='info-message'>
					<span class='sender'>:</span><span class='send-time'>#{msg.try(:send_time)}</span>
				</div>
				<span class='say'>#{sanitize(msg.try(:html_content), tags: %w(br img span p i b a), attributes: %w(id class style))}</span>
			</span>"
			end
			messages.join('')
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chatroom-0.1.1 app/helpers/chatroom/message_helper.rb