From ac6f82440a3f3da5bcd1c1e8589c59087edfe0b2 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Wed, 15 Nov 2023 15:37:00 +0800 Subject: [PATCH 1/2] MDL-80121 grade: Trim heading In order to prevent rendering an empty heading

, we need to make sure that the $heading parameter passed to print_grade_page_head() is not an empty string. --- grade/lib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grade/lib.php b/grade/lib.php index 23607f0f688..c31b9a5654b 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -891,6 +891,12 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti ?string $headerhelpcomponent = null, ?stdClass $user = null, ?action_bar $actionbar = null, $showtitle = true) { global $CFG, $OUTPUT, $PAGE, $USER; + if ($heading !== false) { + // Make sure to trim heading, including the non-breaking space character. + $heading = str_replace(" ", " ", $heading); + $heading = trim($heading); + } + // Put a warning on all gradebook pages if the course has modules currently scheduled for background deletion. require_once($CFG->dirroot . '/course/lib.php'); if (course_modules_pending_deletion($courseid, true)) { From 3c339154c883759146405a3396b2bb1e4728fb06 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Wed, 15 Nov 2023 19:22:57 +0800 Subject: [PATCH 2/2] MDL-80121 gradereport_singleview: Increase zero-state heading level With the h2 heading not being rendered on the zero-state pages of the Single view report, we need to increase the heading level of the "Search for a user to view all their grades" and "Select a grade item above" headings from h3 to h2. --- grade/report/singleview/templates/zero_state_grade.mustache | 2 +- grade/report/singleview/templates/zero_state_user.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grade/report/singleview/templates/zero_state_grade.mustache b/grade/report/singleview/templates/zero_state_grade.mustache index 8041c60b2a0..07eb9c15959 100644 --- a/grade/report/singleview/templates/zero_state_grade.mustache +++ b/grade/report/singleview/templates/zero_state_grade.mustache @@ -26,6 +26,6 @@ }}
-

{{#str}}viewsinglegradeitem, gradereport_singleview{{/str}}

+

{{#str}}viewsinglegradeitem, gradereport_singleview{{/str}}

{{#str}}singleviewdescription, gradereport_singleview{{/str}}

diff --git a/grade/report/singleview/templates/zero_state_user.mustache b/grade/report/singleview/templates/zero_state_user.mustache index 280ee8b5ca3..a81796bc65d 100644 --- a/grade/report/singleview/templates/zero_state_user.mustache +++ b/grade/report/singleview/templates/zero_state_user.mustache @@ -26,6 +26,6 @@ }}
-

{{#str}}viewsingleuser, gradereport_singleview{{/str}}

+

{{#str}}viewsingleuser, gradereport_singleview{{/str}}

{{#str}}singleviewdescription, gradereport_singleview{{/str}}