scientist-softserv / britishlibrary

Other
3 stars 0 forks source link

override Hyrax::WorkShowPresenter.authorized_item_ids to filter out p… #463

Closed cziaarm closed 9 months ago

cziaarm commented 11 months ago

…df_pages

Story

When a pdf is processed by iiif_print gem it produces a child work for each page using the pdf_page work type, so that these can be displayed in the universal viewer as images and get all that good paging stuff.

But Hyra/Hyku will lovingly display all the child works on the show page for the original pdf, which causes a big old list of oddly named files.

It can be a handy way for administrators to manage the page images, but for the general users it makes them sad and confused.

This PR overrides the WorkShowPresenters authorized_item_ids method adding a line to filter out works of type pdf_page, but only if there is not a logged in user (so admins still have a route to the child work show pages and beyond).

Expected Behaviour Before Changes

Work how pages for works with PDFs that have have been processed by iiif_print gem have all those child pdf_page works displayed.

Expected Behavior After Changes

Work how pages for works with PDFs that have have been processed by iiif_print gem only display members that are not pdf_pages

Screenshots / Video

Before (or when logged in):

image

After (When not logged in):

image