jquery_dynamic_fields 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ module JqueryDynamicFieldsHelper
2
+ module FieldHelper
3
+ def link_to_add_fields name, f, association
4
+ new_object = f.object.send(association).class.new
5
+ id = new_object.object_id
6
+ fields = f.fields_for(association, new_object, child_index: id) do |builder|
7
+ render(association.to_s.singularize + "_fields", f: builder)
8
+ end
9
+ link_to(name, '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
10
+ end
11
+
12
+ def link_to_remove_field f
13
+ (f.hidden_field :_destroy) +
14
+ link_to("remove", "#", class: "remove_field")
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module JqueryDynamicFields
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery_dynamic_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-11 00:00:00.000000000 Z
12
+ date: 2012-06-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Dynamically add and remove form fields in a Rails 3.1+ app
15
15
  email:
@@ -24,7 +24,7 @@ files:
24
24
  - README.md
25
25
  - Rakefile
26
26
  - app/assets/javascripts/jquery_dynamic_fields.js.coffee
27
- - app/helpers/jquery_dynamic_fields_helper.rb
27
+ - app/helpers/jquery_dynamic_fields/field_helper.rb
28
28
  - jquery_dynamic_fields.gemspec
29
29
  - lib/jquery_dynamic_fields.rb
30
30
  - lib/jquery_dynamic_fields/engine.rb
@@ -1,15 +0,0 @@
1
- module JqueryDynamicFieldsHelper
2
- def link_to_add_fields name, f, association
3
- new_object = f.object.send(association).klass.new
4
- id = new_object.object_id
5
- fields = f.fields_for(association, new_object, child_index: id) do |builder|
6
- render(association.to_s.singularize + "_fields", f: builder)
7
- end
8
- link_to(name, '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
9
- end
10
-
11
- def link_to_remove_field f
12
- (f.hidden_field :_destroy) +
13
- link_to("remove", "#", class: "remove_field")
14
- end
15
- end