Save and open new contact on click
This commit is contained in:
parent
17f3263a21
commit
87cd3f5053
2 changed files with 12 additions and 2 deletions
|
@ -50,10 +50,19 @@
|
||||||
'keyup': 'keyup',
|
'keyup': 'keyup',
|
||||||
'click .back button': 'hideCompose',
|
'click .back button': 'hideCompose',
|
||||||
'click .fab': 'showCompose',
|
'click .fab': 'showCompose',
|
||||||
'open .contact': 'openConversation'
|
'open #contacts': 'openConversation',
|
||||||
|
'open .contacts': 'openConversation',
|
||||||
|
'open .new-contact': 'createConversation',
|
||||||
},
|
},
|
||||||
openConversation: function(e, data) {
|
openConversation: function(e, data) {
|
||||||
bg.openConversation(data.modelId);
|
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() {
|
showCompose: function() {
|
||||||
this.$fab.hide();
|
this.$fab.hide();
|
||||||
|
|
|
@ -59,7 +59,8 @@ var Whisper = Whisper || {};
|
||||||
|
|
||||||
this.new_contact = new Whisper.ConversationListItemView({
|
this.new_contact = new Whisper.ConversationListItemView({
|
||||||
model: new Whisper.Conversation({
|
model: new Whisper.Conversation({
|
||||||
active_at: null
|
active_at: null,
|
||||||
|
type: 'private'
|
||||||
})
|
})
|
||||||
}).render();
|
}).render();
|
||||||
this.$el.find('.new-contact').append(this.new_contact.el);
|
this.$el.find('.new-contact').append(this.new_contact.el);
|
||||||
|
|
Loading…
Reference in a new issue