From 29b9d503632a656f68289eb7203ec731f174b02b Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Thu, 14 Sep 2017 11:30:53 +0200 Subject: [PATCH] Modals now popup correctly trough ajax, added js file for this functionality, and two partials which are reused from existing importer --- app/controllers/protocols_controller.rb | 7 ++++++- .../import_export/_import_json_protocol_modal.html.erb | 1 + .../_import_json_protocol_preview_modal.html.erb | 4 +++- app/views/protocols/index.html.erb | 5 ++--- app/views/protocols/protocolsio_import_create.js.erb | 3 +++ 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 app/views/protocols/protocolsio_import_create.js.erb diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 005f609dd..760a96a9f 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -609,7 +609,12 @@ def protocolsio_import_create json_file_contents=File.read(params[:json_file].path) @json_object=JSON.parse(json_file_contents) - render :partial => "/protocols/import_json_protocol_preview_modal" + + respond_to do |format| + format.html + format.js + end + end def protocolsio_temp_params diff --git a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb index a9bfc0a61..5d35ba8c7 100644 --- a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb @@ -18,6 +18,7 @@ <%= submit_tag t("protocols.index.modal_import_json_submit"), class: "btn btn-default" %> <% end %> + diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb index 07510de19..771b74ea3 100644 --- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb @@ -1,4 +1,4 @@ -