effective_posts 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/post.rb +8 -1
- data/app/views/admin/posts/_form.html.haml +4 -1
- data/app/views/effective/posts/_form.html.haml +3 -0
- data/app/views/effective/posts/index.html.haml +1 -1
- data/config/effective_posts.rb +4 -1
- data/lib/effective_posts.rb +3 -2
- data/lib/effective_posts/version.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: a8e22a8b5820e9247c7706dc4b865b5594716a77735287df3db5c9b024d84548
|
4
|
+
data.tar.gz: 22015e1dff80275f1b947856491906ce49b86f394492ff4c864ae67f5c8f1fd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11170221b45aff9ce7760151ae2c8acd5fc66ac96e9d9ad569b7681b9fc141679918d46c934346d2e5f1c8263def85c5c04256f541293fd54d2f2de5176adabc
|
7
|
+
data.tar.gz: 22e3ab7afd761b286364594ef05556b0df0e895520f9495deff680b883a37a0e8b887d83fa2e4d4e6016027d500292a8502ee9661c6c334ea702d7be7f4f4f8d
|
@@ -1,9 +1,16 @@
|
|
1
1
|
module Effective
|
2
2
|
class Post < ActiveRecord::Base
|
3
|
-
acts_as_role_restricted if defined?(EffectiveRoles) && EffectivePosts.use_effective_roles
|
4
3
|
acts_as_regionable
|
5
4
|
acts_as_slugged
|
6
5
|
|
6
|
+
if EffectivePosts.use_effective_roles && respond_to?(:acts_as_role_restricted)
|
7
|
+
acts_as_role_restricted
|
8
|
+
end
|
9
|
+
|
10
|
+
if EffectivePosts.use_active_storage && respond_to?(:has_one_attached)
|
11
|
+
has_one_attached :image
|
12
|
+
end
|
13
|
+
|
7
14
|
self.table_name = EffectivePosts.posts_table_name.to_s
|
8
15
|
|
9
16
|
belongs_to :user
|
@@ -10,6 +10,9 @@
|
|
10
10
|
- else
|
11
11
|
= f.hidden_field :category, (EffectivePosts.categories.first || 'posts')
|
12
12
|
|
13
|
+
- if EffectivePosts.use_active_storage
|
14
|
+
= f.file_field :image, hint: 'An image for your post'
|
15
|
+
|
13
16
|
= f.ck_editor :excerpt, hint: 'Will be used for the post excerpt on index pages.'
|
14
17
|
= f.text_field :description, hint: 'The content of the post meta tags.', maxlength: 150
|
15
18
|
|
@@ -22,7 +25,7 @@
|
|
22
25
|
- unless EffectivePosts.use_fullscreen_editor
|
23
26
|
= f.ck_editor :body, hint: 'The content of your post.'
|
24
27
|
|
25
|
-
- if defined?(EffectiveRoles)
|
28
|
+
- if defined?(EffectiveRoles) && f.object.respond_to?(:roles) && EffectivePosts.use_effective_roles
|
26
29
|
= render partial: '/admin/posts/roles', locals: { post: post, form: f, f: f }
|
27
30
|
|
28
31
|
= f.submit do
|
@@ -10,6 +10,9 @@
|
|
10
10
|
- else
|
11
11
|
= f.hidden_field :category, (EffectivePosts.categories.first || 'posts')
|
12
12
|
|
13
|
+
- if EffectivePosts.use_active_storage
|
14
|
+
= f.file_field :image, hint: 'An image for your post'
|
15
|
+
|
13
16
|
= f.ck_editor :excerpt, hint: 'Will be used for the post excerpt on index pages.'
|
14
17
|
= f.text_field :description, hint: 'The content of the post meta tags.', maxlength: 150
|
15
18
|
|
data/config/effective_posts.rb
CHANGED
@@ -14,7 +14,7 @@ EffectivePosts.setup do |config|
|
|
14
14
|
# Regardless of this setting, posts will always be available via /posts?category=events
|
15
15
|
config.use_category_routes = true
|
16
16
|
|
17
|
-
# Create routes for a blog.
|
17
|
+
# Create routes for a blog.
|
18
18
|
# Includes category routes, but they're not top level.
|
19
19
|
# /blog is posts#index
|
20
20
|
# /blog/category/announcements is posts#index?category=announcements
|
@@ -69,6 +69,9 @@ EffectivePosts.setup do |config|
|
|
69
69
|
# Hides the Save and Edit Content links from admin. They can just use the textarea input.
|
70
70
|
config.use_fullscreen_editor = true
|
71
71
|
|
72
|
+
# Display a file upload field when the admin creates a new post to collect a post.image
|
73
|
+
config.use_active_storage = true
|
74
|
+
|
72
75
|
# Submissions
|
73
76
|
# Allow users to submit posts (optionally for approval) to display on the website
|
74
77
|
config.submissions_enabled = true
|
data/lib/effective_posts.rb
CHANGED
@@ -20,6 +20,7 @@ module EffectivePosts
|
|
20
20
|
|
21
21
|
mattr_accessor :use_effective_roles
|
22
22
|
mattr_accessor :use_fullscreen_editor
|
23
|
+
mattr_accessor :use_active_storage
|
23
24
|
|
24
25
|
mattr_accessor :per_page
|
25
26
|
mattr_accessor :post_meta_author
|
@@ -54,9 +55,9 @@ module EffectivePosts
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def self.permitted_params
|
57
|
-
|
58
|
+
[
|
58
59
|
:title, :excerpt, :description, :draft, :category, :slug, :published_at, :body, :tags, :extra,
|
59
|
-
:start_at, :end_at, :location, :website_name, :website_href, roles: []
|
60
|
+
:image, :start_at, :end_at, :location, :website_name, :website_href, roles: []
|
60
61
|
].compact
|
61
62
|
end
|
62
63
|
|
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.6
|
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: 2019-
|
11
|
+
date: 2019-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|