Move openConversation handler to InboxView
Removes the background page ref to inbox which should fix view tests. Prep for handling new contact creation.
This commit is contained in:
parent
1eab26635b
commit
d26dc8c7e6
3 changed files with 8 additions and 4 deletions
|
@ -19,7 +19,6 @@ var Whisper = Whisper || {};
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
var bg = extension.windows.getBackground();
|
||||
// list of conversations, showing user/group and last message sent
|
||||
Whisper.ConversationListItemView = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
|
@ -40,7 +39,7 @@ var Whisper = Whisper || {};
|
|||
|
||||
open: function(e) {
|
||||
this.$el.addClass('selected');
|
||||
bg.openConversation(this.model.id);
|
||||
this.$el.trigger('open', {modelId: this.model.id});
|
||||
},
|
||||
|
||||
stopPropagation: function(e) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
'use strict';
|
||||
|
||||
window.Whisper = window.Whisper || {};
|
||||
var bg = extension.windows.getBackground();
|
||||
|
||||
Whisper.InboxView = Backbone.View.extend({
|
||||
initialize: function () {
|
||||
|
@ -48,7 +49,11 @@
|
|||
events: {
|
||||
'click .back': 'hideCompose',
|
||||
'click .fab': 'showCompose',
|
||||
'keyup input.new-message': 'compose'
|
||||
'keyup input.new-message': 'compose',
|
||||
'open .contact': 'openConversation'
|
||||
},
|
||||
openConversation: function(e, data) {
|
||||
bg.openConversation(data.modelId);
|
||||
},
|
||||
showCompose: function() {
|
||||
this.$fab.hide();
|
||||
|
|
|
@ -80,7 +80,7 @@ var Whisper = Whisper || {};
|
|||
var query = this.$input.val();
|
||||
if (query.length) {
|
||||
if (this.maybeNumber(query)) {
|
||||
this.new_contact.model.set('name', query);
|
||||
this.new_contact.model.set('id', query);
|
||||
this.new_contact.$el.show();
|
||||
} else {
|
||||
this.new_contact.$el.hide();
|
||||
|
|
Loading…
Reference in a new issue