MDL-80750 mod_assign: Move quick grading submit button to sticky footer

This commit is contained in:
Shamim Rezaie
2024-09-18 15:48:09 +08:00
committed by Mihail Geshoski
parent b491cc3a49
commit 512f163309
10 changed files with 35 additions and 18 deletions
@@ -26,7 +26,7 @@ Feature: Admin can set Recover grades default setting
And I navigate to "Submissions" in current page administration
And I click on "Quick grading" "checkbox"
And I set the field "User grade" to "60.00"
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
# Confirm that assigned grade was saved
And I am on the "Course 1" "grades > Grader report > View" page
And I should see "60.00" in the "Student One" "table_row"
@@ -29,12 +29,12 @@ Feature: In an assignment, teachers can provide feedback comments on student sub
And I navigate to "Submissions" in current page administration
Then I click on "Quick grading" "checkbox"
And I set the field "Feedback comments" to "Feedback from teacher."
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
And I should see "The grade changes were saved"
And I press "Continue"
And I should see "Feedback from teacher."
And I set the field "Feedback comments" to ""
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
And I should see "The grade changes were saved"
And I press "Continue"
And I should not see "Feedback from teacher."
+1 -1
View File
@@ -530,7 +530,6 @@ $string['reverttodraft'] = 'Revert the submission to draft status';
$string['reverttodraftshort'] = 'Revert the submission to draft';
$string['reviewed'] = 'Reviewed';
$string['save'] = 'Save';
$string['saveallquickgradingchanges'] = 'Save all quick grading changes';
$string['saveandcontinue'] = 'Save and continue';
$string['savechanges'] = 'Save changes';
$string['savegradingresult'] = 'Grade';
@@ -709,6 +708,7 @@ $string['choosegradingaction'] = 'Grading action';
$string['downloadasfolders_help'] = 'Assignment submissions may be downloaded in folders. Each submission is then put in a separate folder, with the folder structure kept for any subfolders, and files are not renamed.';
$string['editaction'] = 'Actions...';
$string['groupoverridesdeleted'] = 'Group overrides deleted';
$string['saveallquickgradingchanges'] = 'Save all quick grading changes';
$string['updategrade'] = 'Update grade';
$string['useroverridesdeleted'] = 'User overrides deleted';
$string['viewgrader'] = 'View Grader';
+1
View File
@@ -6,3 +6,4 @@ updategrade,mod_assign
viewgrader,mod_assign
downloadasfolders_help,mod_assign
editaction,mod_assign
saveallquickgradingchanges,mod_assign
+9 -5
View File
@@ -4609,21 +4609,25 @@ class assign {
$footerdata = [
'perpage' => $gradingtable->get_paging_selector(),
'pagingbar' => $gradingtable->get_paging_bar(),
'hassubmit' => $usequickgrading,
];
$footer = new core\output\sticky_footer($OUTPUT->render_from_template('mod_assign/grading_sticky_footer', $footerdata));
$table .= $this->get_renderer()->render($footer);
if ($usequickgrading) {
$page = optional_param('page', null, PARAM_INT);
$quickformparams = array('cm'=>$this->get_course_module()->id,
'gradingtable'=>$table,
'sendstudentnotifications' => $this->get_instance()->sendstudentnotifications,
'page' => $page);
$quickformparams = [
'cm' => $this->get_course_module()->id,
'gradingtable' => $table,
'sendstudentnotifications' => $this->get_instance()->sendstudentnotifications,
'page' => $page,
'footer' => $this->get_renderer()->render($footer),
];
$quickgradingform = new mod_assign_quick_grading_form(null, $quickformparams);
$o .= $this->get_renderer()->render(new assign_form('quickgradingform', $quickgradingform));
} else {
$o .= $table;
$o .= $this->get_renderer()->render($footer);
}
if ($this->can_grade()) {
+3 -3
View File
@@ -58,9 +58,9 @@ class mod_assign_quick_grading_form extends moodleform {
$mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign'));
$mform->setDefault('sendstudentnotifications', $instance['sendstudentnotifications']);
// Buttons.
$savemessage = get_string('saveallquickgradingchanges', 'assign');
$mform->addElement('submit', 'savequickgrades', $savemessage);
// No need to add a submit button.
// The submit button is in the footer.
$mform->addElement('html', $instance['footer']);
}
}
@@ -22,7 +22,8 @@
Example context (json):
{
"perpage": "<label>Show<select name='perpage' class='custom-select'><option value='-1'>All</select></label>",
"pagingbar": "<nav class='pagination pagination-centered justify-content-center'><ul class='mt-1 pagination '><li class='page-item active'><a href='#' class='page-link'><span>1</span></a></li></ul></nav>"
"pagingbar": "<nav class='pagination pagination-centered justify-content-center'><ul class='mt-1 pagination '><li class='page-item active'><a href='#' class='page-link'><span>1</span></a></li></ul></nav>",
"hassubmit": true
}
}}
<div class="col-auto">
@@ -35,3 +36,15 @@
{{{.}}}
{{/pagingbar}}
</div>
<div class="col-auto">
{{#hassubmit}}
<button type="submit" id="{{uniqid}}-submit" class="btn btn-primary">
{{#str}}save{{/str}}
</button>
{{#js}}
require(['core_form/submit'], function(Submit) {
Submit.init("{{uniqid}}-submit");
});
{{/js}}
{{/hassubmit}}
</div>
@@ -107,9 +107,8 @@ Feature: In an assignment, students start a new attempt based on their previous
And "Student 3" row "Status" column of "generaltable" table should contain "No submission"
And "Student 4" row "Status" column of "generaltable" table should contain "No submission"
And I click on "Quick grading" "checkbox"
And I click on "Student 1" "checkbox"
And I set the field "User grade" to "60.0"
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
And I should see "The grade changes were saved"
And I press "Continue"
And I click on "Student 1" "checkbox"
+2 -2
View File
@@ -95,7 +95,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "View all submissions"
Then I click on "Quick grading" "checkbox"
And I set the field "User grade" to "60.0"
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
And I should see "The grade changes were saved"
And I press "Continue"
And I am on the "Test assignment name" "assign activity" page logged in as student1
@@ -123,7 +123,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I click on "Hide Feedback comments" "link"
And I click on "Hide Final grade" "link"
And I click on "Hide Outcomes" "link"
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
And I should see "The grade changes were saved"
And I press "Continue"
And I am on the "Test assignment name" "assign activity" page logged in as student1
@@ -42,7 +42,7 @@ Feature: Submissions are unlocked when a new attempt is given
And I should see "Submission changes not allowed"
And I click on "Quick grading" "checkbox"
And I set the field "User grade" to "49.0"
And I press "Save all quick grading changes"
And I click on "Save" "button" in the "sticky-footer" "region"
And I should see "The grade changes were saved"
And I press "Continue"
Then I should see "Reopened"