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

View file

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

View file

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