effective_pages 3.11.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f608a5aa1318fab93ca116d9edea04aeb3a2077ecbcd41378dad81b3fb3018a5
4
- data.tar.gz: 803a6fbc21a969464faf8d149b724d1a65b1b970e2a4b2e5ac57ddd17cf02e87
3
+ metadata.gz: a415e3b0c2a07052c1c2be02f5444637ce620debf117d680939a0ed57dffc4c0
4
+ data.tar.gz: aa71beffd9b9b95c841a329c19e6813d6f860dad393e6a0dfddd1150420c7de8
5
5
  SHA512:
6
- metadata.gz: 482a07502489d6b6e6494bc6bf17f5b17c82ee05a68f500b85a33d380b71abc49074c371f556816b60142f131d523f46a3f66271c0ea69094dda69fb147523aa
7
- data.tar.gz: dd26dfe9186dc3d1e8408f42967431a3e94d8db2882d8c96f7d53deb9103bb8af0888ccbd5bd247c52a5ba99ff9f0caf8d141caa037d478d5cb5aa98fee64e0b
6
+ metadata.gz: a93466db870f0d256d864c49ca2cec4f21e644198c05959490b6918a45ecfc83da350a94d68f669dc94cdf00e1b7d6a85ecfd769d7904e6a4f1d2cb070e16654
7
+ data.tar.gz: 24407df9909682c9cf3d781625e84b9eb0037b33a5da778541b8b8fed9f5988cd8dec5c2da1300387778d00ace3b36101a7a2548eb4863dc12ce62aad749299f
@@ -20,7 +20,10 @@ class EffectivePagesDatatable < Effective::Datatable
20
20
  link_to(page.slug, effective_pages.page_path(page), target: '_blank')
21
21
  end
22
22
 
23
- col :draft
23
+ col :draft?, as: :boolean, visible: false
24
+ col :published?, as: :boolean
25
+ col :published_start_at
26
+ col :published_end_at
24
27
 
25
28
  col :layout, visible: false
26
29
  col :tempate, visible: false
@@ -19,19 +19,21 @@ module Effective
19
19
  has_many :menu_children, -> { Effective::Page.menuable }, class_name: 'Effective::Page',
20
20
  foreign_key: :menu_parent_id, inverse_of: :menu_parent
21
21
 
22
- acts_as_role_restricted
23
- acts_as_paginable if respond_to?(:acts_as_paginable) # Effective Resources
22
+ acts_as_role_restricted if respond_to?(:acts_as_role_restricted)
23
+ acts_as_paginable
24
+ acts_as_published
24
25
  acts_as_slugged
25
26
  acts_as_tagged
26
27
  has_many_rich_texts
27
-
28
28
  log_changes if respond_to?(:log_changes)
29
29
 
30
30
  effective_resource do
31
31
  title :string
32
32
  meta_description :string
33
33
 
34
- draft :boolean
34
+ published_start_at :datetime
35
+ published_end_at :datetime
36
+ legacy_draft :boolean # No longer used. To be removed.
35
37
 
36
38
  layout :string
37
39
  template :string
@@ -68,9 +70,6 @@ module Effective
68
70
  }
69
71
 
70
72
  scope :deep_menuable, -> { includes(:menu_parent, menu_children: [:menu_parent, :menu_children]) }
71
-
72
- scope :draft, -> { where(draft: true) }
73
- scope :published, -> { where(draft: false) }
74
73
  scope :sorted, -> { order(:title) }
75
74
 
76
75
  scope :on_menu, -> { where(menu: true) }
@@ -154,10 +153,6 @@ module Effective
154
153
  rich_text_sidebar
155
154
  end
156
155
 
157
- def published?
158
- !draft?
159
- end
160
-
161
156
  # Returns a duplicated post object, or throws an exception
162
157
  def duplicate
163
158
  Page.new(attributes.except('id', 'updated_at', 'created_at')).tap do |page|
@@ -168,7 +163,7 @@ module Effective
168
163
  page.send("rich_text_#{rt.name}=", rt.body)
169
164
  end
170
165
 
171
- page.draft = true
166
+ page.assign_attributes(published_start_at: nil, published_end_at: nil)
172
167
  end
173
168
  end
174
169
 
@@ -2,8 +2,15 @@
2
2
 
3
3
  = f.text_field :title
4
4
 
5
- = f.check_box :draft,
6
- label: 'Save this page as a draft. It will not appear in a menu and can only be accessed by admin users.'
5
+ -# acts_as_published
6
+ = f.hide_if(:save_as_draft, true) do
7
+ .row
8
+ .col-md-6
9
+ = f.datetime_field :published_start_at, hint: 'The page will be available starting on this date and time.'
10
+ .col-md-6
11
+ = f.datetime_field :published_end_at, hint: 'The page will no longer be available after this date and time. Leave blank for no end date.', date_linked: false
12
+
13
+ = f.check_box :save_as_draft, label: "Save as a draft. It will not appear in a menu and can only be accessed by admin users."
7
14
 
8
15
  = f.text_field :meta_description,
9
16
  hint: "150 character summary. Appears on Google search results underneath the page title. ",
@@ -6,7 +6,9 @@ class CreateEffectivePages < ActiveRecord::Migration[6.0]
6
6
  t.string :title
7
7
  t.string :meta_description
8
8
 
9
- t.boolean :draft, default: false
9
+ t.datetime :published_start_at
10
+ t.datetime :published_end_at
11
+ t.boolean :legacy_draft, default: false
10
12
 
11
13
  t.string :layout, default: 'application'
12
14
  t.string :template
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.11.0'.freeze
2
+ VERSION = '3.12.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.12.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-27 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails