Module: Chatroom::MessageHelper

Defined in:
app/helpers/chatroom/message_helper.rb

Instance Method Summary collapse

Instance Method Details

#new_communication(msg = nil) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/helpers/chatroom/message_helper.rb', line 3

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'>#{msg.try(:html_content)}</span>
  </span>"
end

#show_communications(msgs = nil) ⇒ Object

Show all the communications in chatroom



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/chatroom/message_helper.rb', line 13

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'>#{msg.try(:html_content)}</span>
  </span>"
  end
  messages.join('')
end