codecombat/app/views/play/level/modal/ProgressView.coffee
2016-05-31 10:59:06 -07:00

29 lines
1 KiB
CoffeeScript

CocoView = require 'views/core/CocoView'
utils = require 'core/utils'
module.exports = class ProgressView extends CocoView
id: 'progress-view'
className: 'modal-content'
template: require 'templates/play/level/modal/progress-view'
events:
'click #done-btn': 'onClickDoneButton'
'click #next-level-btn': 'onClickNextLevelButton'
initialize: (options) ->
@level = options.level
@course = options.course
@classroom = options.classroom
@nextLevel = options.nextLevel
@levelSessions = options.levelSessions
# 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)
@nextLevel.get('description', true) # Make sure the defaults are available
@nextLevelDescription = marked(utils.i18n(@nextLevel.attributesWithDefaults, 'description').replace(/!\[.*?\]\(.*?\)\n*/g, ''))
onClickDoneButton: ->
@trigger 'done'
onClickNextLevelButton: ->
@trigger 'next-level'