]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6248 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 29 Sep 2023 10:43:16 +0000 (12:43 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 29 Sep 2023 10:43:16 +0000 (12:43 +0200)
app/Elearning/QuizCompiler/L10N.php
app/Models/Quiz.php
app/Models/QuizTranslation.php [deleted file]
resources/views/fields/elearning_translation_overwrite.blade.php

index 0f78ce061e8276fd9be9064d3ff94ae513e12dc8..5092e434329226c5e5bf16eed161a56aa45eea5a 100644 (file)
@@ -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);
     }
 }
index 68f11036531a3e450fc090756dbb27aeb94ed127..6e253818b7876025577801a47e8511b653702390 100644 (file)
@@ -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 (file)
index a1e20c1..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel;
-
-// __('!! e-Learning')
-class QuizTranslation extends CubistMagicAbstractModel
-{
-    protected $table = 'quiz_translation';
-    protected $_options = ['name' => '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',
-        ];
-    }
-}
index 15b5462716f883bdbe34c9f148693396ce56ef3c..e3935a3cc44ce0e0afd901cce2e8459e1e81d12f 100644 (file)
@@ -3,10 +3,10 @@
     @php $seenTranslationOverwrite=true;@endphp
     @push('crud_fields_scripts')
         <script>
-            var allTranslations =@json(\App\Models\FluidbookTranslate::getAllTranslations());
-            var locale = $('select[name="locale"]').val();
-            $(document).on('change', 'select[name="locale"]', function () {
-                locale = $('select[name="locale"]').val()
+            var allTranslations =@json(\App\Models\ElearningTranslate::getAllTranslations());
+            var locale = $('select[name="translation"]').val();
+            $(document).on('change', 'select[name="translation"]', function () {
+                locale = $('select[name="translation"]').val()
                 updateTranslationOverwrite();
             });