mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-12 00:31:21 -05:00
e36cf0ca3f
Do not localize these files. This is under construction.
31 lines
859 B
CoffeeScript
31 lines
859 B
CoffeeScript
app = require 'core/application'
|
|
RootView = require 'views/core/RootView'
|
|
template = require 'templates/courses/mock1/course-info'
|
|
|
|
module.exports = class CourseInfoView extends RootView
|
|
id: 'course-info-view'
|
|
template: template
|
|
|
|
events:
|
|
'click .btn-enroll': 'onClickEnroll'
|
|
|
|
constructor: (options, @courseID) ->
|
|
super options
|
|
@initData()
|
|
|
|
getRenderData: ->
|
|
context = super()
|
|
context.course = @course ? {}
|
|
context.courseID = @courseID
|
|
context.praise = @praise
|
|
context
|
|
|
|
initData: ->
|
|
mockData = require 'views/courses/mock1/CoursesMockData'
|
|
@course = mockData.courses[@courseID]
|
|
@praise = mockData.praise[_.random(0, mockData.praise.length - 1)]
|
|
|
|
onClickEnroll: (e) ->
|
|
courseID = $(e.target).data('course-id')
|
|
app.router.navigate "/courses/mock1/#{courseID}/enroll"
|
|
window.location.reload()
|