Example for Thorsten! :)
This commit is contained in:
parent
73ce455a74
commit
16a12dc923
1 changed files with 30 additions and 0 deletions
|
@ -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' )
|
Loading…
Reference in a new issue