Commit 8acf9407 by alisan617

revert and fix membership tab course team mgmt section

parent e05262e7
...@@ -12,7 +12,11 @@ such that the value can be defined later than this assignment (file load order). ...@@ -12,7 +12,11 @@ such that the value can be defined later than this assignment (file load order).
(function() { (function() {
'use strict'; 'use strict';
var AuthListWidget, BatchEnrollment, BetaTesterBulkAddition, var AuthListWidget, BatchEnrollment, BetaTesterBulkAddition,
MemberListWidget, Membership, emailStudents, plantTimeout, statusAjaxError; MemberListWidget, Membership, emailStudents, plantTimeout, statusAjaxError,
/* eslint-disable */
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
/* eslint-enable */
plantTimeout = function() { plantTimeout = function() {
return window.InstructorDashboard.util.plantTimeout.apply(this, arguments); return window.InstructorDashboard.util.plantTimeout.apply(this, arguments);
...@@ -38,10 +42,8 @@ such that the value can be defined later than this assignment (file load order). ...@@ -38,10 +42,8 @@ such that the value can be defined later than this assignment (file load order).
add_btn_label: 'Add Member', add_btn_label: 'Add Member',
add_handler: function() {} add_handler: function() {}
}); });
templateHtml = $('#member-list-widget-template').html(); templateHtml = window.Mustache.render($('#member-list-widget-template').html(), memberListParams);
edx.HtmlUtils.setHtml( edx.HtmlUtils.setHtml(this.$container, edx.HtmlUtils.HTML(templateHtml));
this.$container, window.Mustache.render(templateHtml, edx.HtmlUtils.HTML(memberListParams))
);
this.$('input[type="button"].add').click(function() { this.$('input[type="button"].add').click(function() {
condition = typeof memberListParams.add_handler === 'function'; condition = typeof memberListParams.add_handler === 'function';
return condition ? memberListParams.add_handler(memberlistwidget.$('.add-field').val()) : undefined; return condition ? memberListParams.add_handler(memberlistwidget.$('.add-field').val()) : undefined;
...@@ -64,7 +66,7 @@ such that the value can be defined later than this assignment (file load order). ...@@ -64,7 +66,7 @@ such that the value can be defined later than this assignment (file load order).
item = rowArray[i]; item = rowArray[i];
$td = $('<td>'); $td = $('<td>');
if (item instanceof jQuery) { if (item instanceof jQuery) {
edx.HtmlUtils.append($td, item); edx.HtmlUtils.append($td, edx.HtmlUtils.HTML(item));
} else { } else {
$td.text(item); $td.text(item);
} }
...@@ -86,13 +88,14 @@ such that the value can be defined later than this assignment (file load order). ...@@ -86,13 +88,14 @@ such that the value can be defined later than this assignment (file load order).
return memberListWidget; return memberListWidget;
}()); }());
AuthListWidget = (function() { AuthListWidget = (function(_super) {
function authListWidget($container, rolename, $errorSection) { __extends(AuthListWidget, _super); // eslint-disable-line no-use-before-define
function AuthListWidget($container, rolename, $errorSection) { // eslint-disable-line no-shadow
var msg, var msg,
authlistwidget = this; authlistwidget = this;
this.rolename = rolename; this.rolename = rolename;
this.$errorSection = $errorSection; this.$errorSection = $errorSection;
authListWidget.super.constructor.call(this, $container, { AuthListWidget.__super__.constructor.call(this, $container, { // eslint-disable-line no-underscore-dangle
title: $container.data('display-name'), title: $container.data('display-name'),
info: $container.data('info-text'), info: $container.data('info-text'),
labels: [gettext('Username'), gettext('Email'), gettext('Revoke access')], labels: [gettext('Username'), gettext('Email'), gettext('Revoke access')],
...@@ -112,13 +115,13 @@ such that the value can be defined later than this assignment (file load order). ...@@ -112,13 +115,13 @@ such that the value can be defined later than this assignment (file load order).
this.reload_list(); this.reload_list();
} }
authListWidget.prototype.re_view = function() { AuthListWidget.prototype.re_view = function() {
this.clear_errors(); this.clear_errors();
this.clear_input(); this.clear_input();
return this.reload_list(); return this.reload_list();
}; };
authListWidget.prototype.add_handler = function(input) { AuthListWidget.prototype.add_handler = function(input) {
var authlistwidgetaddhandler = this; var authlistwidgetaddhandler = this;
if ((input != null) && input !== '') { if ((input != null) && input !== '') {
return this.modify_member_access(input, 'allow', function(error) { return this.modify_member_access(input, 'allow', function(error) {
...@@ -134,7 +137,7 @@ such that the value can be defined later than this assignment (file load order). ...@@ -134,7 +137,7 @@ such that the value can be defined later than this assignment (file load order).
} }
}; };
authListWidget.prototype.reload_list = function() { AuthListWidget.prototype.reload_list = function() {
var authlistwidgetreloadlist = this; var authlistwidgetreloadlist = this;
return this.get_member_list(function(error, memberList) { return this.get_member_list(function(error, memberList) {
if (error !== null) { if (error !== null) {
...@@ -163,19 +166,19 @@ such that the value can be defined later than this assignment (file load order). ...@@ -163,19 +166,19 @@ such that the value can be defined later than this assignment (file load order).
}); });
}; };
authListWidget.prototype.clear_errors = function() { AuthListWidget.prototype.clear_errors = function() {
var ref, result; var ref, result;
result = (this.$error_section) != null ? ref.text('') : undefined; result = (this.$error_section) != null ? ref.text('') : undefined;
return result; return result;
}; };
authListWidget.prototype.show_errors = function(msg) { AuthListWidget.prototype.show_errors = function(msg) {
var ref, result; var ref, result;
result = (this.$error_section) != null ? ref.text(msg) : undefined; result = (this.$error_section) != null ? ref.text(msg) : undefined;
return result; return result;
}; };
authListWidget.prototype.get_member_list = function(cb) { AuthListWidget.prototype.get_member_list = function(cb) {
var authlistwidgetgetmemberlist = this; var authlistwidgetgetmemberlist = this;
return $.ajax({ return $.ajax({
type: 'POST', type: 'POST',
...@@ -190,7 +193,7 @@ such that the value can be defined later than this assignment (file load order). ...@@ -190,7 +193,7 @@ such that the value can be defined later than this assignment (file load order).
}); });
}; };
authListWidget.prototype.modify_member_access = function(uniqueStudentIdentifier, action, cb) { AuthListWidget.prototype.modify_member_access = function(uniqueStudentIdentifier, action, cb) {
var authlistwidgetmemberaccess = this; var authlistwidgetmemberaccess = this;
return $.ajax({ return $.ajax({
type: 'POST', type: 'POST',
...@@ -210,7 +213,7 @@ such that the value can be defined later than this assignment (file load order). ...@@ -210,7 +213,7 @@ such that the value can be defined later than this assignment (file load order).
}); });
}; };
authListWidget.prototype.member_response = function(data) { AuthListWidget.prototype.member_response = function(data) {
var msg; var msg;
this.clear_errors(); this.clear_errors();
this.clear_input(); this.clear_input();
...@@ -233,7 +236,7 @@ such that the value can be defined later than this assignment (file load order). ...@@ -233,7 +236,7 @@ such that the value can be defined later than this assignment (file load order).
} }
}; };
return authListWidget; return AuthListWidget;
}(MemberListWidget)); }(MemberListWidget));
this.AutoEnrollmentViaCsv = (function() { this.AutoEnrollmentViaCsv = (function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment