effective_resources 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/effective/crud_controller/actions.rb +8 -1
- data/app/controllers/concerns/effective/crud_controller/permitted_params.rb +1 -1
- data/app/models/effective/resources/associations.rb +5 -0
- data/app/views/application/member_action.js.erb +2 -5
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f342d10de6f2f7786972e79f3afa354685bf31
|
4
|
+
data.tar.gz: efe2fbb67f1f01c850e2e6a5e4040b03889fd20c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeed7f84960367679ebab343fc64638aa1ad433ee64376042cfb519578583270a1ac15bbd03d3182a44d329d94d1ba44fbf02d427d0068967cb10734c19f0a69
|
7
|
+
data.tar.gz: 48af4ce59340e3f97c5216ed7aacdaa2aac4bf4a0bf7778f3be810f15fca533c8b989e241e98fc2d4b81d31fc871038a3008e6c4a66c98f363ba2d56327ca020
|
@@ -163,7 +163,14 @@ module Effective
|
|
163
163
|
@page_title ||= "#{action.to_s.titleize} #{resource}"
|
164
164
|
|
165
165
|
if request.get?
|
166
|
-
run_callbacks(:resource_render)
|
166
|
+
run_callbacks(:resource_render)
|
167
|
+
|
168
|
+
respond_to do |format|
|
169
|
+
format.html { }
|
170
|
+
format.js { render(template_present?(action) ? action : 'member_action.js', locals: { action: action }) }
|
171
|
+
end
|
172
|
+
|
173
|
+
return
|
167
174
|
end
|
168
175
|
|
169
176
|
to_assign = (send(resource_params_method_name) rescue {})
|
@@ -84,7 +84,7 @@ module Effective
|
|
84
84
|
end
|
85
85
|
|
86
86
|
# Recursively add any accepts_nested_resources
|
87
|
-
effective_resource.
|
87
|
+
effective_resource.accepts_nested_attributes.each do |nested|
|
88
88
|
if (nested_params = permitted_params_for(nested.klass, namespaces)).present?
|
89
89
|
nested_params.insert(nested_params.rindex { |obj| !obj.kind_of?(Hash)} + 1, :_destroy)
|
90
90
|
permitted_params << { "#{nested.name}_attributes".to_sym => nested_params }
|
@@ -67,6 +67,11 @@ module Effective
|
|
67
67
|
klass.reflect_on_all_associations(:has_one).select { |ass| ass.options[:autosave] }
|
68
68
|
end
|
69
69
|
|
70
|
+
def accepts_nested_attributes
|
71
|
+
return [] unless klass.respond_to?(:reflect_on_all_associations)
|
72
|
+
klass.reflect_on_all_associations.select { |ass| ass.options[:autosave] }
|
73
|
+
end
|
74
|
+
|
70
75
|
def associated(name)
|
71
76
|
name = (name.to_s.end_with?('_id') ? name.to_s[0...-3] : name).to_sym
|
72
77
|
klass.reflect_on_all_associations.find { |ass| ass.name == name } || effective_addresses(name)
|
@@ -1,12 +1,9 @@
|
|
1
1
|
<% resource = (@_effective_resource || Effective::Resource.new(controller_path)) %>
|
2
2
|
<% @resource = instance_variable_get('@' + resource.name) if resource.name %>
|
3
3
|
|
4
|
-
|
5
|
-
EffectiveForm.remote_form_payload = "<%= j render_resource_form(@resource, action: action) %>";
|
6
|
-
<% end %>
|
7
|
-
|
4
|
+
EffectiveForm.remote_form_payload = "<%= j render_resource_form(@resource, action: action) %>";
|
8
5
|
EffectiveForm.remote_form_flash = <%= raw flash.to_json %>;
|
9
6
|
|
10
|
-
<% if @resource.respond_to?(:refresh_datatables) && @resource.refresh_datatables.present? %>
|
7
|
+
<% if !request.get? && @resource.respond_to?(:refresh_datatables) && @resource.refresh_datatables.present? %>
|
11
8
|
EffectiveForm.remote_form_refresh_datatables = <%= raw Array(@resource.refresh_datatables).uniq.compact.map(&:to_s) %>;
|
12
9
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|