From 51a6181e16ab97dec2cffaa177b018a4c96171e8 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 b0077dff365..4a514cffc0e 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, $unused = null) { 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); + } + if ($unused !== null) { debugging('Deprecated argument passed to ' . __FUNCTION__, DEBUG_DEVELOPER); } From 3bb574b35a1314923da0974934bc4abb8a01a0aa 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}}