effective_posts 1.1.5 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e75ef03c3fbb14f1770a332ff3963df4f065ae653fa3c9bcf476e66bff581bd
4
- data.tar.gz: 618cac368b24754d447df9d65446355f18c9d2e1c3d26006398e94723043ed70
3
+ metadata.gz: a8e22a8b5820e9247c7706dc4b865b5594716a77735287df3db5c9b024d84548
4
+ data.tar.gz: 22015e1dff80275f1b947856491906ce49b86f394492ff4c864ae67f5c8f1fd9
5
5
  SHA512:
6
- metadata.gz: a1fdf0cf42896d884c75ef94a87776dd55b4a3ef74878345e4100ac2b78945f8f7d2ba65bb0f730daec3eb8f3e6eb6b9335033e30d203da4f43ec56aea3952b8
7
- data.tar.gz: 2e618b276e175bf0d18b5e686d94abc9ef72f9fd16be3507ef4d0163cae87efd675b3793290bab54d5fdcf30bc6b91ef004719612deb36334b54f7c4e0280984
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) and f.object.respond_to?(:roles) && EffectivePosts.use_effective_roles
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
 
@@ -5,4 +5,4 @@
5
5
  = render partial: @posts, spacer_template: 'spacer'
6
6
 
7
7
  %nav.d-flex.justify-content-center
8
- = paginate(@posts, per_page: EffectivePosts.per_page)
8
+ = bootstrap_paginate(@posts, per_page: EffectivePosts.per_page)
@@ -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
@@ -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
- @@permitted_params ||= [
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectivePosts
2
- VERSION = '1.1.5'.freeze
2
+ VERSION = '1.1.6'.freeze
3
3
  end
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.5
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-06-21 00:00:00.000000000 Z
11
+ date: 2019-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails