mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -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")
|
||||
tbody
|
||||
if campaign
|
||||
- var lastLevelCompleted = true;
|
||||
- var previousLevelCompleted = true;
|
||||
- var lastLevelCompleted = view.getLastLevelCompleted();
|
||||
- var passedLastCompletedLevel = false;
|
||||
- var levelCount = 0;
|
||||
each level, levelID in campaign.get('levels')
|
||||
- var levelStatus = null;
|
||||
if userLevelStateMap[me.id]
|
||||
- levelStatus = userLevelStateMap[me.id][levelID]
|
||||
tr
|
||||
td
|
||||
if lastLevelCompleted || view.teacherMode
|
||||
if previousLevelCompleted || view.teacherMode || !passedLastCompletedLevel || levelStatus
|
||||
- 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)
|
||||
td
|
||||
if userLevelStateMap[me.id]
|
||||
div= userLevelStateMap[me.id][levelID]
|
||||
- lastLevelCompleted = userLevelStateMap[me.id][levelID] === 'complete'
|
||||
- previousLevelCompleted = userLevelStateMap[me.id][levelID] === 'complete'
|
||||
else
|
||||
- lastLevelCompleted = false
|
||||
- previousLevelCompleted = false
|
||||
td= ++levelCount + '. ' + level.name.replace('Course: ', '')
|
||||
td
|
||||
if levelConceptMap[levelID]
|
||||
each concept in course.get('concepts')
|
||||
if levelConceptMap[levelID][concept]
|
||||
span.spr.concept(data-i18n="concepts." + concept)
|
||||
if levelID === lastLevelCompleted
|
||||
- passedLastCompletedLevel = true
|
||||
|
|
|
@ -238,3 +238,10 @@ module.exports = class CourseDetailsView extends RootView
|
|||
else
|
||||
storage.save 'no-school', true
|
||||
@$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