From f9ca13a86fb1d8721ec96bcd6dcae61f94265554 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 3 Mar 2015 13:05:39 -0800 Subject: [PATCH] DRY up audio and video views --- js/views/attachment_view.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/js/views/attachment_view.js b/js/views/attachment_view.js index 58ef1bdd..16127d0e 100644 --- a/js/views/attachment_view.js +++ b/js/views/attachment_view.js @@ -24,19 +24,7 @@ } }); - var AudioView = Backbone.View.extend({ - tagName: 'audio', - initialize: function() { - this.$el.attr('controls', ''); - }, - render: function(dataUrl) { - this.$el.attr('src', dataUrl); - return this; - } - }); - - var VideoView = Backbone.View.extend({ - tagName: 'video', + var MediaView = Backbone.View.extend({ initialize: function() { this.$el.attr('controls', ''); }, @@ -49,6 +37,9 @@ } }); + var AudioView = MediaView.extend({ tagName: 'audio' }); + var VideoView = MediaView.extend({ tagName: 'video' }); + Whisper.AttachmentView = Backbone.View.extend({ tagName: 'span', className: 'attachment',