effective_posts 2.6.2 → 2.7.0

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: ba2b29680fd67771e07107f6fc283581b317593e18bec35916ca2e99ff7f7a21
4
- data.tar.gz: 395b803b93e46491d74e9965702e2f50b019ce36410e57f5e0472ac5ed9524ca
3
+ metadata.gz: b560ca6e8b647ccb668b7c91edf4689995e3c238a639d90f1f8d6c61eb5cab5f
4
+ data.tar.gz: 6b60247bb9072eec7b7f6fe9b7991db47b305a271d79c5baddbde15db295e462
5
5
  SHA512:
6
- metadata.gz: a0908054fb05b30f5e45f4f0bfc9b58597c59dd2f3b9eddee0cac8a51fcfc2ef4a81bf83c1af487d228c648acca09734db53a5b3bde4a40b1fac943f9a7075de
7
- data.tar.gz: 21e8a107beba7055c689209ad068f9dfef739e8581eaf3be2b71c21cf252b42dfdf7d3f3fb63ae13661c0b69805718fe4fc1094158ff1a8f9e8f0766c43272cb
6
+ metadata.gz: 28412a0ad8153586d93042bc83aaa0c4fd844158e95269a8d76a12927d1ec0de5306a7e0de0295e73f84444269c6b7029d0f2be8c9935310ed281211bcaaebed
7
+ data.tar.gz: 97014b04d38f48179037a237a6f284c785c10ff1f5c03eabdb7e3d64e861c99109bafd3ff0e8d290d6372b078e665869ab15de4a0a75a24a5a6d65f387f10328
@@ -58,7 +58,7 @@ module Effective
58
58
  end
59
59
 
60
60
  @page_title ||= @post.title
61
- @meta_description ||= @post.description
61
+ @meta_description ||= (@post.description.presence || @post.title)
62
62
  @canonical_url ||= effective_posts.post_url(@post)
63
63
  end
64
64
 
@@ -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
- (post.excerpt.to_s + readmore_link(post, label: label)).html_safe
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, length: { maximum: 255 }
59
- validates :description, presence: true, length: { maximum: 150 }
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
- = f.text_field :description,
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 defined?(EffectiveArticleEditor)
25
- = f.article_editor :excerpt, hint: 'Will be used for the post excerpt on index pages.'
26
- - else
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
- - if EffectivePosts.use_active_storage
14
- = f.file_field :image, hint: 'An image for your post'
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
- - if defined?(EffectiveArticleEditor)
17
- = f.article_editor :excerpt, hint: 'Will be used for the post excerpt on index pages.'
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
- = f.text_field :description, hint: 'The content of the post meta tags.', maxlength: 150
16
+ - if EffectivePosts.use_description
17
+ = f.text_field :description, hint: 'The content of the post meta tags.', maxlength: 150
22
18
 
23
- = render partial: '/effective/posts/additional_fields', locals: { post: post, form: f, f: f }
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'
@@ -6,4 +6,4 @@
6
6
  = admin_post_status_badge(post)
7
7
 
8
8
  .post-content.post-excerpt
9
- = post.excerpt
9
+ = post.excerpt.presence || post.body
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EffectivePosts
2
- VERSION = '2.6.2'.freeze
2
+ VERSION = '2.7.0'.freeze
3
3
  end
@@ -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.6.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-09 00:00:00.000000000 Z
11
+ date: 2024-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails