effective_posts 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/posts_controller.rb +7 -2
- data/app/datatables/effective_posts_datatable.rb +31 -0
- data/app/helpers/effective_posts_helper.rb +1 -1
- data/app/models/effective/datatables/posts.rb +1 -1
- data/app/views/effective/posts/show.html.haml +9 -9
- data/config/effective_posts.rb +4 -2
- data/lib/effective_posts/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0adec48b907d17f506e2176b161e53daf59a86d5
|
4
|
+
data.tar.gz: 5a2c2158ae1cdcc9f6fd1a7391fa3675c28a6531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f861165de83fe29bae345c5e114fdb870bf5c842830ae8b63845e715fa3f7a26b05210b1aea63e4f0cc36fada2f1196707dea8cd59133c6460cd1104e88414
|
7
|
+
data.tar.gz: 89633a7b7e1d03069005ab164d8815024446cdd16e83696e3911d752ba00472a66836f8ab15c39385a63e960050ab669247278849263b180440194950cf03b37
|
@@ -1,12 +1,17 @@
|
|
1
1
|
module Admin
|
2
2
|
class PostsController < ApplicationController
|
3
|
-
|
3
|
+
before_action(:authenticate_user!) # Devise
|
4
4
|
|
5
5
|
layout (EffectivePosts.layout.kind_of?(Hash) ? EffectivePosts.layout[:admin] : EffectivePosts.layout)
|
6
6
|
|
7
7
|
def index
|
8
8
|
@page_title = 'Posts'
|
9
|
-
|
9
|
+
|
10
|
+
if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
11
|
+
@datatable = Effective::Datatables::Posts.new()
|
12
|
+
else
|
13
|
+
@datatable = EffectivePostsDatatable.new(self)
|
14
|
+
end
|
10
15
|
|
11
16
|
authorize_effective_posts!
|
12
17
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
2
|
+
class EffectivePostsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
order :published_at, :desc
|
5
|
+
|
6
|
+
col :published_at
|
7
|
+
col :id, visible: false
|
8
|
+
|
9
|
+
col :title
|
10
|
+
col :category, search: { collection: EffectivePosts.categories }
|
11
|
+
|
12
|
+
if EffectivePosts.submissions_enabled
|
13
|
+
col :approved, sql_column: 'NOT(draft)', as: :boolean do |post|
|
14
|
+
post.draft? ? 'No' : 'Yes'
|
15
|
+
end
|
16
|
+
|
17
|
+
col :draft, visible: false
|
18
|
+
else
|
19
|
+
col :draft
|
20
|
+
end
|
21
|
+
|
22
|
+
col :created_at, label: 'Submitted at', visible: false
|
23
|
+
|
24
|
+
actions_col partial: '/admin/posts/actions', partial_as: :post
|
25
|
+
end
|
26
|
+
|
27
|
+
collection do
|
28
|
+
Effective::Post.all
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -21,7 +21,7 @@ module EffectivePostsHelper
|
|
21
21
|
'Published',
|
22
22
|
"on #{post.published_at.strftime('%B %d, %Y at %l:%M %p')}",
|
23
23
|
("to #{link_to_post_category(post.category)}" if Array(EffectivePosts.categories).length > 1),
|
24
|
-
("by #{post.user.to_s.presence || 'Unknown'}" if EffectivePosts.post_meta_author)
|
24
|
+
("by #{post.user.to_s.presence || 'Unknown'}" if EffectivePosts.post_meta_author && post.user.present?)
|
25
25
|
].compact.join(' ').html_safe
|
26
26
|
end
|
27
27
|
|
@@ -3,28 +3,28 @@
|
|
3
3
|
|
4
4
|
%p.post-meta= post_meta(@post)
|
5
5
|
|
6
|
-
- if post.category == 'events'
|
6
|
+
- if @post.category == 'events'
|
7
7
|
%table.table.post-events
|
8
8
|
%tbody
|
9
|
-
- if post.start_at.present?
|
9
|
+
- if @post.start_at.present?
|
10
10
|
%tr
|
11
11
|
%th Starts
|
12
|
-
%td= post.start_at
|
12
|
+
%td= @post.start_at
|
13
13
|
|
14
|
-
- if post.end_at.present?
|
14
|
+
- if @post.end_at.present?
|
15
15
|
%tr
|
16
16
|
%th Ends
|
17
|
-
%td= post.start_at
|
17
|
+
%td= @post.start_at
|
18
18
|
|
19
|
-
- if post.location.present?
|
19
|
+
- if @post.location.present?
|
20
20
|
%tr
|
21
21
|
%th Location
|
22
|
-
%td= post.location
|
22
|
+
%td= @post.location
|
23
23
|
|
24
|
-
- if post.website_href.present? && post.website_name.present?
|
24
|
+
- if @post.website_href.present? && @post.website_name.present?
|
25
25
|
%tr
|
26
26
|
%th Website
|
27
|
-
%td= link_to post.website_name, post.website_href
|
27
|
+
%td= link_to @post.website_name, @post.website_href
|
28
28
|
|
29
29
|
.post-body.post-content
|
30
30
|
= effective_region @post, :body do
|
data/config/effective_posts.rb
CHANGED
@@ -41,8 +41,10 @@ EffectivePosts.setup do |config|
|
|
41
41
|
#
|
42
42
|
# Or disable the check completely:
|
43
43
|
# config.authorization_method = false
|
44
|
-
config.authorization_method = Proc.new
|
45
|
-
|
44
|
+
config.authorization_method = Proc.new do |controller, action, resource|
|
45
|
+
authorize!(action, resource)
|
46
|
+
resource.respond_to?(:roles_permit?) ? resource.roles_permit?(current_user) : true
|
47
|
+
end
|
46
48
|
|
47
49
|
# Layout Settings
|
48
50
|
# Configure the Layout per controller, or all at once
|
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: 0.5.
|
4
|
+
version: 0.5.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: 2017-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- app/assets/stylesheets/effective_posts.scss
|
154
154
|
- app/controllers/admin/posts_controller.rb
|
155
155
|
- app/controllers/effective/posts_controller.rb
|
156
|
+
- app/datatables/effective_posts_datatable.rb
|
156
157
|
- app/helpers/effective_kaminari_helper.rb
|
157
158
|
- app/helpers/effective_posts_helper.rb
|
158
159
|
- app/helpers/effective_truncate_html_helper.rb
|