From e4cca4d7fdb0634e4cac1f3d7cb03fcbca48f160 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 13 Apr 2017 11:48:37 -0500 Subject: Display video blobs in-line like images --- app/assets/stylesheets/framework/files.scss | 6 ++++-- app/models/blob.rb | 2 ++ app/models/blob_viewer/video.rb | 12 ++++++++++++ app/views/projects/blob/viewers/_video.html.haml | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 app/models/blob_viewer/video.rb create mode 100644 app/views/projects/blob/viewers/_video.html.haml (limited to 'app') diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index df819ffe4bc..c197bf6b9f5 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -61,11 +61,13 @@ .file-content { background: $white-light; - &.image_file { + &.image_file, + &.video { background: $file-image-bg; text-align: center; - img { + img, + video { padding: 20px; max-width: 80%; } diff --git a/app/models/blob.rb b/app/models/blob.rb index 290df5d5520..1cdb8811cff 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -27,6 +27,8 @@ class Blob < SimpleDelegator BlobViewer::Image, BlobViewer::Sketch, + BlobViewer::Video, + BlobViewer::PDF, BlobViewer::BinarySTL, diff --git a/app/models/blob_viewer/video.rb b/app/models/blob_viewer/video.rb new file mode 100644 index 00000000000..057f9fe516f --- /dev/null +++ b/app/models/blob_viewer/video.rb @@ -0,0 +1,12 @@ +module BlobViewer + class Video < Base + include Rich + include ClientSide + + self.partial_name = 'video' + self.extensions = UploaderHelper::VIDEO_EXT + self.binary = true + self.switcher_icon = 'film' + self.switcher_title = 'video' + end +end diff --git a/app/views/projects/blob/viewers/_video.html.haml b/app/views/projects/blob/viewers/_video.html.haml new file mode 100644 index 00000000000..595a890a27d --- /dev/null +++ b/app/views/projects/blob/viewers/_video.html.haml @@ -0,0 +1,2 @@ +.file-content.video + %video{ src: blob_raw_url, controls: true, data: { setup: '{}' } } -- cgit v1.2.1