nested_form_fields 0.6.3 → 0.6.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92c72a926632a8dc0558393682855c62e4a4ba39
4
- data.tar.gz: bdaf269d3f7c98c30b67e410eac619cbb0329279
3
+ metadata.gz: 4e6d917676faea51365b71981a3894f71cadd08d
4
+ data.tar.gz: 258aa4cd30b9e4aaa8c988a1728adce07ce8bfa5
5
5
  SHA512:
6
- metadata.gz: d2f8674c9813f30b69e229fcfa16d2936ac442a6214a883a9c051f4a61c641ee68b1aa194b1898b1534912bcbc258b0c6200faf486a8ae2be3d5828e50603dd8
7
- data.tar.gz: c8ee47add34f6956e827ca6ccc8d010e040f896eb1b1cdb6d0e6f1d846f14cca2b388b6c3a5ade92096bdf8e59f291ffa50321c77592c5561953136c83de385f
6
+ metadata.gz: 6cd4d2b3649e84142eced58f735e41800ecbcf617f1b87148373f33fa2e21ae815b4a8b8cbcfd391bc9083c5947408e5a2abd62c28a846e4e67cdb7296d9fd8a
7
+ data.tar.gz: f50d77161b8d1edeaf8a1e96793e556103d76561cfe6cfbfad4576fe932616243d311ea0050ba03d13d90c2ebf548590329893a5d039ab89d189662732da2521
@@ -2,14 +2,15 @@ window.nested_form_fields or= {}
2
2
 
3
3
  nested_form_fields.bind_nested_forms_links = () ->
4
4
  $('body').off("click", '.add_nested_fields_link')
5
- $('body').on 'click', '.add_nested_fields_link', ->
5
+ $('body').on 'click', '.add_nested_fields_link', (event) ->
6
6
  $link = $(this)
7
7
  object_class = $link.data('object-class')
8
8
  association_path = $link.data('association-path')
9
9
  added_index = $(".nested_#{association_path}").length
10
10
  $.event.trigger("fields_adding.nested_form_fields",{object_class: object_class, added_index: added_index, association_path: association_path});
11
11
  $template = $("##{association_path}_template")
12
-
12
+ target = $link.attr('data-insert-into')
13
+
13
14
  template_html = $template.html()
14
15
 
15
16
  # insert association indexes
@@ -23,8 +24,11 @@ nested_form_fields.bind_nested_forms_links = () ->
23
24
  $child = $(this)
24
25
  $child.replaceWith($("<script id='#{$child.attr('id')}' type='text/html' />").html($child.html()))
25
26
 
26
- $template.before( $parsed_template )
27
- $parsed_template.trigger("fields_added.nested_form_fields", {object_class: object_class, added_index: added_index, association_path: association_path});
27
+ if target?
28
+ $('#' + target).append($parsed_template)
29
+ else
30
+ $template.before( $parsed_template )
31
+ $parsed_template.trigger("fields_added.nested_form_fields", {object_class: object_class, added_index: added_index, association_path: association_path, event: event});
28
32
  false
29
33
 
30
34
  $('body').off("click", '.remove_nested_fields_link')
@@ -1,3 +1,3 @@
1
1
  module NestedFormFields
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested_form_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico Ritsche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails