x-editable-rails 1.0.3 → 1.1.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: f2c2b641183f292b3bc8ba7131c00b3b416b5845
4
- data.tar.gz: 15f114f8300f620b6ad0f668fac167b07bc5a416
3
+ metadata.gz: c93848fb0c32466ffce4502e3aead74af7d39b99
4
+ data.tar.gz: 636c74b1410daaca83d67190f62933b4dfca8b78
5
5
  SHA512:
6
- metadata.gz: 9a91e096a1e4a653559e0e0bc191ebd800e0fc711e69b769bc798c501b0c76d46d75c8c066095d03d7ca3e3490758a7fe0f962846cee4bfde663f55c590db4b6
7
- data.tar.gz: fe090ecd2f49610a240f00ec55973ad7947a7c2d7310dd2b0a9f13a475c122e4165c8b42484407b29e9e1a5063709ef32cbb0ab05ada73a9d8711d9ca80e8b42
6
+ metadata.gz: 6a081571397867d85072c2b235c5cd18190283f205723a0e551e17a2d215c3180f4cc4d83a2e83a3ddf8277af0e191b86f99370de6b2947fcbf46d0292c69663
7
+ data.tar.gz: 4a0979504d966ec5eaa1fa188a140fd3977e2aebf8569e7a2ef54bfdb7a95d5acea87eb9cbae147cf05a847a0b241363e5b2d3876ccfe2d523acb4656e1f65da
data/README.md CHANGED
@@ -59,6 +59,11 @@ or with nested attributes (globalize3 example)
59
59
  # nested: nested attributes, nid: id of nested attribute
60
60
  ```
61
61
 
62
+ Example of nested resource
63
+ ```ruby
64
+ %h1= editable Picture, [picture.gallery, picture], 'name', nested: 'translations', nid: picture.translation.id, e: picture.name
65
+ ```
66
+
62
67
  You can also update everything directly.
63
68
  ```haml
64
69
  %a{href: '#', class: 'editable', data: { type: 'text', model: 'post', name: 'name', url: post_path(post), 'original-title' => 'Your info here'}}= post.name
@@ -1,7 +1,7 @@
1
1
  module X
2
2
  module Editable
3
3
  module Rails
4
- VERSION = "1.0.3"
4
+ VERSION = "1.1.0"
5
5
  end
6
6
  end
7
- end
7
+ end
@@ -4,9 +4,10 @@ module X
4
4
  module ViewHelpers
5
5
  def editable model, object, method, options = {}
6
6
  if can? :edit, model and xeditable?
7
+ data_url = polymorphic_path(object)
8
+ object = object.last if object.kind_of?(Array)
7
9
  model_param = model.to_s.downcase.gsub('::', '_')
8
10
  model_name = model.to_s.downcase.gsub('::', '/')
9
- data_url = options[:nested_model] ? polymorphic_path([options[:nested_model], object]) : polymorphic_path(object)
10
11
  content_tag :a, href: "#", class: "editable", data: { type: 'text', model: model_param, name: method, url: data_url,
11
12
  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
12
13
  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.0.3
4
+ version: 1.1.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-14 00:00:00.000000000 Z
11
+ date: 2013-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler