tb_blog 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/posts_controller.rb +6 -16
- data/lib/generators/spud/blog/views_generator.rb +5 -5
- data/lib/spud_blog/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 250051e40ce087fa0ce2207cfd3f452bb2b6c6dc
|
4
|
+
data.tar.gz: 8eb90c01fff8917f672846f2e16c1b62f559e842
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6290aab7f3741c21640a533c408aaddf096e975a7104e674c7f96906e22482fad28030952bdeb98696df1e7e9dbd876d1d584609e16f1bb08cdec84d3d4ad369
|
7
|
+
data.tar.gz: a269a9c499629f36a1df5d7a88d1f1c01a52c17cf21e4e0b5f24af6c3473f2b0a044787c60bdd3927a9d2218bd7d82f2c28ba2496c5efd550e999406216f3dc2
|
@@ -4,10 +4,11 @@ class PostsController < ApplicationController
|
|
4
4
|
respond_to :html, :json, :rss
|
5
5
|
|
6
6
|
before_action :load_blog
|
7
|
+
before_action :load_page_number, :only => [:index, :archive, :category]
|
7
8
|
before_action :find_post, :only => [:show, :create_comment]
|
8
9
|
|
9
10
|
def index
|
10
|
-
@posts = SpudPost.for_user(current_user).visible.for_blog(params[:blog_key]).ordered.paginate(:page =>
|
11
|
+
@posts = SpudPost.for_user(current_user).visible.for_blog(params[:blog_key]).ordered.paginate(:page => @page_number, :per_page => Spud::Blog.config.posts_per_page)
|
11
12
|
if params[:search]
|
12
13
|
@posts = @posts.search(params[:search])
|
13
14
|
end
|
@@ -32,19 +33,8 @@ class PostsController < ApplicationController
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def category
|
35
|
-
page = 1
|
36
|
-
if params[:page].blank? == false
|
37
|
-
page = params[:page].to_i
|
38
|
-
if page.to_s != params[:page].to_s
|
39
|
-
if(page > 1)
|
40
|
-
redirect_to post_category_path(:page => page),:status => :moved_permanently and return
|
41
|
-
else
|
42
|
-
redirect_to post_category_path(:page => nil),:status => :moved_permanently and return
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
36
|
if @post_category = SpudPostCategory.find_by_url_name(params[:category_url_name])
|
47
|
-
@posts = @post_category.posts.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).paginate(:page =>
|
37
|
+
@posts = @post_category.posts.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).paginate(:page => @page_number, :per_page => Spud::Blog.config.posts_per_page)
|
48
38
|
else
|
49
39
|
redirect_to posts_path
|
50
40
|
return
|
@@ -55,7 +45,7 @@ class PostsController < ApplicationController
|
|
55
45
|
end
|
56
46
|
|
57
47
|
def archive
|
58
|
-
@posts = SpudPost.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).paginate(:page =>
|
48
|
+
@posts = SpudPost.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).paginate(:page => @page_number, :per_page => Spud::Blog.config.posts_per_page)
|
59
49
|
respond_with @posts do |format|
|
60
50
|
format.html { render view_for_action 'index' }
|
61
51
|
end
|
@@ -107,7 +97,7 @@ private
|
|
107
97
|
params.require(:spud_post_comment).permit(:author, :content)
|
108
98
|
end
|
109
99
|
|
110
|
-
def
|
100
|
+
def load_page_number
|
111
101
|
page = 1
|
112
102
|
if params[:page].present?
|
113
103
|
page = params[:page].to_i
|
@@ -119,7 +109,7 @@ private
|
|
119
109
|
end
|
120
110
|
end
|
121
111
|
end
|
122
|
-
|
112
|
+
@page_number = page
|
123
113
|
end
|
124
114
|
|
125
115
|
def load_blog
|
@@ -6,13 +6,13 @@ class Spud::Blog::ViewsGenerator < ::Rails::Generators::Base
|
|
6
6
|
|
7
7
|
def install
|
8
8
|
if Spud::Blog.config.blog_enabled
|
9
|
-
copy_file '
|
10
|
-
copy_file '
|
11
|
-
copy_file '
|
9
|
+
copy_file 'posts/_comment_form.html.erb', 'app/views/blog/_comment_form.html.erb'
|
10
|
+
copy_file 'posts/index.html.erb', 'app/views/blog/index.html.erb'
|
11
|
+
copy_file 'posts/show.html.erb', 'app/views/blog/show.html.erb'
|
12
12
|
end
|
13
13
|
if Spud::Blog.config.news_enabled
|
14
|
-
copy_file '
|
15
|
-
copy_file '
|
14
|
+
copy_file 'posts/index.html.erb', 'app/views/news/index.html.erb'
|
15
|
+
copy_file 'posts/show.html.erb', 'app/views/news/show.html.erb'
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/spud_blog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Westlake Design
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
319
|
rubyforge_project:
|
320
|
-
rubygems_version: 2.
|
320
|
+
rubygems_version: 2.4.6
|
321
321
|
signing_key:
|
322
322
|
specification_version: 4
|
323
323
|
summary: Twice Baked Blog Engine.
|