Skip to content

Commit

Permalink
MDL-80745 mod_assign: Move group selector on grading page to action bar
Browse files Browse the repository at this point in the history
AMOS BEGIN
 MOV [clearall,gradereport_grader],[clearall,core]
AMOS END
  • Loading branch information
rezaies committed Jun 18, 2024
1 parent c1a2436 commit 859a54b
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 15 deletions.
1 change: 0 additions & 1 deletion grade/report/grader/lang/en/gradereport_grader.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/

$string['aria:dropdowncolumns'] = 'Collapsed columns found';
$string['clearall'] = 'Clear all';
$string['clearsearch'] = 'Clear searched users';
$string['collapsedcolumns'] = 'Collapsed columns <span class="badge rounded-pill bg-primary text-white ml-1" data-collapse="count">{$a}</span>';
$string['editingmode_title'] = 'Editing the grader report';
Expand Down
2 changes: 1 addition & 1 deletion grade/report/grader/templates/action_bar.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
{{/initialselector}}
{{#pagereset}}
<div class="navitem align-self-center">
<a href="{{{.}}}" class="btn btn-link">{{#str}}clearall, gradereport_grader{{/str}}</a>
<a href="{{{.}}}" class="btn btn-link">{{#str}}clearall, core{{/str}}</a>
</div>
<div class="navitem-divider"></div>
{{/pagereset}}
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
$string['city'] = 'City/town';
$string['cleaningtempdata'] = 'Cleaning temp data';
$string['clear'] = 'Clear';
$string['clearall'] = 'Clear all';
$string['clearfilterrow'] = 'Remove filter row';
$string['clearfilters'] = 'Clear filters';
$string['clearsearch'] = 'Clear search input';
Expand Down
29 changes: 24 additions & 5 deletions mod/assign/classes/output/grading_actionmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,31 @@ public function __construct(int $cmid, bool $submissionpluginenabled = false, in
* @return array Data to render.
*/
public function export_for_template(\renderer_base $output): array {
$downloadall = '';
global $PAGE;

$course = $PAGE->course;
$data = [];

if ($this->submissionpluginenabled && $this->submissioncount) {
$downloadall = (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'downloadall']))->out(false);
$data['downloadall'] = (
new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'downloadall'])
)->out(false);
}

if ($course->groupmode) {
$actionbarrenderer = $PAGE->get_renderer('core_course', 'actionbar');
$data['groupselector'] = $actionbarrenderer->render(new \core_course\output\actionbar\group_selector($course));
}
return [
'downloadall' => $downloadall
];

if (groups_get_course_group($course)) {
$reset = new moodle_url('/mod/assign/view.php', [
'id' => $this->cmid,
'action' => 'grading',
'group' => 0,
]);
$data['pagereset'] = $reset->out(false);
}

return $data;
}
}
9 changes: 5 additions & 4 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4567,9 +4567,13 @@ protected function view_grading_table() {
$buttons = new \mod_assign\output\grading_actionmenu($this->get_course_module()->id,
$this->is_any_submission_plugin_enabled(), $this->count_submissions());
$actionformtext = $this->get_renderer()->render($buttons);
$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $this->get_course_module()->id, 'action' => 'grading']);
$PAGE->activityheader->set_attrs(['hidecompletion' => true]);

$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $this->get_course_module()->id, 'action' => 'grading']);
// Conditionally add the group JS if we have groups enabled.
if ($this->get_course()->groupmode) {
$PAGE->requires->js_call_amd('core_course/actionbar/group', 'init', [$currenturl->out(false)]);
}

$header = new assign_header($this->get_instance(),
$this->get_context(),
Expand All @@ -4583,11 +4587,8 @@ protected function view_grading_table() {

$o .= $actionformtext;

$o .= $this->get_renderer()->heading(get_string('gradeitem:submissions', 'mod_assign'), 2);
$o .= $this->get_renderer()->render($gradingactions);

$o .= groups_print_activity_menu($this->get_course_module(), $currenturl, true);

// Plagiarism update status apearring in the grading book.
if (!empty($CFG->enableplagiarism)) {
require_once($CFG->libdir . '/plagiarismlib.php');
Expand Down
22 changes: 20 additions & 2 deletions mod/assign/templates/grading_actionmenu.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,34 @@
* none
Context variables required for this template:
* see mod/lesson/classes/output/grading_actionmenu.php
* groupselector - (optional) HTML that outputs the group selector
Example context (json):
{
"groupselector": "<div class='group-selector'></div>",
"pagereset": "http://moodle.local/mod/assign/view.php?id=2&action=grading&group=0",
"downloadall": "https://moodle.org"
}

}}
<div class="container-fluid tertiary-navigation">
<div class="container-fluid tertiary-navigation full-width-bottom-border">
<div class="row">
<div class="navitem">
<h2>{{#str}}gradeitem:submissions, mod_assign{{/str}}</h2>
</div>
<div class="navitem-divider d-none d-sm-flex"></div>
{{#groupselector}}
<div class="navitem">
{{{.}}}
</div>
<div class="navitem-divider d-none d-sm-flex"></div>
{{/groupselector}}
{{#pagereset}}
<div class="navitem align-self-center">
<a href="{{{.}}}" class="btn btn-link">{{#str}}clearall, core{{/str}}</a>
</div>
<div class="navitem-divider"></div>
{{/pagereset}}
{{#downloadall}}
<div class="navitem ml-sm-auto">
<a class="btn btn-secondary" href="{{downloadall}}">{{#str}}downloadall, mod_assign{{/str}}</a>
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/tests/behat/group_submission.feature
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ Feature: Group assignment submissions
| student1 | G1 |
And I am on the "Test assignment name" "assign activity" page
And I follow "View all submissions"
And I set the field "Separate groups" to "Group 1"
And I click on "Group 1" in the "group" search widget
And I should see "Group 1" in the "Student 0" "table_row"
And I should see "Group 1" in the "Student 1" "table_row"
And I should not see "Student 2"
And I set the field "Separate groups" to "All participants"
And I click on "All participants" in the "group" search widget
And I should see "Group 1" in the "Student 0" "table_row"
And I should see "Group 1" in the "Student 1" "table_row"
And I should see "Default group" in the "Student 2" "table_row"
Expand Down
7 changes: 7 additions & 0 deletions theme/boost/scss/moodle/tertiarynavigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
}
}

h2 {
font-size: 1.4rem;
font-weight: bold;
margin: 0;
align-self: center;
}

.navitem:not(:last-child),
.navitem-divider:not(:last-child) {
margin-right: 20px;
Expand Down
6 changes: 6 additions & 0 deletions theme/boost/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -38508,6 +38508,12 @@ div.editor_atto_toolbar button .icon {
font-size: 1.4rem;
font-weight: bold;
}
.tertiary-navigation h2 {
font-size: 1.4rem;
font-weight: bold;
margin: 0;
align-self: center;
}
.tertiary-navigation .navitem:not(:last-child),
.tertiary-navigation .navitem-divider:not(:last-child) {
margin-right: 20px;
Expand Down
6 changes: 6 additions & 0 deletions theme/classic/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -38442,6 +38442,12 @@ div.editor_atto_toolbar button .icon {
font-size: 1.4rem;
font-weight: bold;
}
.tertiary-navigation h2 {
font-size: 1.4rem;
font-weight: bold;
margin: 0;
align-self: center;
}
.tertiary-navigation .navitem:not(:last-child),
.tertiary-navigation .navitem-divider:not(:last-child) {
margin-right: 20px;
Expand Down

0 comments on commit 859a54b

Please sign in to comment.