Sha256: da35db0773253eec034224ae570796c9c8888b74b49ae88045942614f2d3890a
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
jQuery ($) -> EditableForm = $.fn.editableform.Constructor EditableForm.prototype.saveWithUrlHook = (value) -> url = @options.url model = @options.model nestedName = @options.nested nestedId = @options.nid @options.url = (params) => myName = params.name myValue = params.value.replace(/(\r\n|\n|\r)/gm,"<br/>") obj = {} if nestedName nested = {} nested[myName] = myValue nested['id'] = nestedId obj[nestedName + '_attributes'] = nested else obj[myName] = myValue params[model] = obj delete params.name delete params.value delete params.pk $.ajax($.extend({ url : url data : params type : 'PUT' dataType: 'json' }, @options.ajaxOptions)) @saveWithoutUrlHook(value) EditableForm.prototype.saveWithoutUrlHook = EditableForm.prototype.save EditableForm.prototype.save = EditableForm.prototype.saveWithUrlHook
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
x-editable-rails-0.0.3 | vendor/assets/javascripts/rails-editable.js.coffee |