mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Have level list in CourseDetailsView include play buttons up through the last level completed and any levels started
This commit is contained in:
parent
6d5d3d1091
commit
71bca28148
2 changed files with 18 additions and 4 deletions
|
@ -139,23 +139,30 @@ block content
|
||||||
th(data-i18n="courses.concepts")
|
th(data-i18n="courses.concepts")
|
||||||
tbody
|
tbody
|
||||||
if campaign
|
if campaign
|
||||||
- var lastLevelCompleted = true;
|
- var previousLevelCompleted = true;
|
||||||
|
- var lastLevelCompleted = view.getLastLevelCompleted();
|
||||||
|
- var passedLastCompletedLevel = false;
|
||||||
- var levelCount = 0;
|
- var levelCount = 0;
|
||||||
each level, levelID in campaign.get('levels')
|
each level, levelID in campaign.get('levels')
|
||||||
|
- var levelStatus = null;
|
||||||
|
if userLevelStateMap[me.id]
|
||||||
|
- levelStatus = userLevelStateMap[me.id][levelID]
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
if lastLevelCompleted || view.teacherMode
|
if previousLevelCompleted || view.teacherMode || !passedLastCompletedLevel || levelStatus
|
||||||
- var i18n = level.type === 'course-ladder' ? 'play.compete' : 'home.play';
|
- var i18n = level.type === 'course-ladder' ? 'play.compete' : 'home.play';
|
||||||
button.btn.btn-success.btn-play-level(data-level-slug=level.slug, data-i18n=i18n, data-level-id=levelID)
|
button.btn.btn-success.btn-play-level(data-level-slug=level.slug, data-i18n=i18n, data-level-id=levelID)
|
||||||
td
|
td
|
||||||
if userLevelStateMap[me.id]
|
if userLevelStateMap[me.id]
|
||||||
div= userLevelStateMap[me.id][levelID]
|
div= userLevelStateMap[me.id][levelID]
|
||||||
- lastLevelCompleted = userLevelStateMap[me.id][levelID] === 'complete'
|
- previousLevelCompleted = userLevelStateMap[me.id][levelID] === 'complete'
|
||||||
else
|
else
|
||||||
- lastLevelCompleted = false
|
- previousLevelCompleted = false
|
||||||
td= ++levelCount + '. ' + level.name.replace('Course: ', '')
|
td= ++levelCount + '. ' + level.name.replace('Course: ', '')
|
||||||
td
|
td
|
||||||
if levelConceptMap[levelID]
|
if levelConceptMap[levelID]
|
||||||
each concept in course.get('concepts')
|
each concept in course.get('concepts')
|
||||||
if levelConceptMap[levelID][concept]
|
if levelConceptMap[levelID][concept]
|
||||||
span.spr.concept(data-i18n="concepts." + concept)
|
span.spr.concept(data-i18n="concepts." + concept)
|
||||||
|
if levelID === lastLevelCompleted
|
||||||
|
- passedLastCompletedLevel = true
|
||||||
|
|
|
@ -238,3 +238,10 @@ module.exports = class CourseDetailsView extends RootView
|
||||||
else
|
else
|
||||||
storage.save 'no-school', true
|
storage.save 'no-school', true
|
||||||
@$el.find('#school-form').slideUp('slow')
|
@$el.find('#school-form').slideUp('slow')
|
||||||
|
|
||||||
|
getLastLevelCompleted: ->
|
||||||
|
lastLevelCompleted = null
|
||||||
|
for levelID in _.keys(@campaign.get('levels'))
|
||||||
|
if @userLevelStateMap?[me.id]?[levelID] is 'complete'
|
||||||
|
lastLevelCompleted = levelID
|
||||||
|
return lastLevelCompleted
|
||||||
|
|
Loading…
Reference in a new issue