       name: $('#edit-contact-name').val()
       groups: []
     @session.updateContact contact
+    this.eachContact @currentContact, (node) ->
+      node.attr 'data-name', contact.name || ''
     false
 
   toggleForm: (form, fn) ->

    $('.contact-form').each ->
      $(this).hide() unless this.id == form.attr 'id'
    if form.is ':hidden'
      form.fadeIn 100
    else
      form.fadeOut 100, ->


    $('#add-contact').click    => this.toggleForm '#add-contact-form'
    $('#remove-contact').click => this.toggleForm '#remove-contact-form'
    $('#edit-contact').click   => this.toggleForm '#edit-contact-form', =>
      if @currentContact
        $('#edit-contact-jid').text @currentContact
        $('#edit-contact-name').val @session.roster[@currentContact].name

    $('#add-contact-cancel').click    => this.toggleForm '#add-contact-form'
    $('#remove-contact-cancel').click => this.toggleForm '#remove-contact-form'
