pulibrary / bibdata

Local API for retrieving bibliographic and other useful data from Alma (Ruby 3.2.0, Rails 7.1.3.4)
BSD 2-Clause "Simplified" License
16 stars 7 forks source link

Update fragment to be viewer-container #1848

Open christinach opened 2 years ago

christinach commented 2 years ago

Update 'view' to 'viewer-container' https://github.com/pulibrary/bibdata/blob/e97b8911e50c10a2b6d2279cbddc2317d9f67b91/marc_to_solr/lib/princeton_marc.rb#L434

The id of the viewer container changed from view to viewer-container.

<div class="intrinsic-container intrinsic-container-16x9" id="viewer-container">
<iframe allowfullscreen="true" id="iframe-1" src="https://figgy.princeton.edu/viewer#?manifest=https://figgy.princeton.edu/concern/scanned_resources/94fe1231-a706-4361-b720-25626f4c4232/manifest&amp;config=https://figgy.princeton.edu/uv/uv_config.json">
</iframe>
</div>  

Part of https://github.com/pulibrary/orangelight/issues/1757

maxkadel commented 2 years ago

So, oddly, if you clear your cache and use the existing link with the #view anchor it does bring you to the correct place on the page the first time, but not subsequent times. Using the same link with #viewer-container does not appear to. I think it's possible that this is a javascript issue, as opposed to an issue with the text / anchor of the link.

christinach commented 2 years ago

The element with div id="view" is always at the bottom of the page. The viewer-container is the id of the iframe viewer container. We are building this element with id='viewer-container' in javascript. When there is a thumbnail with icon content indicating there is a viewer at the bottom of the page this thumbnail is part of an element with href 'viewer-container'. When the user clicks on the thumbnail or content-icon it will navigate them to the viewer-container at the bottom of the page. example of an element is:

<a href="#viewer-container"><div class="document-thumbnail has-viewer-link" data-oclc="[&quot;785740708&quot;]" data-bib-id="9970446223506421"><span class="sr-only">Go to viewer</span><img alt="" src="https://iiif-cloud.princeton.edu/iiif/2/c8%2Ff6%2F71%2Fc8f67121600746e6aa6ddfd1c3fe1d20%2Fintermediate_file/square/225,/0/default.jpg"></div></a>

When there is a text-anchor 'Digital content' in the record page with a link having the fragment https://catalog.princeton.edu/catalog/9946018083506421#view this will still navigate the user to the bottom of the page , because the div element with id=view is always at the bottom of the page and exists as a wrapper of the 'viewer-containers'. Unfortunately this cannot happen right now because the catalog domains that are being created through the indexing process are pulling ids from the figgy_ark_cache which is very old and containes voyager ids. This is why currently in Digital Content : the url would be 'https://catalog.princeton.edu/catalog/4601808#view'. When the user clicks on the url it will open a new page because it resolves to the alma id. The figgy_ark_cache cannot be updated because the specific rake task is broken. This is a different ticket and another discussion but all are connected https://github.com/pulibrary/orangelight/issues/3104. @maxkadel I'm looking into this ticket as well as the rest that are connected in #3104