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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e6d917676faea51365b71981a3894f71cadd08d
|
|
4
|
+
data.tar.gz: 258aa4cd30b9e4aaa8c988a1728adce07ce8bfa5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
27
|
-
|
|
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')
|
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.
|
|
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-
|
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|