bootstrap-editable-rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 592e5bedbbdd4d25e0d65eacbd09f67d919de051
4
- data.tar.gz: fc5a619cad16bd1ebd8ea40124050cc75be7ae24
3
+ data.tar.gz: a3d6799428ff1f761a995a19917424eb3c4b475e
4
+ metadata.gz: 2ffee4e362be3020dcec4ef4ee4ca179ae29d936
5
5
  SHA512:
6
- metadata.gz: 6d2197c41e0562fcfe380b444f9ec789cad7d5f9e4945e715f05f2f61ffbc218a85b69755c3a9e29d5ed11503a638ed979b766f774dc53850e271b5e59abec77
7
- data.tar.gz: 77c313797c8c469261399a6722350867597b8b768e5f447225a079bd716e6be1d2abd263e061023fc360fe4b83e5ffa31d554a6c561e0b685fa6f73c765a5a76
6
+ data.tar.gz: 26f7a2fddb88768584d8b8a059e96f18c13315852b8878118ee7451dda324437ac04d0055210287d351bdeb34186fa2e73fd37e37cbc3d661b20b9c063da0572
7
+ metadata.gz: 9058f215c150d79c92f7cf6766cc3d2c884f25c849ae3844aa0345714ab3742ab7b77e842c2273f655df44b5533ff1e41fd4b8256d310221b19057119fff5a03
@@ -1,7 +1,7 @@
1
1
  module Bootstrap
2
2
  module Editable
3
3
  module Rails
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.7"
5
5
  end
6
6
  end
7
7
  end
@@ -3,31 +3,32 @@
3
3
 
4
4
  jQuery ($) ->
5
5
  EditableForm = $.fn.editableform.Constructor
6
- EditableForm.prototype.saveWithUrlHook = (value) ->
7
- originalUrl = @options.url
8
- resource = @options.resource
9
- @options.url = (params) =>
10
- # TODO: should not send when create new object
11
- if typeof originalUrl == 'function' # user's function
12
- originalUrl.call(@options.scope, params)
13
- else if originalUrl? && @options.send != 'never'
14
- # send ajax to server and return deferred object
15
- obj = {}
16
- obj[params.name] = params.value
17
- # support custom inputtypes (eg address)
18
- if resource
19
- params[resource] = obj
20
- else
21
- params = obj
22
- delete params.name
23
- delete params.value
24
- delete params.pk
25
- $.ajax($.extend({
26
- url : originalUrl
27
- data : params
28
- type : 'PUT' # TODO: should be 'POST' when create new object
29
- dataType: 'json'
30
- }, @options.ajaxOptions))
31
- @saveWithoutUrlHook(value)
32
- EditableForm.prototype.saveWithoutUrlHook = EditableForm.prototype.save
33
- EditableForm.prototype.save = EditableForm.prototype.saveWithUrlHook
6
+ unless EditableForm::saveWithUrlHook?
7
+ EditableForm::saveWithUrlHook = (value) ->
8
+ originalUrl = @options.url
9
+ resource = @options.resource
10
+ @options.url = (params) =>
11
+ # TODO: should not send when create new object
12
+ if typeof originalUrl == 'function' # user's function
13
+ originalUrl.call(@options.scope, params)
14
+ else if originalUrl? && @options.send != 'never'
15
+ # send ajax to server and return deferred object
16
+ obj = {}
17
+ obj[params.name] = params.value
18
+ # support custom inputtypes (eg address)
19
+ if resource
20
+ params[resource] = obj
21
+ else
22
+ params = obj
23
+ delete params.name
24
+ delete params.value
25
+ delete params.pk
26
+ $.ajax($.extend({
27
+ url : originalUrl
28
+ data : params
29
+ type : 'PUT' # TODO: should be 'POST' when create new object
30
+ dataType: 'json'
31
+ }, @options.ajaxOptions))
32
+ @saveWithoutUrlHook(value)
33
+ EditableForm::saveWithoutUrlHook = EditableForm::save
34
+ EditableForm::save = EditableForm::saveWithUrlHook
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-editable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toru KAWAMURA
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-06-05 00:00:00 Z
12
+ date: 2014-06-09 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties