diff --git a/course/format/classes/output/local/content/section/cmsummary.php b/course/format/classes/output/local/content/section/cmsummary.php index cb86c6438ca..2d95756c989 100644 --- a/course/format/classes/output/local/content/section/cmsummary.php +++ b/course/format/classes/output/local/content/section/cmsummary.php @@ -70,15 +70,13 @@ class cmsummary implements named_templatable, renderable { list($mods, $complete, $total, $showcompletion) = $this->calculate_section_stats(); - if (empty($mods)) { - return new stdClass(); - } - + $totalactivities = array_reduce($mods, fn($carry, $item) => $carry + ($item["count"] ?? 0), 0); $data = (object)[ 'showcompletion' => $showcompletion, 'total' => $total, 'complete' => $complete, 'mods' => array_values($mods), + 'totalactivities' => $totalactivities, ]; $data->modprogress = get_string('progresstotal', 'completion', $data); diff --git a/course/format/templates/local/content/section/cmsummary.mustache b/course/format/templates/local/content/section/cmsummary.mustache index aedb357e3f0..e15e225851c 100644 --- a/course/format/templates/local/content/section/cmsummary.mustache +++ b/course/format/templates/local/content/section/cmsummary.mustache @@ -32,16 +32,17 @@ "count": "2" } ], - "modprogress": "Total 5" + "modprogress": "Progress: 1 / 5", + "totalactivities": "5" } }} -
- {{#mods}} - {{name}}: {{count}} - {{/mods}} -
-{{#showcompletion}} -
- {{modprogress}} +
+
+ {{#pix}}i/activities, moodle{{/pix}}{{#str}} totalactivities, course, {{totalactivities}} {{/str}}
-{{/showcompletion}} + {{#showcompletion}} +
+ {{#pix}}i/stats, moodle{{/pix}}{{modprogress}} +
+ {{/showcompletion}} +
diff --git a/course/format/templates/local/content/section/content.mustache b/course/format/templates/local/content/section/content.mustache index 50daad080d9..c9ede9023f8 100644 --- a/course/format/templates/local/content/section/content.mustache +++ b/course/format/templates/local/content/section/content.mustache @@ -39,6 +39,7 @@ "hasname": "true" }, "id": 3, + "cmid": 3, "module": "forum", "anchor": "activity-3", "extraclasses": "newmessages" @@ -51,6 +52,7 @@ "hasname": "true" }, "id": 4, + "cmid": 4, "anchor": "activity-4", "module": "assign", "extraclasses": "" @@ -123,11 +125,30 @@ {{> core_courseformat/local/content/section/controlmenu }} {{/ core_courseformat/local/content/section/controlmenu }} {{/controlmenu}} +{{#header}} + {{#headerdisplaymultipage}} + {{^controlmenu}} +
+ + + {{#pix}}t/right, moodle{{/pix}} + + + {{#pix}}t/left, moodle, {{#str}}gotosection, course, {{name}}{{/str}}{{/pix}} + + + {{#str}}gotosection, course, {{name}}{{/str}} + + +
+ {{/controlmenu}} + {{/headerdisplaymultipage}} +{{/header}}
+ class="content {{^iscoursedisplaymultipage}}{{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}{{/iscoursedisplaymultipage}}">
{{#summary}} {{$ core_courseformat/local/content/section/summary }} diff --git a/course/tests/behat/paged_course_information.feature b/course/tests/behat/paged_course_information.feature index aaa424a25d8..6923d1d0611 100644 --- a/course/tests/behat/paged_course_information.feature +++ b/course/tests/behat/paged_course_information.feature @@ -13,7 +13,7 @@ Feature: Course paged mode information | activity | course | name | section | completion | | chat | C1 | Chat room | 1 | | | data | C1 | Database | 1 | | - | forum | C1 | First forum | 2 | | + | forum | C1 | First forum | 1 | | | forum | C1 | Second forum | 2 | | And the following "users" exist: | username | firstname | lastname | email | @@ -23,13 +23,13 @@ Feature: Course paged mode information | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - When I log in as "" - And I am on "Course 1" course homepage - Then I should see "Chat: 1" in the "#section-1" "css_element" - And I should see "Database: 1" in the "#section-1" "css_element" + When I am on the "Course 1" "Course" page logged in as "" + Then I should see "Activities: 3" in the "#section-1" "css_element" And I should "Progress:" in the "#section-1" "css_element" - And I should see "Forums: 2" in the "#section-2" "css_element" + And I should see "Activities: 1" in the "#section-2" "css_element" And I should "Progress:" in the "#section-2" "css_element" + And I should see "Activities: 0" in the "#section-3" "css_element" + And I should not see "Progress:" in the "#section-3" "css_element" Examples: | user | courseformat | completion | show | @@ -51,18 +51,17 @@ Feature: Course paged mode information | activity | course | name | section | completion | | chat | C1 | Chat room | 1 | | | data | C1 | Database | 1 | | - | forum | C1 | First forum | 2 | | + | forum | C1 | First forum | 1 | | | forum | C1 | Second forum | 2 | | And I am on the "Course 1" "enrolment methods" page logged in as admin And I click on "Enable" "link" in the "Guest access" "table_row" - And I log out - When I log in as "guest" - And I am on "Course 1" course homepage - Then I should see "Chat: 1" in the "#section-1" "css_element" - And I should see "Database: 1" in the "#section-1" "css_element" + When I am on the "Course 1" "Course" page logged in as "guest" + Then I should see "Activities: 3" in the "#section-1" "css_element" And I should not see "Progress:" in the "#section-1" "css_element" - And I should see "Forums: 2" in the "#section-2" "css_element" + And I should see "Activities: 1" in the "#section-2" "css_element" And I should not see "Progress:" in the "#section-2" "css_element" + And I should see "Activities: 0" in the "#section-3" "css_element" + And I should not see "Progress:" in the "#section-3" "css_element" Examples: | courseformat | completion | diff --git a/lang/en/course.php b/lang/en/course.php index 19b2b101270..b923aaacaa4 100644 --- a/lang/en/course.php +++ b/lang/en/course.php @@ -162,6 +162,8 @@ $string['targetlabelstudentgradetopassno'] = 'Student who is likely to meet the $string['targetlabelstudentgradetopassyes'] = 'Student at risk of not meeting the minimum grade to pass the course.'; $string['targetlabelteachingyes'] = 'Users with teaching capabilities who have access to the course'; $string['targetlabelteachingno'] = 'Courses at risk of not starting'; +$string['totalactivities'] = 'Activities: {$a}'; +$string['gotosection'] = 'Go to section {$a}'; // Deprecated since Moodle 4.3. $string['aria:courseimage'] = 'Course image'; diff --git a/theme/boost/scss/moodle/course.scss b/theme/boost/scss/moodle/course.scss index 0292298ebce..e07516f7b1c 100644 --- a/theme/boost/scss/moodle/course.scss +++ b/theme/boost/scss/moodle/course.scss @@ -375,14 +375,6 @@ body:not(.editing) .sitetopic ul.section { margin: 2px 5px 2px 5px; } -.course-content .section-summary .section-summary-activities .activity-count { - color: $text-muted; - font-size: $font-size-sm; - margin: 3px; - white-space: nowrap; - display: inline-block; -} - .course-content .section-summary .summary { margin-top: 5px; } @@ -1366,6 +1358,13 @@ $activity-add-hover: theme-color-level('primary', -10) !default; padding-left: 0; border-bottom: $border-width solid $border-color; + .sectionname > a { + color: $gray-900; + &:hover { + text-decoration: none; + } + } + &:last-child:not(.section-summary) { border-bottom: 0; } @@ -1423,12 +1422,22 @@ $activity-add-hover: theme-color-level('primary', -10) !default; } } - .section-summary-activities .activity-count { - color: $text-muted; - font-size: $font-size-sm; - margin: 3px; - white-space: nowrap; - display: inline-block; + .section-summary-activities { + .icon { + width: inherit; + color: $primary; + } + } + + .section-summary-activities + .section { + border-top: $border-width solid $border-color; + margin-top: map-get($spacers, 3) !important; // stylelint-disable-line declaration-no-important + padding-top: map-get($spacers, 3) !important; // stylelint-disable-line declaration-no-important + } + + .section_goto .icon { + font-size: $font-size-lg; + color: $primary; } // Legacy dndupload classes. Can be removed in 4.4 as part of MDL-77124. diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index ccc3fc6bd4d..ded622b8200 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -28251,14 +28251,6 @@ body:not(.editing) .sitetopic ul.section .label .mod-indent-outer { margin: 2px 5px 2px 5px; } -.course-content .section-summary .section-summary-activities .activity-count { - color: #6a737b; - font-size: 0.8203125rem; - margin: 3px; - white-space: nowrap; - display: inline-block; -} - .course-content .section-summary .summary { margin-top: 5px; } @@ -29140,6 +29132,12 @@ span.editinstructions .alert-link { padding-left: 0; border-bottom: 1px solid #dee2e6; } +.course-section .sectionname > a { + color: #1d2125; +} +.course-section .sectionname > a:hover { + text-decoration: none; +} .course-section:last-child:not(.section-summary) { border-bottom: 0; } @@ -29180,12 +29178,18 @@ span.editinstructions .alert-link { margin-top: 0.5rem; border-radius: 0.5rem; } -.course-section .section-summary-activities .activity-count { - color: #6a737b; - font-size: 0.8203125rem; - margin: 3px; - white-space: nowrap; - display: inline-block; +.course-section .section-summary-activities .icon { + width: inherit; + color: #0f6cbf; +} +.course-section .section-summary-activities + .section { + border-top: 1px solid #dee2e6; + margin-top: 1rem !important; + padding-top: 1rem !important; +} +.course-section .section_goto .icon { + font-size: 1.171875rem; + color: #0f6cbf; } .course-section.dndupload-dropzone { border: 2px dashed #0f6cbf; diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index a53081dcca3..a5ef2050d4a 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -28251,14 +28251,6 @@ body:not(.editing) .sitetopic ul.section .label .mod-indent-outer { margin: 2px 5px 2px 5px; } -.course-content .section-summary .section-summary-activities .activity-count { - color: #6a737b; - font-size: 0.8203125rem; - margin: 3px; - white-space: nowrap; - display: inline-block; -} - .course-content .section-summary .summary { margin-top: 5px; } @@ -29140,6 +29132,12 @@ span.editinstructions .alert-link { padding-left: 0; border-bottom: 1px solid #dee2e6; } +.course-section .sectionname > a { + color: #1d2125; +} +.course-section .sectionname > a:hover { + text-decoration: none; +} .course-section:last-child:not(.section-summary) { border-bottom: 0; } @@ -29180,12 +29178,18 @@ span.editinstructions .alert-link { margin-top: 0.5rem; border-radius: 0.25rem; } -.course-section .section-summary-activities .activity-count { - color: #6a737b; - font-size: 0.8203125rem; - margin: 3px; - white-space: nowrap; - display: inline-block; +.course-section .section-summary-activities .icon { + width: inherit; + color: #0f6cbf; +} +.course-section .section-summary-activities + .section { + border-top: 1px solid #dee2e6; + margin-top: 1rem !important; + padding-top: 1rem !important; +} +.course-section .section_goto .icon { + font-size: 1.171875rem; + color: #0f6cbf; } .course-section.dndupload-dropzone { border: 2px dashed #0f6cbf;