sunspot_with_kaminari 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,4 +8,21 @@ on `Gemfile`
8
8
 
9
9
  gem 'kaminari'
10
10
  gem "sunspot_rails"
11
- gem "sunspot_with_kaminari"
11
+ gem "sunspot_with_kaminari", '~> 0.1'
12
+
13
+ on the controller
14
+
15
+ @products ||= Product.search do
16
+ keywords params[:search]
17
+ paginate :page => params[:page], :per_page => 20
18
+ end
19
+
20
+ on the view you want to do something like this:
21
+
22
+ <ul>
23
+ <% @products.results.each do |product| %>
24
+ <li><%= product.name %></li>
25
+ <% end %>
26
+ </ul>
27
+
28
+ <%= paginate @products, :window => 1 %>
@@ -1,3 +1,3 @@
1
1
  module SunspotWithKaminari
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -28,6 +28,14 @@ module Sunspot
28
28
  def limit_value
29
29
  @query.per_page
30
30
  end
31
+
32
+ def empty?
33
+ total == 0
34
+ end
35
+
36
+ def any?
37
+ total > 0
38
+ end
31
39
  end
32
40
  end
33
41
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunspot_with_kaminari
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
5
+ version: 0.1.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Richard Millan
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-22 00:00:00 -07:00
19
- default_executable:
13
+ date: 2011-05-01 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: sunspot_rails
@@ -26,9 +20,6 @@ dependencies:
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
23
  version: "0"
33
24
  type: :runtime
34
25
  version_requirements: *id001
@@ -40,9 +31,6 @@ dependencies:
40
31
  requirements:
41
32
  - - ">="
42
33
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
34
  version: "0"
47
35
  type: :runtime
48
36
  version_requirements: *id002
@@ -63,7 +51,6 @@ files:
63
51
  - lib/sunspot_with_kaminari.rb
64
52
  - lib/sunspot_with_kaminari/version.rb
65
53
  - sunspot_with_kaminari.gemspec
66
- has_rdoc: true
67
54
  homepage: https://github.com/richardiux/sunspot_with_kaminari
68
55
  licenses: []
69
56
 
@@ -77,23 +64,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
64
  requirements:
78
65
  - - ">="
79
66
  - !ruby/object:Gem::Version
80
- hash: 3
81
- segments:
82
- - 0
83
67
  version: "0"
84
68
  required_rubygems_version: !ruby/object:Gem::Requirement
85
69
  none: false
86
70
  requirements:
87
71
  - - ">="
88
72
  - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
73
  version: "0"
93
74
  requirements: []
94
75
 
95
76
  rubyforge_project: sunspot_with_kaminari
96
- rubygems_version: 1.5.2
77
+ rubygems_version: 1.7.2
97
78
  signing_key:
98
79
  specification_version: 3
99
80
  summary: Pagination with kaminari for sunspot