effective_resources 1.9.18 → 1.11.0

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: f5c9b933021449f0eb3d4ae100ff09fa9aa4af1efbff1e3ee29bdbbf7204a264
4
- data.tar.gz: db60abded322951ceb47c9f75c8a19743ff6989a29b0441bc9c55915481a92ed
3
+ metadata.gz: a57730f0c7dea924ad0f2e97691d9c165efa9d8b7bffa0b4dddefed1a5364ac3
4
+ data.tar.gz: a225961a1f6e45ba7ec2a510fc831c21727ac3e36b97dfdc5efe575b524226cf
5
5
  SHA512:
6
- metadata.gz: 1d09592ecbb18c8b4310d374f19e2a30d63522c4d34ff27ef795eb3e0aef4e441305872012fa1cf6fa6519998e33a9dd86237abd5fe50ab878543292def7a390
7
- data.tar.gz: 6f4e36f8181d3673739d72dc19750b68e3f239d5d911dcf9399c24be92a9f1716fb709c41345252506689eb1b220dfd91212b2213aa76cf8b05b976600c9a980
6
+ metadata.gz: 264898b9e51e5deb83cd76dd1ef5a18b9aa3904c1fa2e5899ad4bdb5cff5b2a1563752386a28c758bd398e5c3ce69417069f0e49d8d8334e5bd9accb653960b5
7
+ data.tar.gz: dd7f10337d9eee419d13b5a8770929474c64bbe69d6b9c028586d0af83c739cbf4791bfa6a5e4b8972812e14edc811cd3e5d60d56a78bab29c4e970b5e42178f
@@ -10,6 +10,10 @@ module Effective
10
10
  include Effective::WizardController::Save
11
11
  include Effective::WizardController::WickedOverrides
12
12
 
13
+ module ClassMethods
14
+ def effective_wizard_controller?; true; end
15
+ end
16
+
13
17
  included do
14
18
  raise("please install gem 'wicked' to use Effective::WizardController") unless defined?(Wicked)
15
19
 
@@ -244,4 +244,8 @@ module EffectiveResourcesHelper
244
244
  simple_format(sanitize(value.to_s, tags: @format_resource_tags, attributes: @format_resource_atts), {}, sanitize: false)
245
245
  end
246
246
 
247
+ def edit_effective_wizard?
248
+ controller.class.try(:effective_wizard_controller?) && defined?(resource) && resource.draft?
249
+ end
250
+
247
251
  end
@@ -14,8 +14,8 @@ module EffectiveResourcesWizardHelper
14
14
  return sidebar unless block_given?
15
15
 
16
16
  content_tag(:div, class: 'row') do
17
- content_tag(:div, class: 'col-3') { sidebar } +
18
- content_tag(:div, class: 'col-9') { yield }
17
+ content_tag(:div, class: 'col-lg-3') { sidebar } +
18
+ content_tag(:div, class: 'col-lg-9') { yield }
19
19
  end
20
20
  end
21
21
 
@@ -28,10 +28,10 @@ module EffectiveResourcesWizardHelper
28
28
  disabled = !resource.can_visit_step?(nav_step)
29
29
 
30
30
  label = [index, title].compact.join('. ')
31
- klass = ['list-group-item', ('active' if current), ('disabled' if disabled && !current)].compact.join(' ')
31
+ klass = ['list-group-item', 'list-group-item-action', ('active' if current), ('disabled' if disabled && !current)].compact.join(' ')
32
32
 
33
33
  if (current || disabled)
34
- content_tag(:li, label, class: klass)
34
+ content_tag(:a, label, class: klass)
35
35
  else
36
36
  link_to(label, wizard_path(nav_step), class: klass)
37
37
  end
@@ -59,6 +59,12 @@ module ActsAsWizard
59
59
  wizard_step_keys()
60
60
  end
61
61
 
62
+ # For use in the summary partials. Does not include summary.
63
+ def render_steps
64
+ blacklist = [:start, :billing, :checkout, :submitted, :summary]
65
+ (required_steps - blacklist).select { |step| has_completed_step?(step) }
66
+ end
67
+
62
68
  def wizard_step_title(step)
63
69
  self.class.const_get(:WIZARD_STEPS).fetch(step)
64
70
  end
@@ -134,6 +140,11 @@ module ActsAsWizard
134
140
 
135
141
  module ClassMethods
136
142
  def acts_as_wizard?; true; end
143
+
144
+ def all_wizard_steps
145
+ const_get(:WIZARD_STEPS).keys
146
+ end
147
+
137
148
  end
138
149
 
139
150
  end
@@ -0,0 +1,7 @@
1
+ !!!
2
+ %html{style: 'background: #fff;'}
3
+ %head
4
+ %meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}
5
+
6
+ %body{style: 'background: #fff;'}
7
+ = yield
@@ -21,6 +21,8 @@ EffectiveResources.setup do |config|
21
21
  # end
22
22
  config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
23
23
 
24
+ # Default Submits
25
+ #
24
26
  # These default submit actions will be added to each controller
25
27
  # and rendered when calling effective_submit(f)
26
28
  # based on the controller, and its `submits` if any.
@@ -28,4 +30,22 @@ EffectiveResources.setup do |config|
28
30
  # Supported values: 'Save', 'Continue', and 'Add New'
29
31
  config.default_submits = ['Save', 'Continue', 'Add New']
30
32
 
33
+ # Email Settings
34
+ #
35
+ # The default mailer settings for all effective gems
36
+ #
37
+ # Configure the parent class responsible to send e-mails.
38
+ # config.parent_mailer = '::ApplicationMailer'
39
+
40
+ # Default deliver method
41
+ # config.deliver_method = :deliver_later
42
+
43
+ # Default layout
44
+ # config.mailer_layout = 'effective_mailer_layout'
45
+
46
+ # Default From
47
+ config.mailer_sender = "no-reply@example.com"
48
+
49
+ # Send Admin correspondence To
50
+ config.mailer_admin = "admin@example.com"
31
51
  end
@@ -38,6 +38,16 @@ module EffectiveGem
38
38
 
39
39
  true
40
40
  end
41
+
42
+ # This is included into every gem
43
+ # The gem may not have a mailer or use effective email templates
44
+ def send_email(email, *args)
45
+ raise('gem does not respond to mailer_class') unless respond_to?(:mailer_class)
46
+ raise('expected args to be an Array') unless args.kind_of?(Array)
47
+
48
+ mailer_class.send(email, *args).send(EffectiveResources.deliver_method)
49
+ end
50
+
41
51
  end
42
52
 
43
53
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.9.18'.freeze
2
+ VERSION = '1.11.0'.freeze
3
3
  end
@@ -5,7 +5,10 @@ require 'effective_resources/effective_gem'
5
5
  module EffectiveResources
6
6
 
7
7
  def self.config_keys
8
- [:authorization_method, :default_submits]
8
+ [
9
+ :authorization_method, :default_submits,
10
+ :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :parent_mailer
11
+ ]
9
12
  end
10
13
 
11
14
  include EffectiveGem
@@ -31,6 +34,31 @@ module EffectiveResources
31
34
  (['Save', 'Continue', 'Add New'] & Array(config.default_submits)).inject({}) { |h, v| h[v] = true; h }
32
35
  end
33
36
 
37
+ # Email
38
+ def self.deliver_method
39
+ return config[:deliver_method] if config[:deliver_method].present?
40
+
41
+ rails = Rails.application.config
42
+ (rails.respond_to?(:active_job) && rails.active_job.queue_adapter) ? :deliver_later : :deliver_now
43
+ end
44
+
45
+ def self.mailer_layout
46
+ config[:mailer_layout] || 'effective_mailer_layout'
47
+ end
48
+
49
+ def self.mailer_sender
50
+ config[:mailer_sender] || raise('effective resources mailer_sender missing. Add it to config/initializers/effective_resources.rb')
51
+ end
52
+
53
+ def self.mailer_admin
54
+ config[:mailer_admin] || raise('effective resources mailer_admin missing. Add it to config/initializers/effective_resources.rb')
55
+ end
56
+
57
+ def self.parent_mailer_class
58
+ return config[:parent_mailer].constantize if config[:parent_mailer].present?
59
+ '::ApplicationMailer'.safe_constantize || 'ActionMailer::Base'.constantize
60
+ end
61
+
34
62
  # Utilities
35
63
 
36
64
  # This looks up the best class give the name
@@ -81,10 +109,6 @@ module EffectiveResources
81
109
  end
82
110
  end
83
111
 
84
- def self.deliver_method
85
- config = Rails.application.config
86
- (config.respond_to?(:active_job) && config.active_job.queue_adapter) ? :deliver_later : :deliver_now
87
- end
88
112
 
89
113
  def self.advance_date(date, business_days: 1, holidays: [:ca, :observed])
90
114
  raise('business_days must be an integer <= 365') unless business_days.kind_of?(Integer) && business_days <= 365
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.9.18
4
+ version: 1.11.0
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-01-13 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -202,6 +202,7 @@ files:
202
202
  - app/views/effective/resource/_actions.html.haml
203
203
  - app/views/effective/resource/_actions_dropleft.html.haml
204
204
  - app/views/effective/resource/_actions_glyphicons.html.haml
205
+ - app/views/layouts/effective_mailer_layout.html.haml
205
206
  - config/effective_resources.rb
206
207
  - lib/effective_resources.rb
207
208
  - lib/effective_resources/effective_gem.rb