comfy_blog 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,12 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', '>=3.1.0'
4
- gem 'will_paginate', '~>3.0.2'
5
- gem 'rails_autolink', '~>1.0.4'
4
+ gem 'rails_autolink', '>=1.0.4'
6
5
  gem 'jquery-rails', '>=1.0.0'
7
6
 
7
+ # gem 'will_paginate', '>=3.0.2'
8
+ # gem 'kaminari', '>=0.0.0'
9
+
8
10
  group :test do
9
11
  gem 'sqlite3'
10
12
  gem 'jeweler'
data/README.md CHANGED
@@ -50,6 +50,7 @@ Since ComfyBlog is an engine, it allows you to completely overwrite views. It's
50
50
  create `app/views/blog/posts/index.html.erb` (could be HAML or whatever you want) and structure
51
51
  it in any way you want. There's also `show.html.erb` and `_post.html.erb` available.
52
52
 
53
+ Pagination is done using either [WillPaginate](https://github.com/mislav/will_paginate) or [Kaminari](https://github.com/amatsuda/kaminari). Add either in your Gemfile.
53
54
  You can control number of posts per page by adjusting this config:
54
55
 
55
56
  config.posts_per_page = 10
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -4,7 +4,13 @@ class Admin::Blog::PostsController < Admin::Blog::BaseController
4
4
  before_filter :load_post, :only => [:edit, :update, :destroy]
5
5
 
6
6
  def index
7
- @posts = Blog::Post.paginate :page => params[:page]
7
+ @posts = if defined? WillPaginate
8
+ Blog::Post.paginate :page => params[:page]
9
+ elsif defined? Kaminari
10
+ Blog::Post.page params[:page]
11
+ else
12
+ Blog::Post.all
13
+ end
8
14
  end
9
15
 
10
16
  def new
@@ -16,7 +16,13 @@ class Blog::PostsController < ApplicationController
16
16
 
17
17
  respond_to do |f|
18
18
  f.html do
19
- @posts = scope.paginate :per_page => ComfyBlog.config.posts_per_page, :page => params[:page]
19
+ @posts = if defined? WillPaginate
20
+ scope.paginate :per_page => ComfyBlog.config.posts_per_page, :page => params[:page]
21
+ elsif defined? Kaminari
22
+ scope.page(params[:page]).per(ComfyBlog.config.posts_per_page)
23
+ else
24
+ scope
25
+ end
20
26
  end
21
27
  f.rss do
22
28
  @posts = scope.limit(ComfyBlog.config.posts_per_page)
@@ -8,4 +8,8 @@
8
8
  <% end %>
9
9
  </ul>
10
10
 
11
- <%= will_paginate @posts %>
11
+ <% if defined?(WillPaginate) %>
12
+ <%= will_paginate @posts %>
13
+ <% elsif defined?(Kaminari)%>
14
+ <%= paginate @posts %>
15
+ <% end %>
@@ -2,4 +2,8 @@
2
2
  <%= render :partial => 'post', :object => post %>
3
3
  <% end %>
4
4
 
5
- <%= will_paginate @posts, :previous_label => '« Older Posts', :next_label => 'Newer Posts »', :page_links => false %>
5
+ <% if defined?(WillPaginate) %>
6
+ <%= will_paginate @posts, :previous_label => '« Older Posts', :next_label => 'Newer Posts »', :page_links => false %>
7
+ <% elsif defined?(Kaminari) %>
8
+ <%= paginate @posts %>
9
+ <% end %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "comfy_blog"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc."]
12
- s.date = "2012-01-20"
12
+ s.date = "2012-01-30"
13
13
  s.description = ""
14
14
  s.email = "oleg@twg.ca"
15
15
  s.extra_rdoc_files = [
@@ -121,19 +121,16 @@ Gem::Specification.new do |s|
121
121
 
122
122
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
123
123
  s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
124
- s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.2"])
125
- s.add_runtime_dependency(%q<rails_autolink>, ["~> 1.0.4"])
124
+ s.add_runtime_dependency(%q<rails_autolink>, [">= 1.0.4"])
126
125
  s.add_runtime_dependency(%q<jquery-rails>, [">= 1.0.0"])
127
126
  else
128
127
  s.add_dependency(%q<rails>, [">= 3.1.0"])
129
- s.add_dependency(%q<will_paginate>, ["~> 3.0.2"])
130
- s.add_dependency(%q<rails_autolink>, ["~> 1.0.4"])
128
+ s.add_dependency(%q<rails_autolink>, [">= 1.0.4"])
131
129
  s.add_dependency(%q<jquery-rails>, [">= 1.0.0"])
132
130
  end
133
131
  else
134
132
  s.add_dependency(%q<rails>, [">= 3.1.0"])
135
- s.add_dependency(%q<will_paginate>, ["~> 3.0.2"])
136
- s.add_dependency(%q<rails_autolink>, ["~> 1.0.4"])
133
+ s.add_dependency(%q<rails_autolink>, [">= 1.0.4"])
137
134
  s.add_dependency(%q<jquery-rails>, [">= 1.0.0"])
138
135
  end
139
136
  end
@@ -10,10 +10,12 @@ class Admin::Blog::PostsControllerTest < ActionController::TestCase
10
10
  end
11
11
 
12
12
  def test_get_index_with_pagination
13
- get :index, :page => 99
14
- assert_response :success
15
- assert assigns(:posts)
16
- assert_equal 0, assigns(:posts).size
13
+ if defined?(WillPaginate) || defined?(Kaminari)
14
+ get :index, :page => 99
15
+ assert_response :success
16
+ assert assigns(:posts)
17
+ assert_equal 0, assigns(:posts).size
18
+ end
17
19
  end
18
20
 
19
21
  def test_get_new
@@ -26,9 +26,11 @@ class Blog::PostsControllerTest < ActionController::TestCase
26
26
  end
27
27
 
28
28
  def test_get_index_with_pagination
29
- get :index, :page => 99
30
- assert_response :success
31
- assert_equal 0, assigns(:posts).size
29
+ if defined?(WillPaginate) || defined?(Kaminari)
30
+ get :index, :page => 99
31
+ assert_response :success
32
+ assert_equal 0, assigns(:posts).size
33
+ end
32
34
  end
33
35
 
34
36
  def test_get_index_for_tagged
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfy_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-20 00:00:00.000000000Z
13
+ date: 2012-01-30 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70292918028660 !ruby/object:Gem::Requirement
17
+ requirement: &70142022204480 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,32 +22,21 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70292918028660
26
- - !ruby/object:Gem::Dependency
27
- name: will_paginate
28
- requirement: &70292918028060 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 3.0.2
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: *70292918028060
25
+ version_requirements: *70142022204480
37
26
  - !ruby/object:Gem::Dependency
38
27
  name: rails_autolink
39
- requirement: &70292918027460 !ruby/object:Gem::Requirement
28
+ requirement: &70142022203220 !ruby/object:Gem::Requirement
40
29
  none: false
41
30
  requirements:
42
- - - ~>
31
+ - - ! '>='
43
32
  - !ruby/object:Gem::Version
44
33
  version: 1.0.4
45
34
  type: :runtime
46
35
  prerelease: false
47
- version_requirements: *70292918027460
36
+ version_requirements: *70142022203220
48
37
  - !ruby/object:Gem::Dependency
49
38
  name: jquery-rails
50
- requirement: &70292918026880 !ruby/object:Gem::Requirement
39
+ requirement: &70142022201680 !ruby/object:Gem::Requirement
51
40
  none: false
52
41
  requirements:
53
42
  - - ! '>='
@@ -55,7 +44,7 @@ dependencies:
55
44
  version: 1.0.0
56
45
  type: :runtime
57
46
  prerelease: false
58
- version_requirements: *70292918026880
47
+ version_requirements: *70142022201680
59
48
  description: ''
60
49
  email: oleg@twg.ca
61
50
  executables: []
@@ -171,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
160
  version: '0'
172
161
  segments:
173
162
  - 0
174
- hash: 4279942090542155642
163
+ hash: -3227396926195768290
175
164
  required_rubygems_version: !ruby/object:Gem::Requirement
176
165
  none: false
177
166
  requirements: