Merge branch 'MDL-78286-master' of https://github.com/roland04/moodle

This commit is contained in:
Huong Nguyen
2023-08-08 21:34:32 +07:00
7 changed files with 63 additions and 1 deletions
@@ -102,10 +102,18 @@ class completion implements named_templatable, renderable {
* @return array the completion dialog exported for template
*/
private function get_completion_dialog(\renderer_base $output, stdClass $completioninfo): array {
global $PAGE;
$editurl = new \moodle_url(
'/course/modedit.php',
['update' => $this->mod->id, 'showonly' => 'activitycompletionheader']
);
$completioninfo->editurl = $editurl->out(false);
$completioninfo->editing = $PAGE->user_is_editing();
$dialogcontent = $output->render_from_template('core_courseformat/local/content/cm/completion_dialog', $completioninfo);
$buttoncontent = get_string('completionmenuitem', 'completion');
$buttonclass = '';
if ($completioninfo->istrackeduser) {
$buttoncontent = get_string('todo', 'completion');
if ($completioninfo->overallcomplete) {
@@ -93,4 +93,13 @@
{{/istrackeduser}}
{{/ismanual}}
</div>
{{! Show edit link to editing teachers. }}
{{#editing}}
{{#editurl}}
<div class="editcompletion border-top mt-3 pt-3">
<a href="{{editurl}}" class="px-2 py-1">{{#pix}} i/edit, core {{/pix}}{{#str}}editconditions, completion{{/str}}</a>
</div>
{{/editurl}}
{{/editing}}
</div>
@@ -70,3 +70,20 @@ Feature: Course page activities completion
And I am on the "Course 1" course page
And "To do" "button" should not exist in the "Activity sample" "activity"
And the "View" item should exist in the "Done" dropdown of the "Activity sample" "activity"
Scenario: Teacher can edit activity completion using completion dialog link
Given the following "activity" exists:
| activity | assign |
| name | Activity sample |
| course | C1 |
| completion | 2 |
| completionview | 1 |
When I am on the "C1" "Course" page logged in as "teacher1"
# Edit conditions link should not be displayed when editing mode is off.
Then "Edit conditions" "link" should not exist in the "Activity sample" "core_courseformat > Activity completion"
# Edit conditions link should be displayed when editing mode is on.
But I am on "C1" course homepage with editing mode on
And I click on "Edit conditions" "link" in the "Activity sample" "core_courseformat > Activity completion"
And I should see "Activity sample" in the "page-header" "region"
And I should see "Updating: Assignment"
And I should see "Activity completion"
+1
View File
@@ -154,6 +154,7 @@ $string['detail_desc:receivepassgrade'] = 'Receive a passing grade';
$string['detail_desc:view'] = 'View';
$string['done'] = 'Done';
$string['hiddenrules'] = 'Some settings specific to <b>{$a}</b> have been hidden. To view unselect other activities';
$string['editconditions'] = 'Edit conditions';
$string['enablecompletion'] = 'Enable completion tracking';
$string['enablecompletion_help'] = 'If enabled, you can set conditions for activity completion or course completion.';
$string['enrolmentduration'] = 'Enrolment duration';
+9
View File
@@ -1606,6 +1606,15 @@ $activity-add-hover: theme-color-level('primary', -10) !default;
height: $font-size-sm;
margin-right: map-get($spacers, 1);
}
.editcompletion a {
@include border-radius();
color: $gray-700;
font-weight: bold;
text-decoration: none;
&:hover {
background-color: $gray-200;
}
}
}
}
+9
View File
@@ -29393,6 +29393,15 @@ span.editinstructions .alert-link {
height: 0.8203125rem;
margin-right: 0.25rem;
}
.activity-item .activity-completion .completion-dialog .editcompletion a {
border-radius: 0.5rem;
color: #495057;
font-weight: bold;
text-decoration: none;
}
.activity-item .activity-completion .completion-dialog .editcompletion a:hover {
background-color: #e9ecef;
}
.activity-item .activity-groupmode-info {
grid-area: groupmode;
justify-self: end;
+9
View File
@@ -29393,6 +29393,15 @@ span.editinstructions .alert-link {
height: 0.8203125rem;
margin-right: 0.25rem;
}
.activity-item .activity-completion .completion-dialog .editcompletion a {
border-radius: 0.25rem;
color: #495057;
font-weight: bold;
text-decoration: none;
}
.activity-item .activity-completion .completion-dialog .editcompletion a:hover {
background-color: #e9ecef;
}
.activity-item .activity-groupmode-info {
grid-area: groupmode;
justify-self: end;