effective_posts 2.9.5 → 2.10.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac4e05cce1c65124d62fe558a99e3126b6b65a24062850ada6d0d9c0a8b926ad
|
|
4
|
+
data.tar.gz: 94990fdcec750ff87644840f9ffe4e5e88cd277e8281e81a738518a2bb032370
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49dbea147d32f61c7e263919165f968f6e02676e5eab13299fa0f1e2c51aa4ade64a12274e14ef2d6fc52b70c05fb213b2b814e236a03addea9303828636b49b
|
|
7
|
+
data.tar.gz: 4b6fc77c7b355ad8d981b25459f96e8d1d607f60ae9e944f0925a586bebfc92e0552b6f832cfa802a8d5ac4d3385f0b9b3182ec650b166f0883e3747e22c7cb2
|
|
@@ -16,8 +16,6 @@ module Effective
|
|
|
16
16
|
unpublished: EffectiveResources.authorized?(self, :admin, :effective_posts)
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
@posts = @posts.paginate(page: params[:page])
|
|
20
|
-
|
|
21
19
|
if EffectivePosts.event_categories.include?(@category)
|
|
22
20
|
@posts = @posts.reorder(:start_at).where('start_at > ?', Time.zone.now)
|
|
23
21
|
end
|
|
@@ -35,6 +33,16 @@ module Effective
|
|
|
35
33
|
|
|
36
34
|
EffectiveResources.authorize!(self, :index, Effective::Post)
|
|
37
35
|
|
|
36
|
+
@posts_count = @posts.limit(nil).offset(nil).count
|
|
37
|
+
|
|
38
|
+
page = EffectiveResources.validate_page!(
|
|
39
|
+
params[:page],
|
|
40
|
+
collection_count: @posts_count,
|
|
41
|
+
per_page: EffectivePosts.per_page
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
@posts = @posts.paginate(page: page)
|
|
45
|
+
|
|
38
46
|
@page_title ||= [(@category || view_context.posts_name_label).to_s.titleize, (" - Page #{params[:page]}" if params[:page])].compact.join
|
|
39
47
|
@canonical_url ||= helpers.effective_post_category_url(params[:category], page: params[:page])
|
|
40
48
|
end
|
|
@@ -49,7 +57,7 @@ module Effective
|
|
|
49
57
|
|
|
50
58
|
EffectiveResources.authorize!(self, :show, @post)
|
|
51
59
|
|
|
52
|
-
if admin
|
|
60
|
+
if admin
|
|
53
61
|
flash.now[:warning] = [
|
|
54
62
|
'Hi Admin!',
|
|
55
63
|
('You are viewing a hidden post.' unless @post.published?),
|
data/config/effective_posts.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
EffectivePosts.setup do |config|
|
|
2
2
|
# Every post must have a category
|
|
3
3
|
# Each of these categories parameterized value will be a top level route
|
|
4
|
+
# Include 'Events' here to allow posts in an Events category
|
|
4
5
|
config.categories = ['News', 'Events']
|
|
5
6
|
|
|
6
|
-
# Which of the above categories will be considered post.event?
|
|
7
|
+
# Which of the above categories will be considered post.event?
|
|
7
8
|
# Used to select the fields on the Admin form
|
|
8
9
|
# Can't be unique. Must be subset of config.categories
|
|
10
|
+
# Use ['Events'] when config.categories includes 'Events'
|
|
9
11
|
config.event_categories = ['Events']
|
|
10
12
|
|
|
11
13
|
# Create top level routes for each category
|