Skip to content

Commit

Permalink
MDL-59368 groups: Add behat for new group edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Jul 12, 2017
1 parent 090d064 commit 76c493b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
17 changes: 11 additions & 6 deletions enrol/tests/behat/add_to_group.feature
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions group/classes/output/user_groups_editable.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function __construct($course, $context, $user, $coursegroups, $value) {
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);
Expand All @@ -84,9 +86,6 @@ public function __construct($course, $context, $user, $coursegroups, $value) {
* @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) {
Expand Down
2 changes: 1 addition & 1 deletion lang/en/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$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.
Expand Down
2 changes: 1 addition & 1 deletion lib/grouplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ';
}

Expand Down
5 changes: 5 additions & 0 deletions theme/boost/scss/moodle/user.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions theme/bootstrapbase/less/moodle/user.less
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions theme/bootstrapbase/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 76c493b

Please sign in to comment.