Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Ensure we pass query to IIIF viewer
In the later versions of Hyku, they override the Hyrax view of `app/views/catalog/_index_header_list_default.html.erb`; so IIIF Print's strategy of overriding that view does not work. (Because Hyku's view path rightly takes higher precedence than any Gem). Looking at the updated view, the URL is generated via a helper method. So our approach to adding the parent_query or query parameter leverages extending the helper method. We still need the view override, as it reflects a prior state of Hyku (and Hyrax) that some implementations will continue to use. Below is a *diff of the files in Hyku v5.0.1 and IIIF Print*. I have not resolved all of these things but am close: <details> <summary>diff of the files in Hyku v5.0.1 and IIIF Print</summary> ``` ❯ diff hyrax-webapp/app/views/catalog/_index_header_list_default.html.erb ../iiif_print/app/views/catalog/_index_header_list_default.html.erb 1,2c1,2 < <%# OVERRIDE Hyrax 3.4.0 to support shared search %> < <% model = document.hydra_model %> --- > <%# OVERRIDE Hyrax 2.9.6 to show parent_query params if metadata is found in parent record %> > 4,9c4,12 < <% if model == Hyrax::PcdmCollection || model < Hyrax::PcdmCollection %> < <h4 class="search-result-title"><%= link_to document.title_or_label, generate_work_url(document, request) %></h4> < <%= Hyrax::CollectionPresenter.new(document, current_ability).collection_type_badge %> < <% else %> < <h4 class="search-result-title"><%= link_to document.title_or_label, generate_work_url(document, request) %></h4> < <% end %> --- > <h3 class="search-result-title"> > <% if params['q'].present? && document.any_highlighting? %> > <%= link_to document.title_or_label, [document, { parent_query: params['q'] }] %></h3> > <% elsif params['q'].present? %> > <%= link_to document.title_or_label, [document, { query: params['q'] }] %></h3> > <% else %> > <%= link_to document.title_or_label, document %></h3> > <% end %> > </h3> ``` </details> Co-authored-by: Kirk Wang <[email protected]>
- Loading branch information