Sha256: 292fad5e9e8d6ee7de4d4ee41723bf438ec290134f5ba403c4bb10da7cbba626

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

jQuery ->
  $( ".best_in_place" ).best_in_place()
                       .addClass( "editable ")
                       .bind( "edit", ->
                         $( this ).data( 'bestInPlaceEditor' ).activate()
                         $( this ).find( "*" ).unbind( 'blur' )
                                              .unbind( 'click' )
                                              .unbind( 'keyup' )
                                              .unbind( 'submit' )
                                              .bind( 'keyup', keyUpHandler )
                       )
                       .bind( "cancel", ->
                         $( this ).data( 'bestInPlaceEditor' ).abort()
                       )
                       .bind( "save", ->
                         $( this ).data( 'bestInPlaceEditor' ).update()
                       )

  keyUpHandler = (event) ->
    if event.keyCode == 27
      $( this ).closest( ".edit_mode_group" ).trigger( "cancel" )
    if event.keyCode == 13
      unless $( event.target ).is( "textarea" )
        $( this ).closest( ".edit_mode_group" ).trigger( "save" )

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
edit_mode-0.0.4 lib/assets/javascripts/edit_mode/best_in_place.js.coffee
edit_mode-0.0.3 lib/assets/javascripts/edit_mode/best_in_place.js.coffee
edit_mode-0.0.2 lib/assets/javascripts/edit_mode/best_in_place.js.coffee
edit_mode-0.0.1 lib/assets/javascripts/edit_mode/best_in_place.js.coffee