Merged and tweaked phansch's save indicator from #205.
This commit is contained in:
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
|
@ -203,6 +203,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
|
||||||
tome_select_a_thang: "Select Someone for "
|
tome_select_a_thang: "Select Someone for "
|
||||||
tome_available_spells: "Available Spells"
|
tome_available_spells: "Available Spells"
|
||||||
hud_continue: "Continue (press shift-space)"
|
hud_continue: "Continue (press shift-space)"
|
||||||
|
spell_saved: "Spell Saved"
|
||||||
|
|
||||||
admin:
|
admin:
|
||||||
av_title: "Admin Views"
|
av_title: "Admin Views"
|
||||||
|
|
|
@ -18,7 +18,13 @@
|
||||||
position: absolute
|
position: absolute
|
||||||
top: 0
|
top: 0
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
||||||
|
.save-status
|
||||||
|
display: none
|
||||||
|
position: relative
|
||||||
|
padding-top: 2px
|
||||||
|
padding-left: 10px
|
||||||
|
|
||||||
.firepad
|
.firepad
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
img(src="/images/level/code_editor_background.png").code-background
|
img(src="/images/level/code_editor_background.png").code-background
|
||||||
|
|
||||||
div.ace
|
div.ace
|
||||||
|
|
||||||
|
.save-status(data-i18n="play_level.spell_saved") Spell Saved
|
||||||
|
|
|
@ -21,9 +21,11 @@ module.exports = class SpellView extends View
|
||||||
'god:user-code-problem': 'onUserCodeProblem'
|
'god:user-code-problem': 'onUserCodeProblem'
|
||||||
'tome:manual-cast': 'onManualCast'
|
'tome:manual-cast': 'onManualCast'
|
||||||
'tome:reload-code': 'onCodeReload'
|
'tome:reload-code': 'onCodeReload'
|
||||||
|
'tome:spell-changed': 'onSpellChanged'
|
||||||
|
'level:session-will-save': 'onSessionWillSave'
|
||||||
'modal-closed': 'focus'
|
'modal-closed': 'focus'
|
||||||
'focus-editor': 'focus'
|
'focus-editor': 'focus'
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click .ace': -> console.log 'clicked ace', @
|
'click .ace': -> console.log 'clicked ace', @
|
||||||
|
|
||||||
|
@ -316,6 +318,16 @@ module.exports = class SpellView extends View
|
||||||
#else
|
#else
|
||||||
# console.log "valid but not at end of line; recompile in", @autocastDelay + "ms"
|
# 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) ->
|
onUserCodeProblem: (e) ->
|
||||||
return @onInfiniteLoop e if e.problem.id is "runtime_InfiniteLoop"
|
return @onInfiniteLoop e if e.problem.id is "runtime_InfiniteLoop"
|
||||||
return unless e.problem.userInfo.methodName is @spell.name
|
return unless e.problem.userInfo.methodName is @spell.name
|
||||||
|
|
Reference in a new issue