mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-77932 gradereport_grader: Make range row cells collapsible
This commit is contained in:
parent
7beda01cae
commit
71241e64a5
4 changed files with 15 additions and 8 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -48,6 +48,7 @@ const selectors = {
|
||||||
content: '[data-collapse="content"]',
|
content: '[data-collapse="content"]',
|
||||||
sort: '[data-collapse="sort"]',
|
sort: '[data-collapse="sort"]',
|
||||||
expandbutton: '[data-collapse="expandbutton"]',
|
expandbutton: '[data-collapse="expandbutton"]',
|
||||||
|
rangerowcell: '[data-collapse="rangerowcell"]',
|
||||||
avgrowcell: '[data-collapse="avgrowcell"]',
|
avgrowcell: '[data-collapse="avgrowcell"]',
|
||||||
menu: '[data-collapse="menu"]',
|
menu: '[data-collapse="menu"]',
|
||||||
icons: '.data-collapse_gradeicons',
|
icons: '.data-collapse_gradeicons',
|
||||||
|
@ -375,6 +376,7 @@ export default class ColumnSearch extends GradebookSearchClass {
|
||||||
const content = element.querySelector(selectors.content);
|
const content = element.querySelector(selectors.content);
|
||||||
const sort = element.querySelector(selectors.sort);
|
const sort = element.querySelector(selectors.sort);
|
||||||
const expandButton = element.querySelector(selectors.expandbutton);
|
const expandButton = element.querySelector(selectors.expandbutton);
|
||||||
|
const rangeRowCell = element.querySelector(selectors.rangerowcell);
|
||||||
const avgRowCell = element.querySelector(selectors.avgrowcell);
|
const avgRowCell = element.querySelector(selectors.avgrowcell);
|
||||||
const nodeSet = [
|
const nodeSet = [
|
||||||
element.querySelector(selectors.menu),
|
element.querySelector(selectors.menu),
|
||||||
|
@ -389,12 +391,15 @@ export default class ColumnSearch extends GradebookSearchClass {
|
||||||
window.location = this.defaultSort;
|
window.location = this.defaultSort;
|
||||||
}
|
}
|
||||||
if (content === null) {
|
if (content === null) {
|
||||||
if (avgRowCell.classList.contains('d-none')) {
|
// If it's not a content cell, it must be an overall average or a range cell.
|
||||||
avgRowCell?.classList.remove('d-none');
|
const rowCell = avgRowCell ?? rangeRowCell;
|
||||||
avgRowCell?.setAttribute('aria-hidden', 'false');
|
|
||||||
|
if (rowCell.classList.contains('d-none')) {
|
||||||
|
rowCell?.classList.remove('d-none');
|
||||||
|
rowCell?.setAttribute('aria-hidden', 'false');
|
||||||
} else {
|
} else {
|
||||||
avgRowCell?.classList.add('d-none');
|
rowCell?.classList.add('d-none');
|
||||||
avgRowCell?.setAttribute('aria-hidden', 'true');
|
rowCell?.setAttribute('aria-hidden', 'true');
|
||||||
}
|
}
|
||||||
} else if (content.classList.contains('d-none')) {
|
} else if (content.classList.contains('d-none')) {
|
||||||
// We should always have content but some cells do not contain menus or other actions.
|
// We should always have content but some cells do not contain menus or other actions.
|
||||||
|
|
|
@ -1379,7 +1379,9 @@ class grade_report_grader extends grade_report {
|
||||||
|
|
||||||
$formattedrange = $item->get_formatted_range($rangesdisplaytype, $rangesdecimalpoints);
|
$formattedrange = $item->get_formatted_range($rangesdisplaytype, $rangesdecimalpoints);
|
||||||
|
|
||||||
$itemcell->text = $OUTPUT->container($formattedrange, 'rangevalues'.$hidden);
|
$itemcell->attributes['data-itemid'] = $itemid;
|
||||||
|
$itemcell->text = html_writer::div($formattedrange, 'rangevalues' . $hidden,
|
||||||
|
['data-collapse' => 'rangerowcell']);
|
||||||
$rangerow->cells[] = $itemcell;
|
$rangerow->cells[] = $itemcell;
|
||||||
}
|
}
|
||||||
$rows[] = $rangerow;
|
$rows[] = $rangerow;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue