From 46cb5e57f9a85430c60d16362a147c3a78f6d99d Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 14 Dec 2021 23:39:31 +0100 Subject: [PATCH] Hide FileTemplate for new files if not configured --- app/views/code_ocean/files/_form.html.slim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/code_ocean/files/_form.html.slim b/app/views/code_ocean/files/_form.html.slim index 0a42f458..bfdf2257 100644 --- a/app/views/code_ocean/files/_form.html.slim +++ b/app/views/code_ocean/files/_form.html.slim @@ -11,9 +11,10 @@ .form-group = f.label(:file_type_id, t('activerecord.attributes.file.file_type_id')) = f.collection_select(:file_type_id, FileType.where(binary: false).order(:name), :id, :name, {selected: @exercise.execution_environment.file_type.try(:id)}, class: 'form-control') - .form-group - = f.label(:file_template_id, t('activerecord.attributes.file.file_template_id')) - = f.collection_select(:file_template_id, FileTemplate.all.order(:name), :id, :name, {:include_blank => true}, class: 'form-control') + - if FileTemplate.any? + .form-group + = f.label(:file_template_id, t('activerecord.attributes.file.file_template_id')) + = f.collection_select(:file_template_id, FileTemplate.all.order(:name), :id, :name, {:include_blank => true}, class: 'form-control') = f.hidden_field(:context_id) .d-none#noTemplateLabel data-text=t('file_template.no_template_label') .actions = render('shared/submit_button', f: f, object: CodeOcean::File.new)