Save and open new contact on click

This commit is contained in:
lilia 2015-01-26 13:55:22 -10:00
parent 17f3263a21
commit 87cd3f5053
2 changed files with 12 additions and 2 deletions

View file

@ -50,10 +50,19 @@
'keyup': 'keyup',
'click .back button': 'hideCompose',
'click .fab': 'showCompose',
'open .contact': 'openConversation'
'open #contacts': 'openConversation',
'open .contacts': 'openConversation',
'open .new-contact': 'createConversation',
},
openConversation: function(e, data) {
bg.openConversation(data.modelId);
this.hideCompose();
},
createConversation: function(e, data) {
this.newConversationView.new_contact.model.save().then(function() {
bg.openConversation(data.modelId);
});
this.hideCompose();
},
showCompose: function() {
this.$fab.hide();

View file

@ -59,7 +59,8 @@ var Whisper = Whisper || {};
this.new_contact = new Whisper.ConversationListItemView({
model: new Whisper.Conversation({
active_at: null
active_at: null,
type: 'private'
})
}).render();
this.$el.find('.new-contact').append(this.new_contact.el);