Skip to content
Browse files

Added default per_page option

  • Loading branch information...
1 parent f53b39f commit dc35d0e32e28740ec5ec184003c4b51eab2d90ca @binarylogic committed Sep 7, 2008
Showing with 30 additions and 6 deletions.
  1. +1 −1 config/environments/development.rb
  2. +5 −0 config/initializers/searchgasm.rb
  3. +2 −0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/CHANGELOG
  4. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/MIT-LICENSE
  5. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/Manifest
  6. +2 −1 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/README.rdoc
  7. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/Rakefile
  8. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/examples/README.rdoc
  9. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/init.rb
  10. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm.rb
  11. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/active_record/associations.rb
  12. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/active_record/base.rb
  13. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/base.rb
  14. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/begins_with.rb
  15. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/child_of.rb
  16. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/contains.rb
  17. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/descendant_of.rb
  18. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/does_not_equal.rb
  19. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/ends_with.rb
  20. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/equals.rb
  21. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/greater_than.rb
  22. 0 ...lugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/greater_than_or_equal_to.rb
  23. 0 ...plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/inclusive_descendant_of.rb
  24. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/keywords.rb
  25. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/less_than.rb
  26. 0 ...r/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/less_than_or_equal_to.rb
  27. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/sibling_of.rb
  28. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/condition/tree.rb
  29. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/conditions/base.rb
  30. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/conditions/protection.rb
  31. +12 −0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/config.rb
  32. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/helpers/form_helper.rb
  33. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/helpers/search_helper.rb
  34. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/helpers/utilities_helper.rb
  35. +4 −0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/search/base.rb
  36. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/search/conditions.rb
  37. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/search/ordering.rb
  38. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/search/pagination.rb
  39. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/search/protection.rb
  40. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/utilities.rb
  41. +1 −1 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/lib/searchgasm/version.rb
  42. +3 −3 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/searchgasm.gemspec
  43. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/fixtures/accounts.yml
  44. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/fixtures/orders.yml
  45. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/fixtures/users.yml
  46. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/libs/acts_as_tree.rb
  47. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/libs/rexml_fix.rb
  48. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_active_record_associations.rb
  49. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_active_record_base.rb
  50. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_condition.rb
  51. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_conditions_base.rb
  52. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_helper.rb
  53. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_search_base.rb
  54. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_search_ordering.rb
  55. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_search_pagination.rb
  56. 0 vendor/plugins/{searchgasm-0.9.7 → searchgasm-0.9.8}/test/test_search_protection.rb
View
2 config/environments/development.rb
@@ -17,4 +17,4 @@
config.action_mailer.raise_delivery_errors = false
config.plugin_paths += ["../../Ruby Libs"]
-config.plugins = [:calendar_date_select, :searchgasm]
+config.plugins = ["calendar_date_select", "searchgasm-0.9.8"]
View
5 config/initializers/searchgasm.rb
@@ -1,3 +1,8 @@
+# Confugration
+Searchgasm::Config.configure do |config|
+ config.per_page = config.per_page_choices.first # 20
+end
+
# Actual function for MySQL databases only
class SoundsLikeCondition < Searchgasm::Condition::Base
class << self
View
2 vendor/plugins/searchgasm-0.9.7/CHANGELOG → vendor/plugins/searchgasm-0.9.8/CHANGELOG
@@ -1,3 +1,5 @@
+v0.9.8. Fixed order_by helper bug when determing the text with arrays. Should use the first value instead of last. Added in per_page config option.
+
v0.9.7. Complete class restructure, much more organized, added in documentation, added in helpers for using searchgasm in a rails app, updated readme with link to documentation as well as a live example, some bug fixes, more tests
v0.9.6. Fix bug when instantiating with nil options
View
0 vendor/plugins/searchgasm-0.9.7/MIT-LICENSE → vendor/plugins/searchgasm-0.9.8/MIT-LICENSE
File renamed without changes.
View
0 vendor/plugins/searchgasm-0.9.7/Manifest → vendor/plugins/searchgasm-0.9.8/Manifest
File renamed without changes.
View
3 vendor/plugins/searchgasm-0.9.7/README.rdoc → vendor/plugins/searchgasm-0.9.8/README.rdoc
@@ -11,7 +11,8 @@ I'm a big fan of understanding what I'm using, so here's a quick explanation: Th
== Quicklinks
* <b>Documentation:</b> http://searchgasm.rubyforge.org
-* <b>Live rails example:</b> http://searchgasm_example.binarylogic.com
+* <b>Easy pagination, ordering, and searching tutorial:</b> http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm
+* <b>The tutorial above, live:</b> http://searchgasm_example.binarylogic.com
== Install and use
View
0 vendor/plugins/searchgasm-0.9.7/Rakefile → vendor/plugins/searchgasm-0.9.8/Rakefile
File renamed without changes.
View
0 ...ins/searchgasm-0.9.7/examples/README.rdoc → ...ins/searchgasm-0.9.8/examples/README.rdoc
File renamed without changes.
View
0 vendor/plugins/searchgasm-0.9.7/init.rb → vendor/plugins/searchgasm-0.9.8/init.rb
File renamed without changes.
View
0 ...lugins/searchgasm-0.9.7/lib/searchgasm.rb → ...lugins/searchgasm-0.9.8/lib/searchgasm.rb
File renamed without changes.
View
0 .../searchgasm/active_record/associations.rb → .../searchgasm/active_record/associations.rb
File renamed without changes.
View
0 ....9.7/lib/searchgasm/active_record/base.rb → ....9.8/lib/searchgasm/active_record/base.rb
File renamed without changes.
View
0 ...sm-0.9.7/lib/searchgasm/condition/base.rb → ...sm-0.9.8/lib/searchgasm/condition/base.rb
File renamed without changes.
View
0 ...7/lib/searchgasm/condition/begins_with.rb → ...8/lib/searchgasm/condition/begins_with.rb
File renamed without changes.
View
0 ....9.7/lib/searchgasm/condition/child_of.rb → ....9.8/lib/searchgasm/condition/child_of.rb
File renamed without changes.
View
0 ....9.7/lib/searchgasm/condition/contains.rb → ....9.8/lib/searchgasm/condition/contains.rb
File renamed without changes.
View
0 ...lib/searchgasm/condition/descendant_of.rb → ...lib/searchgasm/condition/descendant_of.rb
File renamed without changes.
View
0 ...ib/searchgasm/condition/does_not_equal.rb → ...ib/searchgasm/condition/does_not_equal.rb
File renamed without changes.
View
0 ...9.7/lib/searchgasm/condition/ends_with.rb → ...9.8/lib/searchgasm/condition/ends_with.rb
File renamed without changes.
View
0 ...-0.9.7/lib/searchgasm/condition/equals.rb → ...-0.9.8/lib/searchgasm/condition/equals.rb
File renamed without changes.
View
0 .../lib/searchgasm/condition/greater_than.rb → .../lib/searchgasm/condition/greater_than.rb
File renamed without changes.
View
0 ...asm/condition/greater_than_or_equal_to.rb → ...asm/condition/greater_than_or_equal_to.rb
File renamed without changes.
View
0 ...gasm/condition/inclusive_descendant_of.rb → ...gasm/condition/inclusive_descendant_of.rb
File renamed without changes.
View
0 ....9.7/lib/searchgasm/condition/keywords.rb → ....9.8/lib/searchgasm/condition/keywords.rb
File renamed without changes.
View
0 ...9.7/lib/searchgasm/condition/less_than.rb → ...9.8/lib/searchgasm/condition/less_than.rb
File renamed without changes.
View
0 ...chgasm/condition/less_than_or_equal_to.rb → ...chgasm/condition/less_than_or_equal_to.rb
File renamed without changes.
View
0 ....7/lib/searchgasm/condition/sibling_of.rb → ....8/lib/searchgasm/condition/sibling_of.rb
File renamed without changes.
View
0 ...sm-0.9.7/lib/searchgasm/condition/tree.rb → ...sm-0.9.8/lib/searchgasm/condition/tree.rb
File renamed without changes.
View
0 ...m-0.9.7/lib/searchgasm/conditions/base.rb → ...m-0.9.8/lib/searchgasm/conditions/base.rb
File renamed without changes.
View
0 ...7/lib/searchgasm/conditions/protection.rb → ...8/lib/searchgasm/conditions/protection.rb
File renamed without changes.
View
12 ...searchgasm-0.9.7/lib/searchgasm/config.rb → ...searchgasm-0.9.8/lib/searchgasm/config.rb
@@ -55,6 +55,18 @@ def pages_type=(value)
@pages_type = value.to_sym
end
+ def per_page # :nodoc:
+ @per_page
+ end
+
+ # The default for per page.
+ #
+ # * <tt>Default:</tt> nil, nil means "show all"
+ # * <tt>Accepts:</tt> Any value in your per_page choices
+ def per_page=(value)
+ @per_page = value
+ end
+
def per_page_choices # :nodoc:
@per_page_choices ||= [10, 25, 50, 100, 150, 200, nil]
end
View
0 ...9.7/lib/searchgasm/helpers/form_helper.rb → ...9.8/lib/searchgasm/helpers/form_helper.rb
File renamed without changes.
View
0 ...7/lib/searchgasm/helpers/search_helper.rb → ...8/lib/searchgasm/helpers/search_helper.rb
File renamed without changes.
View
0 ...ib/searchgasm/helpers/utilities_helper.rb → ...ib/searchgasm/helpers/utilities_helper.rb
File renamed without changes.
View
4 ...hgasm-0.9.7/lib/searchgasm/search/base.rb → ...hgasm-0.9.8/lib/searchgasm/search/base.rb
@@ -49,6 +49,10 @@ def inspect
"#<#{klass} #{options_as_nice_string}>"
end
+ def limit
+ @limit ||= Config.per_page
+ end
+
def limit=(value)
@limit = value.blank? || value == 0 ? nil : value.to_i
end
View
0 ...0.9.7/lib/searchgasm/search/conditions.rb → ...0.9.8/lib/searchgasm/search/conditions.rb
File renamed without changes.
View
0 ...m-0.9.7/lib/searchgasm/search/ordering.rb → ...m-0.9.8/lib/searchgasm/search/ordering.rb
File renamed without changes.
View
0 ...0.9.7/lib/searchgasm/search/pagination.rb → ...0.9.8/lib/searchgasm/search/pagination.rb
File renamed without changes.
View
0 ...0.9.7/lib/searchgasm/search/protection.rb → ...0.9.8/lib/searchgasm/search/protection.rb
File renamed without changes.
View
0 ...rchgasm-0.9.7/lib/searchgasm/utilities.rb → ...rchgasm-0.9.8/lib/searchgasm/utilities.rb
File renamed without changes.
View
2 ...earchgasm-0.9.7/lib/searchgasm/version.rb → ...earchgasm-0.9.8/lib/searchgasm/version.rb
@@ -67,7 +67,7 @@ def to_a
MAJOR = 0
MINOR = 9
- TINY = 7
+ TINY = 8
# The current version as a Version instance
CURRENT = new(MAJOR, MINOR, TINY)
View
6 ...ugins/searchgasm-0.9.7/searchgasm.gemspec → ...ugins/searchgasm-0.9.8/searchgasm.gemspec
@@ -1,18 +1,18 @@
-# Gem::Specification for Searchgasm-0.9.7
+# Gem::Specification for Searchgasm-0.9.8
# Originally generated by Echoe
--- !ruby/object:Gem::Specification
name: searchgasm
version: !ruby/object:Gem::Version
- version: 0.9.7
+ version: 0.9.8
platform: ruby
authors:
- Ben Johnson of Binary Logic
autorequire:
bindir: bin
-date: 2008-09-06 00:00:00 -04:00
+date: 2008-09-07 00:00:00 -04:00
default_executable:
dependencies:
- !ruby/object:Gem::Dependency
View
0 ...archgasm-0.9.7/test/fixtures/accounts.yml → ...archgasm-0.9.8/test/fixtures/accounts.yml
File renamed without changes.
View
0 ...searchgasm-0.9.7/test/fixtures/orders.yml → ...searchgasm-0.9.8/test/fixtures/orders.yml
File renamed without changes.
View
0 .../searchgasm-0.9.7/test/fixtures/users.yml → .../searchgasm-0.9.8/test/fixtures/users.yml
File renamed without changes.
View
0 ...earchgasm-0.9.7/test/libs/acts_as_tree.rb → ...earchgasm-0.9.8/test/libs/acts_as_tree.rb
File renamed without changes.
View
0 ...s/searchgasm-0.9.7/test/libs/rexml_fix.rb → ...s/searchgasm-0.9.8/test/libs/rexml_fix.rb
File renamed without changes.
View
0 ...7/test/test_active_record_associations.rb → ...8/test/test_active_record_associations.rb
File renamed without changes.
View
0 ...asm-0.9.7/test/test_active_record_base.rb → ...asm-0.9.8/test/test_active_record_base.rb
File renamed without changes.
View
0 ...s/searchgasm-0.9.7/test/test_condition.rb → ...s/searchgasm-0.9.8/test/test_condition.rb
File renamed without changes.
View
0 ...chgasm-0.9.7/test/test_conditions_base.rb → ...chgasm-0.9.8/test/test_conditions_base.rb
File renamed without changes.
View
0 ...gins/searchgasm-0.9.7/test/test_helper.rb → ...gins/searchgasm-0.9.8/test/test_helper.rb
File renamed without changes.
View
0 ...searchgasm-0.9.7/test/test_search_base.rb → ...searchgasm-0.9.8/test/test_search_base.rb
File renamed without changes.
View
0 ...chgasm-0.9.7/test/test_search_ordering.rb → ...chgasm-0.9.8/test/test_search_ordering.rb
File renamed without changes.
View
0 ...gasm-0.9.7/test/test_search_pagination.rb → ...gasm-0.9.8/test/test_search_pagination.rb
File renamed without changes.
View
0 ...gasm-0.9.7/test/test_search_protection.rb → ...gasm-0.9.8/test/test_search_protection.rb
File renamed without changes.

0 comments on commit dc35d0e

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