Hide problem alert on code change

This commit is contained in:
Matt Lott 2014-11-09 11:36:17 -08:00
parent 5741968210
commit 377138f35f
3 changed files with 8 additions and 2 deletions

View file

@ -123,9 +123,10 @@ module.exports =
'tome:winnability-updated': c.object {title: 'Winnability Updated', description: 'When we think we can now win (or can no longer win), we may want to emphasize the submit button versus the run button (or vice versa), so this fires when we get new goal states (even preloaded goal states) suggesting success or failure change.', required: ['winnable']},
winnable: {type: 'boolean'}
# Problem Alert
'tome:show-problem-alert': c.object {title: 'Show Problem Alert', description: 'A problem alert needs to be shown.', required: ['problem']},
problem: {type: 'object'}
lineOffsetPx: {type: ['number', 'undefined']}
'tome:hide-problem-alert': c.object {title: 'Hide Problem Alert'}
'tome:jiggle-problem-alert': c.object {title: 'Jiggle Problem Alert'}

View file

@ -9,6 +9,7 @@ module.exports = class ProblemAlertView extends CocoView
subscriptions:
'tome:show-problem-alert': 'onShowProblemAlert'
'tome:hide-problem-alert': 'onHideProblemAlert'
'tome:jiggle-problem-alert': 'onJiggleProblemAlert'
'tome:manual-cast': 'onHideProblemAlert'
'real-time-multiplayer:manual-cast': 'onHideProblemAlert'

View file

@ -379,6 +379,9 @@ module.exports = class SpellView extends CocoView
@ace.setOptions minLines: lines, maxLines: lines
$('#spell-palette-view').css('top', 175 + lineHeight * lines) # Move spell palette up, slightly overlapping us.
hideProblemAlert: ->
Backbone.Mediator.publish 'tome:hide-problem-alert', {}
onManualCast: (e) ->
cast = @$el.parent().length
@recompile cast, e.realTime
@ -438,6 +441,7 @@ module.exports = class SpellView extends CocoView
_.throttle @notifyEditingBegan, 250
_.throttle @notifySpellChanged, 300
_.throttle @updateLines, 500
_.throttle @hideProblemAlert, 500
]
onSignificantChange.push _.debounce @checkRequiredCode, 1500 if requiredCodePerLevel[@options.level.get('slug')]
@onCodeChangeMetaHandler = =>