From 975f970567740df24d72e984092a34136d82c5e6 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 18 Aug 2013 02:16:45 +0100 Subject: [PATCH] Media message toggling #355 --- client/assets/src/views/mediamessage.js | 8 ++++++++ client/assets/src/views/panel.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/assets/src/views/mediamessage.js b/client/assets/src/views/mediamessage.js index de24eb4..369c1dd 100644 --- a/client/assets/src/views/mediamessage.js +++ b/client/assets/src/views/mediamessage.js @@ -8,6 +8,14 @@ _kiwi.view.MediaMessage = Backbone.View.extend({ this.url = this.$el.data('url'); }, + toggle: function () { + if (!this.$content || !this.$content.is(':visible')) { + this.open(); + } else { + this.close(); + } + }, + // Close the media content and remove it from display close: function () { var that = this; diff --git a/client/assets/src/views/panel.js b/client/assets/src/views/panel.js index 7cec509..fefde49 100644 --- a/client/assets/src/views/panel.js +++ b/client/assets/src/views/panel.js @@ -199,7 +199,7 @@ _kiwi.view.Panel = Backbone.View.extend({ $media.data('media', media_message); } - media_message.open(); + media_message.toggle(); }, // Cursor hovers over a message -- 2.25.1