Skip to content

Commit

Permalink
Remove empty masterfile titles from default playlistitem title
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeese committed Sep 19, 2017
1 parent 89f414a commit 7e5029c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/controllers/media_objects_controller.rb
Expand Up @@ -108,8 +108,7 @@ def add_to_playlist
end
else
#create a single item for the entire masterfile
item_title = @media_object.title
item_title += " - #{mf.title}" if @media_object.master_file_ids.count>1
item_title = @media_object.master_file_ids.count>1? mf.embed_title : @media_object.title
clip = AvalonClip.new(title: item_title, master_file: mf)
playlist.items += [PlaylistItem.new(clip: clip, playlist: playlist)]
end
Expand Down
8 changes: 6 additions & 2 deletions app/models/concerns/master_file_behavior.rb
Expand Up @@ -67,11 +67,15 @@ def stream_details(token,host=nil)
})
end

def embed_title
def display_title
mf_title = self.structuralMetadata.section_title unless self.structuralMetadata.blank?
mf_title ||= self.title if self.title.present?
mf_title ||= self.file_location.split( "/" ).last if self.file_location.present?
[ self.media_object.title, mf_title ].compact.join(" - ")
mf_title.blank? ? nil : mf_title
end

def embed_title
[ self.media_object.title, display_title ].compact.join(" - ")
end

def embed_code(width, permalink_opts = {})
Expand Down

0 comments on commit 7e5029c

Please sign in to comment.