Example for Thorsten! :)

This commit is contained in:
Martin Edenhofer 2015-04-27 14:19:57 +02:00
parent 73ce455a74
commit 16a12dc923

View file

@ -0,0 +1,30 @@
class Widget extends App.Controller
constructor: ->
super
# bind on key down
# if ctrl+shift+t is pressed, enable translation_inline and fire ui:rerender
$(document).on('keydown', (e) =>
if e.altKey && e.ctrlKey && e.keyCode is 84
if @active
@disable()
@active = false
else
@enable()
@active = true
)
enable: ->
App.Config.set( 'translation_inline', true )
App.Event.trigger('ui:rerender')
$(document).bind('click.block', (e) ->
e.preventDefault()
e.stopPropagation()
)
disable: ->
App.Config.set( 'translation_inline', false )
App.Event.trigger('ui:rerender')
$(document).unbind('click.block')
App.Config.set( 'translation_inline', Widget, 'Widgets' )