Add enroll students button to /courses/teachers

This commit is contained in:
Matt Lott 2015-12-21 15:01:14 -08:00
parent e070c70b9d
commit bde8e6721c
4 changed files with 16 additions and 1 deletions

View file

@ -1,6 +1,9 @@
#teacher-courses-view
margin-bottom: 50px
#activate-licenses-btn
margin-left: 10px
.active-courses
font-size: 12px
font-weight: bold

View file

@ -4,7 +4,8 @@ block modal-header-content
.clearfix
.text-center
h2(data-i18n="courses.enroll_paid")
p= view.classroom.get('name')
if view.classroom
p= view.classroom.get('name')
block modal-body-content
- var usedLic = view.prepaids.totalRedeemers();

View file

@ -68,6 +68,7 @@ block content
strong.spr(data-i18n="courses.unused_enrollments")
strong.spr= view.prepaids.totalAvailable()
a.btn.btn-success.btn(href="/courses/purchase", data-i18n="courses.purchase_enrollments")
button#activate-licenses-btn.btn.btn-info(data-i18n="courses.enroll_paid")
p(data-i18n="courses.students_access")

View file

@ -1,3 +1,4 @@
ActivateLicensesModal = require 'views/courses/ActivateLicensesModal'
app = require 'core/application'
AuthModal = require 'views/core/AuthModal'
CocoCollection = require 'collections/CocoCollection'
@ -17,6 +18,7 @@ module.exports = class TeacherCoursesView extends RootView
template: template
events:
'click #activate-licenses-btn': 'onClickActivateLicensesButton'
'click .btn-add-students': 'onClickAddStudents'
'click .create-new-class': 'onClickCreateNewClassButton'
'click .edit-classroom-small': 'onClickEditClassroomSmall'
@ -49,6 +51,14 @@ module.exports = class TeacherCoursesView extends RootView
url: "/db/classroom/#{classroom.id}/members"
})
onClickActivateLicensesButton: ->
modal = new ActivateLicensesModal({
users: @members
})
@openModalView(modal)
modal.once 'redeem-users', -> document.location.reload()
application.tracker?.trackEvent 'Courses teachers started enroll students', category: 'Courses'
onClickAddStudents: (e) ->
classroomID = $(e.target).data('classroom-id')
classroom = @classrooms.get(classroomID)