diff --git a/enrol/tests/behat/add_to_group.feature b/enrol/tests/behat/add_to_group.feature index 79f4b4c39c7..0324747e141 100644 --- a/enrol/tests/behat/add_to_group.feature +++ b/enrol/tests/behat/add_to_group.feature @@ -1,4 +1,4 @@ -@core_enrol @core_group +@core_enrol @core_group @doit Feature: Users can be added to multiple groups at once In order to manage group membership effectively As a user @@ -22,15 +22,20 @@ Feature: Users can be added to multiple groups at once | teacher1 | C1 | editingteacher | | student1 | C1 | editingteacher | + @javascript Scenario: Adding a user to one group Given I log in as "teacher1" And I am on "Course 1" course homepage - And I navigate to "Enrolled users" node in "Course administration > Users" - And I click on "Add user into group" "link" in the "student1" "table_row" - When I set the field "Add user into group" to "Group 1" - And I press "Save changes" - Then I should see "Group 1" + And I follow "Participants" + And I click on "Edit groups for \"Student 1\"" "link" in the "student1" "table_row" + And I click on ".form-autocomplete-downarrow" "css_element" + And I click on ".form-autocomplete-suggestions [role=option]" "css_element" + And I click on ".form-autocomplete-downarrow" "css_element" + And I click on ".form-autocomplete-suggestions [role=option]" "css_element" + And I click on "Save changes" "link" + Then I should see "Group 1, Group 2" + @javascript Scenario: Adding a user to multiple group Given I log in as "teacher1" And I am on "Course 1" course homepage diff --git a/group/classes/output/user_groups_editable.php b/group/classes/output/user_groups_editable.php index 1db352c3c55..17c99bd7296 100644 --- a/group/classes/output/user_groups_editable.php +++ b/group/classes/output/user_groups_editable.php @@ -72,6 +72,8 @@ class user_groups_editable extends \core\output\inplace_editable { foreach ($coursegroups as $group) { $options[$group->id] = $group->name; } + $this->edithint = get_string('editusersgroupsa', 'group', fullname($user)); + $this->editlabel = get_string('editusersgroupsa', 'group', fullname($user)); $attributes = ['multiple' => true]; $this->set_type_autocomplete($options, $attributes); @@ -84,9 +86,6 @@ class user_groups_editable extends \core\output\inplace_editable { * @return \stdClass */ public function export_for_template(\renderer_base $output) { - // Set edithint and display value. - $this->edithint = get_string('editusersgroups', 'group'); - $listofgroups = []; $groupids = json_decode($this->value); foreach ($groupids as $id) { diff --git a/lang/en/group.php b/lang/en/group.php index 3132a6436ff..ead53e5d0af 100644 --- a/lang/en/group.php +++ b/lang/en/group.php @@ -56,7 +56,7 @@ $string['deletegroupsconfirm'] = 'Are you sure you want to delete the following $string['deleteselectedgroup'] = 'Delete selected group'; $string['editgroupingsettings'] = 'Edit grouping settings'; $string['editgroupsettings'] = 'Edit group settings'; -$string['editusersgroups'] = 'Edit users groups'; +$string['editusersgroupsa'] = 'Edit groups for "{$a}"'; $string['enrolmentkey'] = 'Enrolment key'; $string['enrolmentkey_help'] = 'An enrolment key enables access to the course to be restricted to only those who know the key. If a group enrolment key is specified, then not only will entering that key let the user into the course, but it will also automatically make them a member of this group. diff --git a/lib/grouplib.php b/lib/grouplib.php index 427e4f48602..b2f1d7ee907 100644 --- a/lib/grouplib.php +++ b/lib/grouplib.php @@ -264,7 +264,7 @@ function groups_get_all_groups($courseid, $userid=0, $groupingid=0, $fields='g.* } if ($withmembers) { - $memberselect = 'ugm.id AS ugmid, ugm.userid, '; + $memberselect = $DB->sql_concat("COALESCE(ugm.userid, ugm.userid, 'NULL')", "':'", 'g.id') . ' AS ugmid, ugm.userid, '; $memberjoin = ' LEFT JOIN {groups_members} ugm ON ugm.groupid = g.id '; } diff --git a/theme/boost/scss/moodle/user.scss b/theme/boost/scss/moodle/user.scss index af83503ca71..ff0f2c110ed 100644 --- a/theme/boost/scss/moodle/user.scss +++ b/theme/boost/scss/moodle/user.scss @@ -28,6 +28,11 @@ } } +// This rule overrides the automatic no-overflow on the participants table. It kills the auto-complete. +#participantsform .no-overflow { + overflow: visible; +} + .userprofile dl.list { // Copied from dl.row. > dd + dt { diff --git a/theme/bootstrapbase/less/moodle/user.less b/theme/bootstrapbase/less/moodle/user.less index 24a48027d9e..701a3981210 100644 --- a/theme/bootstrapbase/less/moodle/user.less +++ b/theme/bootstrapbase/less/moodle/user.less @@ -52,6 +52,10 @@ text-align: right; } } +// This rule overrides the automatic no-overflow on the participants table. It kills the auto-complete. +#participantsform .no-overflow { + overflow: visible; +} /** * This rule has been added to duplicate the style of icons with the diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index 88cc4a8f369..2e0ba551e80 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -9670,6 +9670,9 @@ body.path-question-type .mform fieldset.hidden { .path-user .node_category .viewmore { text-align: right; } +#participantsform .no-overflow { + overflow: visible; +} /** * This rule has been added to duplicate the style of icons with the * .iconsmall class for consistent rendering.