effective_resources 2.7.8 → 2.7.10

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
  SHA256:
3
- metadata.gz: 876509ce690f40009d985ee70ab314d1e7e626528f6314357a6a671803afed11
4
- data.tar.gz: 7c3f841ef1c7eb55e755acee2ad346352fdfc1df17816ecba720ee6203d4bf90
3
+ metadata.gz: 48aa19d02843bf4a42426c3de84b791ec707d0784b1d3275f75348fd3795fb17
4
+ data.tar.gz: 8f31b8917443d4543992e41bbdf5c894591f02ae2b339d46d20994e97da5e1db
5
5
  SHA512:
6
- metadata.gz: d22deab3141c5b804a1ce147311cad65c3342ec7c866007cf321b582bb6f9e53bbc6b2cc2bb4e940abfdea2e71dbe8d85879702bedb0c4b6bc9da42f2e2ec8cf
7
- data.tar.gz: 496e8c8b2cfc6d990f947609afdd661f7b0a24c846886ec6df4396409f18a322a6fa7e76046d2f01d2da76c7bad3616320902c52011b833d4d8c6c8162a5809f
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 render_if_exists(partial, atts = {})
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
- if lookup_context.exists?(file, [path], :partial)
219
- render(partial, atts)
220
- else
221
- Rails.logger.info "Skipped Render (effective_resources) render_if_exists: #{partial}"
222
- nil
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}
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.7.8'.freeze
2
+ VERSION = '2.7.10'.freeze
3
3
  end
@@ -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.exists?(path)
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.8
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-04-24 00:00:00.000000000 Z
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