diff --git a/js/models/threads.js b/js/models/threads.js index 66acaf7b..16f2eacb 100644 --- a/js/models/threads.js +++ b/js/models/threads.js @@ -43,7 +43,6 @@ var Whisper = Whisper || {}; if (!this.messageCollection) { this.messageCollection = new Whisper.MessageCollection([], {threadId: this.id}); } - this.messageCollection.fetch(); return this.messageCollection; }, }); diff --git a/js/views/conversation_list_view.js b/js/views/conversation_list_view.js index db00c22f..7ea57ed0 100644 --- a/js/views/conversation_list_view.js +++ b/js/views/conversation_list_view.js @@ -11,7 +11,6 @@ var Whisper = Whisper || {}; events: { 'select .conversation': 'select', - 'deselect': 'deselect' }, select: function(e) { @@ -20,10 +19,5 @@ var Whisper = Whisper || {}; target.addClass('selected').trigger('open'); return false; }, - - deselect: function() { - this.$el.find('.selected').removeClass('selected').trigger('close'); - this.$el.find('.conversation').show(); - } }); })(); diff --git a/js/views/conversations/show.js b/js/views/conversations/show.js index 802df8ec..105f5c45 100644 --- a/js/views/conversations/show.js +++ b/js/views/conversations/show.js @@ -3,32 +3,6 @@ var Whisper = Whisper || {}; (function () { 'use strict'; - var destroyer = Backbone.View.extend({ - tagName: 'button', - className: 'btn btn-square btn-sm destroy', - events: { - 'click': 'destroy' - }, - initialize: function() { - this.$el.html('×'); - }, - - destroy: function() { - this.model.messages().each(function(message) { message.destroy(); }); - this.model.set('active', false); - this.model.save(); - this.model.trigger('destroy'); - } - }); - - var menu = Backbone.View.extend({ - tagName: 'ul', - className: 'menu', - initialize: function() { - this.$el.html("
  • delete
  • "); - } - }); - Whisper.ConversationView = Backbone.View.extend({ tagName: 'li', className: 'conversation', @@ -42,18 +16,9 @@ var Whisper = Whisper || {}; Mustache.parse(this.template); this.listenTo(this.model, 'change', this.render); // auto update - this.listenTo(this.model, 'message', this.addMessage); // auto update this.listenTo(this.model, 'destroy', this.remove); // auto update - this.listenTo(Whisper.Messages, 'reset', this.addAllMessages); // auto update this.$el.addClass('closed'); - this.$destroy = (new destroyer({model: this.model})).$el; - - this.$image = $('
    '); - this.$name = $(''); - this.$header = $('
    ').append(this.$image, this.$name); - - this.$el.append(this.$header, this.$collapsable); }, sendMessage: function(e) { @@ -67,37 +32,11 @@ var Whisper = Whisper || {}; this.$el.remove(); }, - close: function() { - if (!this.$el.hasClass('closed')) { - this.$el.addClass('closed'); - } - }, - open: function(e) { - this.$el.siblings().addClass('closed'); - this.$el.removeClass('closed'); var v = new Whisper.MessageListView({collection: this.model.messages()}); v.render(); }, - toggle: function() { - if (this.$el.hasClass('closed')) { - this.open(); - } else { - this.close(); - } - }, - - addMessage: function (message) { - var view = new Whisper.MessageView({ model: message }); - this.$messages.append(view.render().el); - }, - - addAllMessages: function () { - this.model.messages().each(this.addMessage, this); - this.render(); - }, - render: function() { this.$el.html( Mustache.render(this.template, { diff --git a/js/views/message_view.js b/js/views/message_view.js index 6c6100ad..2d44bc13 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -3,15 +3,6 @@ var Whisper = Whisper || {}; (function () { 'use strict'; - var Destroyer = Backbone.View.extend({ - tagName: 'button', - className: 'btn btn-square btn-sm', - initialize: function() { - this.$el.html('×'); - this.listenTo(this.$el, 'click', this.model.destroy); - } - }); - Whisper.MessageView = Backbone.View.extend({ tagName: "li", className: "message",