From 5b619c43f0c148c3194c4a91237cc9c78e370630 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 21 Oct 2021 03:30:42 -0500 Subject: [PATCH] Improve exercise answers CSS style --- assets/css/app.scss | 6 ++---- assets/css/scss/_exercise.scss | 12 ++++++++++++ public/main/exercise/Draggable.php | 2 +- public/main/exercise/MatchingDraggable.php | 2 +- public/main/exercise/calculated_answer.class.php | 2 +- public/main/exercise/exercise.class.php | 4 ++-- .../main/exercise/global_multiple_answer.class.php | 2 +- public/main/exercise/matching.class.php | 2 +- public/main/exercise/multiple_answer.class.php | 2 +- .../exercise/multiple_answer_combination.class.php | 2 +- .../exercise/multiple_answer_true_false.class.php | 2 +- public/main/exercise/question.class.php | 4 ++-- public/main/exercise/unique_answer.class.php | 2 +- .../main/exercise/unique_answer_no_option.class.php | 2 +- public/main/inc/lib/exercise_show_functions.lib.php | 6 +++--- 15 files changed, 31 insertions(+), 21 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index 88b642c82a..6efe42baf5 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -129,14 +129,12 @@ @apply bg-gray-50; } - table thead th { - @apply py-2; - } - table tbody { @apply bg-white divide-y divide-gray-200; } + table thead th, + table tbody th, table tbody td { @apply px-2 py-1; } diff --git a/assets/css/scss/_exercise.scss b/assets/css/scss/_exercise.scss index e5bb4cc35d..b9d55507a9 100644 --- a/assets/css/scss/_exercise.scss +++ b/assets/css/scss/_exercise.scss @@ -211,6 +211,10 @@ @apply font-bold p-3; } + &-description { + @apply mb-4; + } + &--no-ribbon { @apply border-l-8; @@ -220,4 +224,12 @@ } } } + + &__detail { + @apply mb-4; + + th { + @apply text-left; + } + } } \ No newline at end of file diff --git a/public/main/exercise/Draggable.php b/public/main/exercise/Draggable.php index 62944b08d8..2b6d5707b7 100644 --- a/public/main/exercise/Draggable.php +++ b/public/main/exercise/Draggable.php @@ -212,7 +212,7 @@ class Draggable extends Question } else { $header .= ''.get_lang('Elements list').''; } - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; $header .= ''; return $header; diff --git a/public/main/exercise/MatchingDraggable.php b/public/main/exercise/MatchingDraggable.php index ab8f67836e..72e548e98e 100644 --- a/public/main/exercise/MatchingDraggable.php +++ b/public/main/exercise/MatchingDraggable.php @@ -266,7 +266,7 @@ class MatchingDraggable extends Question } if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } $header .= ''; diff --git a/public/main/exercise/calculated_answer.class.php b/public/main/exercise/calculated_answer.class.php index bdd12f08c7..a072b77d00 100644 --- a/public/main/exercise/calculated_answer.class.php +++ b/public/main/exercise/calculated_answer.class.php @@ -259,7 +259,7 @@ class CalculatedAnswer extends Question if ($exercise->showExpectedChoiceColumn()) { $header .= ''.get_lang('Expected choice').''; } - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } $header .= ''; diff --git a/public/main/exercise/exercise.class.php b/public/main/exercise/exercise.class.php index 0521385a0d..fba61edf2b 100644 --- a/public/main/exercise/exercise.class.php +++ b/public/main/exercise/exercise.class.php @@ -4561,7 +4561,7 @@ class Exercise } echo ''; } - echo ''.$status.''; + echo ''.$status.''; } else { if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { if (isset($real_list[$i_answer_correct_answer]) && @@ -4605,7 +4605,7 @@ class Exercise $status = Display::label(get_lang('Correct'), 'success'); } echo ''.$s_answer_label.''; - echo ''.$status.''; + echo ''.$status.''; } else { echo ''.$s_answer_label.''; echo ''.$user_answer.''; diff --git a/public/main/exercise/global_multiple_answer.class.php b/public/main/exercise/global_multiple_answer.class.php index d73430710d..12565b092d 100644 --- a/public/main/exercise/global_multiple_answer.class.php +++ b/public/main/exercise/global_multiple_answer.class.php @@ -255,7 +255,7 @@ class GlobalMultipleAnswer extends Question $header .= ''.get_lang('Answer').''; if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } $header .= ''.get_lang('Comment').''; $header .= ''; diff --git a/public/main/exercise/matching.class.php b/public/main/exercise/matching.class.php index 2b615068ea..359d2d055a 100644 --- a/public/main/exercise/matching.class.php +++ b/public/main/exercise/matching.class.php @@ -285,7 +285,7 @@ class Matching extends Question } if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } $header .= ''; diff --git a/public/main/exercise/multiple_answer.class.php b/public/main/exercise/multiple_answer.class.php index 980bb9a1d2..c6c83b540b 100644 --- a/public/main/exercise/multiple_answer.class.php +++ b/public/main/exercise/multiple_answer.class.php @@ -222,7 +222,7 @@ class MultipleAnswer extends Question $header .= ''.get_lang('Answer').''; if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } if (false === $exercise->hideComment) { diff --git a/public/main/exercise/multiple_answer_combination.class.php b/public/main/exercise/multiple_answer_combination.class.php index 4618f27930..df1d8aa533 100644 --- a/public/main/exercise/multiple_answer_combination.class.php +++ b/public/main/exercise/multiple_answer_combination.class.php @@ -224,7 +224,7 @@ class MultipleAnswerCombination extends Question $header .= ''.get_lang('Answer').''; if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } if (false === $exercise->hideComment) { $header .= ''.get_lang('Comment').''; diff --git a/public/main/exercise/multiple_answer_true_false.class.php b/public/main/exercise/multiple_answer_true_false.class.php index d588b4fdda..e127369498 100644 --- a/public/main/exercise/multiple_answer_true_false.class.php +++ b/public/main/exercise/multiple_answer_true_false.class.php @@ -317,7 +317,7 @@ class MultipleAnswerTrueFalse extends Question $header .= ''.get_lang('Answer').''; if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } if (EXERCISE_FEEDBACK_TYPE_EXAM != $exercise->getFeedbackType() || in_array( diff --git a/public/main/exercise/question.class.php b/public/main/exercise/question.class.php index a18362b4a2..4f05b2e8bf 100644 --- a/public/main/exercise/question.class.php +++ b/public/main/exercise/question.class.php @@ -38,7 +38,7 @@ abstract class Question public $feedback; public $typePicture = 'new_question.png'; public $explanationLangVar = ''; - public $question_table_class = 'table table-striped'; + public $question_table_class = 'table table-striped question-answer-result__detail'; public $questionTypeWithFeedback; public $extra; public $export = false; @@ -1730,7 +1730,7 @@ abstract class Question // Do not show the description (the text to read) if the question is of type READING_COMPREHENSION $header .= Display::div( $this->description, - ['class' => 'question_description'] + ['class' => 'question-answer-result__header-description'] ); } else { /** @var ReadingComprehension $this */ diff --git a/public/main/exercise/unique_answer.class.php b/public/main/exercise/unique_answer.class.php index 61aea9315b..449fa46255 100644 --- a/public/main/exercise/unique_answer.class.php +++ b/public/main/exercise/unique_answer.class.php @@ -445,7 +445,7 @@ class UniqueAnswer extends Question $header .= ''.get_lang('Answer').''; if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } if (false === $exercise->hideComment) { $header .= ''.get_lang('Comment').''; diff --git a/public/main/exercise/unique_answer_no_option.class.php b/public/main/exercise/unique_answer_no_option.class.php index 8822adb7b8..0f27f9d0e0 100644 --- a/public/main/exercise/unique_answer_no_option.class.php +++ b/public/main/exercise/unique_answer_no_option.class.php @@ -404,7 +404,7 @@ class UniqueAnswerNoOption extends Question } $header .= ''.get_lang('Answer').''; if ($exercise->showExpectedChoice()) { - $header .= ''.get_lang('Status').''; + $header .= ''.get_lang('Status').''; } if (false === $exercise->hideComment) { $header .= ''.get_lang('Comment').''; diff --git a/public/main/inc/lib/exercise_show_functions.lib.php b/public/main/inc/lib/exercise_show_functions.lib.php index 3eac82c514..f76f3da373 100644 --- a/public/main/inc/lib/exercise_show_functions.lib.php +++ b/public/main/inc/lib/exercise_show_functions.lib.php @@ -423,7 +423,7 @@ class ExerciseShowFunctions if ($answerCorrect || ($answerCorrect && $studentChoiceInt === $answerCorrectChoice)) { $status = Display::label(get_lang('Correct'), 'success'); } - echo ''; + echo ''; // Show only status for the selected student answer BT#16256 if ($studentChoice) { echo $status; @@ -551,7 +551,7 @@ class ExerciseShowFunctions $status = Display::label(get_lang('Correct'), 'success'); } } - $content .= ''; + $content .= ''; $content .= $status; $content .= ''; } @@ -779,7 +779,7 @@ class ExerciseShowFunctions $status = Display::label(get_lang('Correct'), 'success'); } } - echo ''; + echo ''; echo $status; echo ''; }