Merged and tweaked phansch's save indicator from .

This commit is contained in:
Nick Winter 2014-01-16 10:10:27 -08:00
commit af7344175a
4 changed files with 23 additions and 2 deletions
app
locale
styles/play/level/tome
templates/play/level/tome
views/play/level/tome

View file

@ -203,6 +203,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
tome_select_a_thang: "Select Someone for "
tome_available_spells: "Available Spells"
hud_continue: "Continue (press shift-space)"
spell_saved: "Spell Saved"
admin:
av_title: "Admin Views"

View file

@ -18,7 +18,13 @@
position: absolute
top: 0
height: 100%
.save-status
display: none
position: relative
padding-top: 2px
padding-left: 10px
.firepad
width: 100%
height: 100%

View file

@ -1,3 +1,5 @@
img(src="/images/level/code_editor_background.png").code-background
div.ace
.save-status(data-i18n="play_level.spell_saved") Spell Saved

View file

@ -21,9 +21,11 @@ module.exports = class SpellView extends View
'god:user-code-problem': 'onUserCodeProblem'
'tome:manual-cast': 'onManualCast'
'tome:reload-code': 'onCodeReload'
'tome:spell-changed': 'onSpellChanged'
'level:session-will-save': 'onSessionWillSave'
'modal-closed': 'focus'
'focus-editor': 'focus'
events:
'click .ace': -> console.log 'clicked ace', @
@ -316,6 +318,16 @@ module.exports = class SpellView extends View
#else
# console.log "valid but not at end of line; recompile in", @autocastDelay + "ms"
onSpellChanged: (e) ->
@spellHasChanged = true
onSessionWillSave: (e) ->
setTimeout(=>
unless @spellHasChanged
@$el.find('.save-status').finish().show().fadeOut(2000)
, 1000)
@spellHasChanged = false
onUserCodeProblem: (e) ->
return @onInfiniteLoop e if e.problem.id is "runtime_InfiniteLoop"
return unless e.problem.userInfo.methodName is @spell.name