Skip to content

Commit

Permalink
Display media_object.title when there is 1 section
Browse files Browse the repository at this point in the history
  • Loading branch information
masaball committed Jan 10, 2024
1 parent 2e58606 commit 9222907
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/concerns/master_file_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def display_title
elsif file_location.present? && (media_object.master_file_ids.size > 1)
file_location.split("/").last
end
mf_title.blank? ? nil : mf_title
mf_title.blank? ? media_object.title : mf_title
end

def embed_title
Expand Down
8 changes: 4 additions & 4 deletions app/presenters/speedy_af/proxy/master_file.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2011-2023, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
#
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
Expand Down Expand Up @@ -44,7 +44,7 @@ def display_title
elsif file_location.present? && (media_object.master_file_ids.size > 1)
file_location.split("/").last
end
mf_title.blank? ? nil : mf_title
mf_title.blank? ? media_object.title : mf_title
end

# @return [SupplementalFile]
Expand Down
6 changes: 3 additions & 3 deletions spec/models/iiif_canvas_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
let(:structure_xml) { "" }
let(:master_file) { FactoryBot.create(:master_file, title: "video.mp4", media_object: media_object, derivatives: [derivative]) }

it 'autogenerates a basic range with display_title label' do
it 'autogenerates a basic range with display_title as label' do
expect(subject.label.to_s).to eq "{\"none\"=>[\"#{master_file.display_title}\"]}"
expect(subject.items.size).to eq 1
expect(subject.items.first).to be_a IiifCanvasPresenter
Expand All @@ -103,8 +103,8 @@
context 'master file without title' do
let(:structure_xml) { "" }

it 'autogenerates a basic range with nil label' do
expect(subject.label.to_s).to eq "{\"none\"=>[nil]}"
it 'autogenerates a basic range with media_object.title as label' do
expect(subject.label.to_s).to eq "{\"none\"=>[\"#{media_object.title}\"]}"
expect(subject.items.size).to eq 1
expect(subject.items.first).to be_a IiifCanvasPresenter
expect(subject.items.first.media_fragment).to eq "t=0,#{master_file.duration.to_f/1000}"
Expand Down

0 comments on commit 9222907

Please sign in to comment.