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-script-0.11.6 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.11.5 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.11.4 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.11.3 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.11.2 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.11.1 lib/javascript/decko/autosave.js.coffee
card-mod-script-0.11.0 lib/javascript/decko/autosave.js.coffee
card-1.100.0 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.6 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.5 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.4 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.3 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.2 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.1 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.99.0 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.98.3 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.98.2 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.98.1 mod/machines/lib/javascript/decko/autosave.js.coffee
card-1.98.0 mod/machines/lib/javascript/decko/autosave.js.coffee