mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 00:28:31 -05:00
71fd13276f
Add individual course session selection, call them classes. Edit buttons for class name and description. Rearrange layout. Update course concept lists to use real values. Also add class name field to course enrollment page.
42 lines
1.3 KiB
CoffeeScript
42 lines
1.3 KiB
CoffeeScript
app = require 'core/application'
|
|
RootView = require 'views/core/RootView'
|
|
template = require 'templates/courses/mock1/course-details'
|
|
|
|
module.exports = class CourseDetailsView extends RootView
|
|
id: 'course-details-view'
|
|
template: template
|
|
|
|
events:
|
|
'click .edit-class-name-btn': 'onClickEditClassName'
|
|
'click .edit-description-btn': 'onClickEditClassDescription'
|
|
'change .select-session': 'onChangeSession'
|
|
|
|
constructor: (options, @courseID) ->
|
|
super options
|
|
@initData()
|
|
|
|
getRenderData: ->
|
|
context = super()
|
|
context.course = @course ? {}
|
|
context.instance = @instances?[@currentInstanceIndex] ? {}
|
|
context.instances = @instances ? []
|
|
context
|
|
|
|
initData: ->
|
|
mockData = require 'views/courses/mock1/CoursesMockData'
|
|
@course = mockData.courses[@courseID]
|
|
# @instance = mockData.instances[_.random(0, mockData.instances.length - 1)]
|
|
@currentInstanceIndex = 0
|
|
@instances = mockData.instances
|
|
|
|
onChangeSession: (e) ->
|
|
newSessionValue = $(e.target).val()
|
|
for val, index in @instances when val.name is newSessionValue
|
|
@currentInstanceIndex = index
|
|
@render?()
|
|
|
|
onClickEditClassName: (e) ->
|
|
alert 'TODO: Popup for editing name for this course session'
|
|
|
|
onClickEditClassDescription: (e) ->
|
|
alert 'TODO: Popup for editing description for this course session'
|