diff --git a/lms/djangoapps/teams/static/teams/js/models/team.js b/lms/djangoapps/teams/static/teams/js/models/team.js index 010116e3717e..fdab4fb7d48f 100644 --- a/lms/djangoapps/teams/static/teams/js/models/team.js +++ b/lms/djangoapps/teams/static/teams/js/models/team.js @@ -16,7 +16,9 @@ country: '', language: '', membership: [], - last_activity_at: '' + last_activity_at: '', + professor: '', + content_group: '', }, initialize: function(options) { diff --git a/lms/djangoapps/teams/static/teams/js/views/edit_team.js b/lms/djangoapps/teams/static/teams/js/views/edit_team.js index 4413faf5de33..a6e4568ab5fb 100644 --- a/lms/djangoapps/teams/static/teams/js/views/edit_team.js +++ b/lms/djangoapps/teams/static/teams/js/views/edit_team.js @@ -27,6 +27,9 @@ this.topic = options.topic; this.collection = options.collection; this.action = options.action; + this.contentGroupsNameMap = _.map(this.context.contentGroups, function(group) { + return [group.id, group.name] + }); if (this.action === 'create') { this.teamModel = new TeamModel({}); @@ -57,6 +60,27 @@ + 'goals or direction of the team (maximum 300 characters).') }); + this.teamProfessorField = new FieldViews.TextareaFieldView({ + model: this.teamModel, + title: gettext('Professor in charge (Required) *'), + valueAttribute: 'professor', + editable: 'always', + showMessages: false, + helpMessage: gettext( + 'The name of the professor in charge of the team (maximum 300 characters).') + }); + + this.teamContentGroupsField = new FieldViews.DropdownFieldView({ + model: this.teamModel, + title: gettext('Content Groups'), + valueAttribute: 'content_group', + required: false, + showMessages: false, + options: this.contentGroupsNameMap, + helpMessage: gettext( + 'The content groups that the team is associated with.') + }); + this.teamLanguageField = new FieldViews.DropdownFieldView({ model: this.teamModel, title: gettext('Language'), @@ -92,6 +116,8 @@ ); this.set(this.teamNameField, '.team-required-fields'); this.set(this.teamDescriptionField, '.team-required-fields'); + this.set(this.teamProfessorField, '.team-required-fields'); + this.set(this.teamContentGroupsField, '.team-optional-fields'); this.set(this.teamLanguageField, '.team-optional-fields'); this.set(this.teamCountryField, '.team-optional-fields'); return this; @@ -105,17 +131,20 @@ this.$(selector).append(view.render().$el); } }, - createOrUpdateTeam: function(event) { event.preventDefault(); var view = this, // eslint-disable-line vars-on-top teamLanguage = this.teamLanguageField.fieldValue(), teamCountry = this.teamCountryField.fieldValue(), + teamContentGroup = this.teamContentGroupsField.fieldValue(), data = { name: this.teamNameField.fieldValue(), description: this.teamDescriptionField.fieldValue(), + professor: this.teamProfessorField.fieldValue(), language: _.isNull(teamLanguage) ? '' : teamLanguage, - country: _.isNull(teamCountry) ? '' : teamCountry + country: _.isNull(teamCountry) ? '' : teamCountry, + content_group: _.isNull(teamContentGroup) ? '' : teamContentGroup, + user_partition_id: this.context.partitionID }, saveOptions = { wait: true diff --git a/lms/djangoapps/teams/templates/teams/teams.html b/lms/djangoapps/teams/templates/teams/teams.html index 3dfa5b51aeb6..ce64a5b159ee 100644 --- a/lms/djangoapps/teams/templates/teams/teams.html +++ b/lms/djangoapps/teams/templates/teams/teams.html @@ -24,6 +24,10 @@ <%include file="/courseware/course_navigation.html" args="active_page='teams'" /> +<%! +from openedx.core.djangoapps.course_groups.partition_scheme import get_grouped_user_partition +%> +