From 13e946943f7a73581117a3f5a5aa29ba74ae579a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 29 Sep 2023 12:43:16 +0200 Subject: [PATCH] wip #6248 @0.25 --- app/Elearning/QuizCompiler/L10N.php | 4 +- app/Models/Quiz.php | 9 ---- app/Models/QuizTranslation.php | 50 ------------------- .../elearning_translation_overwrite.blade.php | 8 +-- 4 files changed, 6 insertions(+), 65 deletions(-) delete mode 100644 app/Models/QuizTranslation.php diff --git a/app/Elearning/QuizCompiler/L10N.php b/app/Elearning/QuizCompiler/L10N.php index 0f78ce061..5092e4343 100644 --- a/app/Elearning/QuizCompiler/L10N.php +++ b/app/Elearning/QuizCompiler/L10N.php @@ -13,7 +13,7 @@ trait L10N protected function getTranslations() { - $res= ElearningTranslate::getLocaleTranslations($this->data->translation, true); - return $res; + $res = ElearningTranslate::getLocaleTranslations($this->data->translation, true); + return array_merge($res, $this->data->translations); } } diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php index 68f110365..6e253818b 100644 --- a/app/Models/Quiz.php +++ b/app/Models/Quiz.php @@ -173,15 +173,6 @@ class Quiz extends ToolboxModel 'default' => true, 'type' => 'Checkbox', ]); - $this->addField('instant_success_messages', Textarea::class, __('Petits messages accompagnant une bonne réponse'), - [ - 'when' => ['instantReview' => ['1']], - 'placeholder' => __('Bonne réponse'), 'hint' => __('Une phrase par ligne, la phrase affichée sera sélectionnée aléatoirement dans cette liste.') . ' ' . __(' Par défaut "Bonne réponse" dans la langue du quiz') - ]); - $this->addField('instant_fail_messages', Textarea::class, __('Petits messages accompagnant une mauvaise réponse'), [ - 'when' => ['instantReview' => ['1']], - 'placeholder' => __('Mauvaise réponse'), 'hint' => __('Une phrase par ligne, la phrase affichée sera sélectionnée aléatoirement dans cette liste.') . ' ' . __(' Par défaut "Mauvaise réponse" dans la langue du quiz') - ]); $this->addField('section_theme', FormBigSection::class, __('Thème graphique')); $this->addField('theme', \App\Fields\QuizTheme::class, __('Thème'), ['non_default_tracking' => false, 'default' => 1]); diff --git a/app/Models/QuizTranslation.php b/app/Models/QuizTranslation.php deleted file mode 100644 index a1e20c1e9..000000000 --- a/app/Models/QuizTranslation.php +++ /dev/null @@ -1,50 +0,0 @@ - 'quiztranslation', - 'singular' => 'traduction de quiz', - 'plural' => 'traductions de quiz']; - - public function setFields() - { - parent::setFields(); - - $this->addField(['name' => 'locale', - 'label' => __('Langue'), - 'type' => 'Locale', - 'column' => true]); - - foreach (self::getTexts() as $name => $default) { - $this->addField(['name' => $name, - 'label' => sprintf(__('Traduction de « %s »'), $default), - 'type' => 'Text']); - } - - foreach (Quiz::getMessages() as $name => $label) { - $this->addField([ - 'name' => $name, - 'label' => $label, - 'type' => 'Text']); - } - } - - public static function getTexts() - { - return [ - 'validateAnswer' => 'Validate answers', - 'validateAnswerSingular' => 'Validate answer', - 'reviewAnswer' => 'Review answers', - 'question' => 'Question %d:', - 'totalQuestions' => 'Total questions:', - 'correctAnswers' => 'Correct answers:', - 'restartQuiz' => 'Restart the quiz', - ]; - } -} diff --git a/resources/views/fields/elearning_translation_overwrite.blade.php b/resources/views/fields/elearning_translation_overwrite.blade.php index 15b546271..e3935a3cc 100644 --- a/resources/views/fields/elearning_translation_overwrite.blade.php +++ b/resources/views/fields/elearning_translation_overwrite.blade.php @@ -3,10 +3,10 @@ @php $seenTranslationOverwrite=true;@endphp @push('crud_fields_scripts')