effective_events 2.34.0 → 2.35.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.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/datatables/effective_events_datatable.rb +2 -1
  3. data/app/models/concerns/effective_events_event_registration.rb +27 -4
  4. data/app/models/effective/event.rb +10 -4
  5. data/app/models/effective/event_addon.rb +1 -1
  6. data/app/views/effective/event_registrations/_addons.html.haml +1 -7
  7. data/app/views/effective/event_registrations/_code_of_conduct.html.haml +3 -0
  8. data/app/views/effective/event_registrations/_code_of_conduct_fields.html.haml +6 -0
  9. data/app/views/effective/event_registrations/_event_registration.html.haml +2 -1
  10. data/app/views/effective/event_registrations/_tickets.html.haml +1 -7
  11. data/app/views/effective/event_registrations/billing.html.haml +3 -3
  12. data/app/views/effective/event_registrations/checkout.html.haml +1 -1
  13. data/app/views/effective/event_registrations/code_of_conduct.html.haml +11 -0
  14. data/app/views/effective/event_registrations/details.html.haml +2 -3
  15. data/app/views/effective/event_registrations/start.html.haml +23 -26
  16. data/app/views/effective/event_registrations/summary.html.haml +2 -1
  17. data/app/views/effective/event_registrations/tickets.html.haml +5 -5
  18. data/app/views/effective/events/show.html.haml +11 -2
  19. data/config/effective_events.rb +6 -0
  20. data/lib/effective_events/version.rb +1 -1
  21. data/lib/effective_events.rb +17 -0
  22. metadata +7 -4
  23. /data/app/views/effective/event_registrations/{_fields_event_registrants.html.haml → _details_fields.html.haml} +0 -0
  24. /data/app/views/effective/event_registrations/{_fields_event_ticket_selections.html.haml → _tickets_fields.html.haml} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cb357bc4bbc753d7c333e7dd8410323330c35081258bb898496e597cd5ecbae
4
- data.tar.gz: 1cd28f66fc94ba767cfda94936a5dfa0ef06ae433c193a03d8b1f4a5a1b810aa
3
+ metadata.gz: 0a35679ce20fbdd029eb43d42d309d2d9afb8f14563a8678b6a0dfed1fba1c86
4
+ data.tar.gz: af28a6d095903ec662b695943fbf0c8eb140bbfc3151c67cb68696fad79bc657
5
5
  SHA512:
6
- metadata.gz: 980795fa4aa2ee13ec0a914388ecf72b7842e1861e555ce5fcb790513d64e6128feea4b1ab2540bb4c250108f6317848f4115fd6bac388630d8b6dba111ea0bc
7
- data.tar.gz: da796c0c1a13e13e7de03af15ac9649c35c617661bdefd55af85e503b8b2d62b2915878960737e1287ea333cd08e18373cf9f7f3c7ed2d104f47c07afd525216
6
+ metadata.gz: f62138d80a94f535ff09d17b7d243ac77519efeac21040813535e4daf7a7a039474e8226e8569602397e4efd5227ae4bcf1de6c0dd8766c195f5d541212c4be8
7
+ data.tar.gz: 64fa8b144451340b18c3ba0e10764618717f64f833bd67fe25256d9857608c08face61f94142f69ee830a99379247f64500642f69d97a1187fa349aa03b5c83d
@@ -35,8 +35,9 @@ class EffectiveEventsDatatable < Effective::Datatable
35
35
 
36
36
  actions_col show: false do |event|
37
37
  if event.registerable?
38
+ label = (event.waitlist_only? ? 'Join Waitlist' : 'Register')
38
39
  url = event.external_registration_url.presence || effective_events.new_event_event_registration_path(event)
39
- dropdown_link_to('Register', url)
40
+ dropdown_link_to(label, url)
40
41
  end
41
42
  end
42
43
  end
@@ -36,6 +36,7 @@ module EffectiveEventsEventRegistration
36
36
  tickets: 'Tickets',
37
37
  details: 'Ticket Details',
38
38
  addons: 'Add-ons',
39
+ code_of_conduct: 'Code of Conduct',
39
40
  summary: 'Review',
40
41
  billing: 'Billing Address',
41
42
  checkout: 'Checkout',
@@ -61,7 +62,7 @@ module EffectiveEventsEventRegistration
61
62
  accepts_nested_attributes_for :event_registrants, reject_if: :all_blank, allow_destroy: true
62
63
 
63
64
  has_many :event_addons, -> { order(:event_product_id, :id) }, class_name: 'Effective::EventAddon', inverse_of: :event_registration, dependent: :destroy
64
- accepts_nested_attributes_for :event_addons, reject_if: :all_blank, allow_destroy: true
65
+ accepts_nested_attributes_for :event_addons, reject_if: -> (atts) { atts[:event_product_id].blank? }, allow_destroy: true
65
66
 
66
67
  has_many :orders, -> { order(:id) }, as: :parent, class_name: 'Effective::Order', dependent: :nullify
67
68
  accepts_nested_attributes_for :orders
@@ -73,6 +74,9 @@ module EffectiveEventsEventRegistration
73
74
  accepts_nested_attributes_for :fees, reject_if: :all_blank, allow_destroy: true
74
75
  end
75
76
 
77
+ # Code of Conduct Step
78
+ attr_accessor :declare_code_of_conduct
79
+
76
80
  effective_resource do
77
81
  # Acts as Statused
78
82
  status :string, permitted: false
@@ -161,6 +165,11 @@ module EffectiveEventsEventRegistration
161
165
  end
162
166
  end
163
167
 
168
+ # Code of Conduct Step
169
+ with_options(if: -> { current_step == :code_of_conduct }) do
170
+ validates :declare_code_of_conduct, acceptance: true
171
+ end
172
+
164
173
  # If we're submitted. Try to move to completed.
165
174
  before_save(if: -> { submitted? }) { try_completed! }
166
175
 
@@ -193,9 +202,18 @@ module EffectiveEventsEventRegistration
193
202
  def required_steps
194
203
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
195
204
 
196
- with_addons = event.event_products.any? { |event_product| event_product.archived? == false }
197
-
198
- with_addons ? wizard_step_keys : (wizard_step_keys - [:addons])
205
+ [
206
+ :start,
207
+ :tickets,
208
+ :details,
209
+ (:addons if event.event_products.any? { |event_product| !event_product.archived? }),
210
+ (:code_of_conduct if EffectiveEvents.code_of_conduct_enabled?),
211
+ :summary,
212
+ :billing,
213
+ :checkout,
214
+ :submitted,
215
+ :complete
216
+ ].compact
199
217
  end
200
218
 
201
219
  def delayed_payment_attributes
@@ -507,6 +525,11 @@ module EffectiveEventsEventRegistration
507
525
  false
508
526
  end
509
527
 
528
+ def wizard_step_title(step)
529
+ return EffectiveEvents.code_of_conduct_page_title if step == :code_of_conduct
530
+ default_wizard_step_title(step)
531
+ end
532
+
510
533
  private
511
534
 
512
535
  def update_deferred_event_registration!
@@ -210,8 +210,10 @@ module Effective
210
210
  end
211
211
 
212
212
  def registration_available?
213
- return false if registration_start_at.blank? || registration_end_at.blank?
214
- (registration_start_at..registration_end_at).cover?(Time.zone.now)
213
+ return false if closed?
214
+
215
+ return false if registration_start_at.blank?
216
+ registration_start_at <= Time.zone.now
215
217
  end
216
218
 
217
219
  def closed?
@@ -228,6 +230,10 @@ module Effective
228
230
  event_tickets.none? { |event_ticket| event_ticket_available?(event_ticket, except: except, quantity: 1) }
229
231
  end
230
232
 
233
+ def waitlist_only?
234
+ any_waitlist? && event_tickets.none? { |et| et.capacity_available > 0 }
235
+ end
236
+
231
237
  def upcoming?
232
238
  end_at > Time.zone.now
233
239
  end
@@ -297,7 +303,7 @@ module Effective
297
303
  end
298
304
 
299
305
  # Can I register/purchase this many new event tickets?
300
- def event_ticket_available?(event_ticket, except: nil, quantity: 0)
306
+ def event_ticket_available?(event_ticket, except: nil, quantity: 1)
301
307
  raise('expected an EventTicket') unless event_ticket.kind_of?(Effective::EventTicket)
302
308
  raise('expected except to be an EventRegistration') if except && !except.class.try(:effective_events_event_registration?)
303
309
  raise('expected quantity to be greater than 0') unless quantity.to_i > 0
@@ -311,7 +317,7 @@ module Effective
311
317
  end
312
318
 
313
319
  # Can I register/purchase this many new event products?
314
- def event_product_available?(event_product, quantity:)
320
+ def event_product_available?(event_product, quantity: 1)
315
321
  raise('expected an EventProduct') unless event_product.kind_of?(Effective::EventProduct)
316
322
  raise('expected quantity to be greater than 0') unless quantity.to_i > 0
317
323
 
@@ -81,7 +81,7 @@ module Effective
81
81
  end
82
82
 
83
83
  def tax_exempt
84
- event_product.tax_exempt
84
+ event_product&.tax_exempt
85
85
  end
86
86
 
87
87
  def qb_item_name
@@ -1,9 +1,3 @@
1
- = card do
2
- .row
3
- .col-sm
4
- %h5.card-title= event_registration.wizard_step_title(:addons)
5
- .col-sm-auto.text-right
6
- = link_to('Edit', wizard_path(:addons)) if edit_effective_wizard?
7
-
1
+ = wizard_card(event_registration) do
8
2
  - datatable = EffectiveEventAddonsDatatable.new(event_registration: event_registration)
9
3
  .mb-4= render_simple_datatable(datatable)
@@ -0,0 +1,3 @@
1
+ = wizard_card(event_registration) do
2
+ = effective_table_with(event_registration) do |f|
3
+ = render("effective/event_registrations/code_of_conduct_fields", f: f)
@@ -0,0 +1,6 @@
1
+ - f.object.declare_code_of_conduct = f.object.has_completed_step?(:code_of_conduct)
2
+
3
+ - page = EffectiveEvents.code_of_conduct_effective_page!
4
+
5
+ = f.check_box :declare_code_of_conduct, required: true,
6
+ label: "I agree to abide by the #{link_to(page.title, effective_pages.page_path(page), target: '_blank')}."
@@ -1,3 +1,4 @@
1
1
  .effective-event-registration
2
2
  - event_registration.render_steps.each do |partial|
3
- = render "effective/event_registrations/#{partial}", event_registration: event_registration, step: partial
3
+ - event_registration.render_step = partial
4
+ = render "effective/event_registrations/#{partial}", event_registration: event_registration
@@ -1,9 +1,3 @@
1
- = card do
2
- .row
3
- .col-sm
4
- %h5.card-title= event_registration.wizard_step_title(:tickets)
5
- .col-sm-auto.text-right
6
- = link_to('Edit', wizard_path(:tickets)) if edit_effective_wizard?
7
-
1
+ = wizard_card(event_registration) do
8
2
  - datatable = EffectiveEventRegistrantsDatatable.new(event_registration: event_registration)
9
3
  .mb-4= render_simple_datatable(datatable)
@@ -10,7 +10,7 @@
10
10
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
11
11
  = f.hidden_field :id
12
12
 
13
- = f.fields_for(:owner, f.object.owner) do |fu|
14
- = effective_address_fields(fu, :billing)
13
+ = f.fields_for(:owner, f.object.owner) do |fo|
14
+ = effective_address_fields(fo, :billing)
15
15
 
16
- = f.save 'Save and Continue'
16
+ = f.submit 'Save and Continue', left: true
@@ -20,5 +20,5 @@
20
20
  - if resource.submit_order.delayed? && resource.submit_order.deferred?
21
21
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
22
22
  = f.hidden_field :id
23
- = f.save 'Save and Continue'
23
+ = f.submit 'Save and Continue', left: true
24
24
 
@@ -0,0 +1,11 @@
1
+ = render 'layout' do
2
+ = render('effective/event_registrations/changing', resource: resource)
3
+ = render('effective/event_registrations/content', resource: resource)
4
+
5
+ = card do
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
8
+
9
+ = render('effective/event_registrations/code_of_conduct_fields', f: f)
10
+
11
+ = f.submit 'Save and Continue', left: true
@@ -5,7 +5,6 @@
5
5
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
6
6
  = f.hidden_field :id
7
7
 
8
- = render('effective/event_registrations/fields_event_registrants', form: f)
8
+ = render('effective/event_registrations/details_fields', form: f)
9
9
 
10
- %hr
11
- = f.save 'Save and Continue'
10
+ = f.submit 'Save and Continue', left: true
@@ -1,37 +1,34 @@
1
1
  = render 'layout' do
2
2
  = render('effective/event_registrations/content', resource: resource)
3
3
 
4
- - # Signed out
5
- - if resource.owner.blank?
6
- .card
7
- .card-body
8
- %p Welcome!
4
+ = card do
5
+ - # Signed out
6
+ - if resource.owner.blank?
7
+ %p Welcome!
9
8
 
10
- %p You are about to register for #{resource.event}.
9
+ %p You are about to register for #{resource.event}.
11
10
 
12
- %p
13
- Please
14
- = link_to 'sign in', '/users/sign_in'
15
- or
16
- = link_to 'sign up', '/users/sign_up'
17
- to continue.
18
-
19
- %p= link_to 'Sign In to Continue', '/users/sign_in', class: 'btn btn-primary'
11
+ %p
12
+ Please
13
+ = link_to 'sign in', '/users/sign_in'
14
+ or
15
+ = link_to 'sign up', '/users/sign_up'
16
+ to continue.
17
+
18
+ %p= link_to 'Sign In to Continue', '/users/sign_in', class: 'btn btn-primary'
20
19
 
21
- - # Signed in
22
- - if resource.owner.present?
23
- .card
24
- .card-body
25
- %p Welcome #{current_user}!
20
+ - # Signed in
21
+ - if resource.owner.present?
22
+ %p Welcome #{current_user}!
26
23
 
27
- %p You are registering for #{resource.event}.
24
+ %p You are registering for #{resource.event}.
28
25
 
29
- = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
30
- = f.hidden_field :id
26
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
27
+ = f.hidden_field :id
31
28
 
32
- = f.hidden_field :event_id
29
+ = f.hidden_field :event_id
33
30
 
34
- = f.hidden_field :owner_type
35
- = f.hidden_field :owner_id
31
+ = f.hidden_field :owner_type
32
+ = f.hidden_field :owner_id
36
33
 
37
- = f.save 'Save and Continue'
34
+ = f.submit 'Save and Continue', left: true
@@ -1,9 +1,10 @@
1
1
  = render 'layout' do
2
2
  = render('effective/event_registrations/changing', resource: resource)
3
3
  = render('effective/event_registrations/content', resource: resource)
4
+
4
5
  = render('effective/event_registrations/event_registration', event_registration: resource)
5
6
 
6
7
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
8
  = f.hidden_field :id
8
9
 
9
- = f.save 'Save and Continue'
10
+ = f.submit 'Save and Continue', left: true
@@ -2,10 +2,10 @@
2
2
  = render('effective/event_registrations/changing', resource: resource)
3
3
  = render('effective/event_registrations/content', resource: resource)
4
4
 
5
- = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
6
- = f.hidden_field :id
5
+ = card do
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
7
8
 
8
- = card do
9
- = render('effective/event_registrations/fields_event_ticket_selections', form: f)
9
+ = render('effective/event_registrations/tickets_fields', form: f)
10
10
 
11
- = f.save 'Save and Continue'
11
+ = f.submit 'Save and Continue', left: true
@@ -16,8 +16,9 @@
16
16
 
17
17
  - if @event.registerable? || (impersonating? && @event.registerable_when_impersonating?)
18
18
  .register.mb-4
19
+ - label = (@event.waitlist_only? ? 'Join Waitlist' : 'Register')
19
20
  - url = @event.external_registration_url.presence || effective_events.new_event_event_registration_path(@event)
20
- = link_to 'Register', url, class: 'btn btn-lg btn-primary'
21
+ = link_to label, url, class: 'btn btn-lg btn-primary'
21
22
 
22
23
  - if @event.file.attached?
23
24
  = image_tag url_for(@event.file), class: "effective-events-image d-none d-lg-block float-right", alt: @event.title, width: "350", height: "220"
@@ -58,9 +59,17 @@
58
59
  .effective-event-body.mb-5
59
60
  = @event.body.to_s
60
61
 
62
+ - if EffectiveEvents.code_of_conduct_enabled?
63
+ - page = EffectiveEvents.code_of_conduct_effective_page!
64
+
65
+ .effective-event-code-of-conduct.mb-4
66
+ View the
67
+ = link_to(page.title, effective_pages.page_path(page), target: '_blank')
68
+
61
69
  - if @event.registerable?
62
70
  .register.mb-4
71
+ - label = (@event.waitlist_only? ? 'Join Waitlist' : 'Register')
63
72
  - url = @event.external_registration_url.presence || effective_events.new_event_event_registration_path(@event)
64
- = link_to 'Register', url, class: 'btn btn-lg btn-primary'
73
+ = link_to label, url, class: 'btn btn-lg btn-primary'
65
74
 
66
75
  = link_to("&larr; #{events_name_label}".html_safe, effective_events.events_path, class: "btn btn-secondary my-4")
@@ -29,6 +29,12 @@ EffectiveEvents.setup do |config|
29
29
  # Hint text for event images attachments
30
30
  config.events_hint_text = 'Optional. Shown on the events index and event pages. Dimensions are 220px tall and 350px wide.'
31
31
 
32
+ # Code of Conduct
33
+ # Enable the code of conduct checkbox on the event registration wizard
34
+ # Create an Effective::Page for the code of conduct with this slug.
35
+ config.code_of_conduct_enabled = false
36
+ config.code_of_conduct_slug = 'event-code-of-conduct'
37
+
32
38
  # Mailer Settings
33
39
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
34
40
  #
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '2.34.0'.freeze
2
+ VERSION = '2.35.1'.freeze
3
3
  end
@@ -11,6 +11,7 @@ module EffectiveEvents
11
11
  :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
12
12
  :layout, :per_page, :use_effective_roles, :categories, :events_hint_text,
13
13
  :organization_enabled, :create_users, :company_or_organization_required,
14
+ :code_of_conduct_enabled, :code_of_conduct_slug,
14
15
  :event_registration_class_name
15
16
  ]
16
17
  end
@@ -34,6 +35,22 @@ module EffectiveEvents
34
35
  organization_enabled == true
35
36
  end
36
37
 
38
+ def self.code_of_conduct_enabled?
39
+ code_of_conduct_enabled == true
40
+ end
41
+
42
+ def self.code_of_conduct_effective_page
43
+ return unless defined?(Effective::Page)
44
+ Effective::Page.where(slug: code_of_conduct_slug).first
45
+ end
46
+
47
+ def self.code_of_conduct_effective_page!
48
+ page = code_of_conduct_effective_page()
49
+ raise("The Effective::Page for slug \"#{code_of_conduct_slug}\" does not exist. Please create it.") if page.blank?
50
+
51
+ page
52
+ end
53
+
37
54
  # If we can create delayed payment events at all
38
55
  def self.delayed?
39
56
  !!EffectiveOrders.try(:delayed?)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.0
4
+ version: 2.35.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: 2025-07-23 00:00:00.000000000 Z
11
+ date: 2025-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -270,20 +270,23 @@ files:
270
270
  - app/views/effective/event_registrants/_fields.html.haml
271
271
  - app/views/effective/event_registrations/_addons.html.haml
272
272
  - app/views/effective/event_registrations/_changing.html.haml
273
+ - app/views/effective/event_registrations/_code_of_conduct.html.haml
274
+ - app/views/effective/event_registrations/_code_of_conduct_fields.html.haml
273
275
  - app/views/effective/event_registrations/_content.html.haml
274
276
  - app/views/effective/event_registrations/_dashboard.html.haml
275
277
  - app/views/effective/event_registrations/_details.html.haml
278
+ - app/views/effective/event_registrations/_details_fields.html.haml
276
279
  - app/views/effective/event_registrations/_event_registration.html.haml
277
- - app/views/effective/event_registrations/_fields_event_registrants.html.haml
278
- - app/views/effective/event_registrations/_fields_event_ticket_selections.html.haml
279
280
  - app/views/effective/event_registrations/_form_blank_registrants.html.haml
280
281
  - app/views/effective/event_registrations/_layout.html.haml
281
282
  - app/views/effective/event_registrations/_orders.html.haml
282
283
  - app/views/effective/event_registrations/_summary.html.haml
283
284
  - app/views/effective/event_registrations/_tickets.html.haml
285
+ - app/views/effective/event_registrations/_tickets_fields.html.haml
284
286
  - app/views/effective/event_registrations/addons.html.haml
285
287
  - app/views/effective/event_registrations/billing.html.haml
286
288
  - app/views/effective/event_registrations/checkout.html.haml
289
+ - app/views/effective/event_registrations/code_of_conduct.html.haml
287
290
  - app/views/effective/event_registrations/complete.html.haml
288
291
  - app/views/effective/event_registrations/details.html.haml
289
292
  - app/views/effective/event_registrations/start.html.haml