effective_resources 1.9.17 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b69f74d07daa22a1733f0c9a9834056c614e025f70382f5c5bbae286d3bf066
4
- data.tar.gz: 18517fd35b619d93f979a2536e0feed6d007306e47028beb70b21f6afcb3dfaf
3
+ metadata.gz: 536afe56ae331c14920c56f2eb625812127f0b0ad9f57696b8dce9cc198b6840
4
+ data.tar.gz: 99afc3984fd065ae8014bb031ea16a9138fce77e3ec0861b140a7d18e6f5e5fd
5
5
  SHA512:
6
- metadata.gz: 8ef58e8d1d3f02d64c1a0e9f5979b22db50dc47314b945906cbc89edae6147d733d77305353ab25798f512d0f182460525fae2cfe6c4c93f919717d743670f32
7
- data.tar.gz: 42b9e8c8ac3878d56d1f71f429c40cae535e23bbb43fe76b0b70deb3917779bb60c52a9122bbd5c0d057fc70778f4983c47d7ac5c3cd0024cdb0fbace2fe640f
6
+ metadata.gz: dd3e83bde7a2a01e86e9588d1998249c5e1f8882bceb679e4c32d4bafbb409b419125cc7bcca2ab4fe358bce0e707f79f7f1a5f1ef4628228dc897a9c74ca510
7
+ data.tar.gz: 659aab8c923fd9a5b33cb21335251c038f7af37e141c5312fea317bf0a2a9fbb2f673a12cec5b8170a3e57a50e27dcaec21a76af4b69bfdb0143ea7fdcced82b
@@ -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
@@ -49,15 +49,16 @@ module ActsAsPurchasableWizard
49
49
 
50
50
  def find_or_build_submit_order
51
51
  order = submit_order || orders.build(user: owner)
52
- fees = submit_fees()
52
+ fees = submit_fees().reject { |fee| fee.marked_for_destruction? }
53
53
 
54
54
  # Adds fees, but does not overwrite any existing price.
55
55
  fees.each do |fee|
56
56
  order.add(fee) unless order.purchasables.include?(fee)
57
57
  end
58
58
 
59
- order.purchasables.each do |purchasable|
60
- order.remove(purchasable) unless fees.include?(purchasable)
59
+ order.order_items.each do |order_item|
60
+ fee = fees.find { |fee| fee == order_item.purchasable }
61
+ order.remove(order_item) unless fee.present?
61
62
  end
62
63
 
63
64
  # From Billing Step
@@ -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_now
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.17'.freeze
2
+ VERSION = '1.10.1'.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.17
4
+ version: 1.10.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: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-01-24 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