effective_posts 1.1.6 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/effective/posts_controller.rb +3 -10
- data/app/helpers/effective_posts_helper.rb +10 -5
- data/app/models/effective/post.rb +1 -1
- data/app/views/admin/posts/_actions.html.haml +1 -1
- data/app/views/effective/posts/_recent_posts.html.haml +1 -4
- data/lib/effective_posts/version.rb +1 -1
- metadata +6 -7
- data/app/models/effective/datatables/posts.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15619ebf6addfa716f58d0fb7869856a7767d3ce2b330e215965f2597d6dc2d2
|
4
|
+
data.tar.gz: a9b86d1453132f0aa42a14118f7f6b8c2d20efe2ea9bb7a216422329cde031e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8cef5af970f766636881e7e2ac17ff6d41e23b11b97e24695dd0dab6311c427e1247cb9712dbf1acca7b273a1ec73ab7c9abacdc91ae162078076aa654e4e0
|
7
|
+
data.tar.gz: 18f8c7ec44d83352c57486ff6f33d6b68288dff8ab27fb1e6cb1322129cb74e76ac9ee808468d9e97499e4a6385650797c21fc035497770725ff5ef7bfd72330
|
@@ -25,21 +25,14 @@ module Effective
|
|
25
25
|
|
26
26
|
EffectivePosts.authorize!(self, :index, Effective::Post)
|
27
27
|
|
28
|
-
if params[:page]
|
29
|
-
|
30
|
-
@canonical_url ||= effective_posts.posts_url(page: params[:page])
|
31
|
-
else
|
32
|
-
@page_title ||= (params[:category].presence || 'Blog').titleize
|
33
|
-
@canonical_url ||= effective_posts.posts_url
|
34
|
-
end
|
35
|
-
|
28
|
+
@page_title ||= [(params[:category] || 'Blog').to_s.titleize, (" - Page #{params[:page]}" if params[:page])].compact.join
|
29
|
+
@canonical_url ||= helpers.effective_post_category_url(params[:category], page: params[:page])
|
36
30
|
end
|
37
31
|
|
38
32
|
def show
|
39
33
|
@posts ||= Effective::Post.posts(user: current_user, category: params[:category], unpublished: EffectivePosts.authorized?(self, :admin, :effective_posts))
|
40
34
|
@post = @posts.find(params[:id])
|
41
35
|
|
42
|
-
|
43
36
|
if @post.respond_to?(:roles_permit?)
|
44
37
|
raise Effective::AccessDenied.new('Access Denied', :show, @post) unless @post.roles_permit?(current_user)
|
45
38
|
end
|
@@ -51,7 +44,7 @@ module Effective
|
|
51
44
|
'Hi Admin!',
|
52
45
|
('You are viewing a hidden post.' unless @post.published?),
|
53
46
|
'Click here to',
|
54
|
-
("<a href='#{effective_regions.edit_path(effective_posts.post_path(@post, exit: effective_posts.post_path(@post)))}' class='alert-link'>edit post content</a> or" unless admin_edit?),
|
47
|
+
("<a href='#{effective_regions.edit_path(effective_posts.post_path(@post, exit: effective_posts.post_path(@post)))}' class='alert-link' data-no-turbolink='true' data-turbolinks='false'>edit post content</a> or" unless admin_edit?),
|
55
48
|
("<a href='#{effective_posts.edit_admin_post_path(@post)}' class='alert-link'>edit post settings</a>.")
|
56
49
|
].compact.join(' ')
|
57
50
|
end
|
@@ -29,20 +29,25 @@ module EffectivePostsHelper
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def effective_post_category_path(category, opts = nil)
|
32
|
-
return effective_posts.posts_path unless category.present?
|
32
|
+
return effective_posts.posts_path(opts || {}) unless category.present?
|
33
33
|
|
34
34
|
category = category.to_s.downcase
|
35
|
-
opts
|
35
|
+
opts = (opts || {}).compact
|
36
|
+
query = ('?' + opts.to_query) if opts.present?
|
36
37
|
|
37
38
|
if EffectivePosts.use_blog_routes
|
38
|
-
"/blog/category/#{category}"
|
39
|
+
"/blog/category/#{category}#{query}"
|
39
40
|
elsif EffectivePosts.use_category_routes
|
40
|
-
"/#{category}"
|
41
|
+
"/#{category}#{query}"
|
41
42
|
else
|
42
|
-
effective_posts.posts_path(opts.merge(category: category))
|
43
|
+
effective_posts.posts_path(opts.merge(category: category.presence).compact)
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
47
|
+
def effective_post_category_url(category, opts = nil)
|
48
|
+
root_url.to_s.chomp('/') + effective_post_category_path(category, opts)
|
49
|
+
end
|
50
|
+
|
46
51
|
def link_to_post_category(category, options = {})
|
47
52
|
category = category.to_s.downcase
|
48
53
|
link_to(category.to_s.titleize, effective_post_category_path(category), title: category.to_s.titleize)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
= dropdown_link_to 'Edit', effective_posts.edit_admin_post_path(post)
|
7
7
|
- if EffectivePosts.use_fullscreen_editor
|
8
|
-
= dropdown_link_to 'Edit Content', effective_post_path(post, edit: true), title: 'Edit Content', 'data-no-turbolink': true, target: '_blank'
|
8
|
+
= dropdown_link_to 'Edit Content', effective_post_path(post, edit: true), title: 'Edit Content', 'data-no-turbolink': true, 'data-turbolinks': false, target: '_blank'
|
9
9
|
|
10
10
|
= dropdown_link_to 'View', effective_post_path(post), target: '_blank'
|
11
11
|
|
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: 1.1.
|
4
|
+
version: 1.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -143,7 +143,6 @@ files:
|
|
143
143
|
- app/helpers/effective_truncate_html_helper.rb
|
144
144
|
- app/mailers/effective/posts_mailer.rb
|
145
145
|
- app/models/effective/access_denied.rb
|
146
|
-
- app/models/effective/datatables/posts.rb
|
147
146
|
- app/models/effective/post.rb
|
148
147
|
- app/models/effective/snippets/read_more_divider.rb
|
149
148
|
- app/views/admin/posts/_actions.html.haml
|
@@ -183,7 +182,7 @@ homepage: https://github.com/code-and-effect/effective_posts
|
|
183
182
|
licenses:
|
184
183
|
- MIT
|
185
184
|
metadata: {}
|
186
|
-
post_install_message:
|
185
|
+
post_install_message:
|
187
186
|
rdoc_options: []
|
188
187
|
require_paths:
|
189
188
|
- lib
|
@@ -198,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
197
|
- !ruby/object:Gem::Version
|
199
198
|
version: '0'
|
200
199
|
requirements: []
|
201
|
-
rubygems_version: 3.
|
202
|
-
signing_key:
|
200
|
+
rubygems_version: 3.1.2
|
201
|
+
signing_key:
|
203
202
|
specification_version: 4
|
204
203
|
summary: A blog implementation with WYSIWYG content editing, post scheduling, pagination
|
205
204
|
and optional top level routes for each post category.
|
@@ -1,40 +0,0 @@
|
|
1
|
-
if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
2
|
-
module Effective
|
3
|
-
module Datatables
|
4
|
-
class Posts < Effective::Datatable
|
5
|
-
datatable do
|
6
|
-
default_order :published_at, :desc
|
7
|
-
|
8
|
-
table_column :published_at
|
9
|
-
table_column :id, visible: false
|
10
|
-
|
11
|
-
table_column :title
|
12
|
-
col :slug, visible: false
|
13
|
-
table_column :category, filter: { type: :select, values: EffectivePosts.categories }
|
14
|
-
|
15
|
-
if EffectivePosts.submissions_enabled
|
16
|
-
table_column :approved, column: 'NOT(draft)', as: :boolean do |post|
|
17
|
-
post.draft ? 'No' : 'Yes'
|
18
|
-
end
|
19
|
-
|
20
|
-
table_column :draft, visible: false
|
21
|
-
else
|
22
|
-
table_column :draft
|
23
|
-
end
|
24
|
-
|
25
|
-
table_column :start_at
|
26
|
-
table_column :end_at, visible: false
|
27
|
-
table_column :location, visible: false
|
28
|
-
|
29
|
-
table_column :created_at, label: 'Submitted at', visible: false
|
30
|
-
|
31
|
-
table_column :actions, sortable: false, filter: false, partial: '/admin/posts/actions'
|
32
|
-
end
|
33
|
-
|
34
|
-
def collection
|
35
|
-
Effective::Post.all
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|