spud_blog 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/blog_controller.rb +21 -5
- data/lib/spud_blog/version.rb +1 -1
- metadata +4 -6
- data/test/dummy/log/development.log +0 -36
@@ -23,10 +23,14 @@ class BlogController < ApplicationController
|
|
23
23
|
|
24
24
|
def index
|
25
25
|
page = 1
|
26
|
-
if params[:page].blank? == false
|
26
|
+
if params[:page].blank? == false
|
27
27
|
page = params[:page].to_i
|
28
|
-
if
|
29
|
-
|
28
|
+
if page.to_s != params[:page].to_s
|
29
|
+
if(page > 1)
|
30
|
+
redirect_to blog_path(:page => page),:status => :moved_permanently and return
|
31
|
+
else
|
32
|
+
redirect_to blog_path(:page => nil),:status => :moved_permanently and return
|
33
|
+
end
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
@@ -51,11 +55,23 @@ class BlogController < ApplicationController
|
|
51
55
|
end
|
52
56
|
|
53
57
|
def category
|
58
|
+
page = 1
|
59
|
+
if params[:page].blank? == false
|
60
|
+
page = params[:page].to_i
|
61
|
+
if page.to_s != params[:page].to_s
|
62
|
+
if(page > 1)
|
63
|
+
redirect_to blog_category_path(:page => page),:status => :moved_permanently and return
|
64
|
+
else
|
65
|
+
redirect_to blog_category_path(:page => nil),:status => :moved_permanently and return
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
54
70
|
if @post_category = SpudPostCategory.find_by_url_name(params[:category_url_name])
|
55
71
|
if Spud::Core.config.multisite_mode_enabled
|
56
|
-
@posts = @post_category.posts_with_children.public_blog_posts(
|
72
|
+
@posts = @post_category.posts_with_children.public_blog_posts(page, Spud::Blog.config.posts_per_page).for_spud_site(current_site_id).from_archive(params[:archive_date])
|
57
73
|
else
|
58
|
-
@posts = @post_category.posts_with_children.public_blog_posts(
|
74
|
+
@posts = @post_category.posts_with_children.public_blog_posts(page, Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
|
59
75
|
end
|
60
76
|
else
|
61
77
|
redirect_to blog_path
|
data/lib/spud_blog/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -304,7 +304,6 @@ files:
|
|
304
304
|
- MIT-LICENSE
|
305
305
|
- Rakefile
|
306
306
|
- Readme.markdown
|
307
|
-
- test/dummy/log/development.log
|
308
307
|
- test/fixtures/spud_post_sites.yml
|
309
308
|
- test/unit/spud_post_site_test.rb
|
310
309
|
homepage: http://github.com/davydotcom/spud_blog
|
@@ -321,7 +320,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
321
320
|
version: '0'
|
322
321
|
segments:
|
323
322
|
- 0
|
324
|
-
hash:
|
323
|
+
hash: -4333841071858548276
|
325
324
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
326
325
|
none: false
|
327
326
|
requirements:
|
@@ -330,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
329
|
version: '0'
|
331
330
|
segments:
|
332
331
|
- 0
|
333
|
-
hash:
|
332
|
+
hash: -4333841071858548276
|
334
333
|
requirements: []
|
335
334
|
rubyforge_project:
|
336
335
|
rubygems_version: 1.8.24
|
@@ -338,6 +337,5 @@ signing_key:
|
|
338
337
|
specification_version: 3
|
339
338
|
summary: Spud Blog Engine.
|
340
339
|
test_files:
|
341
|
-
- test/dummy/log/development.log
|
342
340
|
- test/fixtures/spud_post_sites.yml
|
343
341
|
- test/unit/spud_post_site_test.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
Mysql2::Error: Table 'spud_blog_development.spud_users' doesn't exist: SHOW FULL FIELDS FROM `spud_users`
|
2
|
-
Mysql2::Error: Table 'spud_blog_development.spud_users' doesn't exist: SHOW FULL FIELDS FROM `spud_users`
|
3
|
-
Mysql2::Error: Table 'spud_blog_development.spud_users' doesn't exist: SHOW FULL FIELDS FROM `spud_users`
|
4
|
-
[1m[36m (153.8ms)[0m [1mCREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB[0m
|
5
|
-
[1m[35m (287.7ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
6
|
-
[1m[36m (0.2ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|
7
|
-
Migrating to CreateSpudPosts (20120125180945)
|
8
|
-
[1m[35m (163.8ms)[0m CREATE TABLE `spud_posts` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `title` varchar(255), `content` text, `comments_enabled` tinyint(1) DEFAULT 0, `visible` tinyint(1) DEFAULT 1, `published_at` datetime, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
9
|
-
[1m[36m (225.6ms)[0m [1mCREATE INDEX `index_spud_posts_on_spud_user_id` ON `spud_posts` (`spud_user_id`)[0m
|
10
|
-
[1m[35m (178.6ms)[0m CREATE INDEX `index_spud_posts_on_visible` ON `spud_posts` (`visible`)
|
11
|
-
[1m[36m (0.5ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120125180945')[0m
|
12
|
-
Migrating to CreateSpudPostCategories (20120125181022)
|
13
|
-
[1m[35m (214.2ms)[0m CREATE TABLE `spud_post_categories` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `name` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
14
|
-
[1m[36m (209.6ms)[0m [1mCREATE TABLE `spud_post_categories_posts` (`spud_post_id` int(11), `spud_post_category_id` int(11)) ENGINE=InnoDB[0m
|
15
|
-
[1m[35m (182.2ms)[0m CREATE INDEX `index_spud_post_categories_posts_on_spud_post_category_id` ON `spud_post_categories_posts` (`spud_post_category_id`)
|
16
|
-
[1m[36m (0.6ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120125181022')[0m
|
17
|
-
Migrating to CreateSpudPostComments (20120125181359)
|
18
|
-
[1m[35m (171.4ms)[0m CREATE TABLE `spud_post_comments` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_post_id` int(11), `author` varchar(255), `content` text, `approved` tinyint(1) DEFAULT 0, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
19
|
-
[1m[36m (237.9ms)[0m [1mCREATE INDEX `index_spud_post_comments_on_spud_post_id` ON `spud_post_comments` (`spud_post_id`)[0m
|
20
|
-
[1m[35m (227.0ms)[0m CREATE INDEX `index_spud_post_comments_on_approved` ON `spud_post_comments` (`approved`)
|
21
|
-
[1m[36m (0.5ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120125181359')[0m
|
22
|
-
Migrating to AddUrlToSpudPosts (20120127143054)
|
23
|
-
[1m[35m (239.3ms)[0m ALTER TABLE `spud_posts` ADD `url_name` varchar(255)
|
24
|
-
[1m[36m (234.5ms)[0m [1mCREATE INDEX `index_spud_posts_on_url_name` ON `spud_posts` (`url_name`)[0m
|
25
|
-
[1m[35m (0.6ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20120127143054')
|
26
|
-
Migrating to AddUrlToSpudPostCategories (20120127144942)
|
27
|
-
[1m[36m (196.9ms)[0m [1mALTER TABLE `spud_post_categories` ADD `parent_id` int(11) DEFAULT 0[0m
|
28
|
-
[1m[35m (220.7ms)[0m ALTER TABLE `spud_post_categories` ADD `url_name` varchar(255)
|
29
|
-
[1m[36m (179.0ms)[0m [1mCREATE INDEX `index_spud_post_categories_on_parent_id` ON `spud_post_categories` (`parent_id`)[0m
|
30
|
-
[1m[35m (178.4ms)[0m CREATE INDEX `index_spud_post_categories_on_url_name` ON `spud_post_categories` (`url_name`)
|
31
|
-
[1m[36m (0.6ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120127144942')[0m
|
32
|
-
Migrating to AddIsNewsToSpudPosts (20120210165540)
|
33
|
-
[1m[35m (207.1ms)[0m ALTER TABLE `spud_posts` ADD `is_news` tinyint(1) DEFAULT 0
|
34
|
-
[1m[36m (212.3ms)[0m [1mCREATE INDEX `index_spud_posts_on_is_news` ON `spud_posts` (`is_news`)[0m
|
35
|
-
[1m[35m (0.8ms)[0m INSERT INTO `schema_migrations` (`version`) VALUES ('20120210165540')
|
36
|
-
[1m[36m (0.2ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|