diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 69d1f46f..0304abb4 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -119,7 +119,7 @@ class ExercisesController < ApplicationController private :user_by_code_harbor_token def exercise_params - params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :team_id, :title, files_attributes: file_attributes).merge(user_id: current_user.id, user_type: current_user.class.name) + params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :allow_file_creation, :team_id, :title, files_attributes: file_attributes).merge(user_id: current_user.id, user_type: current_user.class.name) end private :exercise_params diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index 1995c8d8..f0f69f7a 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -28,6 +28,10 @@ label = f.check_box(:hide_file_tree) = t('activerecord.attributes.exercise.hide_file_tree') + .checkbox + label + = f.check_box(:allow_file_creation) + = t('activerecord.attributes.exercise.allow_file_creation') h2 = t('activerecord.attributes.exercise.files') ul#files.list-unstyled.panel-group = f.fields_for :files do |files_form| diff --git a/app/views/exercises/show.html.slim b/app/views/exercises/show.html.slim index 2181acf2..fc28272a 100644 --- a/app/views/exercises/show.html.slim +++ b/app/views/exercises/show.html.slim @@ -16,6 +16,7 @@ h1 = row(label: 'exercise.maximum_score', value: @exercise.maximum_score) = row(label: 'exercise.public', value: @exercise.public?) = row(label: 'exercise.hide_file_tree', value: @exercise.hide_file_tree?) += row(label: 'exercise.allow_file_creation', value: @exercise.allow_file_creation?) = row(label: 'exercise.embedding_parameters') do = content_tag(:input, nil, class: 'form-control', readonly: true, value: embedding_parameters(@exercise)) diff --git a/config/locales/de.yml b/config/locales/de.yml index ed66f79a..54502828 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -38,6 +38,7 @@ de: team_id: Team title: Titel user: Autor + allow_file_creation: "Dateierstellung erlauben" external_user: consumer: Konsument email: E-Mail diff --git a/config/locales/en.yml b/config/locales/en.yml index f86a6963..635343d4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -38,6 +38,7 @@ en: team_id: Team title: Title user: Author + allow_file_creation: "Allow file creation" external_user: consumer: Consumer email: Email