sciencehistory / scihist_digicoll

Science History Institute Digital Collections
Other
13 stars 0 forks source link

Pass `_scihist_viewer_search_area.html.erb` a reference to the work being shown. #2723

Closed eddierubeiz closed 3 months ago

eddierubeiz commented 3 months ago

Ref #2722 app/views/scihist_image_viewer/_scihist_viewer_search_area.html.erb needs a reference to the work, so pass it in as an argument. We need this so we can report search-within-the-work events to Google Analytics. See #2715

jrochkind commented 3 months ago

Huh, looks like it was good we tracked this down instead of editing the code to allow null and skip work reporting, yeah??

jrochkind commented 3 months ago

So in recent rails like we have, we actually could edit the partial with a "magic comment" saying it requires the local. maybe makes sense here?

https://masilotti.com/safer-rails-partials-with-strict-locals/

<%# locals: (work:) %>