Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit acd468ac6d0ee93f60d06a971505962984590859 @richardiux committed Mar 9, 2011
Showing with 70 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +4 −0 Gemfile
  3. 0 README.md
  4. +2 −0 Rakefile
  5. +33 −0 lib/sunspot_with_kaminari.rb
  6. +3 −0 lib/sunspot_with_kaminari/version.rb
  7. +24 −0 sunspot_with_kaminari.gemspec
4 .gitignore
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in sunspot_with_kaminari.gemspec
+gemspec
0 README.md
No changes.
2 Rakefile
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
33 lib/sunspot_with_kaminari.rb
@@ -0,0 +1,33 @@
+# module SunspotWithKaminari
+# end
+
+module Sunspot
+ module Search
+ class AbstractSearch
+
+ # ==== Returns
+ #
+ # Integer:: Current page number
+ #
+ def current_page
+ @query.page
+ end
+
+ # ==== Returns
+ #
+ # Integer:: Total number of pages for matching documents
+ #
+ def num_pages
+ (total.to_f / @query.per_page).ceil
+ end
+
+ # ==== Returns
+ #
+ # Integer:: Number of records displayed per page
+ #
+ def limit_value
+ @query.per_page
+ end
+ end
+ end
+end
3 lib/sunspot_with_kaminari/version.rb
@@ -0,0 +1,3 @@
+module SunspotWithKaminari
+ VERSION = "0.0.1"
+end
24 sunspot_with_kaminari.gemspec
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "sunspot_with_kaminari/version"
+
+Gem::Specification.new do |s|
+ s.name = "sunspot_with_kaminari"
+ s.version = SunspotWithKaminari::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Richard Millan"]
+ s.email = ["richardiux@gmail.com"]
+ s.homepage = "https://github.com/richardiux/sunspot_with_kaminari"
+ s.summary = %q{Pagination with kaminari for sunspot}
+ s.description = %q{Extends sunspot to be compatible with kaminari for pagination}
+
+ s.rubyforge_project = "sunspot_with_kaminari"
+
+ s.add_dependency 'sunspot_rails'
+ s.add_dependency 'kaminari'
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end

0 comments on commit acd468a

Please sign in to comment.
Something went wrong with that request. Please try again.