effective_events 0.21.3 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/effective_events/base.scss +3 -0
- data/app/controllers/effective/events_controller.rb +10 -4
- data/app/models/effective/event.rb +1 -0
- data/app/models/effective/event_search.rb +5 -2
- data/app/views/effective/events/_sidebar.html.haml +2 -1
- data/config/routes.rb +1 -1
- data/lib/effective_events/version.rb +1 -1
- 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: 2ffd423f757ef4a0b0135bc467e8c98c46c340013b6afb6b360b9ac7c9d31dd0
|
4
|
+
data.tar.gz: 8f922c163d69b87d29d01544dbcc183004642a5828a0dd82f83a734cc13997db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed5b26cf2b8439c5758f3239bcf0ad2fc1de166aa56e5983837c2c5e627e8ce50dd676b08b99675ebafc7eceaf88bb03cf2fd5e17c5912214250d1a2f8223423
|
7
|
+
data.tar.gz: 683aff5ed150fb225e481d5c45701e7651e1691f0ac7d9cac0f54387f4b437f481ef707ced4f6b4adc696fc2423e153820e0d1c5e82b8f8c7e7ed44d662c7f0a
|
@@ -8,13 +8,19 @@ module Effective
|
|
8
8
|
}
|
9
9
|
|
10
10
|
def index
|
11
|
-
|
11
|
+
EffectiveResources.authorize!(self, :index, Effective::Event)
|
12
|
+
|
13
|
+
# Page Title
|
14
|
+
if event_category.blank?
|
15
|
+
@page_title = "Upcoming #{EffectiveResources.ets(Effective::Event)}"
|
16
|
+
elsif event_category == 'past'
|
17
|
+
@page_title = "Past #{EffectiveResources.ets(Effective::Event)}"
|
18
|
+
elsif event_category.present?
|
12
19
|
@page_title = event_category
|
13
20
|
@event_category = event_category
|
14
21
|
else
|
15
|
-
@page_title
|
22
|
+
@page_title = view_context.events_name_label
|
16
23
|
end
|
17
|
-
EffectiveResources.authorize!(self, :index, Effective::Event)
|
18
24
|
|
19
25
|
# Sometimes we just display a Datatable for the events
|
20
26
|
@datatable = EffectiveResources.best('EffectiveEventsDatatable').new
|
@@ -57,7 +63,7 @@ module Effective
|
|
57
63
|
|
58
64
|
def event_category
|
59
65
|
return nil unless params[:category].present?
|
60
|
-
EffectiveEvents.categories.find { |category| category.parameterize == params[:category] }
|
66
|
+
(Array(EffectiveEvents.categories) + ['past']).find { |category| category.parameterize == params[:category] }
|
61
67
|
end
|
62
68
|
|
63
69
|
def search_params
|
@@ -147,6 +147,7 @@ module Effective
|
|
147
147
|
validates :delayed_payment, inclusion: { in: [false], message: "cannot be used for external registration events" }, if: -> { external_registration? }
|
148
148
|
validates :delayed_payment_date, presence: true, if: -> { delayed_payment? }
|
149
149
|
validates :delayed_payment_date, absence: true, unless: -> { delayed_payment? }
|
150
|
+
validates :slug, exclusion: { in: Array(EffectiveEvents.categories) + ['past'], message: "must not match a category name or past" }
|
150
151
|
|
151
152
|
validate(if: -> { start_at && end_at }) do
|
152
153
|
errors.add(:end_at, 'must be after start date') unless start_at < end_at
|
@@ -16,7 +16,7 @@ module Effective
|
|
16
16
|
|
17
17
|
# Base collection to search.
|
18
18
|
def collection
|
19
|
-
Event.events(user: current_user, unpublished: unpublished)
|
19
|
+
Event.events(user: current_user, unpublished: unpublished)
|
20
20
|
end
|
21
21
|
|
22
22
|
def per_page
|
@@ -55,13 +55,16 @@ module Effective
|
|
55
55
|
events = collection()
|
56
56
|
raise('expected an ActiveRecord collection') unless events.kind_of?(ActiveRecord::Relation)
|
57
57
|
|
58
|
+
# Filter by upcoming or past
|
59
|
+
events = (category == 'past') ? events.past : events.upcoming
|
60
|
+
|
58
61
|
# Filter by term
|
59
62
|
if term.present?
|
60
63
|
events = Effective::Resource.new(events).search_any(term)
|
61
64
|
end
|
62
65
|
|
63
66
|
# Filter by category
|
64
|
-
if category.present?
|
67
|
+
if category.present? && category != 'past'
|
65
68
|
events = events.where(category: category)
|
66
69
|
end
|
67
70
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
.effective-event-sidebar
|
2
2
|
%ul.nav.flex-column{role: 'navigation'}
|
3
|
-
= nav_link_to(
|
3
|
+
= nav_link_to("Upcoming #{ets(Effective::Event)}", effective_events.events_path, class: "effective-event-all")
|
4
|
+
= nav_link_to("Past #{ets(Effective::Event)}", effective_events.events_path + '/past', class: "effective-event-past")
|
4
5
|
|
5
6
|
- EffectiveEvents.categories.each do |category|
|
6
7
|
= nav_link_to(category, effective_events.events_path + '/' + category.parameterize, class: "effective-event-#{category.parameterize}")
|
data/config/routes.rb
CHANGED
@@ -10,7 +10,7 @@ EffectiveEvents::Engine.routes.draw do
|
|
10
10
|
|
11
11
|
# Event Category routes
|
12
12
|
match 'events/:category', to: 'events#index', via: :get, constraints: lambda { |req|
|
13
|
-
EffectiveEvents.categories.map(&:parameterize).include?(req.params['category'])
|
13
|
+
(EffectiveEvents.categories.map(&:parameterize) + ['past']).include?(req.params['category'])
|
14
14
|
}
|
15
15
|
|
16
16
|
match "events/:category/:id", to: 'events#show', via: :get, constraints: lambda { |req|
|