Media message toggling #355
authorDarren <darren@darrenwhitlen.com>
Sun, 18 Aug 2013 01:16:45 +0000 (02:16 +0100)
committerDarren <darren@darrenwhitlen.com>
Sun, 18 Aug 2013 01:16:45 +0000 (02:16 +0100)
client/assets/src/views/mediamessage.js
client/assets/src/views/panel.js

index de24eb4da612b451547bcea967a644b01fd7afb7..369c1ddaa500b74e6ee13827e71ea8ecebc0537a 100644 (file)
@@ -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;
index 7cec5098088d90d32dc00e03b4f30a73af4c85e6..fefde496ee06c2970ba1f30ab7179c6fe4c5490f 100644 (file)
@@ -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