effective_events 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b35f3042e9e99875c91066ad1c6cd8c70e601dfc4abc72e0b32632c683523371
4
- data.tar.gz: db5f82e191ab087d2b052fb2426c0204a2d8ef0e19b2f4a6f4720aed2d6f1d91
3
+ metadata.gz: 146d98c901aee1e581e5f34ab7e92d67e7e1f96baf2d3c6be875c99cf58de1a1
4
+ data.tar.gz: 93654dfa9d54f6a4b5be26a31a3462fcab075408c82e8f882a07a0b1081bf0a0
5
5
  SHA512:
6
- metadata.gz: b00e8a6173d55548bbc2b72048b7bab6f724f7655cd6d78dd40eb9bbaa336eba428918b5961882f0d9af1ce688d60aeb2530657bbb1fac24733e43ba0c64552c
7
- data.tar.gz: 79d0a3ec08ce158f5d65115f4d1f5d516eb2992f384e3b63c25e6026410b8f43134b9605bb811e15c7afae075adf58c73138159754f0e060f012e1a46dff5557
6
+ metadata.gz: 6d2eb4b943572972ab938d8b2223c162ad87c99dfaa36f48f88d8412e9a4fcbeaca82f928523d72a4d20fd49f37ba1cd6c00453b512d1c49e9d9d6a65af394f8
7
+ data.tar.gz: c09166658be072cb49804dbc12fe7357caeefcfd1f9d1381089789ed767df9af9e5f1377187a726ea6b7743263a946b24c7882c1ef57a9d80cc599cf6547e506
@@ -6,7 +6,7 @@ module Effective
6
6
 
7
7
  if defined?(PgSearch)
8
8
  include PgSearch::Model
9
- multisearchable against: [:body]
9
+ multisearchable against: [:title, :body]
10
10
  end
11
11
 
12
12
  has_many :event_tickets, -> { EventTicket.sorted }, inverse_of: :event, dependent: :destroy
@@ -214,6 +214,14 @@ module Effective
214
214
  event_tickets.none? { |event_ticket| event_ticket_available?(event_ticket, except: except, quantity: 1) }
215
215
  end
216
216
 
217
+ def upcoming?
218
+ end_at > Time.zone.now
219
+ end
220
+
221
+ def past?
222
+ end_at < Time.zone.now
223
+ end
224
+
217
225
  def early_bird?
218
226
  return false if early_bird_end_at.blank?
219
227
  early_bird_end_at > Time.zone.now
@@ -55,27 +55,30 @@ 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
-
61
58
  # Filter by term
62
59
  if term.present?
63
60
  events = Effective::Resource.new(events).search_any(term)
64
61
  end
65
62
 
66
- # Filter by category
67
- if category.present? && category != 'past'
68
- events = events.where(category: category)
63
+ # Filter by upcoming or past and then apply default sorting
64
+ if category.present?
65
+ if category == 'past'
66
+ events = events.past.sorted
67
+ else
68
+ events = events.where(category: category).sorted
69
+ end
70
+ else
71
+ events = events.upcoming.reorder(start_at: :asc)
69
72
  end
70
73
 
71
- # Apply Sorting
74
+ # Apply sorting from the search form
72
75
  events = case order.to_s
73
76
  when 'Sort by Published Date'
74
77
  events.reorder(published_start_at: :asc)
75
78
  when 'Sort by Event Date'
76
79
  events.reorder(start_at: :asc)
77
80
  else
78
- events.reorder(start_at: :asc) # Default Sort by Event Date
81
+ events
79
82
  end
80
83
 
81
84
  events
@@ -1,10 +1,14 @@
1
1
  .row.mb-5.effective-events{class: "effective-events-#{event.category.to_s.parameterize}"}
2
- - if event.file.present?
2
+ - # Do not show banners for past events
3
+ - if event.file.attached? && event.upcoming?
3
4
  .col-lg-4
4
5
  = link_to effective_events.event_path(event) do
5
6
  = image_tag url_for(event.file), class: "effective-events-image d-none d-lg-flex align-self-start", alt: event.title, width: "350", height: "220"
6
7
 
7
8
  .col
9
+ - if event.past?
10
+ .badge.badge-primary.badge-event.mb-2 Past Event
11
+
8
12
  - if event.category.present? && EffectiveEvents.categories.length > 1
9
13
  = link_to(event.category, effective_events.events_path + '/' + event.category.parameterize, class: "badge badge-primary badge-event mb-2 effective-events-#{event.category.parameterize}")
10
14
 
@@ -1,7 +1,7 @@
1
- .effective-event-sidebar
1
+ .effective-event-sidebar.font-weight-bold.text-center.text-lg-left
2
2
  %ul.nav.flex-column{role: 'navigation'}
3
3
  = nav_link_to("Upcoming #{ets(Effective::Event)}", effective_events.events_path, class: "effective-event-all")
4
4
  = nav_link_to("Past #{ets(Effective::Event)}", effective_events.events_path + '/past', class: "effective-event-past")
5
5
 
6
- - EffectiveEvents.categories.each do |category|
6
+ - EffectiveEvents.categories.sort.each do |category|
7
7
  = nav_link_to(category, effective_events.events_path + '/' + category.parameterize, class: "effective-event-#{category.parameterize}")
@@ -1,11 +1,11 @@
1
1
  = render 'layout' do
2
2
  .row
3
3
  - if EffectiveEvents.categories.length > 1
4
- .d-none.d-lg-block.col-lg-3
4
+ .d-lg-block.col-lg-3.order-2.order-lg-1
5
5
  -#= render('effective/events/form', event_search: @event_search)
6
6
  = render('effective/events/sidebar')
7
7
 
8
- .col
8
+ .col.order-1.order-lg-2
9
9
  %h1.effective-title.mb-4= @page_title
10
10
 
11
11
  - results = @event_search.results(page: params[:page])
@@ -15,5 +15,5 @@
15
15
  - else
16
16
  = render(results) # This renders effective/events/event
17
17
 
18
- %nav.d-flex.justify-content-center
18
+ %nav.d-flex.justify-content-center.mb-4
19
19
  = bootstrap_paginate(results, per_page: @event_search.per_page)
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.23.0'.freeze
2
+ VERSION = '0.24.0'.freeze
3
3
  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.23.0
4
+ version: 0.24.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-08 00:00:00.000000000 Z
11
+ date: 2024-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails