Sha256: 6c7fc129be61e3893583dcbca1c1a38a05eee2cb72f01352acaaf370bc1ee9d4

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 Bytes

Contents

jQuery ->

  # The 'save' and the 'cancel' button are only to be shown in edit mode.
  # In order to receive the proper 'edit', 'save', 'cancel' events, they also have to be .editable.
  $( ".save_button,.cancel_button" ).addClass( "show_only_in_edit_mode editable" )

  # The 'edit' button is only to be shown when not in edit mode.
  $( ".edit_button" ).addClass( "do_not_show_in_edit_mode editable" )

  # The buttons trigger the correspondig events of the surrounding edit_mode_group.
  $( ".edit_button" ).click ( (e) ->
    $( this ).closest( ".edit_mode_group" ).trigger( "edit" )
    e.preventDefault()
  )
  $( ".save_button" ).click( (e) ->
    $( this ).closest( ".edit_mode_group" ).trigger( "save" )
    e.preventDefault()
  )
  $( ".cancel_button" ).click( (e) ->
    $( this ).closest( ".edit_mode_group" ).trigger( "cancel" )
    e.preventDefault()
  )

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
edit_mode-0.0.7 lib/assets/javascripts/edit_mode/tool_buttons.js.coffee
edit_mode-0.0.6 lib/assets/javascripts/edit_mode/tool_buttons.js.coffee
edit_mode-0.0.5 lib/assets/javascripts/edit_mode/tool_buttons.js.coffee
edit_mode-0.0.4 lib/assets/javascripts/edit_mode/tool_buttons.js.coffee