effective_resources 2.9.0 → 2.9.1
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 +3 -1
- data/app/controllers/concerns/effective/crud_controller/respond.rb +3 -2
- data/app/helpers/effective_resources_helper.rb +6 -4
- data/app/models/concerns/acts_as_wizard.rb +7 -1
- data/app/views/application/member_action.js.erb +6 -1
- data/lib/effective_resources/engine.rb +1 -3
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e271cc3c7cc6656818fa8584765872c44add6e05f45aebf71b21a2463d27975e
|
4
|
+
data.tar.gz: b96b045469f418016cbef1d000eec3ee3b82b260122eff4a6f160e689f55f0b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b065909664f6d3dfd6cdb6589023dcd743b77feeccf2d98e74ef940780c5a48492681915437975aa7bd988251d768367d50b00f8198de841642af7728425eec7
|
7
|
+
data.tar.gz: 44e79e8885d98c26b5179955f60cc7b775efac0d7804712e4d5556b20df09fc00d6efad0f9db8e40a0e61c959fc355ec5cf7b7314dcec80aceb0f476932fd9a3
|
@@ -185,8 +185,10 @@ module Effective
|
|
185
185
|
respond_to do |format|
|
186
186
|
format.html { }
|
187
187
|
format.js do
|
188
|
+
html_template = action if template_present?(action, format: :html)
|
188
189
|
template = template_present?(action) ? action : 'member_action'
|
189
|
-
|
190
|
+
|
191
|
+
render(template, formats: :js, locals: { action: action, html_template: html_template })
|
190
192
|
end
|
191
193
|
end
|
192
194
|
|
@@ -103,9 +103,10 @@ module Effective
|
|
103
103
|
flash[:danger] ||= danger
|
104
104
|
end
|
105
105
|
|
106
|
-
def template_present?(action)
|
106
|
+
def template_present?(action, format: nil)
|
107
|
+
format = Array(format).presence
|
107
108
|
formats = [(request.format.symbol.to_s.sub('json', 'js').presence || 'html').to_sym]
|
108
|
-
lookup_context.template_exists?(action, _prefixes, formats: formats)
|
109
|
+
lookup_context.template_exists?(action, _prefixes, formats: (format || formats))
|
109
110
|
end
|
110
111
|
|
111
112
|
end
|
@@ -189,13 +189,15 @@ module EffectiveResourcesHelper
|
|
189
189
|
safe = atts.delete(:safe)
|
190
190
|
atts = { :namespace => (effective_resource.namespace.to_sym if effective_resource.namespace), effective_resource.name.to_sym => resource }.compact.merge(atts)
|
191
191
|
|
192
|
-
|
193
|
-
|
192
|
+
partial = (action.present? ? action.to_s : effective_resource.name)
|
193
|
+
|
194
|
+
if lookup_context.template_exists?(partial, controller._prefixes, :partial)
|
195
|
+
return render(partial, atts)
|
194
196
|
end
|
195
197
|
|
196
198
|
effective_resource.view_paths.each do |view_path|
|
197
|
-
if lookup_context.template_exists?(
|
198
|
-
return render(view_path + '/' +
|
199
|
+
if lookup_context.template_exists?(partial, [view_path], :partial)
|
200
|
+
return render(view_path + '/' + partial, atts)
|
199
201
|
end
|
200
202
|
end
|
201
203
|
|
@@ -146,10 +146,16 @@ module ActsAsWizard
|
|
146
146
|
has_completed_step?(required_steps.last)
|
147
147
|
end
|
148
148
|
|
149
|
-
def
|
149
|
+
def reset_all_wizard_steps!
|
150
150
|
update!(wizard_steps: {})
|
151
151
|
end
|
152
152
|
|
153
|
+
def complete_all_wizard_steps!
|
154
|
+
now = Time.zone.now
|
155
|
+
required_steps.each { |step| wizard_steps[step] ||= now }
|
156
|
+
save!
|
157
|
+
end
|
158
|
+
|
153
159
|
def without_current_step(&block)
|
154
160
|
existing = current_step
|
155
161
|
|
@@ -1,7 +1,12 @@
|
|
1
1
|
<% resource = (@_effective_resource || Effective::Resource.new(controller_path)) %>
|
2
2
|
<% @resource = instance_variable_get('@' + resource.name) if resource.name %>
|
3
3
|
|
4
|
-
|
4
|
+
<% if html_template.present? %>
|
5
|
+
EffectiveForm.remote_form_payload = "<%= j(render_resource_partial(@resource, action: action)) %>";
|
6
|
+
<% else %>
|
7
|
+
EffectiveForm.remote_form_payload = "<%= j(render_resource_form(@resource, action: action, safe: true).presence || render_resource_partial(@resource)) %>";
|
8
|
+
<% end %>
|
9
|
+
|
5
10
|
EffectiveForm.remote_form_commit = "<%= params[:commit] %>";
|
6
11
|
EffectiveForm.remote_form_flash = <%= raw flash.to_json %>;
|
7
12
|
|
@@ -46,10 +46,8 @@ module EffectiveResources
|
|
46
46
|
app.config.to_prepare do
|
47
47
|
if defined?(CanCan::Ability)
|
48
48
|
CanCan::Ability.module_eval do
|
49
|
-
CRUD_ACTIONS = [:index, :new, :create, :edit, :update, :show, :destroy]
|
50
|
-
|
51
49
|
def crud
|
52
|
-
|
50
|
+
[:index, :new, :create, :edit, :update, :show, :destroy]
|
53
51
|
end
|
54
52
|
end
|
55
53
|
|
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: 2.9.
|
4
|
+
version: 2.9.1
|
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: 2023-08-
|
11
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|