2016-01-19 18:42:20 -05:00
|
|
|
CocoView = require 'views/core/CocoView'
|
2016-05-30 19:26:55 -04:00
|
|
|
utils = require 'core/utils'
|
2016-01-19 18:42:20 -05:00
|
|
|
|
|
|
|
module.exports = class ProgressView extends CocoView
|
2016-05-30 19:26:55 -04:00
|
|
|
|
2016-01-19 18:42:20 -05:00
|
|
|
id: 'progress-view'
|
|
|
|
className: 'modal-content'
|
|
|
|
template: require 'templates/play/level/modal/progress-view'
|
|
|
|
|
|
|
|
events:
|
|
|
|
'click #done-btn': 'onClickDoneButton'
|
|
|
|
'click #next-level-btn': 'onClickNextLevelButton'
|
2016-07-15 18:54:22 -04:00
|
|
|
'click #ladder-btn': 'onClickLadderButton'
|
2016-01-19 18:42:20 -05:00
|
|
|
|
|
|
|
initialize: (options) ->
|
|
|
|
@level = options.level
|
|
|
|
@course = options.course
|
2016-04-13 12:54:24 -04:00
|
|
|
@classroom = options.classroom
|
2016-01-19 18:42:20 -05:00
|
|
|
@nextLevel = options.nextLevel
|
|
|
|
@levelSessions = options.levelSessions
|
2016-05-30 19:26:55 -04:00
|
|
|
# Translate and Markdownify level description, but take out any images (we don't have room for arena banners, etc.).
|
|
|
|
# Images in Markdown are like ![description](url)
|
2016-05-31 13:59:06 -04:00
|
|
|
@nextLevel.get('description', true) # Make sure the defaults are available
|
|
|
|
@nextLevelDescription = marked(utils.i18n(@nextLevel.attributesWithDefaults, 'description').replace(/!\[.*?\]\(.*?\)\n*/g, ''))
|
2016-01-19 18:42:20 -05:00
|
|
|
|
|
|
|
onClickDoneButton: ->
|
|
|
|
@trigger 'done'
|
|
|
|
|
|
|
|
onClickNextLevelButton: ->
|
2016-05-30 19:26:55 -04:00
|
|
|
@trigger 'next-level'
|
2016-07-15 18:54:22 -04:00
|
|
|
|
|
|
|
onClickLadderButton: ->
|
|
|
|
@trigger 'ladder'
|