Add enabling users to ClassroomView
This commit is contained in:
parent
cbdef392c5
commit
af136764de
2 changed files with 10 additions and 2 deletions
app
|
@ -49,7 +49,7 @@ block content
|
||||||
.progress
|
.progress
|
||||||
.progress-bar(style='width:'+stats.levels.pctDone)
|
.progress-bar(style='width:'+stats.levels.pctDone)
|
||||||
else if paidFor
|
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
|
if !paidFor
|
||||||
.text-center
|
.text-center
|
||||||
|
|
|
@ -22,6 +22,7 @@ module.exports = class ClassroomView extends RootView
|
||||||
'click #activate-licenses-btn': 'onClickActivateLicensesButton'
|
'click #activate-licenses-btn': 'onClickActivateLicensesButton'
|
||||||
'click .activate-single-license-btn': 'onClickActivateSingleLicenseButton'
|
'click .activate-single-license-btn': 'onClickActivateSingleLicenseButton'
|
||||||
'click #add-students-btn': 'onClickAddStudentsButton'
|
'click #add-students-btn': 'onClickAddStudentsButton'
|
||||||
|
'click .enable-btn': 'onClickEnableButton'
|
||||||
|
|
||||||
initialize: (options, classroomID) ->
|
initialize: (options, classroomID) ->
|
||||||
@classroom = new Classroom({_id: classroomID})
|
@classroom = new Classroom({_id: classroomID})
|
||||||
|
@ -99,4 +100,11 @@ module.exports = class ClassroomView extends RootView
|
||||||
|
|
||||||
onClickAddStudentsButton: (e) ->
|
onClickAddStudentsButton: (e) ->
|
||||||
modal = new InviteToClassroomModal({classroom: @classroom})
|
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
|
Reference in a new issue