effective_posts 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -9
- data/app/controllers/effective/posts_controller.rb +1 -1
- data/app/models/effective/post.rb +7 -0
- data/app/views/effective/posts/index.html.haml +2 -3
- data/config/effective_posts.rb +1 -1
- data/lib/effective_posts.rb +0 -1
- data/lib/effective_posts/version.rb +1 -1
- metadata +3 -24
- data/app/views/kaminari/_first_page.html.haml +0 -2
- data/app/views/kaminari/_gap.html.haml +0 -2
- data/app/views/kaminari/_last_page.html.haml +0 -2
- data/app/views/kaminari/_next_page.html.haml +0 -2
- data/app/views/kaminari/_page.html.haml +0 -6
- data/app/views/kaminari/_paginator.html.haml +0 -11
- data/app/views/kaminari/_prev_page.html.haml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 47bb689897ed31ceb48ad5648df6c3d4ecbd1106
|
4
|
+
data.tar.gz: ebe12bb48e0f6ad2bf48d307acd04ba5927b7a38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46abfef0b22ff676af43f48d221151aeeb697bc8fd7724133bf04c79626eeb2b8bebbd3f0e3a6fc419aaa2e85be3b4c46c29a11b3caabb22bbc8cb336bfb175
|
7
|
+
data.tar.gz: 907116a6c0e6f8a97a22b6bf053694824e776fa5d2f7d252a5b23e303c7d85f77564d6a11a445fbe0f4f1fc1e968860baf53276b848fa2b71382ac9c2cd17e3f
|
data/README.md
CHANGED
@@ -2,11 +2,6 @@
|
|
2
2
|
|
3
3
|
A blog implementation with WYSIWYG content editing, post scheduling, pagination and optional top level routes for each post category.
|
4
4
|
|
5
|
-
Built ontop of effective_regions for post content entry and Kaminari for pagination.
|
6
|
-
|
7
|
-
Rails 3.2.x and 4.x
|
8
|
-
|
9
|
-
|
10
5
|
## effective_posts 1.0
|
11
6
|
|
12
7
|
This is the 1.0 series of effective_posts.
|
@@ -88,13 +83,10 @@ Use `post_excerpt(post)` to display the excerpt for a post. Or `post_excerpt(po
|
|
88
83
|
|
89
84
|
## Pagination
|
90
85
|
|
91
|
-
The [
|
86
|
+
The [effective_bootstrap](https://github.com/code-and-effect/effective_bootstrap) gem is used for pagination on all posts#index type screens.
|
92
87
|
|
93
88
|
The per_page for posts may be configured via the `/app/config/initializers/effective_posts.rb` initializer.
|
94
89
|
|
95
|
-
Included within this gem is the bootstrap3 theme for kaminari, but, as with any gem, your app-specific kaminari views will take priority over these included views.
|
96
|
-
|
97
|
-
|
98
90
|
|
99
91
|
## Authorization
|
100
92
|
|
@@ -12,7 +12,7 @@ module Effective
|
|
12
12
|
unpublished: EffectivePosts.authorized?(self, :admin, :effective_posts)
|
13
13
|
)
|
14
14
|
|
15
|
-
@posts = @posts.page
|
15
|
+
@posts = @posts.paginate(page: params[:page])
|
16
16
|
|
17
17
|
if params[:category] == 'events'
|
18
18
|
@posts = @posts.reorder(:start_at).where('start_at > ?', Time.zone.now)
|
@@ -40,6 +40,13 @@ module Effective
|
|
40
40
|
scope :unpublished, -> { where(draft: true).or(where("#{EffectivePosts.posts_table_name}.published_at > ?", Time.zone.now)) }
|
41
41
|
scope :with_category, -> (category) { where(category: category.to_s.downcase) }
|
42
42
|
|
43
|
+
scope :paginate, -> (page: nil, per_page: EffectivePosts.per_page) {
|
44
|
+
page = (page || 1).to_i
|
45
|
+
offset = [(page - 1), 0].max * per_page
|
46
|
+
|
47
|
+
limit(per_page).offset(offset)
|
48
|
+
}
|
49
|
+
|
43
50
|
scope :posts, -> (user: nil, category: nil, unpublished: false) {
|
44
51
|
scope = all.includes(:regions).order(published_at: :desc)
|
45
52
|
|
data/config/effective_posts.rb
CHANGED
data/lib/effective_posts.rb
CHANGED
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.0
|
4
|
+
version: 1.1.0
|
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-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: kaminari
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: nokogiri
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,13 +156,6 @@ files:
|
|
170
156
|
- app/views/effective/posts/submitted.html.haml
|
171
157
|
- app/views/effective/posts_mailer/post_submitted_to_admin.html.haml
|
172
158
|
- app/views/effective/snippets/_read_more_divider.html.haml
|
173
|
-
- app/views/kaminari/_first_page.html.haml
|
174
|
-
- app/views/kaminari/_gap.html.haml
|
175
|
-
- app/views/kaminari/_last_page.html.haml
|
176
|
-
- app/views/kaminari/_next_page.html.haml
|
177
|
-
- app/views/kaminari/_page.html.haml
|
178
|
-
- app/views/kaminari/_paginator.html.haml
|
179
|
-
- app/views/kaminari/_prev_page.html.haml
|
180
159
|
- app/views/layouts/effective_posts_mailer_layout.html.haml
|
181
160
|
- config/effective_posts.rb
|
182
161
|
- config/routes.rb
|
@@ -206,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
185
|
version: '0'
|
207
186
|
requirements: []
|
208
187
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.4.5.1
|
210
189
|
signing_key:
|
211
190
|
specification_version: 4
|
212
191
|
summary: A blog implementation with WYSIWYG content editing, post scheduling, pagination
|
@@ -1,11 +0,0 @@
|
|
1
|
-
= paginator.render do
|
2
|
-
%ul.pagination
|
3
|
-
= first_page_tag unless current_page.first?
|
4
|
-
= prev_page_tag unless current_page.first?
|
5
|
-
- each_page do |page|
|
6
|
-
- if page.left_outer? || page.right_outer? || page.inside_window?
|
7
|
-
= page_tag page
|
8
|
-
- elsif !page.was_truncated?
|
9
|
-
= gap_tag
|
10
|
-
= next_page_tag unless current_page.last?
|
11
|
-
= last_page_tag unless current_page.last?
|