effective_events 0.21.3 → 0.22.1
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/datatables/admin/effective_event_registrants_datatable.rb +1 -1
- 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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4ffee3a1a64a15a48d9e7ff3ce8eecd6b8f5759fccb0c886e9f943fd42f919
|
4
|
+
data.tar.gz: c184b3851caea22f826b685c4fc2a0db174f1b99a218f59deeb1edaad7a90694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 729e826bfdbe9b0287a87b00f2168791c7b861feb2cbd10e678706ea83876d1bdd638f6e6e18c90b8795bf9058b65c8c2396dda7e47901bfe5962e4071678fe7
|
7
|
+
data.tar.gz: acf5fc1714ad5b37e9ebf9b0aa56dc3eaf83129059d54a5a9cf16da2edb4f2127cb35ca317d521e14fb171717ba2d95851fb7ea7b17aa1df6c81ec041dbf0caf
|
@@ -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|
|
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.22.1
|
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-10-
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|