diff --git a/app/templates/courses/classroom-view.jade b/app/templates/courses/classroom-view.jade index 00b1c5809..2ef694cdf 100644 --- a/app/templates/courses/classroom-view.jade +++ b/app/templates/courses/classroom-view.jade @@ -49,7 +49,7 @@ block content .progress .progress-bar(style='width:'+stats.levels.pctDone) else if paidFor - button.btn.btn-info.btn-sm Enable + button.enable-btn.btn.btn-info.btn-sm(data-user-id=user.id, data-course-instance-id=courseInstance.id) Enable if !paidFor .text-center diff --git a/app/views/courses/ClassroomView.coffee b/app/views/courses/ClassroomView.coffee index 024894d79..576b04b26 100644 --- a/app/views/courses/ClassroomView.coffee +++ b/app/views/courses/ClassroomView.coffee @@ -22,6 +22,7 @@ module.exports = class ClassroomView extends RootView 'click #activate-licenses-btn': 'onClickActivateLicensesButton' 'click .activate-single-license-btn': 'onClickActivateSingleLicenseButton' 'click #add-students-btn': 'onClickAddStudentsButton' + 'click .enable-btn': 'onClickEnableButton' initialize: (options, classroomID) -> @classroom = new Classroom({_id: classroomID}) @@ -99,4 +100,11 @@ module.exports = class ClassroomView extends RootView onClickAddStudentsButton: (e) -> modal = new InviteToClassroomModal({classroom: @classroom}) - @openModalView(modal) \ No newline at end of file + @openModalView(modal) + + onClickEnableButton: (e) -> + courseInstance = @courseInstances.get($(e.target).data('course-instance-id')) + userID = $(e.target).data('user-id') + courseInstance.addMember(userID) + $(e.target).attr('disabled', true) + @listenToOnce courseInstance, 'sync', @render \ No newline at end of file