Add enabling users to ClassroomView

This commit is contained in:
Scott Erickson 2015-12-01 15:27:12 -06:00
parent cbdef392c5
commit af136764de
2 changed files with 10 additions and 2 deletions

View file

@ -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

View file

@ -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)
@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