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 () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var bg = extension.windows.getBackground();
|
|
||||||
// list of conversations, showing user/group and last message sent
|
// list of conversations, showing user/group and last message sent
|
||||||
Whisper.ConversationListItemView = Backbone.View.extend({
|
Whisper.ConversationListItemView = Backbone.View.extend({
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
|
@ -40,7 +39,7 @@ var Whisper = Whisper || {};
|
||||||
|
|
||||||
open: function(e) {
|
open: function(e) {
|
||||||
this.$el.addClass('selected');
|
this.$el.addClass('selected');
|
||||||
bg.openConversation(this.model.id);
|
this.$el.trigger('open', {modelId: this.model.id});
|
||||||
},
|
},
|
||||||
|
|
||||||
stopPropagation: function(e) {
|
stopPropagation: function(e) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.Whisper = window.Whisper || {};
|
window.Whisper = window.Whisper || {};
|
||||||
|
var bg = extension.windows.getBackground();
|
||||||
|
|
||||||
Whisper.InboxView = Backbone.View.extend({
|
Whisper.InboxView = Backbone.View.extend({
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
@ -48,7 +49,11 @@
|
||||||
events: {
|
events: {
|
||||||
'click .back': 'hideCompose',
|
'click .back': 'hideCompose',
|
||||||
'click .fab': 'showCompose',
|
'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() {
|
showCompose: function() {
|
||||||
this.$fab.hide();
|
this.$fab.hide();
|
||||||
|
|
|
@ -80,7 +80,7 @@ var Whisper = Whisper || {};
|
||||||
var query = this.$input.val();
|
var query = this.$input.val();
|
||||||
if (query.length) {
|
if (query.length) {
|
||||||
if (this.maybeNumber(query)) {
|
if (this.maybeNumber(query)) {
|
||||||
this.new_contact.model.set('name', query);
|
this.new_contact.model.set('id', query);
|
||||||
this.new_contact.$el.show();
|
this.new_contact.$el.show();
|
||||||
} else {
|
} else {
|
||||||
this.new_contact.$el.hide();
|
this.new_contact.$el.hide();
|
||||||
|
|
Loading…
Reference in a new issue