effective_events 0.20.6 → 0.21.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 +4 -4
- data/app/views/admin/event_addons/_form.html.haml +1 -1
- data/app/views/admin/event_registrants/_form.html.haml +1 -1
- data/app/views/effective/event_registrants/_fields.html.haml +1 -1
- data/config/routes.rb +0 -5
- data/lib/effective_events/version.rb +1 -1
- metadata +2 -3
- data/app/controllers/effective/event_registrants_select2_ajax_controller.rb +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 920f3a46308fd2041e22efd8b92605424f83308d8cab8d825ea382196d7307b5
|
|
4
|
+
data.tar.gz: bd039692d81798c984c5e2d89ecc5bb4ce3f2c98c9e3cd8a94ac36b2da97fa9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35104d5d711d51a01d30e2c17731f6f6dbcf80e4c49a4a36c7d2e2adf86e88d35329a78284cebf3d8a70c95849e1c39ea3fc1461271c0e4ca5e54a835bb8ea4a
|
|
7
|
+
data.tar.gz: d99668168b29c7159aaf5fd120fb0426b05617a97e917d4fe64b1950179c100ba16818d737c126e27d6b0a59b17bca22f95eb40b383c9c21ca93fb3e3636dcf6
|
|
@@ -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 = (
|
|
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.
|
|
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 = (
|
|
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
|
|
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
|
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.
|
|
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-
|
|
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><#{resource.try(:public_email).presence || resource.email}></small>",
|
|
56
|
-
("<small>#{organizations}</small>" if organizations.present?)
|
|
57
|
-
].compact.join(' ')
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
end
|