effective_resources 1.18.1 → 1.18.2

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: c0c85319423568e1dd19b9b1055bdd0c320bed118398156cc6cf8e8891c6d116
4
- data.tar.gz: 6f9729378c464d1de1fcd1556dc33c5591374efccee47e14044d99f278ff6ca9
3
+ metadata.gz: '0823eab342743da2a61c1b174cad39ffc77c6602c8422488bd32c113148b066f'
4
+ data.tar.gz: 3958c07bc7d38c1c3de867e699b899fddc1833e029b7b639635a08b9a92b9bdc
5
5
  SHA512:
6
- metadata.gz: 11cedc4d9ee5dce6389bcb9e3505e6638abd6ef3ffefe2383f3ea91ea95cf1eff76c02185c563b3b595e4e0ee808828cd1f3bf6d8f758fef287b7437a9c45f45
7
- data.tar.gz: d3a9a54642101af184239b0cb63c33c8a9d66431061da366f1d8dbdd99ec70d2f645248aa5f7de3e235d2c77b7cf2675b8d46168a5c2da782ac937f47853d58e
6
+ metadata.gz: 180567d91706dee43b3ae5ab9e09e9f1abe0f1f352daa1bbf69ed3110564814ddacbc542d8293d5df8093dc94a36d8547a6f4814e307b6966f5ca7e49e7a34a9
7
+ data.tar.gz: 9852aac45f8341b0e27509d1b82c59f5d739eb3d1194daad74f6f1c1a4e7a29a0705a90dedd15945fa2af14c6cc546429d6f07db559d8785b182fa0a6a2d0c3b
@@ -262,4 +262,32 @@ module EffectiveResourcesHelper
262
262
  controller.class.try(:effective_wizard_controller?) && defined?(resource) && resource.draft?
263
263
  end
264
264
 
265
+ def wizard_card(resource, &block)
266
+ raise('expected a block') unless block_given?
267
+ raise('expected an acts_as_wizard resource') unless resource.class.respond_to?(:acts_as_wizard?)
268
+
269
+ step = resource.render_step
270
+ raise('expected a render_step') unless step.present?
271
+
272
+ title = resource.wizard_step_title(step)
273
+ raise("expected a title for step #{step}") unless title.present?
274
+
275
+ link = if edit_effective_wizard? && resource.can_visit_step?(step)
276
+ link_to('Edit', wizard_path(step), title: "Edit #{title}")
277
+ end
278
+
279
+ content_tag(:div, class: 'card') do
280
+ content_tag(:div, class: 'card-body yo') do
281
+ content_tag(:div, class: 'row') do
282
+ content_tag(:div, class: 'col-sm') do
283
+ content_tag(:h5, title, class: 'card-title')
284
+ end +
285
+ content_tag(:div, class: 'col-sm-auto text-right') do
286
+ (link || '')
287
+ end
288
+ end + capture(&block)
289
+ end
290
+ end
291
+ end
292
+
265
293
  end
@@ -29,6 +29,9 @@ module ActsAsWizard
29
29
 
30
30
  attr_accessor :current_user
31
31
 
32
+ # Used by the view when rendering each partial. Not the current step.
33
+ attr_accessor :render_step
34
+
32
35
  if Rails.env.test? # So our tests can override the required_steps method
33
36
  cattr_accessor :test_required_steps
34
37
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.18.1'.freeze
2
+ VERSION = '1.18.2'.freeze
3
3
  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.18.1
4
+ version: 1.18.2
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: 2022-06-24 00:00:00.000000000 Z
11
+ date: 2022-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails