diff --git a/app/controllers/concerns/hyrax/works_controller_behavior.rb b/app/controllers/concerns/hyrax/works_controller_behavior.rb index ebfbf8ec66..fbafe2ec55 100644 --- a/app/controllers/concerns/hyrax/works_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/works_controller_behavior.rb @@ -127,7 +127,10 @@ def inspect_work def manifest headers['Access-Control-Allow-Origin'] = '*' - render json: manifest_builder.to_h + respond_to do |wants| + wants.json { render json: manifest_builder.to_h } + wants.html { render json: manifest_builder.to_h } + end end private diff --git a/app/views/hyrax/base/_representative_media.html.erb b/app/views/hyrax/base/_representative_media.html.erb index 4e84138d6e..6170ba8920 100644 --- a/app/views/hyrax/base/_representative_media.html.erb +++ b/app/views/hyrax/base/_representative_media.html.erb @@ -2,7 +2,7 @@ <% if defined?(viewer) && viewer %> <%= PulUvRails::UniversalViewer.script_tag %>
-
+
<% else %> <%= media_display presenter.representative_presenter %> diff --git a/spec/controllers/hyrax/generic_works_controller_spec.rb b/spec/controllers/hyrax/generic_works_controller_spec.rb index 96f19b06b5..621cd772b0 100644 --- a/spec/controllers/hyrax/generic_works_controller_spec.rb +++ b/spec/controllers/hyrax/generic_works_controller_spec.rb @@ -609,9 +609,14 @@ .and_return(manifest_factory) end - it "produces a manifest" do + it "produces a manifest for a json request" do get :manifest, params: { id: work, format: :json } expect(response.body).to eq "{\"test\":\"manifest\"}" end + + it "produces a manifest for a html request" do + get :manifest, params: { id: work, format: :html } + expect(response.body).to eq "{\"test\":\"manifest\"}" + end end end diff --git a/spec/features/work_show_spec.rb b/spec/features/work_show_spec.rb index fb8bd97570..4cfcf5c59e 100644 --- a/spec/features/work_show_spec.rb +++ b/spec/features/work_show_spec.rb @@ -43,7 +43,7 @@ end # IIIF manifest does not include locale query param - expect(find('div.viewer:first')['data-uri']).to eq "/concern/generic_works/#{work.id}/manifest" + expect(find('div.viewer:first')['data-uri']).to eq "http://www.example.com/concern/generic_works/#{work.id}/manifest" end it "add work to a collection", clean_repo: true, js: true do