Enable exercise forms to manipulate file creation flag

This commit is contained in:
Maximilian Grundke
2016-05-10 17:14:07 +02:00
parent 6c820b75c7
commit aba6d56a87
5 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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|

View File

@ -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))

View File

@ -38,6 +38,7 @@ de:
team_id: Team
title: Titel
user: Autor
allow_file_creation: "Dateierstellung erlauben"
external_user:
consumer: Konsument
email: E-Mail

View File

@ -38,6 +38,7 @@ en:
team_id: Team
title: Title
user: Author
allow_file_creation: "Allow file creation"
external_user:
consumer: Consumer
email: Email