effective_events 0.15.1 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_events_datatable.rb +7 -2
- data/app/models/effective/event.rb +8 -16
- data/app/views/admin/events/_form_event.html.haml +10 -4
- data/db/migrate/101_create_effective_events.rb +3 -2
- data/db/seeds.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: ecc4eb59591259776d458e3fc0d6328ba9790249e07d1ad9409d95a4eb18871b
|
4
|
+
data.tar.gz: f85c9a53cfea60042cc37b81956186f6c2ad943ae3a2e2b001225176e9966ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c83eddb719ba7e8d32d91f4be0474d76a224ca6980bce71d12cbe60bfe737774eb3b20ac005c6a870777f96946bb6e212ddf9693e80ed152728c6a87e0cd5fe
|
7
|
+
data.tar.gz: 7d5809a96b668b4a2afd459e894216d6077a64e444dba188ec615030dda1a68d076f8759e017cb23424f38840c43be1833070fabc939b3330a5b43ade9475f14
|
@@ -4,7 +4,7 @@ module Admin
|
|
4
4
|
scope :all
|
5
5
|
scope :registerable
|
6
6
|
scope :published
|
7
|
-
scope :
|
7
|
+
scope :draft
|
8
8
|
scope :upcoming
|
9
9
|
scope :past
|
10
10
|
end
|
@@ -19,7 +19,12 @@ module Admin
|
|
19
19
|
end
|
20
20
|
|
21
21
|
col :slug, visible: false
|
22
|
-
|
22
|
+
|
23
|
+
col :draft?, as: :boolean, visible: false
|
24
|
+
col :published?, as: :boolean
|
25
|
+
col :published_start_at
|
26
|
+
col :published_end_at
|
27
|
+
|
23
28
|
col :start_at, label: 'Start', visible: false
|
24
29
|
col :end_at, label: 'End', visible: false
|
25
30
|
col :excerpt, visible: false
|
@@ -41,10 +41,11 @@ module Effective
|
|
41
41
|
|
42
42
|
has_one_attached :file
|
43
43
|
|
44
|
+
acts_as_role_restricted if respond_to?(:acts_as_role_restricted)
|
45
|
+
acts_as_published
|
44
46
|
acts_as_slugged
|
45
|
-
log_changes if respond_to?(:log_changes)
|
46
47
|
acts_as_tagged if respond_to?(:acts_as_tagged)
|
47
|
-
|
48
|
+
log_changes if respond_to?(:log_changes)
|
48
49
|
|
49
50
|
effective_resource do
|
50
51
|
title :string
|
@@ -52,8 +53,9 @@ module Effective
|
|
52
53
|
category :string
|
53
54
|
slug :string
|
54
55
|
|
55
|
-
|
56
|
-
|
56
|
+
published_start_at :datetime
|
57
|
+
published_end_at :datetime
|
58
|
+
legacy_draft :boolean # No longer used. To be removed.
|
57
59
|
|
58
60
|
start_at :datetime
|
59
61
|
end_at :datetime
|
@@ -87,9 +89,6 @@ module Effective
|
|
87
89
|
base
|
88
90
|
}
|
89
91
|
|
90
|
-
scope :published, -> { where(draft: false).where(arel_table[:published_at].lt(Time.zone.now)) }
|
91
|
-
scope :unpublished, -> { where(draft: true).or(where(arel_table[:published_at].gteq(Time.zone.now))) }
|
92
|
-
|
93
92
|
scope :upcoming, -> { where(arel_table[:end_at].gt(Time.zone.now)) }
|
94
93
|
scope :past, -> { where(arel_table[:end_at].lteq(Time.zone.now)) }
|
95
94
|
|
@@ -136,7 +135,6 @@ module Effective
|
|
136
135
|
scope :delayed_payment_date_upcoming, -> { delayed.where(arel_table[:delayed_payment_date].gt(Time.zone.today)) }
|
137
136
|
|
138
137
|
validates :title, presence: true, length: { maximum: 255 }
|
139
|
-
validates :published_at, presence: true, unless: -> { draft? }
|
140
138
|
validates :start_at, presence: true
|
141
139
|
validates :end_at, presence: true
|
142
140
|
validates :external_registration_url, url: true
|
@@ -196,13 +194,6 @@ module Effective
|
|
196
194
|
event_tickets.any? { |et| et.waitlist? }
|
197
195
|
end
|
198
196
|
|
199
|
-
def published?
|
200
|
-
return false if draft?
|
201
|
-
return false if published_at.blank?
|
202
|
-
|
203
|
-
published_at < Time.zone.now
|
204
|
-
end
|
205
|
-
|
206
197
|
def registerable?
|
207
198
|
return false unless published?
|
208
199
|
return false if closed?
|
@@ -247,10 +238,11 @@ module Effective
|
|
247
238
|
Event.new(attributes.except('id', 'updated_at', 'created_at')).tap do |event|
|
248
239
|
event.title = event.title + ' (Copy)'
|
249
240
|
event.slug = event.slug + '-copy'
|
250
|
-
event.draft = true
|
251
241
|
|
252
242
|
event.rich_text_body = rich_text_body
|
253
243
|
event.rich_text_excerpt = rich_text_excerpt
|
244
|
+
|
245
|
+
event.assign_attributes(published_start_at: nil, published_end_at: nil)
|
254
246
|
end
|
255
247
|
end
|
256
248
|
|
@@ -1,6 +1,16 @@
|
|
1
1
|
= effective_form_with(model: [:admin, event], engine: true) do |f|
|
2
2
|
= f.text_field :title, label: "Title"
|
3
3
|
|
4
|
+
-# acts_as_published
|
5
|
+
= f.hide_if(:save_as_draft, true) do
|
6
|
+
.row
|
7
|
+
.col-md-6
|
8
|
+
= f.datetime_field :published_start_at, hint: 'The event will be available starting on this date and time.'
|
9
|
+
.col-md-6
|
10
|
+
= f.datetime_field :published_end_at, hint: 'The event will no longer be available after this date and time. Leave blank for no end date.', date_linked: false
|
11
|
+
|
12
|
+
= f.check_box :save_as_draft, label: "Save as a draft. It will not appear on the website and can only be accessed by admin users."
|
13
|
+
|
4
14
|
- if f.object.persisted? || f.object.errors.include?(:slug)
|
5
15
|
- current_url = (effective_events.event_url(f.object) rescue nil)
|
6
16
|
= f.text_field :slug, hint: "The slug controls this event's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This event is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url }".html_safe
|
@@ -14,10 +24,6 @@
|
|
14
24
|
- if event.class.respond_to?(:acts_as_tagged?)
|
15
25
|
= render 'effective/tags/fields', f: f
|
16
26
|
|
17
|
-
= f.check_box :draft, hint: 'Save this event as a draft. It will not be accessible on the website.'
|
18
|
-
.row
|
19
|
-
.col-md-6= f.datetime_field :published_at, label: 'Publish date', hint: 'When should this be displayed on the website.'
|
20
|
-
|
21
27
|
.row
|
22
28
|
.col-md-6= f.datetime_field :start_at, label: "Event Start"
|
23
29
|
.col-md-6= f.datetime_field :end_at, label: "Event End"
|
@@ -6,8 +6,9 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
|
|
6
6
|
t.string :category
|
7
7
|
t.string :slug
|
8
8
|
|
9
|
-
t.
|
10
|
-
t.datetime :
|
9
|
+
t.datetime :published_start_at
|
10
|
+
t.datetime :published_end_at
|
11
|
+
t.boolean :legacy_draft, default: false
|
11
12
|
|
12
13
|
t.datetime :start_at
|
13
14
|
t.datetime :end_at
|
data/db/seeds.rb
CHANGED
@@ -13,7 +13,7 @@ event = Effective::Event.create!(
|
|
13
13
|
rich_text_excerpt: '<p>This is a great event</p>',
|
14
14
|
rich_text_body: '<p>This is a really great event!</p>',
|
15
15
|
|
16
|
-
|
16
|
+
published_start_at: Time.zone.now,
|
17
17
|
start_at: (now + 1.week),
|
18
18
|
end_at: (now + 1.week + 1.hour),
|
19
19
|
|
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.16.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-06-
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|