effective_pages 3.10.3 → 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 +4 -4
- data/app/controllers/effective/permalinks_controller.rb +4 -2
- data/app/datatables/effective_pages_datatable.rb +4 -1
- data/app/datatables/effective_permalinks_datatable.rb +11 -2
- data/app/models/effective/page.rb +7 -12
- data/app/models/effective/permalink.rb +1 -0
- data/app/views/admin/pages/_form_page.html.haml +9 -2
- data/app/views/admin/permalinks/_form.html.haml +8 -2
- data/config/routes.rb +1 -1
- data/db/migrate/101_create_effective_pages.rb +4 -1
- data/lib/effective_pages/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: a415e3b0c2a07052c1c2be02f5444637ce620debf117d680939a0ed57dffc4c0
|
4
|
+
data.tar.gz: aa71beffd9b9b95c841a329c19e6813d6f860dad393e6a0dfddd1150420c7de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a93466db870f0d256d864c49ca2cec4f21e644198c05959490b6918a45ecfc83da350a94d68f669dc94cdf00e1b7d6a85ecfd769d7904e6a4f1d2cb070e16654
|
7
|
+
data.tar.gz: 24407df9909682c9cf3d781625e84b9eb0037b33a5da778541b8b8fed9f5988cd8dec5c2da1300387778d00ace3b36101a7a2548eb4863dc12ce62aad749299f
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module Effective
|
2
2
|
class PermalinksController < ApplicationController
|
3
|
-
|
3
|
+
include Effective::CrudController
|
4
|
+
|
5
|
+
def show
|
4
6
|
@permalink = Effective::Permalink.find_by! slug: params[:slug]
|
5
7
|
|
6
|
-
authorize! :
|
8
|
+
authorize! :show, @permalink
|
7
9
|
|
8
10
|
redirect_to redirect_path_for(@permalink), allow_other_host: (@permalink.target == :url)
|
9
11
|
end
|
@@ -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
|
@@ -5,9 +5,18 @@ class EffectivePermalinksDatatable < Effective::Datatable
|
|
5
5
|
col :updated_at, visible: false
|
6
6
|
|
7
7
|
col :title
|
8
|
-
|
8
|
+
|
9
|
+
col(:url) do |permalink|
|
10
|
+
url = (root_url + "link/" + permalink.slug)
|
11
|
+
link_to(url, url, target: '_blank')
|
12
|
+
end
|
13
|
+
|
9
14
|
col :summary
|
10
|
-
|
15
|
+
|
16
|
+
col :slug, visible: false
|
17
|
+
col :tags, visible: false
|
18
|
+
|
19
|
+
col :tracks_count, label: 'Views'
|
11
20
|
|
12
21
|
actions_col
|
13
22
|
end
|
@@ -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
|
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
|
-
|
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.
|
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
|
-
|
6
|
-
|
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. ",
|
@@ -3,5 +3,11 @@
|
|
3
3
|
= render '/admin/permalinks/form_permalink', permalink: permalink
|
4
4
|
|
5
5
|
- if permalink.persisted?
|
6
|
-
|
7
|
-
=
|
6
|
+
- if permalink.class.respond_to?(:acts_as_trackable?)
|
7
|
+
= tab 'Tracks' do
|
8
|
+
- datatable = Admin::EffectiveTracksDatatable.new(owner: permalink)
|
9
|
+
= render_datatable(datatable, inline: true, namespace: :admin)
|
10
|
+
|
11
|
+
- if permalink.respond_to?(:log_changes_datatable)
|
12
|
+
= tab 'Logs' do
|
13
|
+
= render_datatable(permalink.log_changes_datatable, inline: true, namespace: :admin)
|
data/config/routes.rb
CHANGED
@@ -14,7 +14,7 @@ EffectivePages::Engine.routes.draw do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
scope module: 'effective' do
|
17
|
-
get '/link/:slug', to: 'permalinks#
|
17
|
+
get '/link/:slug', to: 'permalinks#show', as: :permalink_redirect
|
18
18
|
|
19
19
|
match '*id', to: 'pages#show', via: :get, as: :page, constraints: lambda { |req|
|
20
20
|
Effective::Page.find_by_slug_or_id(req.path_parameters[:id] || '/').present?
|
@@ -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.
|
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
|
@@ -88,6 +90,7 @@ class CreateEffectivePages < ActiveRecord::Migration[6.0]
|
|
88
90
|
t.string :slug
|
89
91
|
t.string :url
|
90
92
|
t.text :summary
|
93
|
+
t.integer :tracks_count, default: 0
|
91
94
|
|
92
95
|
t.timestamps
|
93
96
|
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.
|
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-
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|