From 7ca1a5906ff32fc7c19117b60fd717462e1c248d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 7 Oct 2020 20:05:59 +0200 Subject: [PATCH] wip #3924 @3 --- app/Models/Company.php | 7 +++-- app/Models/Quiz.php | 6 +++++ app/SubForms/Question.php | 26 +++++++++---------- composer.json | 4 +-- .../base/inc/sidebar_content.blade.php | 14 +++++++++- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/app/Models/Company.php b/app/Models/Company.php index b2d07b0f7..8402220f6 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -1,4 +1,7 @@ 'Over this score (out of 100), the quiz is passed. Set 0 to disable', 'tab' => 'Settings']); + $this->addField(['name'=>'instantReview', + 'label'=>'Enable instant review', + 'hint'=>'Let the user see if he had a correct or wrong answer, just after his answer', + 'type'=>'Checkbox', + 'tab'=>'Settings']); + $this->addField(['name' => 'review', 'label' => 'Enable answer review', 'hint' => 'Let the user review his answers and the correct ones at the end of the quiz', diff --git a/app/SubForms/Question.php b/app/SubForms/Question.php index 9b7625ee5..815ee738d 100644 --- a/app/SubForms/Question.php +++ b/app/SubForms/Question.php @@ -13,7 +13,15 @@ class Question extends SubForm $this->addField(['name' => 'question', 'type' => 'Text', - 'label' => 'Question']); + 'label' => 'Question label']); + + $this->addField(['name' => 'type', + 'type' => 'SelectFromArray', + 'label' => 'Type', + 'options' => ['multiple' => 'Multiple choice question', + 'text' => 'Text', + 'textarea' => 'Long text', + 'email' => 'E-mail']]); $this->addField(['name' => 'explaination', 'type' => 'Textarea', @@ -22,7 +30,9 @@ class Question extends SubForm $this->addField(['name' => 'multiple', 'type' => 'Checkbox', - 'label' => 'Multiple answers']); + 'label' => 'Multiple answers', + 'when' => ['type' => 'multiple'] + ]); $this->addField([ 'name' => 'answers', @@ -30,17 +40,7 @@ class Question extends SubForm 'bunch' => 'App\SubForms\Answer', 'add_label' => 'New answer', 'label' => 'Answers', + 'when' => ['type' => 'multiple'] ]); - - -// $this->addField([ -// 'name' => 'questions', -// 'type' => 'BunchOfFieldsMultiple', -// 'bunch' => 'App\SubForms\Answer', -// 'label' => 'Questions', -// 'add_label' => 'Add question', -// 'tab' => 'Questions / Answers', -// ]); - } } diff --git a/composer.json b/composer.json index 5f2d55965..4f24d4cbd 100644 --- a/composer.json +++ b/composer.json @@ -23,12 +23,12 @@ "league/csv": "^9.6" }, "require-dev": { - "facade/ignition": "^2.0", + "facade/ignition": "^2.3", "fzaninotto/faker": "^1.9.1", "mockery/mockery": "^1.4", "nunomaduro/collision": "^4.2", "phpunit/phpunit": "^8.5", - "barryvdh/laravel-ide-helper": "^2.7", + "barryvdh/laravel-ide-helper": "^2.8", "filp/whoops": "^2.7", "laravel/tinker": "^2.4" }, diff --git a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php index 0305d3f0c..7b4cd8e06 100644 --- a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php +++ b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php @@ -1,6 +1,7 @@ + class="nav-icon la">{{ trans('backpack::base.dashboard') }} + @canany(['toolbox:quiz','toolbox:quiz:translate']) +@endcanany + +@can('fluidbook:admin') + @endcan + @can('toolbox:maintenance')