effective_posts 2.7.0 → 2.7.2
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 +8 -3
- data/app/datatables/effective_posts_datatable.rb +2 -2
- data/app/helpers/effective_posts_helper.rb +23 -5
- data/app/models/effective/post.rb +2 -1
- data/app/views/admin/posts/_form_post.html.haml +7 -23
- data/app/views/effective/posts/_layout.html.haml +2 -3
- data/app/views/effective/posts/_post.html.haml +14 -5
- data/app/views/effective/posts/index.html.haml +4 -4
- data/app/views/effective/posts/show.html.haml +6 -4
- data/config/locales/effective_posts.en.yml +7 -0
- data/lib/effective_posts/version.rb +1 -1
- metadata +3 -3
- data/app/views/effective/posts/_spacer.html.haml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7535e6aaa66d07e7184ca26b3d747f2d5991f43ed8a1f69a2d3c43252262d845
|
4
|
+
data.tar.gz: a12c21200c2c4c1ce0cc1405effb3041b744eb95f4b5fbd6ad94bf0ad3cef4b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3bc4dc919c8534c7e58db16e468ae8a73d7aec620e05821e443b190768643752cad76bd2eab3826e44e74a5d809b966104574c29c88dbeefd9da70400f8773d
|
7
|
+
data.tar.gz: 1a213e13af145cbc11344c9cc354381d2db2813eb4b64c10424e1330c144c252f4cba6303e3e030152e237d4bc9edc548a3be61e5f90af03ab8412244dd1d1da
|
@@ -27,9 +27,15 @@ module Effective
|
|
27
27
|
@posts = @posts.where(search) if search.present?
|
28
28
|
end
|
29
29
|
|
30
|
+
if @category.present?
|
31
|
+
@page_title = @category.to_s
|
32
|
+
else
|
33
|
+
@page_title ||= view_context.posts_name_label
|
34
|
+
end
|
35
|
+
|
30
36
|
EffectiveResources.authorize!(self, :index, Effective::Post)
|
31
37
|
|
32
|
-
@page_title ||= [(@category ||
|
38
|
+
@page_title ||= [(@category || view_context.posts_name_label).to_s.titleize, (" - Page #{params[:page]}" if params[:page])].compact.join
|
33
39
|
@canonical_url ||= helpers.effective_post_category_url(params[:category], page: params[:page])
|
34
40
|
end
|
35
41
|
|
@@ -52,8 +58,7 @@ module Effective
|
|
52
58
|
'Hi Admin!',
|
53
59
|
('You are viewing a hidden post.' unless @post.published?),
|
54
60
|
('You are viewing an archived post.' if @post.archived?),
|
55
|
-
'
|
56
|
-
("<a href='#{effective_posts.edit_admin_post_path(@post)}' class='alert-link'>edit post settings</a>.")
|
61
|
+
("<a href='#{effective_posts.edit_admin_post_path(@post)}' class='alert-link'>Edit this post</a>.")
|
57
62
|
].compact.join(' ')
|
58
63
|
end
|
59
64
|
|
@@ -26,8 +26,8 @@ class EffectivePostsDatatable < Effective::Datatable
|
|
26
26
|
|
27
27
|
col :draft?, as: :boolean, visible: false
|
28
28
|
col :published?, as: :boolean
|
29
|
-
col :published_start_at
|
30
|
-
col :published_end_at
|
29
|
+
col :published_start_at, label: "Published start"
|
30
|
+
col :published_end_at, label: "Published end"
|
31
31
|
|
32
32
|
col :archived
|
33
33
|
|
@@ -2,6 +2,21 @@ require 'cgi'
|
|
2
2
|
|
3
3
|
module EffectivePostsHelper
|
4
4
|
|
5
|
+
# Posts
|
6
|
+
def posts_name_label
|
7
|
+
et('effective_posts.name')
|
8
|
+
end
|
9
|
+
|
10
|
+
# Post
|
11
|
+
def post_label
|
12
|
+
et(Effective::Post)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Posts
|
16
|
+
def posts_label
|
17
|
+
ets(Effective::Post)
|
18
|
+
end
|
19
|
+
|
5
20
|
def effective_posts_header_tags
|
6
21
|
return unless @post && @post.kind_of?(Effective::Post) && @post.persisted? && @post.published?
|
7
22
|
|
@@ -54,17 +69,20 @@ module EffectivePostsHelper
|
|
54
69
|
link_to(category.to_s.titleize, effective_post_category_path(category), title: category.to_s.titleize)
|
55
70
|
end
|
56
71
|
|
72
|
+
def badge_to_post_category(category, options = {})
|
73
|
+
category = category.to_s.downcase
|
74
|
+
link_to(category.to_s.titleize, effective_post_category_path(category), title: category.to_s.titleize, class: "badge badge-primary badge-post mb-2 effective-posts-#{category.parameterize}")
|
75
|
+
end
|
76
|
+
|
57
77
|
def render_post(post)
|
58
78
|
render(partial: 'effective/posts/post', locals: { post: post })
|
59
79
|
end
|
60
80
|
|
61
81
|
def post_meta(post, date: true, datetime: false, category: true, author: true)
|
62
82
|
[
|
63
|
-
'
|
64
|
-
("
|
65
|
-
("
|
66
|
-
("to #{link_to_post_category(post.category)}" if category && Array(EffectivePosts.categories).length > 1),
|
67
|
-
("by #{post.user.to_s.presence || 'Unknown'}" if author && EffectivePosts.post_meta_author && post.user.present?)
|
83
|
+
("#{post.published_start_at.strftime('%A, %B %d, %Y')}" if date && post.published_start_at),
|
84
|
+
("#{post.published_start_at.strftime('%A, %B %d, %Y · %l:%M%P')}" if datetime && post.published_start_at),
|
85
|
+
("#{post.user.to_s.presence || 'Unknown'}" if author && EffectivePosts.post_meta_author && post.user.present?)
|
68
86
|
].compact.join(' ').html_safe
|
69
87
|
end
|
70
88
|
|
@@ -6,29 +6,15 @@
|
|
6
6
|
- else
|
7
7
|
= f.hidden_field :category, value: (EffectivePosts.categories.first || 'posts')
|
8
8
|
|
9
|
-
|
10
|
-
= f.
|
11
|
-
.row
|
12
|
-
.col-md-6
|
13
|
-
= f.datetime_field :published_start_at, hint: 'The page will be available starting on this date and time. Leave blank to publish immediately.'
|
14
|
-
.col-md-6
|
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
|
16
|
-
|
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."
|
18
|
-
|
19
|
-
- # acts_as_slugged
|
20
|
-
- if f.object.persisted? || f.object.errors.include?(:slug)
|
21
|
-
- current_url = effective_posts.post_path(f.object)
|
22
|
-
|
23
|
-
= f.text_field :slug, required: f.object.persisted?,
|
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
|
9
|
+
= acts_as_published_fields(f)
|
10
|
+
= acts_as_slugged_fields(f, url: (effective_posts.post_url(f.object) rescue nil))
|
25
11
|
|
26
12
|
- if EffectivePosts.use_description
|
27
|
-
= f.text_field :description, input_html: { maxlength: 150 },
|
28
|
-
hint: "150 character summary
|
13
|
+
= f.text_field :description, label: "Meta description", input_html: { maxlength: 150 },
|
14
|
+
hint: "150 character summary that appears on Google search result pages."
|
29
15
|
|
30
16
|
- if EffectivePosts.use_active_storage
|
31
|
-
= f.file_field :image, hint:
|
17
|
+
= f.file_field :image, label: "Image preview", hint: "Optional. Shown on the posts index and post pages. Dimensions are 220px tall and 350px wide."
|
32
18
|
|
33
19
|
- if EffectivePosts.use_excerpt
|
34
20
|
- if defined?(EffectiveArticleEditor)
|
@@ -37,14 +23,12 @@
|
|
37
23
|
= f.rich_text_area :excerpt, hint: 'Will be used for the post excerpt on index pages. Leave blank to use the body instead.'
|
38
24
|
|
39
25
|
- if defined?(EffectiveArticleEditor)
|
40
|
-
= f.article_editor :body
|
26
|
+
= f.article_editor :body
|
41
27
|
- else
|
42
|
-
= f.rich_text_area :body
|
28
|
+
= f.rich_text_area :body
|
43
29
|
|
44
30
|
= render partial: '/effective/posts/additional_fields', locals: { post: post, form: f, f: f }
|
45
31
|
|
46
|
-
= f.check_box :archived, label: 'Yes, this post is archived. It will not be displayed.'
|
47
|
-
|
48
32
|
- if EffectivePosts.use_effective_roles
|
49
33
|
= render partial: '/admin/posts/roles', locals: { post: post, form: f, f: f }
|
50
34
|
|
@@ -1,3 +1,2 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
.col-sm-4= render 'sidebar'
|
1
|
+
.effective-posts.mb-3
|
2
|
+
= yield
|
@@ -1,9 +1,18 @@
|
|
1
|
-
.effective-post
|
2
|
-
|
1
|
+
.col.effective-post.mb-5
|
2
|
+
- if EffectivePosts.categories.length > 1 && post.category.present?
|
3
|
+
= badge_to_post_category(post.category)
|
3
4
|
|
4
|
-
|
5
|
+
- if EffectivePosts.use_active_storage && post.image && post.image.attached?
|
6
|
+
= link_to effective_posts.post_path(post) do
|
7
|
+
= image_tag url_for(post.image), class: "effective-posts-image d-none d-lg-flex align-self-start mb-2", alt: post.title, width: "350", height: "220"
|
8
|
+
|
9
|
+
.effective-posts-meta.mb-2
|
5
10
|
= post_meta(post, author: false)
|
6
11
|
= admin_post_status_badge(post)
|
7
12
|
|
8
|
-
.
|
9
|
-
|
13
|
+
%h2.effective-posts-title= link_to post, effective_post_path(post)
|
14
|
+
|
15
|
+
- if EffectivePosts.use_excerpt && post.excerpt.present?
|
16
|
+
.effective-posts-excerpt
|
17
|
+
= post.excerpt
|
18
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
%h1= @page_title
|
2
|
-
|
3
1
|
= render 'layout' do
|
4
|
-
.effective-
|
5
|
-
|
2
|
+
%h1.effective-title.mb-4= @page_title
|
3
|
+
|
4
|
+
.row.row-cols-1.row-cols-lg-3.effective-posts
|
5
|
+
= render @posts
|
6
6
|
|
7
7
|
%nav.d-flex.justify-content-center
|
8
8
|
= bootstrap_paginate(@posts, per_page: EffectivePosts.per_page)
|
@@ -1,12 +1,14 @@
|
|
1
1
|
= render 'layout' do
|
2
2
|
.effective-post
|
3
|
-
|
4
|
-
|
5
|
-
%p.post-meta.text-muted
|
3
|
+
.effective-posts-meta.mb-2
|
6
4
|
= post_meta(@post, author: false)
|
7
5
|
= admin_post_status_badge(@post)
|
8
6
|
|
7
|
+
%h1.effective-post-title.mb-4= @page_title
|
8
|
+
|
9
9
|
= render 'effective/posts/event', post: @post
|
10
10
|
|
11
|
-
.
|
11
|
+
.effective-posts-body.mb-5
|
12
12
|
= @post.body
|
13
|
+
|
14
|
+
= link_to("← #{posts_name_label}" .html_safe, effective_posts.posts_path, class: "btn btn-secondary my-4")
|
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.7.
|
4
|
+
version: 2.7.2
|
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-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -196,7 +196,6 @@ files:
|
|
196
196
|
- app/views/effective/posts/_post.html.haml
|
197
197
|
- app/views/effective/posts/_recent_posts.html.haml
|
198
198
|
- app/views/effective/posts/_sidebar.html.haml
|
199
|
-
- app/views/effective/posts/_spacer.html.haml
|
200
199
|
- app/views/effective/posts/_upcoming_events.html.haml
|
201
200
|
- app/views/effective/posts/edit.html.haml
|
202
201
|
- app/views/effective/posts/index.html.haml
|
@@ -205,6 +204,7 @@ files:
|
|
205
204
|
- app/views/effective/posts/submitted.html.haml
|
206
205
|
- app/views/effective/posts_mailer/post_submitted.html.haml
|
207
206
|
- config/effective_posts.rb
|
207
|
+
- config/locales/effective_posts.en.yml
|
208
208
|
- config/routes.rb
|
209
209
|
- db/migrate/101_create_effective_posts.rb
|
210
210
|
- lib/effective_posts.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
%hr
|