Skip to content

Commit a013a2b

Browse files
committed
Display: Fix radios and checkboxes styles #7458
1 parent 755be08 commit a013a2b

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

public/main/inc/lib/exercise.lib.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ function handleRadioRow(event, question_id, answer_id) {
631631

632632
if ($debug_mark_answer) {
633633
if ($answerCorrect) {
634-
$attributes['checked'] = 1;
634+
$attributes['checked'] = 'checked';
635635
$attributes['selected'] = 1;
636636
}
637637
}
@@ -671,14 +671,12 @@ class="exercise-unique-answer-image col-xs-6 col-md-3 text-center">';
671671
);
672672

673673
$answer_input = null;
674-
$attributes['class'] = 'checkradios';
675674
if (UNIQUE_ANSWER_IMAGE == $answerType) {
676-
$attributes['class'] = '';
677675
$attributes['style'] = 'display: none;';
678676
$answer = '<div class="thumbnail">'.$answer.'</div>';
679677
}
680678

681-
$answer_input .= '<label class="radio '.$hidingClass.'">';
679+
$answer_input .= '<label class="flex gap-2 items-center '.$hidingClass.'">';
682680
$answer_input .= Display::input(
683681
'radio',
684682
'choice['.$questionId.']',
@@ -728,22 +726,22 @@ class="exercise-unique-answer-image col-xs-6 col-md-3 text-center">';
728726

729727
if ($debug_mark_answer) {
730728
if ($answerCorrect) {
731-
$attributes['checked'] = 1;
729+
$attributes['checked'] = 'checked';
732730
$attributes['selected'] = 1;
733731
}
734732
}
735733

736734
if (MULTIPLE_ANSWER == $answerType || GLOBAL_MULTIPLE_ANSWER == $answerType) {
737735
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
738-
$answer_input = '<div class="flex gap-2 items-center">';
736+
$answer_input = '<label class="flex gap-2 items-center">';
739737
$answer_input .= Display::input(
740738
'checkbox',
741739
'choice['.$questionId.']['.$numAnswer.']',
742740
$numAnswer,
743741
$attributes
744742
);
745743
$answer_input .= $answer;
746-
$answer_input .= '</div>';
744+
$answer_input .= '</label>';
747745

748746
if ($show_comment) {
749747
$s .= '<tr><td>';
@@ -784,7 +782,7 @@ class="exercise-unique-answer-image col-xs-6 col-md-3 text-center">';
784782

785783
if ($debug_mark_answer) {
786784
if ($j == $answerCorrect) {
787-
$attributes['checked'] = 1;
785+
$attributes['checked'] = 'checked';
788786
$attributes['selected'] = 1;
789787
}
790788
}
@@ -849,7 +847,7 @@ class="exercise-unique-answer-image col-xs-6 col-md-3 text-center">';
849847

850848
if ($debug_mark_answer) {
851849
if ($j == $answerCorrect) {
852-
$attributes['checked'] = 1;
850+
$attributes['checked'] = 'checked';
853851
$attributes['selected'] = 1;
854852
}
855853
}
@@ -909,7 +907,7 @@ class="exercise-unique-answer-image col-xs-6 col-md-3 text-center">';
909907

910908
if ($debug_mark_answer) {
911909
if ($answerCorrect) {
912-
$attributes['checked'] = 1;
910+
$attributes['checked'] = 'checked';
913911
$attributes['selected'] = 1;
914912
}
915913
}
@@ -977,7 +975,7 @@ class="exercise-unique-answer-image col-xs-6 col-md-3 text-center">';
977975

978976
if ($debug_mark_answer) {
979977
if ($key == $answerCorrect) {
980-
$attributes['checked'] = 1;
978+
$attributes['checked'] = 'checked';
981979
$attributes['selected'] = 1;
982980
}
983981
}

0 commit comments

Comments
 (0)