Sha256: 6243b06f717324e90edfaea6e9f442b21a337777eb3cbb7d491a12d9efa3c1c5

Contents?: true

Size: 862 Bytes

Versions: 39

Compression:

Stored size: 862 Bytes

Contents

jQuery.fn.extend
  autosave: ->
    slot = @slot()
    return if @attr 'no-autosave'
    multi = @closest '.form-group'
    if multi[0]
      return unless id = multi.data 'cardId'
      reportee = ': ' + multi.data 'cardName'
    else
      id = slot.data 'cardId'
      reportee = ''

    return unless id

    # might be better to put this href base in the html
    submit_url = decko.path 'update/~' + id
    form_data = $('#edit_card_'+id).serializeArray().reduce( ((obj, item) ->
      obj[item.name] = item.value
      return obj
    ), { 'draft' : 'true', 'success[view]' : 'blank'});
    $.ajax submit_url, {
      data : form_data,
      type : 'POST'
    }
    ##{ 'card[content]' : @val() },

$(window).ready ->
  $('body').on 'change', '.autosave .d0-card-content', ->
    content_field = $(this)
    setTimeout ( -> content_field.autosave() ), 500

Version data entries

39 entries across 39 versions & 3 rubygems

Version Path
card-mod-edit-0.18.1 assets/script/autosave.js.coffee
card-mod-edit-0.18.0 assets/script/autosave.js.coffee
card-mod-edit-0.17.0 assets/script/autosave.js.coffee
card-mod-edit-0.16.0 assets/script/autosave.js.coffee
card-mod-edit-0.15.6 assets/script/autosave.js.coffee
card-mod-edit-0.15.5 assets/script/autosave.js.coffee
card-mod-edit-0.15.4 assets/script/autosave.js.coffee
card-mod-edit-0.15.3 assets/script/autosave.js.coffee
card-mod-edit-0.15.2.pre1 assets/script/autosave.js.coffee
card-mod-edit-0.15.1.1 assets/script/autosave.js.coffee
card-mod-edit-0.15.1 assets/script/autosave.js.coffee
card-mod-edit-0.15.0 assets/script/autosave.js.coffee
card-mod-script-0.14.2 assets/script/decko/autosave.js.coffee
card-mod-script-0.14.1 assets/script/decko/autosave.js.coffee
card-mod-script-0.14.0 assets/script/decko/autosave.js.coffee
card-mod-script-0.13.4 assets/script/decko/autosave.js.coffee
card-mod-script-0.13.3 assets/script/decko/autosave.js.coffee
card-mod-script-0.13.2 assets/script/decko/autosave.js.coffee
card-mod-script-0.11.7 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.12.0 lib/javascript/decko/autosave.js.coffee