Skip to content

Commit

Permalink
Fix question styling
Browse files Browse the repository at this point in the history
  • Loading branch information
AnupamaSarjoshi committed Nov 8, 2023
1 parent 0c9fd1d commit af2c93f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 6 additions & 4 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ public function matrix_table(question_attempt $qa, question_display_options $opt
$table .= html_writer::tag('caption', $caption, ['class' => 'sr-only']);

// Creating the matrix column headers.
$table .= html_writer::start_tag('thead');
$table .= html_writer::start_tag('tr');
$table .= html_writer::tag('th', '', ['scope' => 'col']);
$table .= html_writer::tag('th', '', ['scope' => 'col', 'class' => 'subquestion']);
$index = 0;
foreach ($question->columns as $value) {
$colname[$index] = $value->name;
Expand All @@ -154,6 +155,7 @@ public function matrix_table(question_attempt $qa, question_display_options $opt
'answer_col', ['id' => 'col' . $index]), ['scope' => 'col', 'class' => 'rowfeedback align-middle']);
}
$table .= html_writer::end_tag('tr');
$table .= html_writer::end_tag('thead');

if ($options->readonly) {
$inputattributes['disabled'] = 'disabled';
Expand All @@ -170,7 +172,7 @@ public function matrix_table(question_attempt $qa, question_display_options $opt

$table .= html_writer::start_tag('tr');
$table .= html_writer::tag('th', html_writer::span($rowname, '', ['id' => $rownewid]),
['class' => 'align-middle', 'scope' => 'row']);
['class' => 'subquestion align-middle', 'scope' => 'row']);

for ($c = 1; $c <= count($colname); $c++) {
$inputattributes['name'] = $this->get_input_name($qa, $rowkey, $c);
Expand Down Expand Up @@ -206,9 +208,9 @@ public function matrix_table(question_attempt $qa, question_display_options $opt
// Write row and its attributes.
$button = html_writer::empty_tag('input', $inputattributes);
$answered = html_writer::tag('label', $button . $feedbackimg,
['class' => "$class position-relative d-inline-block w-100 m-0"]);
['class' => "position-relative d-inline-block w-100 m-0"]);

$table .= html_writer::tag('td', $answered, ['class' => "matrixanswer align-middle text-center"]);
$table .= html_writer::tag('td', $answered, ['class' => "$class matrixanswer align-middle text-center"]);
}
if ($options->feedback) {
$table .= html_writer::tag('td', $feedback);
Expand Down
11 changes: 10 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
.que.oumatrix .answer .specificfeedback {
background: #fff3bf;
}
.que.oumatrix .answer .generaltable thead tr {
background-color: rgba(0, 0, 0, 0.03);
}
.que.oumatrix .answer .generaltable tbody tr:nth-of-type(even) {
background-color: rgba(0, 0, 0, 0.03);
}
.que.oumatrix .answer .generaltable tbody tr:nth-of-type(odd) {
background-color: #FFFFFF;
}

/* Editing form. */
body#page-question-type-oumatrix div[id^=fgroup_id_][id*=rowoptions_] {
Expand All @@ -16,7 +25,7 @@ body#page-question-type-oumatrix div[id^=fgroup_id_][id*=rowoptions_] {
border-bottom: 0;
}
body#page-question-type-oumatrix label[data-fieldtype=checkbox] {
margin-right: 0.75rem !important; /* stylelint-disable-line declaration-no-important */
margin-right: 0.75rem;
}
/* Row validation error display. */
body#page-question-type-oumatrix div[id^=fgroup_id_][id*=error_rowoptions_] {
Expand Down

0 comments on commit af2c93f

Please sign in to comment.