hyku icon indicating copy to clipboard operation
hyku copied to clipboard

🚧 i205 - add ability to upload collection thumbnails

Open ShanaLMoore opened this issue 9 months ago • 1 comments

Issue:

  • https://github.com/scientist-softserv/hykuup_knapsack/issues/205

The ability for collections to have thumbnails will be deprecated in Hyrax v5.0.0.

This PR implements the ability to upload collection thumbnails by following the precedence set by the collection's branding's banner and logo uploads.

Ideally we'd contribute this back if the community supports it. However, for the sake of time we are overriding Hyrax instead.

TODO:

  • [x] FRONTEND: render image for collection thumbnails (ie: catalog or collection index page should render the uploaded images)
  • [x] FRONTEND: thumbnails should link to the associated collection from the catalog page
  • [ ] code clean up: there's a lot of similar code since it was basically copied from existing functionality. It'd also be nice to make partials out of the form_branding.html.erb
  • [x] thumbnail alt text not saving. the img must be completely removed first.
  • [x] add and update specs
  • [x] write a rake task to migrate existing collection thumbnails to valkyrie collections
# altext should've been "test" 
# Steps to reproduce: create a collection. upload a thumbnail and save. enter alt text and save. 
# Noticed that you must upload the thumbnail AND enter the alt text before saving for it to persist. 

CollectionBrandingInfo.where(role: thumbnail) => 
[#<CollectionBrandingInfo:0x0000ffff7e0440d8     
  id: 5,                                         
  collection_id:                                 
   "69afdb60-3a3d-41b1-9ecd-c8a5959516ed",       
  role: "thumbnail",                             
  local_path:                                    
   "/app/samvera/hyrax-webapp/public/branding/69afdb60-3a3d-41b1-9ecd-c8a5959516ed/thumbnail/diego_1_.jpg",                                        
  alt_text: "",
  target_url: "TODO: link to the collection",
  height: nil,
  width: nil,
  created_at:
   Mon, 06 May 2024 23:03:29.140187000 UTC +00:00,
  updated_at:
   Mon, 06 May 2024 23:03:29.140187000 UTC +00:00>]

image

image

image

image

ShanaLMoore avatar May 06 '24 22:05 ShanaLMoore