mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-07 18:44:29 -04:00
Free course enrollment for admins
This commit is contained in:
parent
9b704b5f15
commit
8b254164c9
3 changed files with 6 additions and 5 deletions
app
server/prepaids
|
@ -143,7 +143,7 @@ mixin student-dialog(course)
|
|||
input.code-input(type='text', data-course-id="#{course.id}", data-i18n="[placeholder]courses.enter_code1", placeholder="Enter unlock code")
|
||||
.col-md-4
|
||||
button.btn.btn-success.btn-enroll(data-course-id="#{course.id}", data-i18n="courses.enroll")
|
||||
if hocMode && course.get('pricePerSeat') === 0
|
||||
if hocMode && course.get('pricePerSeat') === 0 || me.isAdmin()
|
||||
.row.button-row.center.row-pick-class
|
||||
.col-md-12
|
||||
br
|
||||
|
@ -184,7 +184,7 @@ mixin teacher-dialog(course)
|
|||
div.or(data-i18n="courses.or")
|
||||
.row.button-row.center
|
||||
.col-md-12
|
||||
if course.get('pricePerSeat') === 0
|
||||
if course.get('pricePerSeat') === 0 || me.isAdmin()
|
||||
button.btn.btn-success.btn-lg.btn-buy(data-course-id="#{course.id}") Start new class
|
||||
else
|
||||
button.btn.btn-success.btn-lg.btn-buy(data-course-id="#{course.id}", data-i18n="courses.buy_course1")
|
||||
|
@ -223,7 +223,7 @@ mixin course-block(course)
|
|||
button.btn.btn-lg.btn-success.btn-continue(data-toggle='modal', data-target="#continueModal#{course.id}", data-i18n="courses.enter") Enter
|
||||
else if enrolledCourses[course.id]
|
||||
button.btn.btn-lg.btn-success.btn-continue(data-toggle='modal', data-target="#continueModal#{course.id}", data-i18n="common.continue")
|
||||
else if course.get('pricePerSeat') === 0
|
||||
else if course.get('pricePerSeat') === 0 || me.isAdmin()
|
||||
button.btn.btn-lg.btn-success.btn-buy(data-course-id="#{course.id}", data-i18n='courses.get_free')
|
||||
else
|
||||
button.btn.btn-lg.btn-success.btn-buy(data-course-id="#{course.id}", data-i18n='courses.buy_course')
|
||||
|
|
|
@ -139,4 +139,5 @@ module.exports = class CourseEnrollView extends RootView
|
|||
else
|
||||
coursePrices = (c.get('pricePerSeat') for c in @courses.models)
|
||||
@price = utils.getCourseBundlePrice(coursePrices, @seats)
|
||||
@price = 0 if me.isAdmin()
|
||||
@render?()
|
||||
|
|
|
@ -125,11 +125,11 @@ PrepaidHandler = class PrepaidHandler extends Handler
|
|||
courseIDs = (c.get('_id') for c in courses)
|
||||
coursePrices = (c.get('pricePerSeat') for c in courses)
|
||||
amount = utils.getCourseBundlePrice(coursePrices, maxRedeemers)
|
||||
if amount > 0 and not token
|
||||
if amount > 0 and not (token or user.isAdmin())
|
||||
@logError(user, "Purchase prepaid courses missing required Stripe token #{amount}")
|
||||
return done('Missing required Stripe token')
|
||||
|
||||
if amount is 0
|
||||
if amount is 0 or user.isAdmin()
|
||||
@createPrepaid(user, type, maxRedeemers, courseIDs: courseIDs, done)
|
||||
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue