Skip to content

Commit

Permalink
Merge branch 'main' into test-iiif_print
Browse files Browse the repository at this point in the history
  • Loading branch information
randalldfloyd authored Aug 8, 2023
2 parents 212f8e3 + 8636732 commit ccb617c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/concerns/essi/pdf_download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def pdf
type: 'application/pdf',
disposition: 'inline'
else
redirect_to [main_app, curation_concern],
redirect_to [main_app, presenter],
alert: 'You do not have access to download this PDF.'
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</p>

<p class="copyright">
<span class="line-break"><a href="https://accessibility.iu.edu/assistance" id="accessibility-link" title="Having trouble accessing this web page content? Please visit this page for assistance.">Accessibility</a> | <a href="/privacy" id="privacy-policy-link">Privacy Notice</a></span>
<span class="line-break"><a href="https://accessibility.iu.edu/assistance" id="accessibility-link" title="Having trouble accessing this web page content? Please visit this page for assistance.">Accessibility</a> | <a href="https://libraries.indiana.edu/privacy" id="privacy-policy-link">Privacy Notice</a></span>
<span class="hide-on-mobile"> | </span>
<a href="https://www.iu.edu/copyright/index.html">Copyright</a> &#169; 2020 <span class="line-break-small">The Trustees of <a href="https://www.iu.edu/" itemprop="url"><span itemprop="name">Indiana University</span></a></span>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
Hyrax::ArchivalMaterialPresenter,
described_class)
include_examples('update metadata remotely', :archival_material)
include_examples('pdf controller actions', :archival_material)
end
1 change: 1 addition & 0 deletions spec/controllers/hyrax/paged_resources_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
Hyrax::PagedResourcePresenter,
described_class)
include_examples('update metadata remotely', :paged_resource)
include_examples('pdf controller actions', :paged_resource)
end
23 changes: 23 additions & 0 deletions spec/support/shared_examples/pdf_controller_actions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
RSpec.shared_examples 'pdf controller actions' do |resource_symbol|

describe 'when logged in', :clean do
let(:main_app) { Rails.application.routes.url_helpers }
let(:user) { FactoryBot.create(:user) }
let(:resource) { FactoryBot.create(resource_symbol, user: user, title: ['Dummy Title'], pdf_state: 'NOT downloadable') }

describe '#pdf' do
context 'without authorization' do
before(:each) do
get :pdf, params: { id: resource.id }
end
it 'redirects to the resource' do
show_page = main_app.send("hyrax_#{resource_symbol}_path", resource, locale: 'en')
expect(response).to redirect_to show_page
end
it 'displays an alert' do
expect(flash[:alert]).to match /You do not have access to download this PDF/i
end
end
end
end
end

0 comments on commit ccb617c

Please sign in to comment.