effective_events 0.20.5 → 0.21.0

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: b9b8633a6d61dfd2916934dff65ecbfe5df1ced40cfcff2ee4b49f2138ae2b30
4
- data.tar.gz: 8b843be43da82c2e4127e3a77ecb4fb2eb4f4f503743749e817375db9d3420e2
3
+ metadata.gz: 920f3a46308fd2041e22efd8b92605424f83308d8cab8d825ea382196d7307b5
4
+ data.tar.gz: bd039692d81798c984c5e2d89ecc5bb4ce3f2c98c9e3cd8a94ac36b2da97fa9e
5
5
  SHA512:
6
- metadata.gz: 3c65f032ed10d4164d1e774af03b9b491a50ea8b7016dc8337c9ccb8d76edb556f3483a6c15766f8a8492f05a3b072a96db56f7b857ac102d9adcb3d30467c24
7
- data.tar.gz: 7ad25cf506e1ea2867cbc47fdadecb0370d3cd7598c0424d34cb04d83ddc3f0a0acd0103fa9945341a0dc83eb2ec129113068a79e5dfb4a10387a6b33a76c7f8
6
+ metadata.gz: 35104d5d711d51a01d30e2c17731f6f6dbcf80e4c49a4a36c7d2e2adf86e88d35329a78284cebf3d8a70c95849e1c39ea3fc1461271c0e4ca5e54a835bb8ea4a
7
+ data.tar.gz: d99668168b29c7159aaf5fd120fb0426b05617a97e917d4fe64b1950179c100ba16818d737c126e27d6b0a59b17bca22f95eb40b383c9c21ca93fb3e3636dcf6
@@ -23,7 +23,7 @@ module Effective
23
23
  return if resource.event.registerable? && !resource.event.sold_out?(except: resource)
24
24
 
25
25
  flash[:danger] = "Your selected event is no longer available for registration. This event registration is no longer available."
26
- return redirect_to('/dashboard')
26
+ return redirect_to(view_context.return_to_dashboard_path)
27
27
  end
28
28
 
29
29
  def expire_ticket_selection_window
@@ -45,7 +45,7 @@ module EffectiveEventsHelper
45
45
 
46
46
  # Allow an admin to assign archived tickets
47
47
  authorized = (namespace == :admin)
48
- member = current_user.try(:is_any?, :member)
48
+ member = current_user.try(:membership_present?)
49
49
 
50
50
  tickets = (authorized ? event.event_tickets : event.event_tickets.reject(&:archived?))
51
51
  tickets = tickets.reject { |ticket| ticket.member_only? } unless (authorized || member)
@@ -204,7 +204,7 @@ module Effective
204
204
  end
205
205
 
206
206
  def member_present?
207
- user.try(:is?, :member) || organization.try(:is?, :member)
207
+ user.try(:membership_present?) || organization.try(:membership_present?)
208
208
  end
209
209
 
210
210
  def member_ticket?
@@ -10,7 +10,7 @@
10
10
  - if f.object.new_record?
11
11
  -# User
12
12
  - klass = (f.object.owner || current_user).class
13
- - ajax_url = (@select2_users_ajax_path || effective_resources.users_admin_select2_ajax_index_path) unless Rails.env.test?
13
+ - ajax_url = (effective_resources.users_effective_ajax_index_path unless Rails.env.test?)
14
14
 
15
15
  = f.hidden_field :owner_type, value: klass.name
16
16
  = f.select :owner_id, klass.all, ajax_url: ajax_url, label: 'User'
@@ -9,7 +9,7 @@
9
9
  - if f.object.new_record?
10
10
  -# User
11
11
  - klass = (f.object.owner || current_user).class
12
- - ajax_url = (effective_resources.users_admin_select2_ajax_index_path unless Rails.env.test?)
12
+ - ajax_url = (effective_resources.users_effective_ajax_index_path unless Rails.env.test?)
13
13
 
14
14
  = f.hidden_field :owner_type, value: klass.name
15
15
  = f.select :owner_id, klass.all, ajax_url: ajax_url, label: 'Registration User'
@@ -1,6 +1,6 @@
1
1
  .event-registrant-user-fields
2
2
  - user_klass = (f.object.user || current_user).class
3
- - ajax_url = (effective_events.users_event_registrants_select2_ajax_index_path unless Rails.env.test?)
3
+ - ajax_url = (effective_resources.users_effective_ajax_index_path unless Rails.env.test?)
4
4
  - disabled = (f.object.user.present? && f.object.user.persisted? && f.object.user.errors.blank?)
5
5
  - event_ticket = f.object.event_ticket
6
6
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  - all_member_only_tickets = tickets.all? { |ticket| ticket.member_only? }
7
7
  - any_member_only_tickets = tickets.any? { |ticket| ticket.member_only? }
8
- - is_member = current_user.try(:is?, :member)
8
+ - is_member = current_user.try(:membership_present?)
9
9
 
10
10
  - if event.early_bird?
11
11
  .alert.alert-warning.mb-3
data/config/routes.rb CHANGED
@@ -24,11 +24,6 @@ EffectiveEvents::Engine.routes.draw do
24
24
  put :update_blank_registrants, on: :member
25
25
  end
26
26
  end
27
-
28
- resources :event_registrants_select2_ajax, only: [] do
29
- get :users, on: :collection
30
- get :organizations, on: :collection
31
- end
32
27
  end
33
28
 
34
29
  namespace :admin do
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.20.5'.freeze
2
+ VERSION = '0.21.0'.freeze
3
3
  end
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: 0.20.5
4
+ version: 0.21.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: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -229,7 +229,6 @@ files:
229
229
  - app/controllers/admin/event_registrations_controller.rb
230
230
  - app/controllers/admin/event_tickets_controller.rb
231
231
  - app/controllers/admin/events_controller.rb
232
- - app/controllers/effective/event_registrants_select2_ajax_controller.rb
233
232
  - app/controllers/effective/event_registrations_controller.rb
234
233
  - app/controllers/effective/events_controller.rb
235
234
  - app/datatables/admin/effective_event_addons_datatable.rb
@@ -1,61 +0,0 @@
1
- module Effective
2
- class EventRegistrantsSelect2AjaxController < ApplicationController
3
- before_action(:authenticate_user!) if defined?(Devise)
4
-
5
- include Effective::Select2AjaxController
6
-
7
- def users
8
- authorize! :users, Effective::EventRegistrant
9
-
10
- with_organizations = current_user.class.try(:effective_memberships_organization_user?)
11
-
12
- collection = current_user.class.all
13
- collection = collection.includes(:organizations) if with_organizations
14
-
15
- respond_with_select2_ajax(collection, skip_authorize: true) do |user|
16
- data = { first_name: user.first_name, last_name: user.last_name, email: user.email }
17
-
18
- if with_organizations
19
- data[:company] = user.organizations.first.try(:to_s)
20
- data[:organization_id] = user.organizations.first.try(:id)
21
- data[:organization_type] = user.organizations.first.try(:class).try(:name)
22
- end
23
-
24
- {
25
- id: user.to_param,
26
- text: to_select2(user, with_organizations),
27
- data: data
28
- }
29
- end
30
- end
31
-
32
- def organizations
33
- raise('expected EffectiveEvents.organization_enabled?') unless EffectiveEvents.organization_enabled?
34
-
35
- klass = EffectiveMemberships.Organization
36
- raise('an EffectiveMemberships.Organization is required') unless klass.try(:effective_memberships_organization?)
37
-
38
- collection = klass.all
39
-
40
- # Authorize
41
- EffectiveResources.authorize!(self, :member_organizations, collection.klass)
42
-
43
- respond_with_select2_ajax(collection, skip_authorize: true) do |organization|
44
- { id: organization.to_param, text: organization.to_s }
45
- end
46
- end
47
-
48
- private
49
-
50
- def to_select2(resource, with_organizations)
51
- organizations = Array(resource.try(:organizations)).join(', ') if with_organizations
52
-
53
- [
54
- "<span>#{resource}</span>",
55
- "<small>&lt;#{resource.try(:public_email).presence || resource.email}&gt;</small>",
56
- ("<small>#{organizations}</small>" if organizations.present?)
57
- ].compact.join(' ')
58
- end
59
-
60
- end
61
- end