Course details - use given instance

This commit is contained in:
Matt Lott 2015-08-04 14:52:23 -07:00
parent 55a58ef0b3
commit 60e21600b8
3 changed files with 6 additions and 16 deletions
app
templates/courses/mock1
views/courses/mock1

View file

@ -5,6 +5,7 @@ block content
//- DO NOT localize / i18n
div TODO: fix ugly tabs
div TODO: not enrolled yet
div
span *UNDER CONSTRUCTION, send feedback to
a.spl(href='mailto:team@codecombat.com') team@codecombat.com
@ -40,17 +41,6 @@ block content
h1= course.title
p= course.description
if !studentMode
p
.form-group
span.spr Select your class
select.form-control.select-session
each inst in instances
if instance.name === inst.name
option(selected)= inst.name
else
option= inst.name
h3= instance.name
if !studentMode
span.spl

View file

@ -20,7 +20,7 @@ module.exports = class CourseDetailsView extends RootView
'mouseenter .progress-level-cell': 'onMouseEnterPoint'
'mouseleave .progress-level-cell': 'onMouseLeavePoint'
constructor: (options, @courseID) ->
constructor: (options, @courseID=0, @instanceID=0) ->
super options
@initData()
@ -55,7 +55,7 @@ module.exports = class CourseDetailsView extends RootView
@memberSort = 'nameAsc'
mockData = require 'views/courses/mock1/CoursesMockData'
@course = mockData.courses[@courseID]
@currentInstanceIndex = 0
@currentInstanceIndex = @instanceID
@instances = mockData.instances
@updateLevelMaps()

View file

@ -55,8 +55,7 @@ module.exports = class CoursesView extends RootView
onClickEnroll: (e) ->
$('#continueModal').modal('hide')
courseID = $(e.target).data('course-id')
instanceName = $('.select-session').val()
instanceID = index for val, index in @instances when val.name is instanceName
instanceID = _.random(0, @instances.length - 1)
viewClass = require 'views/courses/mock1/CourseDetailsView'
viewArgs = [{}, courseID, instanceID]
navigationEvent = route: "/courses/mock1/#{courseID}", viewClass: viewClass, viewArgs: viewArgs
@ -65,7 +64,8 @@ module.exports = class CoursesView extends RootView
onClickEnter: (e) ->
$('#continueModal').modal('hide')
courseID = $(e.target).data('course-id')
instanceID = _.random(0, @instances.length - 1)
instanceName = $('.select-session').val()
instanceID = index for val, index in @instances when val.name is instanceName
viewClass = require 'views/courses/mock1/CourseDetailsView'
viewArgs = [{}, courseID, instanceID]
navigationEvent = route: "/courses/mock1/#{courseID}", viewClass: viewClass, viewArgs: viewArgs