From 87cd3f5053da4aae7cbebd5dcfc89cc400418f7f Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 26 Jan 2015 13:55:22 -1000 Subject: [PATCH] Save and open new contact on click --- js/views/inbox_view.js | 11 ++++++++++- js/views/new_conversation_view.js | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 81b1604e..9cfb3585 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -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(); diff --git a/js/views/new_conversation_view.js b/js/views/new_conversation_view.js index cc9d94bb..8a7760e1 100644 --- a/js/views/new_conversation_view.js +++ b/js/views/new_conversation_view.js @@ -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);