effective_resources 2.35.4 → 2.36.1

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: 49408b391bddf7ba9ac46cabb0bf0120a6397347a0fcd4d699c62fb09b9e6e9b
4
- data.tar.gz: 2ed338bad62fb5cd9e0c176aa79283a8ac57c866a7ee779343dc5da77b21eed8
3
+ metadata.gz: ec486d15b125484090a561e126a11a8d5d733e15b12d5d1c843f481d27ad5ccd
4
+ data.tar.gz: 628a22e24a074a88638c6b807e636ea6c96bd624f2e393493a7285fc89a62879
5
5
  SHA512:
6
- metadata.gz: 7e57fb23966732a30240c7d150b5f4cb4c95d22c7f6d6c293ea18d895d5c7b727fc12bb9db22447874ab54a82f08c2a006a3517eaae25b2aef7373cc125c263c
7
- data.tar.gz: 214c87931becd6819744f65b6c6df677ebb8092e226dcd544a8f2c564c451502c656e42cc8f8c870902ece1719d9f91bdf7836ef786dbb9f1b6b0ab762785f3c
6
+ metadata.gz: 131a9916144f3f6250a11c0d8287f10d702fd9c224b9f07a0b1e11bb4538f9e07cc7f5ec4eba8dc6c851c210a7a883e38e7fdea07bd7e4bc3a2ef61ba4bc10e2
7
+ data.tar.gz: fae9029e8e0a8a18fe3282f30efd3b69cd16bd42d8a9bd27f5be3565ba0337f7bd8d150441f9fc5dc8d468cf1d7660cdf5d30419736a17cb036404a97956dac4
@@ -40,7 +40,9 @@ module Effective
40
40
  before_action :ready_checkout
41
41
  end
42
42
 
43
- rate_limit to: 10, within: 1.hour, by: -> { current_user&.id }, only: :show, if: -> { step&.to_sym == :checkout }
43
+ unless Rails.env.development?
44
+ rate_limit to: 10, within: 1.hour, by: -> { current_user&.id }, only: :show, if: -> { step&.to_sym == :checkout }
45
+ end
44
46
 
45
47
  helper_method :resource
46
48
  helper_method :resource_wizard_step_title
@@ -51,13 +51,13 @@ module EffectiveResourcesPrivateHelper
51
51
  # Assign class
52
52
  opts[:class] ||= (
53
53
  if opts['data-method'].to_s == 'delete'
54
- 'btn btn-danger'
54
+ EffectiveResources.delete_action_button_class || 'btn btn-danger'
55
55
  elsif opts[:action] == :new
56
- 'btn btn-success'
56
+ EffectiveResources.new_action_button_class || 'btn btn-success'
57
57
  elsif h.length == 0
58
- 'btn btn-primary'
58
+ EffectiveResources.action_button_class || 'btn btn-primary'
59
59
  elsif defined?(EffectiveBootstrap)
60
- 'btn btn-secondary'
60
+ EffectiveResources.button_class || 'btn btn-secondary'
61
61
  else
62
62
  'btn btn-default'
63
63
  end
@@ -55,6 +55,10 @@ module EffectiveDeviseUser
55
55
  errors.add(:alternate_email, 'cannot be the same as email') if email.strip.downcase == alternate_email.strip.downcase
56
56
  end
57
57
 
58
+ validate(if: -> { first_name.present? && last_name.present? }) do
59
+ errors.add(:last_name, "can't match first name") if first_name == last_name
60
+ end
61
+
58
62
  # Uniqueness validation of emails and alternate emails across all users
59
63
  validate(if: -> { respond_to?(:alternate_email) }) do
60
64
  records = self.class.where.not(id: id)
@@ -72,10 +76,8 @@ module EffectiveDeviseUser
72
76
  end
73
77
  end
74
78
 
75
- with_options(if: -> { respond_to?(:alternate_email) }) do
76
- validates :alternate_email, email: true
77
- end
78
-
79
+ validates :alternate_email, email: true, if: -> { respond_to?(:alternate_email) }
80
+ validates :public_email, email: true, if: -> { respond_to?(:public_email) }
79
81
  end
80
82
 
81
83
  module ClassMethods
@@ -222,6 +224,10 @@ module EffectiveDeviseUser
222
224
  to_s
223
225
  end
224
226
 
227
+ def full_name
228
+ [first_name.presence, last_name.presence].compact.join(' ')
229
+ end
230
+
225
231
  def alternate_email=(value)
226
232
  super(value.to_s.strip.downcase.presence)
227
233
  end
@@ -119,6 +119,11 @@ module Effective
119
119
  # Generate the path
120
120
  path = (routes[action].format(formattable || EMPTY_HASH) rescue nil)
121
121
 
122
+ # Append default format from route (e.g., defaults: { format: :csv })
123
+ if path.present? && (default_format = routes[action].defaults[:format]).present?
124
+ path = "#{path}.#{default_format}"
125
+ end
126
+
122
127
  if path.present? && opts.present?
123
128
  uri = URI.parse(path)
124
129
  uri.query = URI.encode_www_form(opts)
@@ -30,6 +30,14 @@ EffectiveResources.setup do |config|
30
30
  # Supported values: 'Save', 'Continue', and 'Add New'
31
31
  config.default_submits = ['Save', 'Continue', 'Add New']
32
32
 
33
+ # Default Button Classes
34
+ #
35
+ # These are the btn class on links generated by render_resource_buttons method
36
+ # config.action_button_class = 'btn btn-primary'
37
+ # config.new_action_button_class = 'btn btn-success'
38
+ # config.delete_action_button_class = 'btn btn-danger'
39
+ # config.button_class = 'btn btn-secondary'
40
+
33
41
  # Mailer Settings
34
42
  #
35
43
  # The default mailer settings for all effective gems
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.35.4'.freeze
2
+ VERSION = '2.36.1'.freeze
3
3
  end
@@ -12,7 +12,8 @@ module EffectiveResources
12
12
  def self.config_keys
13
13
  [
14
14
  :authorization_method, :default_submits,
15
- :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_froms, :mailer_admin, :mailer_subject
15
+ :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_froms, :mailer_admin, :mailer_subject,
16
+ :action_button_class, :new_action_button_class, :delete_action_button_class, :button_class
16
17
  ]
17
18
  end
18
19
 
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.35.4
4
+ version: 2.36.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: 2026-03-13 00:00:00.000000000 Z
11
+ date: 2026-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails