Simplify event arguments
// FREEBIE
This commit is contained in:
parent
c8a76ab38e
commit
4a482243d0
5 changed files with 8 additions and 9 deletions
|
@ -16,7 +16,7 @@
|
||||||
view.$el.prependTo(bg.$('body',document));
|
view.$el.prependTo(bg.$('body',document));
|
||||||
window.openConversation = function(conversation) {
|
window.openConversation = function(conversation) {
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
view.openConversation(null, {conversation: conversation});
|
view.openConversation(null, conversation);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
openConversation(bg.getOpenConversation());
|
openConversation(bg.getOpenConversation());
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
select: function(e) {
|
select: function(e) {
|
||||||
this.$el.addClass('selected').siblings('.selected').removeClass('selected');
|
this.$el.addClass('selected').siblings('.selected').removeClass('selected');
|
||||||
this.$el.trigger('select', {conversation: this.model});
|
this.$el.trigger('select', this.model);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
|
@ -111,8 +111,7 @@
|
||||||
'click .show-new-conversation': 'showCompose',
|
'click .show-new-conversation': 'showCompose',
|
||||||
'select .gutter .contact': 'openConversation'
|
'select .gutter .contact': 'openConversation'
|
||||||
},
|
},
|
||||||
openConversation: function(e, data) {
|
openConversation: function(e, conversation) {
|
||||||
var conversation = data.conversation;
|
|
||||||
this.conversation_stack.open(conversation);
|
this.conversation_stack.open(conversation);
|
||||||
this.hideCompose();
|
this.hideCompose();
|
||||||
},
|
},
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
var id = this.getRecipients().at(0).id;
|
var id = this.getRecipients().at(0).id;
|
||||||
ConversationController.findOrCreatePrivateById(id).then(function(conversation) {
|
ConversationController.findOrCreatePrivateById(id).then(function(conversation) {
|
||||||
conversation.save('active_at', Date.now());
|
conversation.save('active_at', Date.now());
|
||||||
this.trigger('open', { conversation: conversation });
|
this.trigger('open', conversation);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
};
|
};
|
||||||
var group = ConversationController.create(attributes);
|
var group = ConversationController.create(attributes);
|
||||||
group.save().then(function() {
|
group.save().then(function() {
|
||||||
this.trigger('open', { conversation: group });
|
this.trigger('open', group);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var message = group.messageCollection.add({
|
var message = group.messageCollection.add({
|
||||||
|
|
|
@ -136,14 +136,14 @@
|
||||||
}).render();
|
}).render();
|
||||||
},
|
},
|
||||||
|
|
||||||
addNewRecipient: function(e, data) {
|
addNewRecipient: function() {
|
||||||
this.recipients.add(this.new_contact_view.model);
|
this.recipients.add(this.new_contact_view.model);
|
||||||
this.initNewContact();
|
this.initNewContact();
|
||||||
this.resetTypeahead();
|
this.resetTypeahead();
|
||||||
},
|
},
|
||||||
|
|
||||||
addRecipient: function(e, data) {
|
addRecipient: function(e, conversation) {
|
||||||
this.recipients.add(this.typeahead.remove(data.conversation.id));
|
this.recipients.add(this.typeahead.remove(conversation.id));
|
||||||
this.resetTypeahead();
|
this.resetTypeahead();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue