From: Vincent Vanwaelscappel Date: Fri, 28 Feb 2020 19:03:17 +0000 (+0100) Subject: wip #3438 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3c9505840bcec0a5d15a48450343efd3de880a56;p=QuizFactory.git wip #3438 @0.5 --- diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php index 1dc196e..d79edf3 100644 --- a/app/Models/Quiz.php +++ b/app/Models/Quiz.php @@ -39,7 +39,16 @@ class Quiz extends CubistMagicAbstractModel 'label' => 'Quiz language', 'type' => 'Locale', 'column' => true, - 'tab' => 'Texts and translations']); + 'tab' => 'Settings']); + + $this->addField([ + 'name' => 'questions', + 'type' => 'BunchOfFieldsMultiple', + 'bunch' => 'App\SubForms\Question', + 'label' => 'Questions', + 'add_label' => 'Add question', + 'tab' => 'Questions / Answers', + ]); $colors = [ 'mainColor' => ['label' => 'Main color', 'hint' => 'Buttons and rollovers color'], diff --git a/app/SubForms/Question.php b/app/SubForms/Question.php new file mode 100644 index 0000000..50877e3 --- /dev/null +++ b/app/SubForms/Question.php @@ -0,0 +1,33 @@ +addField(['name' => 'question', + 'type' => 'Text', + 'label' => 'Question']); + + $this->addField(['name' => 'multiple', + 'type' => 'Checkbox', + 'label' => 'Multiple answers']); + + $this->addField([ + 'name' => 'answers', + 'type' => 'Table', + 'entity_singular' => 'answer', + 'columns' => [ + 'answer' => 'Answer label', + 'correct' => 'Correct', + ], + 'label' => 'Answers', + ]); + } +}