Sha256: b55d6165ee8f422eea84493a615603fa1b2b24a1e99806d68ad017e2f19a768b
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
jQuery ($) -> EditableForm = $.fn.editableform.Constructor EditableForm.prototype.saveWithUrlHook = (value) -> url = @options.url model = @options.model nestedName = @options.nested nestedId = @options.nid nestedLocale = @options.locale @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 if nestedLocale nested['locale'] = nestedLocale 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
6 entries across 6 versions & 1 rubygems