codecombat/app/views/courses/mock1/CourseInfoView.coffee
Matt Lott e36cf0ca3f Initial courses mock UI
Do not localize these files.
This is under construction.
2015-06-29 12:15:10 -07:00

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