From d67b723f4f4fcfb3d28bc9f54d60eafb8b31fe8f Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 22 Oct 2014 17:26:37 -0700 Subject: [PATCH] Highlight the selected thread --- js/views/conversation_list_item_view.js | 1 + js/views/conversation_list_view.js | 9 +++------ stylesheets/index.css | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/js/views/conversation_list_item_view.js b/js/views/conversation_list_item_view.js index 3aa27882..f4aa0fb1 100644 --- a/js/views/conversation_list_item_view.js +++ b/js/views/conversation_list_item_view.js @@ -27,6 +27,7 @@ var Whisper = Whisper || {}; this.view.delegateEvents(); } this.view.render(); + this.$el.addClass('selected'); }, render: function() { diff --git a/js/views/conversation_list_view.js b/js/views/conversation_list_view.js index 7211368d..dcc912ae 100644 --- a/js/views/conversation_list_view.js +++ b/js/views/conversation_list_view.js @@ -10,15 +10,12 @@ var Whisper = Whisper || {}; collection: Whisper.Threads, events: { - 'click .conversation': 'select', + 'click .contact': 'select', }, select: function(e) { - var target = $(e.target).closest('.conversation'); - if (!target.is('.selected')) { - target.siblings().removeClass('slected'); - target.addClass('selected'); - } + var target = $(e.target).closest('.contact'); + target.siblings().removeClass('selected'); return false; }, }); diff --git a/stylesheets/index.css b/stylesheets/index.css index c462deec..08862060 100644 --- a/stylesheets/index.css +++ b/stylesheets/index.css @@ -22,6 +22,10 @@ body { display: none; } +.contact.selected { + background-color: aliceblue; +} + .conversation { margin: 0; padding: 0;