Reload now shows confirmation modal again. Added some stuff missing from the last commit.

This commit is contained in:
Nick Winter 2014-11-08 08:38:25 -08:00
parent f3dfcdc81d
commit a8700f5113
7 changed files with 27 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -46,13 +46,13 @@
.thang-avatar-view
width: $childSize - 10px
margin: 5px
margin: 5px 0.4vw
display: inline-block
float: left
.btn.btn-small
margin-top: 15px
margin-right: 15px
margin-right: 1.3vw
font-size: 18px
.glyphicon

View file

@ -0,0 +1,11 @@
extends /templates/modal/modal_base
block modal-header-content
h3(data-i18n="play_level.reload_title") Reload All Code?
block modal-body-content
p(data-i18n="play_level.reload_really") Are you sure you want to reload this level back to the beginning?
block modal-footer-content
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="modal.close").btn Close
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="play_level.reload_confirm").btn.btn-primary#restart-level-confirm-button Reload All

View file

@ -31,7 +31,7 @@ module.exports = class LevelLoadingView extends CocoView
eventualCanvasWidth = $('#canvas-wrapper').outerWidth()
eventualCanvasHeight = Math.max(eventualCanvasWidth / canvasAspectRatio)
currentCanvasHeight = 589
extraHeight # From control bar (I think)
extraHeight = 50 # From control bar (I think)
@$el.addClass('manually-sized').css('height', @$el.outerHeight() + eventualCanvasHeight - currentCanvasHeight + 2 + extraHeight)
onLevelLoaded: (e) ->

View file

@ -0,0 +1,9 @@
ModalView = require 'views/kinds/ModalView'
template = require 'templates/play/level/modal/reload-level-modal'
module.exports = class ReloadLevelModal extends ModalView
id: '#reload-level-modal'
template: template
events:
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart', {}

View file

@ -3,7 +3,7 @@ ThangAvatarView = require 'views/play/level/ThangAvatarView'
template = require 'templates/play/level/tome/spell_list_tab_entry'
LevelComponent = require 'models/LevelComponent'
DocFormatter = require './DocFormatter'
filters = require 'lib/image_filter'
ReloadLevelModal = require 'views/play/level/modal/ReloadLevelModal'
module.exports = class SpellListTabEntryView extends SpellListEntryView
template: template
@ -97,10 +97,10 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'spell-list-open', volume: 1
onCodeReload: (e) ->
return unless @controlsEnabled
#return unless @controlsEnabled
#Backbone.Mediator.publish 'tome:reload-code', spell: @spell # Old: just reload the current code
Backbone.Mediator.publish 'level:restart', {} # New: prompt them to restart the level
# TODO: actually prompt them to restart rather than just doing it
@openModalView new ReloadLevelModal() # New: prompt them to restart the level
onBeautifyClick: (e) ->
return unless @controlsEnabled