Skip to content

Commit

Permalink
Merge pull request #1768 from sul-dlss/move-primary
Browse files Browse the repository at this point in the history
Move primary method to the resource level
  • Loading branch information
aaron-collier authored Nov 17, 2023
2 parents 8a0aa94 + aa13f67 commit 60d0bf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/models/embed/purl/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def size

# @return [ResourceFile]
def primary_file
files.find(&:primary?)
files.find { |file| primary_types.include?(file.mimetype) }
end

def primary_types
@primary_types ||= Array(Settings.primary_mimetypes[type])
end

# @return [ResourceFile]
Expand Down
4 changes: 0 additions & 4 deletions app/models/embed/purl/resource_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def hierarchical_title
title.split('/').last
end

def primary?
Array(Settings.primary_mimetypes[resource.type]).include?(mimetype)
end

def thumbnail?
image? && Settings.resource_types_that_contain_thumbnails.include?(resource.type)
end
Expand Down

0 comments on commit 60d0bf4

Please sign in to comment.