DRY up audio and video views
This commit is contained in:
parent
df06499a19
commit
f9ca13a86f
1 changed files with 4 additions and 13 deletions
|
@ -24,19 +24,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var AudioView = Backbone.View.extend({
|
var MediaView = 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',
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.$el.attr('controls', '');
|
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({
|
Whisper.AttachmentView = Backbone.View.extend({
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
className: 'attachment',
|
className: 'attachment',
|
||||||
|
|
Loading…
Reference in a new issue