diff --git a/app/helpers/pdf_viewer_helper.rb b/app/helpers/pdf_viewer_helper.rb new file mode 100644 index 000000000..6603026e4 --- /dev/null +++ b/app/helpers/pdf_viewer_helper.rb @@ -0,0 +1,20 @@ +module PdfViewerHelper + def viewer_url(path) + "/web/viewer.html?file=#{path}##{query_param}" + end + + def query_param + return unless search_query + "search=#{search_query}&phrase=true" + end + + private + + def search_query + search && search.respond_to?(:query_params) && search.query_params[:q] + end + + def search + current_search_session + end +end diff --git a/app/views/hyrax/file_sets/media_display/_pdf.html.erb b/app/views/hyrax/file_sets/media_display/_pdf.html.erb index 3346795fc..534ddc33c 100644 --- a/app/views/hyrax/file_sets/media_display/_pdf.html.erb +++ b/app/views/hyrax/file_sets/media_display/_pdf.html.erb @@ -5,7 +5,7 @@ + title="PDF Document" src="<%= viewer_url(download_path(file_set)) %>"> <% else %>