From 6b038ed34192ec7bd0979e8f36d69ce267eaf801 Mon Sep 17 00:00:00 2001 From: Kevin De Pelseneer Date: Mon, 22 Jul 2024 16:06:14 +0200 Subject: [PATCH] Move logic to the view --- app/controllers/investigations_controller.rb | 5 ----- app/views/investigations/_form.html.erb | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/investigations_controller.rb b/app/controllers/investigations_controller.rb index 70b942a195..2d42e2e150 100644 --- a/app/controllers/investigations_controller.rb +++ b/app/controllers/investigations_controller.rb @@ -72,11 +72,6 @@ def ro_for_download headers["Content-Length"]=ro_file.size.to_s end - def new - @investigation = Investigation.new - @investigation.is_isa_json_compliant = Seek::Config.isa_json_compliance_enabled ? true : false - respond_to(&:html) - end def create @investigation = Investigation.new(investigation_params) update_sharing_policies @investigation diff --git a/app/views/investigations/_form.html.erb b/app/views/investigations/_form.html.erb index 6fa4080225..a7a4be86b1 100644 --- a/app/views/investigations/_form.html.erb +++ b/app/views/investigations/_form.html.erb @@ -1,4 +1,5 @@ <% object ||= nil %> +<% isa_json_compliance_default = @investigation.new_record? ? Seek::Config.isa_json_compliance_enabled : @investigation.is_isa_json_compliant %> <%= f.error_messages -%> @@ -26,7 +27,7 @@ <% if @investigation.studies.any? %> <%= f.check_box :is_isa_json_compliant, disabled: "disabled"%> <% else %> - <%= f.check_box :is_isa_json_compliant%> + <%= f.check_box :is_isa_json_compliant, checked: isa_json_compliance_default %> <% end %> <%= "Make #{t('investigation')} compliant to ISA-JSON schemas?" %>