From 9fba70cde2c5537bd43f381e276e0013f4a5d5c1 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 16 Dec 2020 18:00:47 +0100 Subject: [PATCH] Always show file upload box when editing exercises --- app/views/exercises/_code_field.html.slim | 6 +++--- config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/exercises/_code_field.html.slim b/app/views/exercises/_code_field.html.slim index 8fd19eec..5e05489b 100644 --- a/app/views/exercises/_code_field.html.slim +++ b/app/views/exercises/_code_field.html.slim @@ -1,7 +1,7 @@ .form-group class="form-group-#{attribute.to_s.gsub('_', '-')}" = form.label(attribute, label) - |   - a.toggle-input data={text_initial: t('shared.upload_file'), text_toggled: t('shared.back')} href='#' = t('shared.upload_file') = form.text_area(attribute, class: 'code-field form-control', rows: 16, style: "display:none;") - = form.file_field(attribute, class: 'alternative-input form-control-file', disabled: true) = render partial: 'editor_edit', locals: { exercise: @exercise } + .card.border-warning.p-2.my-2 + = form.file_field(attribute, class: 'form-control-file', style: "display: inline-block;") + .help-block.form-text = t('exercises.file_form.hints.upload') diff --git a/config/locales/de.yml b/config/locales/de.yml index 07186660..b6d2d1b3 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -366,6 +366,7 @@ de: hints: feedback_message: Diese Nachricht wird als Hinweis zu fehlschlagenden Tests angezeigt. path: 'Pfad der Datei im Projektverzeichnis. Kann auch leer gelassen werden.' + upload: Eine hochgeladene Datei hat Vorrang vor Änderungen im Textfeld und wird nach dem Speichern sichtbar. Der Dateiname und die Dateiendung wird automatisch von der hochgeladenen Datei übernommen. form: add_file: Datei hinzufügen add_tips: Tipps hinzufügen diff --git a/config/locales/en.yml b/config/locales/en.yml index f4d5d959..e7697bd9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -368,6 +368,7 @@ en: hints: feedback_message: This message is used as a hint for failing tests. path: "The file's path in the project tree. Can be left blank." + upload: An uploaded file takes precedence over changes in the text area and will be visible once saved. The resulting file name and file type will be set to match the uploaded file automatically. form: add_file: Add file add_tips: Add tips