effective_events 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -2
- data/app/datatables/admin/effective_events_datatable.rb +7 -6
- data/app/datatables/effective_event_registrations_datatable.rb +2 -1
- data/app/views/effective/event_registrations/_purchases.html.haml +8 -9
- data/app/views/effective/event_registrations/_registrants.html.haml +8 -9
- data/app/views/effective/event_registrations/_summary.html.haml +22 -25
- data/app/views/effective/event_registrations/billing.html.haml +8 -7
- data/config/effective_events.rb +2 -0
- data/db/migrate/01_create_effective_events.rb.erb +11 -11
- data/lib/effective_events/version.rb +1 -1
- data/lib/effective_events.rb +2 -1
- data/lib/generators/effective_events/install_generator.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19f4a303dbab49f23b15a28c71bce29f9d55036371c533a27f36ad3ac70ca1b4
|
4
|
+
data.tar.gz: ad51623c2087ccf9a1c2a2a97d1623f89224be38cd7aae06b246aedb2108e2e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d51690029093356830ee881f54881054b4eafa9b0aaf99d2389c9d8966a2d76b2d8456f11e9ef45ef7df92cddce73c89961094802c21a198a766b04373b0eb8
|
7
|
+
data.tar.gz: 68e1785f75da39ad9916a065c89dc79a3995602c250315276e165b58f4abf43bc4ab116c45698e1ee36cccfa7b7fe2c364efefab73d382deb58bd623e8064325
|
data/README.md
CHANGED
@@ -68,10 +68,34 @@ All authorization checks are handled via the effective_resources gem found in th
|
|
68
68
|
The permissions you actually want to define are as follows (using CanCan):
|
69
69
|
|
70
70
|
```ruby
|
71
|
-
can
|
71
|
+
can([:index, :show], Effective::Event) { |event| !event.draft? }
|
72
|
+
can([:new, :create], EffectiveEvents.EventRegistration)
|
73
|
+
can([:show, :index], Effective::EventRegistrant) { |registrant| registrant.owner == user || registrant.owner.blank? }
|
74
|
+
can([:show, :index], Effective::EventPurchase) { |purchase| purchase.owner == user || purchase.owner.blank? }
|
75
|
+
can([:show, :index], EffectiveEvents.EventRegistration) { |registration| registration.owner == user }
|
76
|
+
can([:update, :destroy], EffectiveEvents.EventRegistration) { |registration| registration.owner == user && !registration.was_submitted? }
|
72
77
|
|
73
78
|
if user.admin?
|
74
|
-
can :
|
79
|
+
can :admin, :effective_events
|
80
|
+
|
81
|
+
can(crud - [:destroy], Effective::Event)
|
82
|
+
can(:destroy, Effective::Event) { |et| et.event_registrants_count == 0 }
|
83
|
+
|
84
|
+
can(crud - [:destroy], Effective::EventRegistrant)
|
85
|
+
can(:mark_paid, Effective::EventRegistrant) { |er| !er.event_registration_id.present? }
|
86
|
+
can(:destroy, Effective::EventRegistrant) { |er| !er.purchased? }
|
87
|
+
|
88
|
+
can(crud - [:destroy], Effective::EventPurchase)
|
89
|
+
can(:mark_paid, Effective::EventPurchase) { |er| !er.event_registration_id.present? }
|
90
|
+
can(:destroy, Effective::EventPurchase) { |er| !er.purchased? }
|
91
|
+
|
92
|
+
can(crud - [:destroy], Effective::EventTicket)
|
93
|
+
can(:destroy, Effective::EventTicket) { |et| et.purchased_event_registrants_count == 0 }
|
94
|
+
|
95
|
+
can(crud - [:destroy], Effective::EventProduct)
|
96
|
+
can(:destroy, Effective::EventProduct) { |et| et.purchased_event_purchases_count == 0 }
|
97
|
+
|
98
|
+
can([:index, :show], EffectiveEvents.EventRegistration)
|
75
99
|
end
|
76
100
|
```
|
77
101
|
|
@@ -15,14 +15,13 @@ module Admin
|
|
15
15
|
|
16
16
|
col :title
|
17
17
|
col :draft
|
18
|
-
col :start_at, label: 'Event Date'
|
19
|
-
|
20
|
-
col :end_at, visible: false
|
18
|
+
col :start_at, label: 'Event Start Date'
|
19
|
+
col :end_at, label: 'Event End Date', visible: false
|
21
20
|
col :excerpt, visible: false
|
22
21
|
|
23
|
-
col :registration_start_at, label: 'Registration opens'
|
24
|
-
col :registration_end_at, label: 'Registration closes'
|
25
|
-
col :early_bird_end_at, label: 'Early bird ends'
|
22
|
+
col :registration_start_at, label: 'Registration opens', visible: false
|
23
|
+
col :registration_end_at, label: 'Registration closes', visible: false
|
24
|
+
col :early_bird_end_at, label: 'Early bird ends', visible: false
|
26
25
|
|
27
26
|
col :early_bird do |event|
|
28
27
|
if event.early_bird?
|
@@ -33,7 +32,9 @@ module Admin
|
|
33
32
|
end
|
34
33
|
|
35
34
|
col :event_tickets, search: :string
|
35
|
+
col :event_products, search: :string
|
36
36
|
col :event_registrants, search: :string
|
37
|
+
col :event_purchases, search: :string
|
37
38
|
|
38
39
|
col :roles, visible: false
|
39
40
|
col :authenticate_user, visible: false
|
@@ -16,7 +16,8 @@ class EffectiveEventRegistrationsDatatable < Effective::Datatable
|
|
16
16
|
|
17
17
|
col :owner, visible: false, search: :string
|
18
18
|
col :status, visible: false
|
19
|
-
col :event_registrants, search: :string
|
19
|
+
col :event_registrants, label: 'Registrants', search: :string
|
20
|
+
col :event_purchases, label: 'Purchases', search: :string
|
20
21
|
col :orders, action: :show, visible: false, search: :string
|
21
22
|
|
22
23
|
actions_col(actions: []) do |er|
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
.
|
4
|
-
.
|
5
|
-
|
6
|
-
|
7
|
-
= link_to('Edit', wizard_path(:purchases)) if edit_effective_event_registrations_wizard?
|
1
|
+
= card do
|
2
|
+
.row
|
3
|
+
.col-sm
|
4
|
+
%h5.card-title= event_registration.wizard_step_title(:purchases)
|
5
|
+
.col-sm-auto.text-right
|
6
|
+
= link_to('Edit', wizard_path(:purchases)) if edit_effective_event_registrations_wizard?
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
- datatable = EffectiveEventPurchasesDatatable.new(event_registration: event_registration)
|
9
|
+
.mb-4= render_simple_datatable(datatable)
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
.
|
4
|
-
.
|
5
|
-
|
6
|
-
|
7
|
-
= link_to('Edit', wizard_path(:registrants)) if edit_effective_event_registrations_wizard?
|
1
|
+
= card do
|
2
|
+
.row
|
3
|
+
.col-sm
|
4
|
+
%h5.card-title= event_registration.wizard_step_title(:registrants)
|
5
|
+
.col-sm-auto.text-right
|
6
|
+
= link_to('Edit', wizard_path(:registrants)) if edit_effective_event_registrations_wizard?
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
- datatable = EffectiveEventRegistrantsDatatable.new(event_registration: event_registration)
|
9
|
+
.mb-4= render_simple_datatable(datatable)
|
@@ -1,29 +1,26 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
%
|
1
|
+
= card('Event Registration') do
|
2
|
+
%table.table.table-sm
|
3
|
+
%tbody
|
4
|
+
%tr
|
5
|
+
%th.border-0 Event
|
6
|
+
%td.border-0
|
7
|
+
= link_to(event_registration.event, effective_events.event_path(event_registration.event))
|
4
8
|
|
5
|
-
|
6
|
-
%tbody
|
9
|
+
- if request.path.start_with?('/admin')
|
7
10
|
%tr
|
8
|
-
%th
|
9
|
-
%td
|
10
|
-
=
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
- url = (polymorphic_admin_path(event_registration.owner) rescue "/admin/users/#{event_registration.owner.to_param}/edit")
|
17
|
-
= link_to(event_registration.owner, url)
|
18
|
-
- else
|
19
|
-
%tr
|
20
|
-
%th Registered by
|
21
|
-
%td= event_registration.owner
|
11
|
+
%th Registered by
|
12
|
+
%td
|
13
|
+
- url = (polymorphic_admin_path(event_registration.owner) rescue "/admin/users/#{event_registration.owner.to_param}/edit")
|
14
|
+
= link_to(event_registration.owner, url)
|
15
|
+
- else
|
16
|
+
%tr
|
17
|
+
%th Registered by
|
18
|
+
%td= event_registration.owner
|
22
19
|
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
- if event_registration.orders.present?
|
22
|
+
%tr
|
23
|
+
%th Order
|
24
|
+
%td
|
25
|
+
- event_registration.orders.each do |order|
|
26
|
+
= link_to(order, effective_orders.order_path(order))
|
@@ -3,12 +3,13 @@
|
|
3
3
|
|
4
4
|
- raise('expected owner to respond to billing_address') unless resource.owner.respond_to?(:billing_address)
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
9
|
-
= f.hidden_field :id
|
6
|
+
= card('Billing Address') do
|
7
|
+
%p Please enter your billing address
|
10
8
|
|
11
|
-
|
12
|
-
|
9
|
+
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
10
|
+
= f.hidden_field :id
|
13
11
|
|
14
|
-
|
12
|
+
= f.fields_for(:owner, f.object.owner) do |fu|
|
13
|
+
= effective_address_fields(fu, :billing)
|
14
|
+
|
15
|
+
= f.save 'Save and Continue'
|
data/config/effective_events.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
EffectiveEvents.setup do |config|
|
2
2
|
config.events_table_name = :events
|
3
3
|
config.event_tickets_table_name = :event_tickets
|
4
|
+
config.event_products_table_name = :event_products
|
4
5
|
config.event_registrants_table_name = :event_registrants
|
6
|
+
config.event_purchases_table_name = :event_purchases
|
5
7
|
config.event_registrations_table_name = :event_registrations
|
6
8
|
|
7
9
|
# Layout Settings
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
2
2
|
def change
|
3
|
-
create_table
|
3
|
+
create_table <%= @events_table_name %> do |t|
|
4
4
|
t.string :title
|
5
5
|
|
6
6
|
t.string :slug
|
@@ -22,10 +22,10 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
22
22
|
t.timestamps
|
23
23
|
end
|
24
24
|
|
25
|
-
add_index
|
26
|
-
add_index
|
25
|
+
add_index <%= @events_table_name %>, :title
|
26
|
+
add_index <%= @events_table_name %>, :end_at
|
27
27
|
|
28
|
-
create_table
|
28
|
+
create_table <%= @event_tickets_table_name %> do |t|
|
29
29
|
t.integer :event_id
|
30
30
|
|
31
31
|
t.string :title
|
@@ -43,7 +43,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
43
43
|
t.timestamps
|
44
44
|
end
|
45
45
|
|
46
|
-
create_table
|
46
|
+
create_table <%= @event_registrants_table_name %> do |t|
|
47
47
|
t.integer :event_id
|
48
48
|
t.integer :event_ticket_id
|
49
49
|
|
@@ -67,7 +67,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
67
67
|
t.timestamps
|
68
68
|
end
|
69
69
|
|
70
|
-
create_table
|
70
|
+
create_table <%= @event_products_table_name %> do |t|
|
71
71
|
t.integer :event_id
|
72
72
|
|
73
73
|
t.string :title
|
@@ -84,7 +84,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
84
84
|
t.timestamps
|
85
85
|
end
|
86
86
|
|
87
|
-
create_table
|
87
|
+
create_table <%= @event_purchases_table_name %> do |t|
|
88
88
|
t.integer :event_id
|
89
89
|
t.integer :event_product_id
|
90
90
|
|
@@ -102,7 +102,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
102
102
|
t.timestamps
|
103
103
|
end
|
104
104
|
|
105
|
-
create_table
|
105
|
+
create_table <%= @event_registrations_table_name %> do |t|
|
106
106
|
t.string :token
|
107
107
|
|
108
108
|
t.integer :event_id
|
@@ -127,9 +127,9 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
127
127
|
t.datetime :created_at
|
128
128
|
end
|
129
129
|
|
130
|
-
add_index
|
131
|
-
add_index
|
132
|
-
add_index
|
130
|
+
add_index <%= @event_registrations_table_name %>, [:owner_id, :owner_type]
|
131
|
+
add_index <%= @event_registrations_table_name %>, :status
|
132
|
+
add_index <%= @event_registrations_table_name %>, :token
|
133
133
|
|
134
134
|
end
|
135
135
|
end
|
data/lib/effective_events.rb
CHANGED
@@ -6,7 +6,8 @@ module EffectiveEvents
|
|
6
6
|
|
7
7
|
def self.config_keys
|
8
8
|
[
|
9
|
-
:events_table_name, :event_registrants_table_name, :event_tickets_table_name,
|
9
|
+
:events_table_name, :event_registrants_table_name, :event_tickets_table_name,
|
10
|
+
:event_registrations_table_name, :event_products_table_name, :event_purchases_table_name,
|
10
11
|
:layout, :per_page, :use_effective_roles,
|
11
12
|
:event_registration_class_name
|
12
13
|
]
|
@@ -21,6 +21,11 @@ module EffectiveEvents
|
|
21
21
|
|
22
22
|
def create_migration_file
|
23
23
|
@events_table_name = ':' + EffectiveEvents.events_table_name.to_s
|
24
|
+
@event_products_table_name = ':' + EffectiveEvents.event_products_table_name.to_s
|
25
|
+
@event_purchases_table_name = ':' + EffectiveEvents.event_purchases_table_name.to_s
|
26
|
+
@event_registrants_table_name = ':' + EffectiveEvents.event_registrants_table_name.to_s
|
27
|
+
@event_registrations_table_name = ':' + EffectiveEvents.event_registrations_table_name.to_s
|
28
|
+
@event_tickets_table_name = ':' + EffectiveEvents.event_tickets_table_name.to_s
|
24
29
|
|
25
30
|
migration_template ('../' * 3) + 'db/migrate/01_create_effective_events.rb.erb', 'db/migrate/create_effective_events.rb'
|
26
31
|
end
|