effective_events 0.22.2 → 0.23.1

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: f3b9faa624904b433109451d6e7a064141af823256bc6482091e3edfe5cfe877
4
- data.tar.gz: a55f320e5007311f0c53ab662642b5192b6f9310fdb40e8171f6f6119d0546e7
3
+ metadata.gz: ac58bdfbd54d957533cc8ccc62152fd17b4d123133d55e7599159d4c495c690f
4
+ data.tar.gz: 3fe705a1de037e35954d50bd0e5ad1092968f373cdc098bbe6ea69a1d5b742e5
5
5
  SHA512:
6
- metadata.gz: e26a9f437b4f21a3a74f6fa666cb602927ecdd22334ea1151761cbc750b6fafa0aefc6f6fc4b616b8b84742aa62359eeb351d79b74656c5bdaea9db4bf423608
7
- data.tar.gz: c7e80b197ccb38b79f9f5f21c5c63247b259a0e728aea20dd148d6b78cee077983f764f9740d8aaf7fa04a4363836009ded9f764a970f64ec53c615640d2f0c2
6
+ metadata.gz: 6eb6bc3ac0e9c42265e2b3c7493ec91029eda738f3608ccf1c0d1cf2255fc20d42b8bfb2ab8a55695692fafd795a34977bcf7aa011ec914369e217ccf9657a10
7
+ data.tar.gz: 60da0662095d319488c227d631d2b80bd4404dacfdde8418508568da51cfb310254d3e3683abcfb933112fcdc0d89f3cab2d1d8795166e53383546d2f41e4f07
@@ -1,11 +1,12 @@
1
1
  module Admin
2
2
  class EffectiveEventAddonsDatatable < Effective::Datatable
3
3
  filters do
4
- scope :unarchived, label: "All"
5
- scope :purchased
4
+ scope :registered
5
+ scope :purchased_or_created_by_admin, label: 'Purchased'
6
6
  scope :deferred
7
- scope :not_purchased
7
+ scope :not_purchased_not_created_by_admin, label: 'Not Purchased'
8
8
  scope :archived
9
+ scope :all
9
10
  end
10
11
 
11
12
  datatable do
@@ -36,7 +37,7 @@ module Admin
36
37
  end
37
38
 
38
39
  collection do
39
- scope = Effective::EventAddon.deep.registered.includes(:purchased_order, :owner)
40
+ scope = Effective::EventAddon.deep.includes(:purchased_order, :owner)
40
41
 
41
42
  if attributes[:event_id].present?
42
43
  scope = scope.where(event: event)
@@ -30,17 +30,17 @@ module Admin
30
30
  col :capacity, visible: false
31
31
  col :capacity_available, visible: false
32
32
 
33
- col :registered_event_addons, label: 'Registered Names' do |product|
34
- product.registered_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
35
- content_tag(:div, addon.name.to_s, class: 'col-resource_item')
36
- end.join.html_safe
37
- end
38
-
39
- col :purchased_event_addons, label: 'Purchased Names', visible: false do |product|
40
- product.purchased_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
41
- content_tag(:div, addon.name.to_s, class: 'col-resource_item')
42
- end.join.html_safe
43
- end
33
+ # col :registered_event_addons, label: 'Registered Names' do |product|
34
+ # product.registered_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
35
+ # content_tag(:div, addon.name.to_s, class: 'col-resource_item')
36
+ # end.join.html_safe
37
+ # end
38
+
39
+ # col :purchased_event_addons, label: 'Purchased Names', visible: false do |product|
40
+ # product.purchased_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
41
+ # content_tag(:div, addon.name.to_s, class: 'col-resource_item')
42
+ # end.join.html_safe
43
+ # end
44
44
 
45
45
  actions_col
46
46
  end
@@ -1,12 +1,12 @@
1
1
  module Admin
2
2
  class EffectiveEventRegistrantsDatatable < Effective::Datatable
3
3
  filters do
4
- scope :unarchived, label: "All"
5
4
  scope :registered
6
- scope :purchased
5
+ scope :purchased_or_created_by_admin, label: 'Purchased'
7
6
  scope :deferred
8
- scope :not_purchased
7
+ scope :not_purchased_not_created_by_admin, label: 'Not Purchased'
9
8
  scope :archived
9
+ scope :all
10
10
  end
11
11
 
12
12
  datatable do
@@ -60,7 +60,15 @@ module Admin
60
60
  col :organization, visible: false
61
61
 
62
62
  col :orders, visible: false
63
- col :price, as: :price
63
+
64
+ col(:price, as: :price) do |registrant|
65
+ [
66
+ (badge('ADMIN') if registrant.created_by_admin?),
67
+ price_to_currency(registrant.price)
68
+ ].compact.join(' ').html_safe
69
+ end
70
+
71
+ col :created_by_admin, visible: false
64
72
 
65
73
  col :first_name, visible: false
66
74
  col :last_name, visible: false
@@ -37,15 +37,15 @@ module Admin
37
37
  col :category, visible: false
38
38
 
39
39
  col :registered_event_registrants_count, label: 'Registered' do |event|
40
- event.event_registrants.registered.unarchived.count
40
+ event.event_registrants.registered.count
41
41
  end
42
42
 
43
43
  col :purchased_event_registrants_count, label: 'Deferred', visible: false do |event|
44
- event.event_registrants.deferred.unarchived.count
44
+ event.event_registrants.deferred.count
45
45
  end
46
46
 
47
47
  col :purchased_event_registrants_count, label: 'Purchased', visible: false do |event|
48
- event.event_registrants.purchased.unarchived.count
48
+ event.event_registrants.purchased.count
49
49
  end
50
50
 
51
51
 
@@ -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
@@ -32,6 +32,8 @@ module Effective
32
32
 
33
33
  archived :boolean
34
34
 
35
+ created_by_admin :boolean
36
+
35
37
  # Acts as Purchasable
36
38
  price :integer
37
39
  qb_item_name :string
@@ -42,7 +44,9 @@ module Effective
42
44
 
43
45
  scope :sorted, -> { order(:id) }
44
46
  scope :deep, -> { includes(:event, :event_product) }
45
- scope :registered, -> { purchased_or_deferred }
47
+ scope :registered, -> { purchased_or_deferred.or(where(created_by_admin: true)) }
48
+ scope :purchased_or_created_by_admin, -> { purchased.or(unarchived.where(created_by_admin: true)) }
49
+ scope :not_purchased_not_created_by_admin, -> { not_purchased.where(created_by_admin: false) }
46
50
 
47
51
  before_validation(if: -> { event_registration.present? }) do
48
52
  self.event ||= event_registration.event
@@ -55,6 +55,8 @@ module Effective
55
55
 
56
56
  archived :boolean
57
57
 
58
+ created_by_admin :boolean
59
+
58
60
  # Acts as Purchasable
59
61
  price :integer
60
62
  qb_item_name :string
@@ -69,7 +71,9 @@ module Effective
69
71
 
70
72
  scope :sorted, -> { order(:event_ticket_id, :id) }
71
73
  scope :deep, -> { includes(:event, :event_ticket, :owner) }
72
- scope :registered, -> { where.not(registered_at: nil) }
74
+ scope :registered, -> { unarchived.where.not(registered_at: nil) }
75
+ scope :purchased_or_created_by_admin, -> { purchased.or(unarchived.where(created_by_admin: true)) }
76
+ scope :not_purchased_not_created_by_admin, -> { not_purchased.where(created_by_admin: false) }
73
77
 
74
78
  before_validation(if: -> { event_registration.present? }) do
75
79
  self.event ||= event_registration.event
@@ -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
@@ -95,7 +95,7 @@ module Effective
95
95
  raise('expected except to be an EventRegistration') if except && !except.class.try(:effective_events_event_registration?)
96
96
 
97
97
  event_registrants.select do |er|
98
- (er.registered? || er.selected_not_expired?) && (except.blank? || er.event_registration_id != except.id)
98
+ (er.registered? || er.selected_not_expired?) && (except.blank? || er.event_registration_id != except.id) && !er.archived?
99
99
  end
100
100
  end
101
101
 
@@ -23,6 +23,9 @@
23
23
 
24
24
  = f.check_box :archived, label: "Archive this addon. It will be displayed as archived on the owner's event registration"
25
25
 
26
+ - if f.object.new_record?
27
+ = f.hidden_field :created_by_admin, value: true
28
+
26
29
  - if f.object.new_record?
27
30
  = f.submit 'Save and Mark Registered'
28
31
  - else
@@ -37,4 +37,7 @@
37
37
 
38
38
  = f.check_box :archived, label: "Archive this registrant. It will be displayed as archived on the owner's event registration"
39
39
 
40
+ - if f.object.new_record?
41
+ = f.hidden_field :created_by_admin, value: true
42
+
40
43
  = f.submit 'Save'
@@ -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)
@@ -105,6 +105,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
105
105
  t.integer :price
106
106
 
107
107
  t.boolean :archived, default: false
108
+ t.boolean :created_by_admin, default: false
108
109
 
109
110
  t.timestamps
110
111
  end
@@ -146,6 +147,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
146
147
  t.integer :price
147
148
 
148
149
  t.boolean :archived, default: false
150
+ t.boolean :created_by_admin, default: false
149
151
 
150
152
  t.timestamps
151
153
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.22.2'.freeze
2
+ VERSION = '0.23.1'.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.22.2
4
+ version: 0.23.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-31 00:00:00.000000000 Z
11
+ date: 2024-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails