app/assets/javascripts/backbone/views/popup/add_contact.js.coffee
910e0f23
 Xmpp.Views.Popup ||= {}
 
 class Xmpp.Views.Popup.AddContactView extends Xmpp.Views.Popup.PopupView
   template: JST["backbone/templates/popup/add_contact"]
0e8bb3a5
   className: 'add-contact'
910e0f23
 
   events:
     'submit form': 'addContact'
 
   initialize: ->
0e8bb3a5
     @events = _.extend(@events, @superEvents())
910e0f23
 
   render: ->
     super(@template())
     $(@el).css(width: '20%', 'z-index': 999)
     $(@el).find('input[type=text]').focus()
     this
 
   addContact: (e) ->
     e.preventDefault()
     jid = $(@el).find('input[name=jid]').val()
     r = new RegExp('^.+@.+\..+$')
     match = r.exec(jid)
     if match and (match.length > 0)
       jid = App.stripJid(match[0])
       App.Com.addContact(jid)