Untangle select vs open events

This commit is contained in:
lilia 2015-02-08 08:44:31 -10:00
parent b27826cba5
commit 3a099657e6
3 changed files with 8 additions and 8 deletions

View File

@ -25,7 +25,7 @@ var Whisper = Whisper || {};
className: 'contact',
events: {
'click': 'open'
'click': 'select'
},
initialize: function() {
this.template = $('#contact').html();
@ -35,9 +35,9 @@ var Whisper = Whisper || {};
this.listenTo(this.model, 'destroy', this.remove); // auto update
},
open: function(e) {
select: function(e) {
this.$el.addClass('selected');
this.$el.trigger('open', {modelId: this.model.id});
this.$el.trigger('select', {modelId: this.model.id});
},
render: function() {

View File

@ -50,8 +50,8 @@
'keyup': 'keyup',
'click .back button': 'hideCompose',
'click .fab': 'showCompose',
'open #contacts': 'openConversation',
'open .new-conversation .contacts': 'openConversation'
'select #contacts .contact': 'openConversation',
'open .new-conversation': 'openConversation'
},
openConversation: function(e, data) {
bg.openConversation(data.modelId);

View File

@ -105,8 +105,8 @@ var Whisper = Whisper || {};
events: {
'change input.new-message': 'filterContacts',
'keyup input.new-message': 'filterContacts',
'open .new-contact': 'addNewRecipient',
'open .contacts': 'addRecipient',
'select .new-contact': 'addNewRecipient',
'select .contacts': 'addRecipient',
'remove .recipient': 'removeRecipient',
'click .create': 'create'
},
@ -203,7 +203,7 @@ var Whisper = Whisper || {};
var id = getString(groupId);
var group = new Whisper.Conversation(attributes);
group.save({ id: id, groupId: id }).then(function() {
this.$group_update.trigger('open', {modelId: id});
this.$el.trigger('open', {modelId: id});
}.bind(this));
}.bind(this));
}.bind(this));