effective_posts 2.6.2 → 2.7.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/posts_controller.rb +1 -1
- data/app/datatables/effective_posts_datatable.rb +1 -1
- data/app/helpers/effective_posts_helper.rb +2 -1
- data/app/models/effective/post.rb +2 -2
- data/app/views/admin/posts/_form_post.html.haml +16 -17
- data/app/views/effective/posts/_form.html.haml +17 -12
- data/app/views/effective/posts/_post.html.haml +1 -1
- data/config/effective_posts.rb +6 -0
- data/lib/effective_posts/version.rb +1 -1
- data/lib/effective_posts.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: b560ca6e8b647ccb668b7c91edf4689995e3c238a639d90f1f8d6c61eb5cab5f
|
4
|
+
data.tar.gz: 6b60247bb9072eec7b7f6fe9b7991db47b305a271d79c5baddbde15db295e462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28412a0ad8153586d93042bc83aaa0c4fd844158e95269a8d76a12927d1ec0de5306a7e0de0295e73f84444269c6b7029d0f2be8c9935310ed281211bcaaebed
|
7
|
+
data.tar.gz: 97014b04d38f48179037a237a6f284c785c10ff1f5c03eabdb7e3d64e861c99109bafd3ff0e8d290d6372b078e665869ab15de4a0a75a24a5a6d65f387f10328
|
@@ -31,7 +31,7 @@ class EffectivePostsDatatable < Effective::Datatable
|
|
31
31
|
|
32
32
|
col :archived
|
33
33
|
|
34
|
-
col :start_at
|
34
|
+
col :start_at, visible: EffectivePosts.categories.include?('Events')
|
35
35
|
col :end_at, visible: false
|
36
36
|
col :location, visible: false
|
37
37
|
col :created_at, label: 'Submitted at', visible: false
|
@@ -82,7 +82,8 @@ module EffectivePostsHelper
|
|
82
82
|
|
83
83
|
# All other options are passed to the link_to 'Read more'
|
84
84
|
def post_excerpt(post, label: 'Continue reading')
|
85
|
-
|
85
|
+
content = post.excerpt.presence || post.body.presence
|
86
|
+
(content.to_s + readmore_link(post, label: label)).html_safe
|
86
87
|
end
|
87
88
|
|
88
89
|
def read_more_link(post, options = {})
|
@@ -55,8 +55,8 @@ module Effective
|
|
55
55
|
self.user ||= current_user
|
56
56
|
end
|
57
57
|
|
58
|
-
validates :title, presence: true
|
59
|
-
validates :description,
|
58
|
+
validates :title, presence: true
|
59
|
+
validates :description, length: { maximum: 150 }
|
60
60
|
validates :category, presence: true
|
61
61
|
validates :start_at, presence: true, if: -> { category == 'events' }
|
62
62
|
|
@@ -1,42 +1,41 @@
|
|
1
1
|
= effective_form_with(model: [:admin, post], engine: true) do |f|
|
2
2
|
= f.text_field :title, hint: 'The title of your post.'
|
3
3
|
|
4
|
+
- if Array(EffectivePosts.categories).length > 1
|
5
|
+
= f.select :category, EffectivePosts.categories
|
6
|
+
- else
|
7
|
+
= f.hidden_field :category, value: (EffectivePosts.categories.first || 'posts')
|
8
|
+
|
4
9
|
-# acts_as_published
|
5
10
|
= f.hide_if(:save_as_draft, true) do
|
6
11
|
.row
|
7
12
|
.col-md-6
|
8
|
-
= f.datetime_field :published_start_at, hint: 'The page will be available starting on this date and time.'
|
13
|
+
= f.datetime_field :published_start_at, hint: 'The page will be available starting on this date and time. Leave blank to publish immediately.'
|
9
14
|
.col-md-6
|
10
15
|
= 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
|
11
16
|
|
12
17
|
= 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
18
|
|
14
|
-
|
15
|
-
hint: "150 character summary. Appears on Google search results underneath the post title. ",
|
16
|
-
input_html: { maxlength: 150 }
|
17
|
-
|
19
|
+
- # acts_as_slugged
|
18
20
|
- if f.object.persisted? || f.object.errors.include?(:slug)
|
19
21
|
- current_url = effective_posts.post_path(f.object)
|
20
22
|
|
21
23
|
= f.text_field :slug, required: f.object.persisted?,
|
22
24
|
hint: "The slug controls this post's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This post is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url && f.object.slug.present? }".html_safe
|
23
25
|
|
24
|
-
- if
|
25
|
-
= f.
|
26
|
-
|
27
|
-
= f.rich_text_area :excerpt, hint: 'Will be used for the post excerpt on index pages.'
|
28
|
-
|
29
|
-
- if Array(EffectivePosts.categories).length > 1
|
30
|
-
= f.select :category, EffectivePosts.categories
|
31
|
-
- else
|
32
|
-
= f.hidden_field :category, value: (EffectivePosts.categories.first || 'posts')
|
33
|
-
|
34
|
-
- if f.object.class.respond_to?(:acts_as_tagged?)
|
35
|
-
= render 'effective/tags/fields', f: f
|
26
|
+
- if EffectivePosts.use_description
|
27
|
+
= f.text_field :description, input_html: { maxlength: 150 },
|
28
|
+
hint: "150 character summary. Appears on Google search results underneath the post title. Leave blank to use post title."
|
36
29
|
|
37
30
|
- if EffectivePosts.use_active_storage
|
38
31
|
= f.file_field :image, hint: 'An image for your post'
|
39
32
|
|
33
|
+
- if EffectivePosts.use_excerpt
|
34
|
+
- if defined?(EffectiveArticleEditor)
|
35
|
+
= f.article_editor :excerpt, hint: 'Will be used for the post excerpt on index pages. Leave blank to use the body instead.'
|
36
|
+
- else
|
37
|
+
= f.rich_text_area :excerpt, hint: 'Will be used for the post excerpt on index pages. Leave blank to use the body instead.'
|
38
|
+
|
40
39
|
- if defined?(EffectiveArticleEditor)
|
41
40
|
= f.article_editor :body, hint: 'The main body of your post'
|
42
41
|
- else
|
@@ -1,30 +1,35 @@
|
|
1
1
|
= effective_form_with(model: post, engine: true) do |f|
|
2
2
|
= f.text_field :title, hint: 'The title of your post.'
|
3
3
|
|
4
|
-
- if f.object.persisted? || f.object.errors.include?(:slug)
|
5
|
-
- current_url = effective_posts.post_path(f.object)
|
6
|
-
= f.text_field :slug, hint: "The slug controls this post's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This post is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url && f.object.slug.present? }".html_safe
|
7
|
-
|
8
4
|
- if Array(EffectivePosts.categories).length > 1
|
9
5
|
= f.select :category, EffectivePosts.categories
|
10
6
|
- else
|
11
7
|
= f.hidden_field :category, value: (EffectivePosts.categories.first || 'posts')
|
12
8
|
|
13
|
-
-
|
14
|
-
|
9
|
+
- # acts_as_slugged
|
10
|
+
- if f.object.persisted? || f.object.errors.include?(:slug)
|
11
|
+
- current_url = effective_posts.post_path(f.object)
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
- else
|
19
|
-
= f.rich_text_area :excerpt, hint: 'Will be used for the post excerpt on index pages.'
|
13
|
+
= f.text_field :slug, required: f.object.persisted?,
|
14
|
+
hint: "The slug controls this post's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This post is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url && f.object.slug.present? }".html_safe
|
20
15
|
|
21
|
-
|
16
|
+
- if EffectivePosts.use_description
|
17
|
+
= f.text_field :description, hint: 'The content of the post meta tags.', maxlength: 150
|
22
18
|
|
23
|
-
|
19
|
+
- if EffectivePosts.use_active_storage
|
20
|
+
= f.file_field :image, hint: 'An image for your post'
|
21
|
+
|
22
|
+
- if EffectivePosts.use_excerpt
|
23
|
+
- if defined?(EffectiveArticleEditor)
|
24
|
+
= f.article_editor :excerpt, hint: 'Will be used for the post excerpt on index pages.'
|
25
|
+
- else
|
26
|
+
= f.rich_text_area :excerpt, hint: 'Will be used for the post excerpt on index pages.'
|
24
27
|
|
25
28
|
- if defined?(EffectiveArticleEditor)
|
26
29
|
= f.article_editor :body, hint: 'The main body of your post'
|
27
30
|
- else
|
28
31
|
= f.rich_text_area :body, hint: 'The main body of your post'
|
29
32
|
|
33
|
+
= render partial: '/effective/posts/additional_fields', locals: { post: post, form: f, f: f }
|
34
|
+
|
30
35
|
= f.submit 'Save'
|
data/config/effective_posts.rb
CHANGED
@@ -41,6 +41,12 @@ EffectivePosts.setup do |config|
|
|
41
41
|
# Display a file upload field when the admin creates a new post to collect a post.image
|
42
42
|
config.use_active_storage = true
|
43
43
|
|
44
|
+
# Display the google search results description field on admin form
|
45
|
+
config.use_description = true
|
46
|
+
|
47
|
+
# Display the excerpt field on admin form
|
48
|
+
config.use_excerpt = true
|
49
|
+
|
44
50
|
# Submissions
|
45
51
|
# Allow users to submit posts (optionally for approval) to display on the website
|
46
52
|
config.submissions_enabled = true
|
data/lib/effective_posts.rb
CHANGED
@@ -10,7 +10,7 @@ module EffectivePosts
|
|
10
10
|
:categories, :event_categories,
|
11
11
|
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
|
12
12
|
:use_category_routes, :use_blog_routes,
|
13
|
-
:use_effective_roles, :use_active_storage,
|
13
|
+
:use_effective_roles, :use_active_storage, :use_description, :use_excerpt,
|
14
14
|
:per_page, :post_meta_author,
|
15
15
|
:submissions_enabled, :submissions_require_current_user,
|
16
16
|
:submissions_require_approval, :submissions_note
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_posts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.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-07-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|