Small modal improvements.

This commit is contained in:
Martin Edenhofer 2014-09-16 22:49:15 +02:00
parent 8f07871520
commit e35d80b183
4 changed files with 15 additions and 13 deletions

View file

@ -451,9 +451,9 @@ class App.ControllerModal extends App.Controller
backdrop: true backdrop: true
keyboard: true keyboard: true
close: true close: true
title: '?' head: '?'
options = _.extend( options, defaults ) options = _.extend( defaults, options )
# do not use @el, because it's inserted by js # do not use @el, because it's inserted by js
delete options.el delete options.el
@ -476,12 +476,17 @@ class App.ControllerModal extends App.Controller
) )
if content if content
@el.find('.modal-body').html content @el.find('.modal-body').html content
@el.modal('show') @el.modal(
keyboard: @keyboard
show: true
backdrop: @backdrop
)
modalHide: (e) -> @el.bind('hidden.bs.modal', =>
if e @onHide()
e.preventDefault() # remove modal from dom
@el.modal('hide') $('.modal').remove();
)
hide: (e) -> hide: (e) ->
if e if e
@ -508,9 +513,6 @@ class App.ErrorModal extends App.ControllerModal
class App.SessionMessage extends App.ControllerModal class App.SessionMessage extends App.ControllerModal
constructor: -> constructor: ->
super super
console.log('SM', @)
@show() @show()
# reload page on modal hidden # reload page on modal hidden

View file

@ -19,7 +19,7 @@ class Widget extends App.Controller
new App.SessionMessage( new App.SessionMessage(
head: message.head head: message.head
message: message.message message: message.message
keyboard: false keyboard: true
backdrop: true backdrop: true
close: true close: true
button: button button: button

View file

@ -43,7 +43,7 @@ class Widget extends App.Controller
message: 'Session taken over... please reload page or work with other browser window.' message: 'Session taken over... please reload page or work with other browser window.'
keyboard: false keyboard: false
backdrop: true backdrop: true
close: true close: false
button: 'Reload application' button: 'Reload application'
forceReload: true forceReload: true
) )

View file

@ -238,7 +238,7 @@ class _webSocketSingleton extends App.Controller
# show reconnect message # show reconnect message
@error = new App.ControllerModal( @error = new App.ControllerModal(
title: 'Lost network connection!' head: 'Lost network connection!'
message: 'Lost network connection to system, trying to reconnect...' message: 'Lost network connection to system, trying to reconnect...'
backdrop: false backdrop: false
keyboard: false keyboard: false