diff --git a/app/controllers/research_controller.rb b/app/controllers/research_controller.rb index 78ee2ff..c61d91e 100644 --- a/app/controllers/research_controller.rb +++ b/app/controllers/research_controller.rb @@ -2,4 +2,9 @@ class ResearchController < ApplicationController def index end + + + def download_pdf + send_file "#{Rails.root}/public/docs/#{params[:path]}.pdf", type: "application/pdf", x_sendfile: true + end end diff --git a/app/views/research/index.html.erb b/app/views/research/index.html.erb index f6e37ce..4d452f4 100644 --- a/app/views/research/index.html.erb +++ b/app/views/research/index.html.erb @@ -17,17 +17,17 @@
- <%= link_to("Test Anxiety", download: asset_path("docs/test_anxiety_and_poor_sleep_2021.pdf"), target: "_blank") do %> + <%= link_to(research_download_pdf_path(path: "test_anxiety_and_poor_sleep")) do %> <%= image_tag "research/test_anxiety_and_sleep.png", class: "file-download" %> <% end %>
- <%= link_to("Psychological toll of high statkes testing", download: asset_path("docs/psychological_toll_of_high_stakes_testing_2022.pdf"), target: "_blank") do %> + <%= link_to(research_download_pdf_path(path: "psychological_toll_of_high_stakes_testing")) do %> <%= image_tag "research/psychological_toll_of_high_stakes_testing.png", class: "file-download" %> <% end %>
- <%= link_to("Test Anxiety", download: asset_path("docs/testing_stress_and_performance.pdf"), target: "_blank") do %> + <%= link_to( research_download_pdf_path(path: "testing_stress_and_performance")) do %> <%= image_tag "research/testing_stress.png", class: "file-download" %> <% end %>
diff --git a/config/routes.rb b/config/routes.rb index cf461cc..5a9d727 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ Rails.application.routes.draw do resources :qpa, only: :index resources :resource, only: :index resources :research, only: :index + get 'research/download_pdf', to: "research#download_pdf" resources :work_with_ecp, only: :index resources :construction, only: :index resources :district_leader, only: :index diff --git a/app/assets/images/docs/psychological_toll_of_high_stakes_testing_2022.pdf b/public/docs/psychological_toll_of_high_stakes_testing.pdf similarity index 100% rename from app/assets/images/docs/psychological_toll_of_high_stakes_testing_2022.pdf rename to public/docs/psychological_toll_of_high_stakes_testing.pdf diff --git a/app/assets/images/docs/test_anxiety_and_poor_sleep_2021.pdf b/public/docs/test_anxiety_and_poor_sleep.pdf similarity index 100% rename from app/assets/images/docs/test_anxiety_and_poor_sleep_2021.pdf rename to public/docs/test_anxiety_and_poor_sleep.pdf diff --git a/app/assets/images/docs/testing_stress_and_performance.pdf b/public/docs/testing_stress_and_performance.pdf similarity index 100% rename from app/assets/images/docs/testing_stress_and_performance.pdf rename to public/docs/testing_stress_and_performance.pdf