-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
103 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/views/curation_concerns/base/_representative_media.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
app/views/curation_concerns/generic_files/_media_display.html.erb
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
app/views/curation_concerns/generic_files/media_display/_audio.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<audio controls="controls" class="audiojs" preload="auto"> | ||
<source src="<%= main_app.download_path(generic_file, file: 'ogg') %>" type="audio/ogg" /> | ||
<source src="<%= main_app.download_path(generic_file, file: 'mp3') %>" type="audio/mpeg" /> | ||
Your browser does not support the audio tag. | ||
</audio> | ||
|
4 changes: 4 additions & 0 deletions
4
app/views/curation_concerns/generic_files/media_display/_default.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<%= link_to main_app.download_path(generic_file), target: "_new", title: "Download the document" do %> | ||
<%= image_tag "default.png", alt: "No preview available", class: "img-responsive" %> | ||
<% end %> | ||
|
8 changes: 8 additions & 0 deletions
8
app/views/curation_concerns/generic_files/media_display/_image.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<%= link_to main_app.download_path(generic_file), target: "_new", title: "Download the full-sized image" do %> | ||
<%= image_tag(main_app.download_path(generic_file, file: 'thumbnail'), | ||
class: "img-responsive", | ||
alt: "Download the full-sized image of #{generic_file.title.first}" | ||
) %> | ||
Download the full-sized image | ||
<% end %> | ||
|
7 changes: 7 additions & 0 deletions
7
app/views/curation_concerns/generic_files/media_display/_pdf.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%= link_to main_app.download_path(generic_file), target: "_new", title: "Download the full-sized PDF" do%> | ||
<%= image_tag main_app.download_path(generic_file, file: 'thumbnail'), | ||
class: "img-responsive", | ||
alt: "Download the full-sized PDF of #{generic_file.title.first}" %> | ||
Download the full-sized PDF | ||
<% end %> | ||
|
6 changes: 6 additions & 0 deletions
6
app/views/curation_concerns/generic_files/media_display/_video.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<video controls="controls" class="video-js vjs-default-skin" data-setup="{}" preload="auto"> | ||
<source src="<%= main_app.download_path(generic_file, file: 'webm') %>" type="video/webm" /> | ||
<source src="<%= main_app.download_path(generic_file, file: 'mp4') %>" type="video/mp4" /> | ||
Your browser does not support the video tag. | ||
</video> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
47 changes: 47 additions & 0 deletions
47
spec/helpers/curation_concerns/generic_file_helper_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'spec_helper' | ||
|
||
describe CurationConcerns::GenericFileHelper do | ||
describe '#media_display' do | ||
let(:generic_file) { GenericFile.new(mime_type: mime_type) } | ||
let(:mime_type) { 'image/tiff' } | ||
|
||
it "renders a partial" do | ||
allow(helper).to receive(:media_display_partial).with(generic_file) | ||
.and_return('curation_concerns/generic_files/media_display/image') | ||
expect(helper).to receive(:render) | ||
.with('curation_concerns/generic_files/media_display/image', generic_file: generic_file) | ||
helper.media_display(generic_file) | ||
end | ||
end | ||
|
||
describe '#media_display_partial' do | ||
subject { helper.media_display_partial(generic_file) } | ||
|
||
let(:generic_file) { GenericFile.new(mime_type: mime_type) } | ||
|
||
context "with an image" do | ||
let(:mime_type) { 'image/tiff' } | ||
it { is_expected.to eq 'curation_concerns/generic_files/media_display/image' } | ||
end | ||
|
||
context "with a video" do | ||
let(:mime_type) { 'video/webm' } | ||
it { is_expected.to eq 'curation_concerns/generic_files/media_display/video' } | ||
end | ||
|
||
context "with an audio" do | ||
let(:mime_type) { 'audio/wav' } | ||
it { is_expected.to eq 'curation_concerns/generic_files/media_display/audio' } | ||
end | ||
|
||
context "with a pdf" do | ||
let(:mime_type) { 'application/pdf' } | ||
it { is_expected.to eq 'curation_concerns/generic_files/media_display/pdf' } | ||
end | ||
|
||
context "with anything else" do | ||
let(:mime_type) { 'application/binary' } | ||
it { is_expected.to eq 'curation_concerns/generic_files/media_display/default' } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters