b933b434 |
Xmpp.Views.Chat ||= {}
class Xmpp.Views.Chat.WindowView extends Backbone.View
template: JST["backbone/templates/chat/window"]
el: $('#conversation-js')
|
424fd46f |
events:
'submit #msg-writer': (e) -> @sendMessage(e)
|
b933b434 |
initialize: () ->
_.bindAll(this)
@tab = @attributes['tab']
@date = new Date() #pre testovacie ucely
render: -> |
b0ed6db5 |
$(@el).html(@template(date: @date.getTime(), showWriter: true)) |
b933b434 |
@show()
return this
hide: ->
$(@el).addClass('hidden')
this
show: ->
$(@el).removeClass('hidden')
this
remove: ->
@undelegateEvents()
$(@el).empty()
# @stopListening() TODO: po upgrade na 1.0 uz bude pristupne |
424fd46f |
this
sendMessage: (e) ->
e.preventDefault()
$this = $(e.currentTarget)
input = $this.find('input[type=text]')
message = input.val().trim()
if (message) |
2a61cdcc |
@tab.getOwner().sendMessage(message, @tab.getChatId()) |
424fd46f |
|