sunspot_with_kaminari 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +11 -0
- data/Rakefile +2 -0
- data/lib/sunspot_with_kaminari.rb +33 -0
- data/lib/sunspot_with_kaminari/version.rb +3 -0
- data/sunspot_with_kaminari.gemspec +24 -0
- metadata +101 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# module SunspotWithKaminari
|
2
|
+
# end
|
3
|
+
|
4
|
+
module Sunspot
|
5
|
+
module Search
|
6
|
+
class AbstractSearch
|
7
|
+
|
8
|
+
# ==== Returns
|
9
|
+
#
|
10
|
+
# Integer:: Current page number
|
11
|
+
#
|
12
|
+
def current_page
|
13
|
+
@query.page
|
14
|
+
end
|
15
|
+
|
16
|
+
# ==== Returns
|
17
|
+
#
|
18
|
+
# Integer:: Total number of pages for matching documents
|
19
|
+
#
|
20
|
+
def num_pages
|
21
|
+
(total.to_f / @query.per_page).ceil
|
22
|
+
end
|
23
|
+
|
24
|
+
# ==== Returns
|
25
|
+
#
|
26
|
+
# Integer:: Number of records displayed per page
|
27
|
+
#
|
28
|
+
def limit_value
|
29
|
+
@query.per_page
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sunspot_with_kaminari/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "sunspot_with_kaminari"
|
7
|
+
s.version = SunspotWithKaminari::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Richard Millan"]
|
10
|
+
s.email = ["richardiux@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/richardiux/sunspot_with_kaminari"
|
12
|
+
s.summary = %q{Pagination with kaminari for sunspot}
|
13
|
+
s.description = %q{Extends sunspot to be compatible with kaminari for pagination}
|
14
|
+
|
15
|
+
s.rubyforge_project = "sunspot_with_kaminari"
|
16
|
+
|
17
|
+
s.add_dependency 'sunspot_rails'
|
18
|
+
s.add_dependency 'kaminari'
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sunspot_with_kaminari
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Richard Millan
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-22 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: sunspot_rails
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: kaminari
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
description: Extends sunspot to be compatible with kaminari for pagination
|
50
|
+
email:
|
51
|
+
- richardiux@gmail.com
|
52
|
+
executables: []
|
53
|
+
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files: []
|
57
|
+
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
63
|
+
- lib/sunspot_with_kaminari.rb
|
64
|
+
- lib/sunspot_with_kaminari/version.rb
|
65
|
+
- sunspot_with_kaminari.gemspec
|
66
|
+
has_rdoc: true
|
67
|
+
homepage: https://github.com/richardiux/sunspot_with_kaminari
|
68
|
+
licenses: []
|
69
|
+
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: sunspot_with_kaminari
|
96
|
+
rubygems_version: 1.5.2
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Pagination with kaminari for sunspot
|
100
|
+
test_files: []
|
101
|
+
|