Xmpp.Views.Contacts ||= {}

class Xmpp.Views.Contacts.ContactView extends Backbone.View
  template: JST["backbone/templates/contacts/contact"]
  tagName: 'li'
  className: 'clear user'

#  events:
#    'click li.user': 'something'

  initialize: () ->
    _.bindAll(this)

    # Patrim nejakemu zoznamu
    @parentList = @attributes['listView']

    @model.on('change', @updateContact, this)

  updateContact: (contact) ->
    @model = contact
    @render()

  render: ->
    contact = @model.toJSON()
    $(@el).html(@template(contact))
    return this