Skip to content

Commit

Permalink
confirm for rti file download
Browse files Browse the repository at this point in the history
  • Loading branch information
Banu Kutlu committed Jul 26, 2022
1 parent af2c1ba commit 7adb906
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/helpers/blacklight_display_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def download_links(document)
content_tag(:span,
link_to(tag.i(class: 'fa fa-download download-link-fa') + "Download #{name}",
Rails.application.routes.url_helpers.final_submission_file_path(final_submission_id),
class: 'file-link form-control'))
data: { confirm: document.confirmation }, class: 'file-link form-control'))
)
end

Expand Down
8 changes: 8 additions & 0 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,12 @@ def defense
def defended_at
fetch(:defended_at_dtsi, nil)
end

def restricted_to_institution?
access_level.current_access_level == 'restricted_to_institution'
end

def confirmation
I18n.t('registered.confirmation') if restricted_to_institution?
end
end
7 changes: 4 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
# available at https://guides.rubyonrails.org/i18n.html.

en:
hello: "Hello world"

graduate:
program:
label: Graduate Program
Expand All @@ -56,4 +54,7 @@ en:
list:
label: Thesis Supervisor

libraries_help_link: https://libraries.psu.edu/website-feedback
libraries_help_link: https://libraries.psu.edu/website-feedback

registered:
confirmation: 'You are attempting to download information that is restricted to the Penn State University community. By clicking OK you acknowledge that the information downloaded should not be dispersed, used, or reproduced for any purposes outside of the University community.'
4 changes: 2 additions & 2 deletions lib/tasks/solr.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace :solr do
desc 'Reset Solr'
task reset: :environment do
conf = EtdaExplore::SolrAdmin.new
conf.delete_all_collections
conf.delete_all_configsets
conf.delete_collection
conf.delete_configset

Rake::Task['solr:init'].invoke
end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/blacklight_display_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

it 'returns a link for open access and restricted to institution submissions' do
expect(render_download_links(oa_doc)).to eq "<span><span><a class=\"file-link form-control\" href=\"/files/final_submissions/#{oa_doc[:value].first}\"><i class=\"fa fa-download download-link-fa\"></i>Download #{oa_doc[:document][:file_name_ssim].first}</a></span></span>"
expect(render_download_links(rti_doc)).to eq "<span><span><a class=\"file-link form-control\" href=\"/files/final_submissions/#{rti_doc[:value].first}\"><i class=\"fa fa-download download-link-fa\"></i>Download #{rti_doc[:document][:file_name_ssim].first}</a></span></span>"
expect(render_download_links(rti_doc)).to eq "<span><span><a data-confirm=\"#{I18n.t('registered.confirmation')}\" class=\"file-link form-control\" href=\"/files/final_submissions/#{rti_doc[:value].first}\"><i class=\"fa fa-download download-link-fa\"></i>Download #{rti_doc[:document][:file_name_ssim].first}</a></span></span>"
expect(render_download_links(r_doc)).to eq '<p>No files available due to restrictions.</p>'
end
end
Expand Down

0 comments on commit 7adb906

Please sign in to comment.