vendor/assets/javascripts/bootstrap-editable-rails.js.coffee in bootstrap-editable-rails-0.0.3 vs vendor/assets/javascripts/bootstrap-editable-rails.js.coffee in bootstrap-editable-rails-0.0.4
- old
+ new
@@ -8,17 +8,24 @@
resource = @options.resource
@options.url = (params) =>
# TODO: should not send when create new object
if typeof originalUrl == 'function' # user's function
originalUrl.call(@options.scope, params)
- else # send ajax to server and return deferred object
+ else if originalUrl? && @options.send != 'never'
+ # send ajax to server and return deferred object
obj = {}
- data = {}
obj[params.name] = params.value
- data[resource] = obj
+ # support custom inputtypes (eg address)
+ if resource
+ params[resource] = obj
+ else
+ params = obj
+ delete params.name
+ delete params.value
+ delete params.pk
$.ajax($.extend({
url : originalUrl
- data : data
+ data : params
type : 'PUT' # TODO: should be 'POST' when create new object
dataType: 'json'
}, @options.ajaxOptions))
@saveWithoutUrlHook(value)
EditableForm.prototype.saveWithoutUrlHook = EditableForm.prototype.save