effective_resources 2.7.8 → 2.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_resources_helper.rb +6 -7
- data/app/helpers/effective_resources_wizard_helper.rb +16 -0
- data/app/models/concerns/acts_as_wizard.rb +2 -1
- data/app/views/effective/acts_as_wizard/_wizard_step.html.haml +11 -0
- data/lib/effective_resources/version.rb +1 -1
- data/lib/effective_resources.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48aa19d02843bf4a42426c3de84b791ec707d0784b1d3275f75348fd3795fb17
|
4
|
+
data.tar.gz: 8f31b8917443d4543992e41bbdf5c894591f02ae2b339d46d20994e97da5e1db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f32a15406d2171eb4ec61801a8d124e17041d60be2004ca20c53dfb852ef15e2fec4cfd036cf1ddeafbdbaa1944c8dc5838fff95b1823be5594a2726b1fc7632
|
7
|
+
data.tar.gz: a582b22c7d231788aeb012d6a38fd0606af01f0b14bbc6ed1efaf285d7c1407cab8f71e31c6a1e1d1a0f2fa9da8e19e192e5f80f17c92b388a94e8807792f25d
|
@@ -206,7 +206,7 @@ module EffectiveResourcesHelper
|
|
206
206
|
end
|
207
207
|
alias_method :render_resource, :render_resource_partial
|
208
208
|
|
209
|
-
def
|
209
|
+
def render_partial_exists?(partial, atts = {})
|
210
210
|
raise('expected a path') unless partial.kind_of?(String)
|
211
211
|
raise('path should not include spaces') if partial.include?(' ')
|
212
212
|
|
@@ -215,12 +215,11 @@ module EffectiveResourcesHelper
|
|
215
215
|
file = pieces.last
|
216
216
|
path = pieces[0..-2].join('/')
|
217
217
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
end
|
218
|
+
lookup_context.exists?(file, [path], :partial)
|
219
|
+
end
|
220
|
+
|
221
|
+
def render_if_exists(partial, atts = {})
|
222
|
+
render(partial, atts) if render_partial_exists?(partial, atts)
|
224
223
|
end
|
225
224
|
|
226
225
|
# Tableize attributes
|
@@ -42,4 +42,20 @@ module EffectiveResourcesWizardHelper
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def render_wizard_resource(resource, as: nil, path: nil)
|
46
|
+
effective_resource = Effective::Resource.new(resource)
|
47
|
+
|
48
|
+
as ||= effective_resource.name
|
49
|
+
path ||= effective_resource.view_file_path(nil)
|
50
|
+
raise('expected a path') unless path.present?
|
51
|
+
|
52
|
+
resource.render_path = path.to_s.chomp('/')
|
53
|
+
|
54
|
+
resource.render_steps.map do |partial|
|
55
|
+
resource.render_step = partial
|
56
|
+
|
57
|
+
render_if_exists("#{path}/#{partial}", as.to_sym => resource) || render('effective/acts_as_wizard/wizard_step', resource: resource, resource_path: path)
|
58
|
+
end.join.html_safe
|
59
|
+
end
|
60
|
+
|
45
61
|
end
|
@@ -31,6 +31,7 @@ module ActsAsWizard
|
|
31
31
|
|
32
32
|
# Used by the view when rendering each partial. Not the current step.
|
33
33
|
attr_accessor :render_step
|
34
|
+
attr_accessor :render_path
|
34
35
|
|
35
36
|
if Rails.env.test? # So our tests can override the required_steps method
|
36
37
|
cattr_accessor :test_required_steps
|
@@ -92,7 +93,7 @@ module ActsAsWizard
|
|
92
93
|
|
93
94
|
# For use in the summary partials. Does not include summary.
|
94
95
|
def render_steps
|
95
|
-
blacklist = [:start, :billing, :checkout, :submitted, :summary]
|
96
|
+
blacklist = [:start, :billing, :checkout, :submit, :submitted, :summary]
|
96
97
|
((required_steps | completed_steps) - blacklist).select { |step| has_completed_step?(step) }
|
97
98
|
end
|
98
99
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= wizard_card(resource) do
|
2
|
+
- partial = "#{resource.render_path}/#{resource.render_step}_fields"
|
3
|
+
|
4
|
+
- if render_partial_exists?(partial)
|
5
|
+
= effective_table_with(resource) { |f| render(partial, f: f) }
|
6
|
+
|
7
|
+
- elsif Rails.env.development? || Rails.env.test?
|
8
|
+
- names = partial.split('/')
|
9
|
+
- name = names[0...-1].join('/') + '/_' + names.last + '.html.haml'
|
10
|
+
|
11
|
+
%div.alert.alert-warning Unable to find partial: #{name}
|
data/lib/effective_resources.rb
CHANGED
@@ -153,7 +153,7 @@ module EffectiveResources
|
|
153
153
|
path = service.path_for(blob.key)
|
154
154
|
duplicate_path = service.path_for(duplicate.key)
|
155
155
|
FileUtils.mkdir_p(File.dirname(duplicate_path))
|
156
|
-
FileUtils.ln(path, duplicate_path) if File.
|
156
|
+
FileUtils.ln(path, duplicate_path) if File.exist?(path)
|
157
157
|
else
|
158
158
|
raise "unknown storage service #{service.class.name}"
|
159
159
|
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: 2.7.
|
4
|
+
version: 2.7.10
|
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-
|
11
|
+
date: 2023-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- app/views/application/show.js.erb
|
208
208
|
- app/views/application/update.js.erb
|
209
209
|
- app/views/effective/acts_as_email_form/_fields.html.haml
|
210
|
+
- app/views/effective/acts_as_wizard/_wizard_step.html.haml
|
210
211
|
- app/views/effective/resource/_actions.html.haml
|
211
212
|
- app/views/effective/resource/_actions_dropleft.html.haml
|
212
213
|
- app/views/effective/resource/_actions_glyphicons.html.haml
|