2014-01-03 13:32:13 -05:00
|
|
|
View = require 'views/kinds/CocoView'
|
|
|
|
template = require 'templates/play/level/tome/problem_alert'
|
|
|
|
{me} = require 'lib/auth'
|
|
|
|
|
|
|
|
module.exports = class ProblemAlertView extends View
|
|
|
|
className: 'problem-alert'
|
|
|
|
template: template
|
|
|
|
|
|
|
|
subscriptions: {}
|
|
|
|
|
|
|
|
events:
|
|
|
|
"click .close": "onRemoveClicked"
|
|
|
|
|
|
|
|
constructor: (options) ->
|
|
|
|
super options
|
|
|
|
@problem = options.problem
|
|
|
|
|
2014-02-11 17:58:45 -05:00
|
|
|
getRenderData: (context={}) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
context = super context
|
2014-04-29 18:25:59 -04:00
|
|
|
format = (s) -> s?.replace('<', '<').replace('>', '>').replace("\n", "<br>")
|
2014-02-14 19:52:50 -05:00
|
|
|
context.message = format @problem.aetherProblem.message
|
|
|
|
context.hint = format @problem.aetherProblem.hint
|
2014-01-03 13:32:13 -05:00
|
|
|
context
|
|
|
|
|
|
|
|
afterRender: ->
|
|
|
|
super()
|
2014-03-28 20:06:21 -04:00
|
|
|
@$el.addClass('alert').addClass("alert-#{@problem.aetherProblem.level}").hide().fadeIn('slow')
|
|
|
|
Backbone.Mediator.publish 'play-sound', trigger: 'error_appear', volume: 1.0
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
onRemoveClicked: ->
|
|
|
|
@$el.remove()
|
|
|
|
@destroy()
|
|
|
|
#@problem.destroy() # let's try leaving the annotations / marker ranges alone
|