nested-fields 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -1,6 +1,6 @@
1
- function remove_fields(link) {
1
+ function remove_fields(link, container) {
2
2
  $(link).prev("input[type=hidden]").val("1");
3
- $(link).closest(".product").hide();
3
+ $(link).closest('.' + container).hide();
4
4
  }
5
5
 
6
6
  function add_child_field(container, field_name, content) {
@@ -1,6 +1,7 @@
1
1
  module NestedFieldsHelper
2
- def link_to_remove_fields(name, f)
3
- f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)")
2
+
3
+ def link_to_remove_fields(name, f, container)
4
+ f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this, '#{container}')")
4
5
  end
5
6
 
6
7
  def link_to_new_child(f, association)
@@ -12,4 +13,5 @@ module NestedFieldsHelper
12
13
 
13
14
  link_to_function "Add #{association}", h("add_child_field('#{association}', 'new_#{association.singularize}', \"#{escape_javascript(fields)}\")")
14
15
  end
16
+
15
17
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nested-fields}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roberto Sanchez Sanchez"]
12
- s.date = %q{2010-07-27}
12
+ s.date = %q{2010-07-28}
13
13
  s.description = %q{Use nested attributes to add nested fields}
14
14
  s.email = %q{roberto.sanchez@crowdint.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested-fields
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roberto Sanchez Sanchez
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-27 00:00:00 -05:00
18
+ date: 2010-07-28 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21