Merge branch 'MDL-79987-master' of https://github.com/sarjona/moodle

This commit is contained in:
Ilya Tregubov 2023-11-16 09:29:00 +08:00
commit 105ae8942a
No known key found for this signature in database
GPG key ID: 0F58186F748E55C1
11 changed files with 113 additions and 73 deletions

File diff suppressed because one or more lines are too long

View file

@ -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);

View file

@ -32,16 +32,17 @@
"count": "2"
}
],
"modprogress": "Total 5"
"modprogress": "Progress: 1 / 5",
"totalactivities": "5"
}
}}
<div class="section-summary-activities pr-2 mdl-right">
{{#mods}}
<span class="activity-count">{{name}}: {{count}}</span>
{{/mods}}
<div class="section-summary-activities d-flex">
<div class="d-flex align-items-center">
{{#pix}}i/activities, moodle{{/pix}}{{#str}} totalactivities, course, {{totalactivities}} {{/str}}
</div>
{{#showcompletion}}
<div class="section-summary-activities pr-2 mdl-right">
<span class="activity-count">{{modprogress}}</span>
<div class="d-flex ml-auto align-items-center">
{{#pix}}i/stats, moodle{{/pix}}{{modprogress}}
</div>
{{/showcompletion}}
</div>

View file

@ -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}}
<div class="section_goto bulk-hidden ml-auto" data-sectionid="{{id}}">
<a href="{{{url}}}"
class="btn btn-icon d-flex align-items-center justify-content-center icon-no-margin"
title="{{#str}}gotosection, course, {{name}}{{/str}}">
<span class="dir-rtl-hide">
{{#pix}}t/right, moodle{{/pix}}
</span>
<span class="dir-ltr-hide">
{{#pix}}t/left, moodle, {{#str}}gotosection, course, {{name}}{{/str}}{{/pix}}
</span>
<span class="sr-only">
{{#str}}gotosection, course, {{name}}{{/str}}
</span>
</a>
</div>
{{/controlmenu}}
{{/headerdisplaymultipage}}
{{/header}}
</div>
<div id="coursecontentcollapse{{num}}"
class="content {{^iscoursedisplaymultipage}}
{{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}
{{/iscoursedisplaymultipage}}">
class="content {{^iscoursedisplaymultipage}}{{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}{{/iscoursedisplaymultipage}}">
<div class="{{#hasavailability}}description{{/hasavailability}} my-3" data-for="sectioninfo">
{{#summary}}
{{$ core_courseformat/local/content/section/summary }}

View file

@ -13,7 +13,7 @@ Feature: Course paged mode information
| activity | course | name | section | completion |
| chat | C1 | Chat room | 1 | <completion> |
| data | C1 | Database | 1 | <completion> |
| forum | C1 | First forum | 2 | <completion> |
| forum | C1 | First forum | 1 | <completion> |
| forum | C1 | Second forum | 2 | <completion> |
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 "<user>"
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 "<user>"
Then I should see "Activities: 3" in the "#section-1" "css_element"
And I should <show> "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 <show> "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 | <completion> |
| data | C1 | Database | 1 | <completion> |
| forum | C1 | First forum | 2 | <completion> |
| forum | C1 | First forum | 1 | <completion> |
| forum | C1 | Second forum | 2 | <completion> |
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 |

View file

@ -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';

View file

@ -193,6 +193,7 @@ class icon_system_fontawesome extends icon_system_font {
'theme:fp/view_icon_active' => 'fa-th',
'theme:fp/view_list_active' => 'fa-list',
'theme:fp/view_tree_active' => 'fa-folder',
'core:i/activities' => 'fa-file-pen',
'core:i/addblock' => 'fa-plus-square',
'core:i/assignroles' => 'fa-user-plus',
'core:i/asterisk' => 'fa-asterisk',

1
pix/i/activities.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 576 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V285.7l-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>

After

Width:  |  Height:  |  Size: 711 B

View file

@ -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;
}
@ -1350,6 +1342,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;
}
@ -1407,12 +1406,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.

View file

@ -28256,14 +28256,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;
}
@ -29128,6 +29120,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;
}
@ -29168,12 +29166,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;

View file

@ -28256,14 +28256,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;
}
@ -29128,6 +29120,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;
}
@ -29168,12 +29166,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;