From 367eff6401957e8b0f81fc37c6a02e5f34615098 Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Wed, 7 Feb 2018 11:17:53 +0100 Subject: [PATCH] re-pushing this, this got merged into master already but i accidentally deleted it when merging two branches --- app/controllers/protocols_controller.rb | 8 ++++++++ .../import_export/_import_json_protocol_modal.html.erb | 1 + app/views/protocols/protocolsio_import_create.js.erb | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 6875c71e3..f0a147486 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -601,6 +601,14 @@ class ProtocolsController < ApplicationController def protocolsio_import_create @protocolsio_too_big = false @protocolsio_invalid_file = false + @protocolsio_no_file = false + if params[:json_file].nil? + @protocolsio_no_file = true + respond_to do |format| + format.js {} + end + return 0 # return 0 stops the rest of the controller code from executing + end extension = File.extname(params[:json_file].path) file_size = File.size(params[:json_file].path) if extension != '.txt' && extension != '.json' 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 1de9272c8..f6928dd40 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 @@