Skip to content

Commit

Permalink
MDL-80750 mod_assign: Move quick grading submit button to sticky footer
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies authored and Mihail Geshoski committed Sep 18, 2024
1 parent b491cc3 commit 512f163
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 18 deletions.
2 changes: 1 addition & 1 deletion grade/tests/behat/grade_recovery_settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."
2 changes: 1 addition & 1 deletion mod/assign/lang/en/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@
$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';
Expand Down Expand Up @@ -709,6 +708,7 @@
$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 change: 1 addition & 0 deletions mod/assign/lang/en/deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ updategrade,mod_assign
viewgrader,mod_assign
downloadasfolders_help,mod_assign
editaction,mod_assign
saveallquickgradingchanges,mod_assign
14 changes: 9 additions & 5 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4609,21 +4609,25 @@ protected function view_grading_table() {
$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()) {
Expand Down
6 changes: 3 additions & 3 deletions mod/assign/quickgradingform.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public function definition() {
$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']);
}
}

15 changes: 14 additions & 1 deletion mod/assign/templates/grading_sticky_footer.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
3 changes: 1 addition & 2 deletions mod/assign/tests/behat/allow_another_attempt.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/tests/behat/quickgrading.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mod/assign/tests/behat/reopen_locked_submission.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 512f163

Please sign in to comment.