Commit 2c6bf8d0 authored by Nick Thomas's avatar Nick Thomas

Merge branch '19822-audio-preview-in-repo' into 'master'

Feature #19822, users can preview audio in a repository.

See merge request gitlab-org/gitlab!18354
parents f081f1dd 2ecc5ae2
...@@ -108,12 +108,14 @@ ...@@ -108,12 +108,14 @@
background: $white-light; background: $white-light;
&.image_file, &.image_file,
&.audio,
&.video { &.video {
background: $gray-darker; background: $gray-darker;
text-align: center; text-align: center;
padding: 30px; padding: 30px;
img, img,
audio,
video { video {
max-width: 80%; max-width: 80%;
} }
......
...@@ -32,6 +32,7 @@ class Blob < SimpleDelegator ...@@ -32,6 +32,7 @@ class Blob < SimpleDelegator
BlobViewer::Balsamiq, BlobViewer::Balsamiq,
BlobViewer::Video, BlobViewer::Video,
BlobViewer::Audio,
BlobViewer::PDF, BlobViewer::PDF,
......
# frozen_string_literal: true
module BlobViewer
class Audio < Base
include Rich
include ClientSide
self.partial_name = 'audio'
self.extensions = UploaderHelper::SAFE_AUDIO_EXT
self.binary = true
end
end
...@@ -8,7 +8,5 @@ module BlobViewer ...@@ -8,7 +8,5 @@ module BlobViewer
self.partial_name = 'video' self.partial_name = 'video'
self.extensions = UploaderHelper::SAFE_VIDEO_EXT self.extensions = UploaderHelper::SAFE_VIDEO_EXT
self.binary = true self.binary = true
self.switcher_icon = 'film'
self.switcher_title = 'video'
end end
end end
.file-content.audio
%audio{ src: blob_raw_path, controls: true, data: { setup: '{}' } }
---
title: Users can preview audio files in a repository.
merge_request: 18354
author: Jesse Hall @jessehall3
type: added
...@@ -320,6 +320,22 @@ describe Blob do ...@@ -320,6 +320,22 @@ describe Blob do
expect(blob.rich_viewer).to be_a(BlobViewer::Markup) expect(blob.rich_viewer).to be_a(BlobViewer::Markup)
end end
end end
context 'when the blob is video' do
it 'returns a video viewer' do
blob = fake_blob(path: 'file.mp4', binary: true)
expect(blob.rich_viewer).to be_a(BlobViewer::Video)
end
end
context 'when the blob is audio' do
it 'returns an audio viewer' do
blob = fake_blob(path: 'file.wav', binary: true)
expect(blob.rich_viewer).to be_a(BlobViewer::Audio)
end
end
end end
describe '#auxiliary_viewer' do describe '#auxiliary_viewer' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment