effective_events 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/effective/events_controller.rb +37 -0
- data/app/datatables/admin/effective_events_datatable.rb +2 -1
- data/app/datatables/effective_events_datatable.rb +3 -1
- data/app/models/concerns/effective_events_event_registration.rb +5 -0
- data/app/models/effective/event.rb +35 -8
- data/app/models/effective/event_search.rb +82 -0
- data/app/views/admin/events/_form.html.haml +2 -0
- data/app/views/admin/events/_form_content.html.haml +6 -4
- data/app/views/admin/events/_form_event.html.haml +11 -1
- data/app/views/effective/events/_categories.html.haml +8 -0
- data/app/views/effective/events/_event.html.haml +22 -10
- data/app/views/effective/events/_form.html.haml +11 -0
- data/app/views/effective/events/_layout.html.haml +2 -0
- data/app/views/effective/events/index.html.haml +16 -5
- data/app/views/effective/events/show.html.haml +42 -2
- data/config/effective_events.rb +6 -0
- data/config/routes.rb +10 -0
- data/db/migrate/01_create_effective_events.rb.erb +6 -0
- data/db/seeds.rb +1 -0
- data/lib/effective_events/version.rb +1 -1
- data/lib/effective_events.rb +6 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b29ba82476500dc0793755782751f968623a5fd7a2a05a4c01075fd57dd3eb2
|
4
|
+
data.tar.gz: f3efe6fa8417a593fcf46a0219e2fdbe77183ab8d6b24344f969e969d4b45bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1788863bd9f10ab8af6e147b4b83df8bb0f12c353efd26c44fd2274f8c3b2108d0db460eb62a770efd6764bc72fd8829023a090208c468cffdda1517cee2897
|
7
|
+
data.tar.gz: 424203654b7861c179002ef3d2989c8fa8334e57fa9886156638d405a292a1de586f836f3e40ac34eb6db5a8fa06dd01549232a9b3862fc48e7bf93ae24ac3c7
|
@@ -7,6 +7,20 @@ module Effective
|
|
7
7
|
Effective::Event.events(user: current_user, unpublished: unpublished)
|
8
8
|
}
|
9
9
|
|
10
|
+
def index
|
11
|
+
@page_title ||= 'Events'
|
12
|
+
EffectiveResources.authorize!(self, :index, Effective::Event)
|
13
|
+
|
14
|
+
# Sometimes we just display a Datatable for the events
|
15
|
+
@datatable = EffectiveResources.best('EffectiveEventsDatatable').new
|
16
|
+
|
17
|
+
# But more often we do a full paginated index with search screen
|
18
|
+
@event_search = build_event_search
|
19
|
+
@event_search.search!
|
20
|
+
|
21
|
+
@events = @event_search.results(page: params[:page])
|
22
|
+
end
|
23
|
+
|
10
24
|
def show
|
11
25
|
@event = resource_scope.find(params[:id])
|
12
26
|
|
@@ -28,5 +42,28 @@ module Effective
|
|
28
42
|
@page_title ||= @event.to_s
|
29
43
|
end
|
30
44
|
|
45
|
+
def build_event_search
|
46
|
+
search = EventSearch.new(search_params)
|
47
|
+
search.current_user = current_user
|
48
|
+
search.unpublished = EffectiveResources.authorized?(self, :admin, :effective_events)
|
49
|
+
search.category ||= event_category
|
50
|
+
search
|
51
|
+
end
|
52
|
+
|
53
|
+
def event_category
|
54
|
+
return nil unless params[:category].present?
|
55
|
+
EffectiveEvents.categories.find { |category| category.parameterize == params[:category] }
|
56
|
+
end
|
57
|
+
|
58
|
+
def search_params
|
59
|
+
return {} unless params[:q].present?
|
60
|
+
|
61
|
+
if params[:q].respond_to?(:to_h) # From the search form
|
62
|
+
params.require(:q).permit!
|
63
|
+
else
|
64
|
+
{ term: params.permit(:q).fetch(:q) } # From the url /events?q=asdf
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
31
68
|
end
|
32
69
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
class EffectiveEventsDatatable < Effective::Datatable
|
3
3
|
filters do
|
4
4
|
# Upcoming should be first here, so when displayed as a simple datatable on the dashboard they only see upcoming events
|
5
|
+
scope :upcoming
|
5
6
|
scope :registerable
|
6
7
|
scope :all
|
7
8
|
end
|
@@ -32,7 +33,8 @@ class EffectiveEventsDatatable < Effective::Datatable
|
|
32
33
|
|
33
34
|
actions_col show: false do |event|
|
34
35
|
if event.registerable?
|
35
|
-
|
36
|
+
url = event.external_registration_url.presence || effective_events.new_event_event_registration_path(event)
|
37
|
+
dropdown_link_to('Register', url)
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -82,6 +82,11 @@ module EffectiveEventsEventRegistration
|
|
82
82
|
validates :owner, presence: true
|
83
83
|
validates :event, presence: true
|
84
84
|
|
85
|
+
# All Steps
|
86
|
+
validate(if: -> { event.present? }) do
|
87
|
+
self.errors.add(:base, "cannot register for an external registration event") if event.external_registration?
|
88
|
+
end
|
89
|
+
|
85
90
|
# Tickets Step
|
86
91
|
validate(if: -> { current_step == :tickets }) do
|
87
92
|
self.errors.add(:event_registrants, "can't be blank") unless present_event_registrants.present?
|
@@ -28,6 +28,8 @@ module Effective
|
|
28
28
|
# rich_text_select_content
|
29
29
|
# rich_text_select_content
|
30
30
|
|
31
|
+
has_one_attached :file
|
32
|
+
|
31
33
|
acts_as_slugged
|
32
34
|
log_changes if respond_to?(:log_changes)
|
33
35
|
acts_as_role_restricted if respond_to?(:acts_as_role_restricted)
|
@@ -37,8 +39,11 @@ module Effective
|
|
37
39
|
effective_resource do
|
38
40
|
title :string
|
39
41
|
|
42
|
+
category :string
|
40
43
|
slug :string
|
44
|
+
|
41
45
|
draft :boolean
|
46
|
+
published_at :datetime
|
42
47
|
|
43
48
|
start_at :datetime
|
44
49
|
end_at :datetime
|
@@ -48,6 +53,9 @@ module Effective
|
|
48
53
|
|
49
54
|
early_bird_end_at :datetime # Optional
|
50
55
|
|
56
|
+
external_registration :boolean
|
57
|
+
external_registration_url :string
|
58
|
+
|
51
59
|
# Access
|
52
60
|
roles_mask :integer
|
53
61
|
authenticate_user :boolean
|
@@ -55,11 +63,11 @@ module Effective
|
|
55
63
|
timestamps
|
56
64
|
end
|
57
65
|
|
58
|
-
scope :sorted, -> { order(:
|
66
|
+
scope :sorted, -> { order(published_at: :desc).order(:id) }
|
59
67
|
scope :deep, -> { includes(:event_registrants, :event_tickets) }
|
60
68
|
|
61
|
-
scope :
|
62
|
-
scope :
|
69
|
+
scope :published, -> { where(draft: false).where(arel_table[:published_at].lt(Time.zone.now)) }
|
70
|
+
scope :unpublished, -> { where(draft: true).where(arel_table[:published_at].gteq(Time.zone.now)) }
|
63
71
|
|
64
72
|
scope :upcoming, -> { where(arel_table[:end_at].gt(Time.zone.now)) }
|
65
73
|
scope :past, -> { where(arel_table[:end_at].lteq(Time.zone.now)) }
|
@@ -79,7 +87,7 @@ module Effective
|
|
79
87
|
limit(per_page).offset(offset)
|
80
88
|
}
|
81
89
|
|
82
|
-
scope :events, -> (user: nil, unpublished: false) {
|
90
|
+
scope :events, -> (user: nil, category: nil, unpublished: false) {
|
83
91
|
scope = all.deep.sorted
|
84
92
|
|
85
93
|
if defined?(EffectiveRoles) && EffectiveEvents.use_effective_roles
|
@@ -90,6 +98,10 @@ module Effective
|
|
90
98
|
scope = scope.where(authenticate_user: false)
|
91
99
|
end
|
92
100
|
|
101
|
+
if category.present?
|
102
|
+
scope = scope.where(category: category)
|
103
|
+
end
|
104
|
+
|
93
105
|
unless unpublished
|
94
106
|
scope = scope.published
|
95
107
|
end
|
@@ -98,11 +110,12 @@ module Effective
|
|
98
110
|
}
|
99
111
|
|
100
112
|
validates :title, presence: true, length: { maximum: 255 }
|
101
|
-
|
113
|
+
validates :published_at, presence: true, unless: -> { draft? }
|
102
114
|
validates :start_at, presence: true
|
103
115
|
validates :end_at, presence: true
|
104
116
|
validates :registration_start_at, presence: true
|
105
117
|
validates :registration_end_at, presence: true
|
118
|
+
validates :external_registration_url, presence: true, if: -> { external_registration? }
|
106
119
|
|
107
120
|
validate(if: -> { start_at && end_at }) do
|
108
121
|
self.errors.add(:end_at, 'must be after start date') unless start_at < end_at
|
@@ -120,6 +133,14 @@ module Effective
|
|
120
133
|
self.errors.add(:early_bird_end_at, 'must be before start date') unless early_bird_end_at < start_at
|
121
134
|
end
|
122
135
|
|
136
|
+
validate(if: -> { file.attached? }) do
|
137
|
+
self.errors.add(:file, 'must be an image') unless file.image?
|
138
|
+
end
|
139
|
+
|
140
|
+
validate(if: -> { category.present? }) do
|
141
|
+
self.errors.add(:category, 'is not included in the list') unless EffectiveEvents.categories.include?(category)
|
142
|
+
end
|
143
|
+
|
123
144
|
def to_s
|
124
145
|
title.presence || 'New Event'
|
125
146
|
end
|
@@ -132,13 +153,19 @@ module Effective
|
|
132
153
|
rich_text_excerpt
|
133
154
|
end
|
134
155
|
|
135
|
-
def
|
156
|
+
def published?
|
136
157
|
return false if draft?
|
158
|
+
return false if published_at.blank?
|
159
|
+
|
160
|
+
published_at < Time.zone.now
|
161
|
+
end
|
162
|
+
|
163
|
+
def registerable?
|
164
|
+
return false unless published?
|
137
165
|
return false if closed?
|
138
166
|
return false if sold_out?
|
139
|
-
return false if event_tickets.blank?
|
140
167
|
|
141
|
-
|
168
|
+
external_registration? || event_tickets.present?
|
142
169
|
end
|
143
170
|
|
144
171
|
def closed?
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Effective
|
2
|
+
class EventSearch
|
3
|
+
include ActiveModel::Model
|
4
|
+
|
5
|
+
ORDERS = ['Sort by Published Date', 'Sort by Event Date']
|
6
|
+
|
7
|
+
attr_accessor :current_user
|
8
|
+
attr_accessor :unpublished
|
9
|
+
|
10
|
+
attr_accessor :term
|
11
|
+
attr_accessor :category
|
12
|
+
attr_accessor :order
|
13
|
+
|
14
|
+
validates :term, length: { minimum: 2, allow_blank: true }
|
15
|
+
validates :order, inclusion: { in: ORDERS, allow_blank: true }
|
16
|
+
|
17
|
+
# Base collection to search.
|
18
|
+
def collection
|
19
|
+
Event.events(user: current_user, unpublished: unpublished)
|
20
|
+
end
|
21
|
+
|
22
|
+
def per_page
|
23
|
+
(EffectiveEvents.per_page || 24).to_i
|
24
|
+
end
|
25
|
+
|
26
|
+
def present?
|
27
|
+
term.present? || category.present? || order.present?
|
28
|
+
end
|
29
|
+
|
30
|
+
# Search and assigns the collection
|
31
|
+
# Assigns the entire collection() if there are no search terms
|
32
|
+
# Otherwise validate the search terms
|
33
|
+
def search!
|
34
|
+
@events = build_collection()
|
35
|
+
@events = @events.none if present? && !valid?
|
36
|
+
@events
|
37
|
+
end
|
38
|
+
|
39
|
+
# The unpaginated results of the search
|
40
|
+
def events
|
41
|
+
@events || collection
|
42
|
+
end
|
43
|
+
|
44
|
+
# The paginated results
|
45
|
+
def results(page: nil)
|
46
|
+
page = (page || 1).to_i
|
47
|
+
offset = [(page - 1), 0].max * per_page
|
48
|
+
|
49
|
+
events.limit(per_page).offset(offset)
|
50
|
+
end
|
51
|
+
|
52
|
+
protected
|
53
|
+
|
54
|
+
def build_collection
|
55
|
+
events = collection()
|
56
|
+
raise('expected an ActiveRecord collection') unless events.kind_of?(ActiveRecord::Relation)
|
57
|
+
|
58
|
+
# Filter by term
|
59
|
+
if term.present?
|
60
|
+
events = Effective::Resource.new(events).search_any(term)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Filter by category
|
64
|
+
if category.present?
|
65
|
+
events = events.where(category: category)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Apply Sorting
|
69
|
+
events = case order.to_s
|
70
|
+
when 'Sort by Published Date'
|
71
|
+
events.reorder(published_at: :desc)
|
72
|
+
when 'Sort by Event Date'
|
73
|
+
events.reorder(start_at: :desc)
|
74
|
+
else
|
75
|
+
events.reorder(published_at: :desc) # Default Sort by Published Date
|
76
|
+
end
|
77
|
+
|
78
|
+
events
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
@@ -6,6 +6,7 @@
|
|
6
6
|
= tab 'Content' do
|
7
7
|
= render '/admin/events/form_content', event: event
|
8
8
|
|
9
|
+
- if event.persisted? && !event.external_registration?
|
9
10
|
= tab 'Tickets' do
|
10
11
|
%h2 Tickets
|
11
12
|
- datatable = Admin::EffectiveEventTicketsDatatable.new(event_id: event.id)
|
@@ -40,6 +41,7 @@
|
|
40
41
|
= tab 'Wizard' do
|
41
42
|
= render '/admin/events/form_event_registration_content', event: event
|
42
43
|
|
44
|
+
- if event.persisted?
|
43
45
|
= tab 'Access' do
|
44
46
|
= render '/admin/events/form_access', event: event
|
45
47
|
|
@@ -1,9 +1,11 @@
|
|
1
1
|
= effective_form_with(model: [:admin, event], engine: true) do |f|
|
2
|
+
= f.file_field :file, label: 'Image attachment', hint: EffectiveEvents.events_hint_text
|
3
|
+
|
2
4
|
- if defined?(EffectiveArticleEditor)
|
3
|
-
= f.article_editor :rich_text_excerpt, hint: 'Will be used for the events excerpt on index pages.'
|
4
|
-
= f.article_editor :rich_text_body, hint: 'The main body of your event'
|
5
|
+
= f.article_editor :rich_text_excerpt, label: 'Excerpt', hint: 'Will be used for the events excerpt on index pages.'
|
6
|
+
= f.article_editor :rich_text_body, label: 'Body', hint: 'The main body of your event'
|
5
7
|
- else
|
6
|
-
= f.rich_text_area :rich_text_excerpt, hint: 'Will be used for the events excerpt on index pages.'
|
7
|
-
= f.rich_text_area :rich_text_body, hint: 'The main body of your event'
|
8
|
+
= f.rich_text_area :rich_text_excerpt, label: 'Excerpt', hint: 'Will be used for the events excerpt on index pages.'
|
9
|
+
= f.rich_text_area :rich_text_body, label: 'Body', hint: 'The main body of your event'
|
8
10
|
|
9
11
|
= f.submit
|
@@ -1,5 +1,11 @@
|
|
1
1
|
= effective_form_with(model: [:admin, event], engine: true) do |f|
|
2
2
|
= f.text_field :title, label: "Title"
|
3
|
+
|
4
|
+
- categories = EffectiveEvents.categories
|
5
|
+
- if categories.present?
|
6
|
+
= f.select :category, categories, hint: 'optional category'
|
7
|
+
|
8
|
+
= f.datetime_field :published_at, label: 'Publish date', hint: 'When should this be displayed on the website.'
|
3
9
|
= f.check_box :draft, hint: 'Save this event as a draft. It will not be accessible on the website.'
|
4
10
|
|
5
11
|
- if f.object.persisted? || f.object.errors.include?(:slug)
|
@@ -13,10 +19,14 @@
|
|
13
19
|
%p The online registration and purchase for this event will be available between:
|
14
20
|
= f.datetime_field :registration_start_at, label: "Registration Start"
|
15
21
|
= f.datetime_field :registration_end_at, label: "Registration End"
|
16
|
-
|
17
22
|
= f.datetime_field :early_bird_end_at, label: "Early Bird End",
|
18
23
|
hint: 'Event tickets can be purchased for early bird pricing before this date. Afterwards regular pricing applies.'
|
19
24
|
|
25
|
+
= f.check_box :external_registration, label: "Yes, the registration for this event is handled by another website"
|
26
|
+
|
27
|
+
= f.show_if(:external_registration, true) do
|
28
|
+
= f.url_field :external_registration_url, hint: "The url for external event registration. Must start with http(s)://"
|
29
|
+
|
20
30
|
= f.submit do
|
21
31
|
= f.save 'Save'
|
22
32
|
= f.save 'Save and View', class: 'btn btn-secondary'
|
@@ -1,5 +1,10 @@
|
|
1
1
|
.card
|
2
2
|
.card-body
|
3
|
+
- if event.file.attached?
|
4
|
+
= image_tag(event.file)
|
5
|
+
|
6
|
+
= event.excerpt.to_s
|
7
|
+
|
3
8
|
%table.table.effective-events-table
|
4
9
|
%tbody
|
5
10
|
%tr
|
@@ -9,6 +14,15 @@
|
|
9
14
|
%br
|
10
15
|
Ends: #{event.end_at&.strftime('%F %R')}
|
11
16
|
|
17
|
+
- if event.category.present?
|
18
|
+
%tr
|
19
|
+
%th Category
|
20
|
+
%td= event.category
|
21
|
+
|
22
|
+
%tr
|
23
|
+
%th Published At
|
24
|
+
%td= event.published_at.strftime('%F %R')
|
25
|
+
|
12
26
|
%tr
|
13
27
|
%th Registration Closes
|
14
28
|
%td= event.registration_end_at.strftime('%F %R')
|
@@ -20,12 +34,13 @@
|
|
20
34
|
%br
|
21
35
|
Ends: #{event.early_bird_end_at&.strftime('%F %R')}
|
22
36
|
|
23
|
-
|
24
|
-
%
|
25
|
-
|
26
|
-
%
|
27
|
-
-
|
28
|
-
|
37
|
+
- if event.event_tickets.present?
|
38
|
+
%tr
|
39
|
+
%th Tickets
|
40
|
+
%td
|
41
|
+
%ul.pl-3
|
42
|
+
- event.event_tickets.each do |ticket|
|
43
|
+
%li= "#{ticket} (#{price_to_currency(ticket.price)})"
|
29
44
|
|
30
45
|
- if event.event_products.present?
|
31
46
|
%tr
|
@@ -35,7 +50,4 @@
|
|
35
50
|
- event.event_products.each do |product|
|
36
51
|
%li= "#{product} (#{price_to_currency(product.price)})"
|
37
52
|
|
38
|
-
|
39
|
-
%tr
|
40
|
-
%th Description
|
41
|
-
%td= event.body
|
53
|
+
= link_to('View more', effective_events.event_path(event))
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= effective_form_with(scope: :q, model: event_search, method: :get, url: request.path) do |f|
|
2
|
+
- if f.object.term.present?
|
3
|
+
= f.search_field :term, label: 'Term'
|
4
|
+
|
5
|
+
/= f.radios :category, EffectiveEvents.categories, buttons: true
|
6
|
+
|
7
|
+
- f.object.order ||= Effective::EventSearch::ORDERS.first
|
8
|
+
= f.radios :order, Effective::EventSearch::ORDERS, buttons: true
|
9
|
+
|
10
|
+
= f.save('Search', class: 'btn btn-primary btn-search mr-3', name: nil)
|
11
|
+
= link_to 'Reset filters', request.path
|
@@ -1,5 +1,16 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
|
4
|
-
-
|
5
|
-
|
1
|
+
= render 'layout' do
|
2
|
+
-# render_datatable(@datatable)
|
3
|
+
|
4
|
+
.mb-4= render('effective/events/categories')
|
5
|
+
.mb-4= render('effective/events/form', event_search: @event_search)
|
6
|
+
|
7
|
+
- results = @event_search.results(page: params[:page])
|
8
|
+
|
9
|
+
- if @event_search.present? && results.length == 0
|
10
|
+
.alert.alert-info There are no results for your search. Please try again.
|
11
|
+
|
12
|
+
-# This renders effective/events/event
|
13
|
+
= render(results)
|
14
|
+
|
15
|
+
%nav.d-flex.justify-content-center
|
16
|
+
= bootstrap_paginate(results, per_page: @event_search.per_page)
|
@@ -7,6 +7,46 @@
|
|
7
7
|
|
8
8
|
- if @event.registerable?
|
9
9
|
.resource-buttons
|
10
|
-
=
|
10
|
+
- url = @event.external_registration_url.presence || effective_events.new_event_event_registration_path(@event)
|
11
|
+
= link_to 'Register', url, class: 'btn btn-primary'
|
11
12
|
|
12
|
-
=
|
13
|
+
= card do
|
14
|
+
- if @event.file.attached?
|
15
|
+
= image_tag(@event.file)
|
16
|
+
|
17
|
+
= @event.body.to_s
|
18
|
+
|
19
|
+
%table.table.effective-events-table
|
20
|
+
%tbody
|
21
|
+
%tr
|
22
|
+
%th Dates
|
23
|
+
%td
|
24
|
+
Starts: #{@event.start_at&.strftime('%F %R')}
|
25
|
+
%br
|
26
|
+
Ends: #{@event.end_at&.strftime('%F %R')}
|
27
|
+
|
28
|
+
%tr
|
29
|
+
%th Registration Closes
|
30
|
+
%td= @event.registration_end_at.strftime('%F %R')
|
31
|
+
|
32
|
+
%tr
|
33
|
+
%th Early Bird
|
34
|
+
%td
|
35
|
+
Status: #{@event.early_bird_status}
|
36
|
+
%br
|
37
|
+
Ends: #{@event.early_bird_end_at&.strftime('%F %R')}
|
38
|
+
|
39
|
+
%tr
|
40
|
+
%th Tickets
|
41
|
+
%td
|
42
|
+
%ul.pl-3
|
43
|
+
- @event.event_tickets.each do |ticket|
|
44
|
+
%li= "#{ticket} (#{price_to_currency(ticket.price)})"
|
45
|
+
|
46
|
+
- if @event.event_products.present?
|
47
|
+
%tr
|
48
|
+
%th Add-ons
|
49
|
+
%td
|
50
|
+
%ul.pl-0
|
51
|
+
- @event.event_products.each do |product|
|
52
|
+
%li= "#{product} (#{price_to_currency(product.price)})"
|
data/config/effective_events.rb
CHANGED
@@ -19,6 +19,12 @@ EffectiveEvents.setup do |config|
|
|
19
19
|
# Events can be restricted by role
|
20
20
|
config.use_effective_roles = true
|
21
21
|
|
22
|
+
# Categories
|
23
|
+
config.categories = ['Events']
|
24
|
+
|
25
|
+
# Hint text for event images attachments
|
26
|
+
config.events_hint_text = 'Hint text that includes required image dimensions'
|
27
|
+
|
22
28
|
# Mailer Settings
|
23
29
|
# Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
|
24
30
|
#
|
data/config/routes.rb
CHANGED
@@ -7,6 +7,16 @@ end
|
|
7
7
|
EffectiveEvents::Engine.routes.draw do
|
8
8
|
# Public routes
|
9
9
|
scope module: 'effective' do
|
10
|
+
|
11
|
+
# Event Category routes
|
12
|
+
match 'events/:category', to: 'events#index', via: :get, constraints: lambda { |req|
|
13
|
+
EffectiveEvents.categories.map(&:parameterize).include?(req.params['category'])
|
14
|
+
}
|
15
|
+
|
16
|
+
match "events/:category/:id", to: 'events#show', via: :get, constraints: lambda { |req|
|
17
|
+
EffectiveEvents.categories.map(&:parameterize).include?(req.params['category'])
|
18
|
+
}
|
19
|
+
|
10
20
|
resources :events, only: [:index, :show] do
|
11
21
|
resources :event_registrations, only: [:new, :show, :destroy] do
|
12
22
|
resources :build, controller: :event_registrations, only: [:show, :update]
|
@@ -3,8 +3,11 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
3
3
|
create_table <%= @events_table_name %> do |t|
|
4
4
|
t.string :title
|
5
5
|
|
6
|
+
t.string :category
|
6
7
|
t.string :slug
|
8
|
+
|
7
9
|
t.boolean :draft, default: false
|
10
|
+
t.datetime :published_at
|
8
11
|
|
9
12
|
t.datetime :start_at
|
10
13
|
t.datetime :end_at
|
@@ -16,6 +19,9 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
16
19
|
t.integer :event_registrants_count, default: 0
|
17
20
|
t.integer :event_addons_count, default: 0
|
18
21
|
|
22
|
+
t.boolean :external_registration, default: false
|
23
|
+
t.string :external_registration_url
|
24
|
+
|
19
25
|
t.integer :roles_mask
|
20
26
|
t.boolean :authenticate_user, default: false
|
21
27
|
|
data/db/seeds.rb
CHANGED
data/lib/effective_events.rb
CHANGED
@@ -9,8 +9,8 @@ module EffectiveEvents
|
|
9
9
|
:events_table_name, :event_registrants_table_name, :event_tickets_table_name,
|
10
10
|
:event_registrations_table_name, :event_products_table_name, :event_addons_table_name,
|
11
11
|
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject, :use_effective_email_templates,
|
12
|
-
:layout, :per_page, :use_effective_roles,
|
13
|
-
:event_registration_class_name
|
12
|
+
:layout, :per_page, :use_effective_roles, :categories, :events_hint_text,
|
13
|
+
:event_registration_class_name
|
14
14
|
]
|
15
15
|
end
|
16
16
|
|
@@ -24,4 +24,8 @@ module EffectiveEvents
|
|
24
24
|
mailer&.constantize || Effective::EventsMailer
|
25
25
|
end
|
26
26
|
|
27
|
+
def categories
|
28
|
+
Array(config[:categories]) - [nil, false, '']
|
29
|
+
end
|
30
|
+
|
27
31
|
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.
|
4
|
+
version: 0.5.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: 2022-10-
|
11
|
+
date: 2022-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- app/models/effective/event_product.rb
|
223
223
|
- app/models/effective/event_registrant.rb
|
224
224
|
- app/models/effective/event_registration.rb
|
225
|
+
- app/models/effective/event_search.rb
|
225
226
|
- app/models/effective/event_ticket.rb
|
226
227
|
- app/views/admin/event_addons/_form.html.haml
|
227
228
|
- app/views/admin/event_notifications/_form.html.haml
|
@@ -251,8 +252,11 @@ files:
|
|
251
252
|
- app/views/effective/event_registrations/submitted.html.haml
|
252
253
|
- app/views/effective/event_registrations/summary.html.haml
|
253
254
|
- app/views/effective/event_registrations/tickets.html.haml
|
255
|
+
- app/views/effective/events/_categories.html.haml
|
254
256
|
- app/views/effective/events/_dashboard.html.haml
|
255
257
|
- app/views/effective/events/_event.html.haml
|
258
|
+
- app/views/effective/events/_form.html.haml
|
259
|
+
- app/views/effective/events/_layout.html.haml
|
256
260
|
- app/views/effective/events/index.html.haml
|
257
261
|
- app/views/effective/events/show.html.haml
|
258
262
|
- app/views/effective/events_mailer/event_registrant_purchased.liquid
|