From d7df919a2c4987ba8fd962a9f6bc6920dedae8c3 Mon Sep 17 00:00:00 2001 From: Ferran Recio Date: Fri, 28 Jan 2022 15:29:35 +0100 Subject: [PATCH] MDL-73697 core_courseformat: fix weeks format this week badge --- .../classes/output/local/content/section.php | 1 + .../templates/local/content/section.mustache | 6 +++++- .../local/content/section/badges.mustache | 5 +++-- .../weeks/tests/behat/current_week.feature | 19 +++++++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 course/format/weeks/tests/behat/current_week.feature diff --git a/course/format/classes/output/local/content/section.php b/course/format/classes/output/local/content/section.php index 40d040b57ba..3b521bc238b 100644 --- a/course/format/classes/output/local/content/section.php +++ b/course/format/classes/output/local/content/section.php @@ -138,6 +138,7 @@ class section implements renderable, templatable { 'summary' => $summary->export_for_template($output), 'availability' => $availability->export_for_template($output), 'restrictionlock' => !empty($thissection->availableinfo), + 'highlightedlabel' => $format->get_section_highlighted_name(), ]; // Check if it is a stealth sections (orphaned). diff --git a/course/format/templates/local/content/section.mustache b/course/format/templates/local/content/section.mustache index 889b11f627f..a1d3cbb5840 100644 --- a/course/format/templates/local/content/section.mustache +++ b/course/format/templates/local/content/section.mustache @@ -26,6 +26,7 @@ "controlmenu": "[tools menu]", "header": { "name": "Section title", + "title": "Section title", "url": "#", "ishidden": true }, @@ -39,6 +40,7 @@ }, "id": 3, "module": "forum", + "anchor": "activity-3", "extraclasses": "newmessages" } }, @@ -49,6 +51,7 @@ "hasname": "true" }, "id": 4, + "anchor": "activity-4", "module": "assign", "extraclasses": "" } @@ -76,7 +79,8 @@ "contentcollapsed": false, "insertafter": true, "numsections": 42, - "sitehome": false + "sitehome": false, + "highlightedlabel" : "Highlighted" } }}
  • {{#str}}highlighted{{/str}} + {{ highlightedlabel }} {{/highlighted}} {{#hiddenfromstudents}} {{#str}}hiddenfromstudents{{/str}} diff --git a/course/format/weeks/tests/behat/current_week.feature b/course/format/weeks/tests/behat/current_week.feature new file mode 100644 index 00000000000..509e1b48dfc --- /dev/null +++ b/course/format/weeks/tests/behat/current_week.feature @@ -0,0 +1,19 @@ +@format @format_weeks +Feature: The current week should be highlighted in the course. + In order to know which is the current week + As a user + I need to see the current week highlighted + + Scenario: Highlight first week + Given the following "courses" exist: + | fullname | shortname | format | coursedisplay | numsections | startdate | + | Course 1 | C1 | weeks | 0 | 5 | ##today## | + When I am on the "C1" "Course" page logged in as "admin" + Then I should see "This week" in the "#section-1" "css_element" + + Scenario: Highlight next week + Given the following "courses" exist: + | fullname | shortname | format | coursedisplay | numsections | startdate | + | Course 1 | C1 | weeks | 0 | 5 | ##monday last week## | + When I am on the "C1" "Course" page logged in as "admin" + Then I should see "This week" in the "#section-2" "css_element"