Skip to content

Commit

Permalink
Merge pull request #2019 from samvera/add-license-rendering
Browse files Browse the repository at this point in the history
🐛 Add custom rendering for license
  • Loading branch information
jeremyf authored Oct 10, 2023
2 parents f8eee24 + 1c2a9d4 commit 6a2d624
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,7 @@ Metrics/BlockLength:
- 'spec/**/*.rb'
- 'lib/tasks/*.rake'
- 'app/controllers/catalog_controller.rb'

RSpec/FilePath:
Exclude:
- 'spec/config/application_spec.rb'
2 changes: 0 additions & 2 deletions app/services/uploaded_collection_thumbnail_path_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ def call(object)
"/uploads/uploaded_collection_thumbnails/#{object.id}/#{object.id}_card.jpg"
end

# rubocop:disable Metrics/LineLength, Rails/FilePath
def uploaded_thumbnail?(collection)
File.exist?(File.join(upload_dir(collection), "#{collection.id}_card.jpg"))
end

def upload_dir(collection)
Hyku::Application.path_for("public/uploads/uploaded_collection_thumbnails/#{collection.id}")
end
# rubocop:enable Metrics/LineLength, Rails/FilePath
end
end
4 changes: 4 additions & 0 deletions app/views/records/show_fields/_license.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% service = Hyrax::LicenseService.new %>
<% record.license.each do |r| %>
<%= link_to_field('license', r, service.label(r)) %> <%= iconify_auto_link(r, false) %><br />
<% end %>

0 comments on commit 6a2d624

Please sign in to comment.