x-editable-rails 1.1.0 → 1.2.0

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: c93848fb0c32466ffce4502e3aead74af7d39b99
4
- data.tar.gz: 636c74b1410daaca83d67190f62933b4dfca8b78
3
+ metadata.gz: 9f39c1375f2107089642f9db987497129da954a8
4
+ data.tar.gz: 8327e2d422935b22a68e3abb880e62c7a64684ad
5
5
  SHA512:
6
- metadata.gz: 6a081571397867d85072c2b235c5cd18190283f205723a0e551e17a2d215c3180f4cc4d83a2e83a3ddf8277af0e191b86f99370de6b2947fcbf46d0292c69663
7
- data.tar.gz: 4a0979504d966ec5eaa1fa188a140fd3977e2aebf8569e7a2ef54bfdb7a95d5acea87eb9cbae147cf05a847a0b241363e5b2d3876ccfe2d523acb4656e1f65da
6
+ metadata.gz: 8443ec604c47018fac79f45674e3314a8d0579a9aadb8d4c7505d65147f645fb6b3919de927945753b4edf56837541ec9c52829628b29f3a672558b35fbe6cbc
7
+ data.tar.gz: 421750f2132b0eebeac8cbd5530de78826abad6e4744f284176d2fdbba84d91997f5f060d2dcf41394db79ab4388d75d0f11ade1d5272d86a57431964d3a0873
data/README.md CHANGED
@@ -49,19 +49,19 @@ end
49
49
  and this is how to use helper method
50
50
 
51
51
  ```ruby
52
- %h1= editable Page, @page, 'name', e: @page.name
53
- # editable Model, object, what_you_want_update, e: exception - when is xeditable? false or can? :edit, Model is false
52
+ %h1= editable @page, 'name', e: @page.name
53
+ # editable object, what_you_want_update, e: exception - when is xeditable? false or can? :edit, object is false
54
54
  ```
55
55
 
56
56
  or with nested attributes (globalize3 example)
57
57
  ```ruby
58
- %h1= editable Page, @page, 'name', nested: 'translations', nid: @page.translation.id, e: @page.name
58
+ %h1= editable @page, 'name', nested: 'translations', nid: @page.translation.id, e: @page.name
59
59
  # nested: nested attributes, nid: id of nested attribute
60
60
  ```
61
61
 
62
62
  Example of nested resource
63
63
  ```ruby
64
- %h1= editable Picture, [picture.gallery, picture], 'name', nested: 'translations', nid: picture.translation.id, e: picture.name
64
+ %h1= editable [picture.gallery, picture], 'name', nested: 'translations', nid: picture.translation.id, e: picture.name
65
65
  ```
66
66
 
67
67
  You can also update everything directly.
@@ -1,7 +1,7 @@
1
1
  module X
2
2
  module Editable
3
3
  module Rails
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -2,12 +2,13 @@ module X
2
2
  module Editable
3
3
  module Rails
4
4
  module ViewHelpers
5
- def editable model, object, method, options = {}
6
- if can? :edit, model and xeditable?
7
- data_url = polymorphic_path(object)
8
- object = object.last if object.kind_of?(Array)
9
- model_param = model.to_s.downcase.gsub('::', '_')
10
- model_name = model.to_s.downcase.gsub('::', '/')
5
+ def editable object, method, options = {}
6
+ data_url = polymorphic_path(object)
7
+ object = object.last if object.kind_of?(Array)
8
+ if can? :edit, object and xeditable?
9
+ model = object.class.to_s.downcase
10
+ model_param = model.gsub('::', '_')
11
+ model_name = model.gsub('::', '/')
11
12
  content_tag :a, href: "#", class: "editable", data: { type: 'text', model: model_param, name: method, url: data_url,
12
13
  nested: (options[:nested] if options[:nested]), nid: (options[:nid] if options[:nid]), 'original-title' => t("activerecord.attributes.#{model_name}#{"/#{options[:nested].singularize}" if options[:nested]}.#{method}") } do
13
14
  object.send(method)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: x-editable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiri Kolarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2013-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler