para 0.8.8 → 0.8.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21679101c22d1235aad9fbe2305f7dddab8d38f0
|
4
|
+
data.tar.gz: a1d88c43b137eb2d075e6d9f2c0e206079939f2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e9304958f70e770b5632b8636c42183fbf5aa504d8e5f5bd3f183f7e16588bd1d7bf0e571d47d54091d24526d938bd74af43cd93449931ac20d4a5178d2f77d
|
7
|
+
data.tar.gz: a2e962254b1001b3930c2a9dc62f8867f5027a9d049cbdb9659f3bc81d7093b07057dcb9855641c65110db7fe605cae6db58f994b1ba838b799186bff0f6d860
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Para
|
2
|
+
module Admin
|
3
|
+
module NestedInputsHelper
|
4
|
+
# Helper that allows filling a parent association for a given resource, based on the
|
5
|
+
# inverse_of option of the parent resource association.
|
6
|
+
#
|
7
|
+
def with_inverse_association_for(resource, attribute_name, parent_resource)
|
8
|
+
resource.tap do
|
9
|
+
association_name = parent_resource.association(attribute_name).options[:inverse_of]
|
10
|
+
return resource unless association_name
|
11
|
+
|
12
|
+
resource.association(association_name).replace(parent_resource)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -5,5 +5,5 @@
|
|
5
5
|
%ul.dropdown-menu
|
6
6
|
- subclasses.each do |submodel|
|
7
7
|
%li
|
8
|
-
= link_to_add_association form, attribute_name, wrap_object: proc { submodel.new }, partial: find_partial_for(submodel, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: 'dropdown-link', data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: submodel, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
|
8
|
+
= link_to_add_association form, attribute_name, wrap_object: proc { with_inverse_association_for(submodel.new, attribute_name, form.object) }, partial: find_partial_for(submodel, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: 'dropdown-link', data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: submodel, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
|
9
9
|
= submodel.model_name.human
|
@@ -6,5 +6,5 @@
|
|
6
6
|
%ul.dropdown-menu
|
7
7
|
- subclasses.each do |submodel|
|
8
8
|
%li
|
9
|
-
= link_to_add_association form, attribute_name, wrap_object: proc { submodel.new }, partial: find_partial_for(submodel, 'nested_one/container', partial_dir: 'inputs'), form_name: 'form', class: 'dropdown-link', data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, locals: { form: form, model: submodel, subclass: subclass, nested_locals: nested_locals } } do
|
9
|
+
= link_to_add_association form, attribute_name, wrap_object: proc { with_inverse_association_for(submodel.new, attribute_name, form.object) }, partial: find_partial_for(submodel, 'nested_one/container', partial_dir: 'inputs'), form_name: 'form', class: 'dropdown-link', data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, locals: { form: form, model: submodel, subclass: subclass, nested_locals: nested_locals } } do
|
10
10
|
= submodel.model_name.human
|
data/lib/para/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: para
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentin Ballestrino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -577,6 +577,7 @@ files:
|
|
577
577
|
- app/helpers/para/admin/components_helper.rb
|
578
578
|
- app/helpers/para/admin/decorators_helper.rb
|
579
579
|
- app/helpers/para/admin/history_helper.rb
|
580
|
+
- app/helpers/para/admin/nested_inputs_helper.rb
|
580
581
|
- app/helpers/para/admin/page_helper.rb
|
581
582
|
- app/helpers/para/admin/pagination_helper.rb
|
582
583
|
- app/helpers/para/admin/resources_helper.rb
|