Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added remote_helper config option

  • Loading branch information...
commit d5ef895f68ec09b0d7422d976fd63470bce442b1 1 parent 96a3cd5
@binarylogic authored
View
4 CHANGELOG.rdoc
@@ -1,3 +1,7 @@
+== 1.1.2 released 2008-09-19
+
+* Added remote_helpers config option.
+
== 1.1.1 released 2008-09-19
* Fixed typo in "next page" button.
View
5 README.rdoc
@@ -9,6 +9,7 @@ Searchgasm is orgasmic. Maybe not orgasmic, but you will get aroused. So go grab
* <b>Documentation:</b> http://searchgasm.rubyforge.org
* <b>Easy pagination, ordering, and searching tutorial:</b> http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm
* <b>Live example of the tutorial above (with source):</b> http://searchgasm_example.binarylogic.com
+* <b>Bugs / feature suggestions:</b> http://binarylogic.lighthouseapp.com/projects/16601-searchgasm
== Install and use
@@ -353,10 +354,6 @@ ActiveRecord should never know about Searchgasm
What that rule means is that any options you pass when searching get "sanitized" down into options ActiveRecord can understand. Searchgasm serves as a transparent filter between you and ActiveRecord. It doesn't dig into the ActiveRecord internals, it only uses what is publicly available. It jumps in and helps out <em>only</em> when needed, otherwise it sits back and stays completely out of the way. Between that and the extensive tests, this is a solid and fast plugin.
-== Reporting problems / bugs
-
-http://binarylogic.lighthouseapp.com/projects/16601-searchgasm
-
== Credits
Author: {Ben Johnson}[http://github.com/binarylogic] of {Binary Logic}[http://www.binarylogic.com]
View
28 lib/searchgasm/config.rb
@@ -43,6 +43,18 @@ def desc_indicator=(value)
@desc_indicator = value
end
+ def hidden_fields # :nodoc:
+ @hidden_fields ||= (Search::Base::SPECIAL_FIND_OPTIONS - [:page])
+ end
+
+ # Which hidden fields to automatically include when creating a form with a Searchgasm object. See Searchgasm::Helpers::Form for more info.
+ #
+ # * <tt>Default:</tt> [:order_by, :order_as, :per_page]
+ # * <tt>Accepts:</tt> Array, nil, false
+ def hidden_fields=(value)
+ @hidden_fields = value
+ end
+
def page_links_first # :nodoc:
@page_links_first
end
@@ -80,7 +92,7 @@ def page_links_inner_spread=(value)
end
def page_links_outer_spread # :nodoc:
- @page_links_outer_spread ||= 2
+ @page_links_outer_spread ||= 1
end
# The default for the :outer_spread option for the page_links helper.
@@ -142,16 +154,16 @@ def per_page_choices=(value)
@per_page_choices = value
end
- def hidden_fields # :nodoc:
- @hidden_fields ||= (Search::Base::SPECIAL_FIND_OPTIONS - [:page])
+ def remote_helpers # :nodoc:
+ @remote_helpers
end
- # Which hidden fields to automatically include when creating a form with a Searchgasm object. See Searchgasm::Helpers::Form for more info.
+ # Sets the default for the :is_remote option for helpers.
#
- # * <tt>Default:</tt> [:order_by, :order_as, :per_page]
- # * <tt>Accepts:</tt> Array, nil, false
- def hidden_fields=(value)
- @hidden_fields = value
+ # * <tt>Default:</tt> false
+ # * <tt>Accepts:</tt> Boolean
+ def remote_helpers=(value)
+ @remote_helpers = value
end
end
end
View
13 lib/searchgasm/helpers/control_types/links.rb
@@ -90,15 +90,10 @@ def per_page_links(options = {})
#
# Please look at per_page_link. All options there are applicable here and are passed onto each option.
#
- # * <tt>:inner_spread</tt> -- default: 3, set to nil to show all pages, this represents how many choices available on each side of the current page
- # * <tt>:outer_spread</tt> -- default: 1, set to nil to disable, this represents how many choices are in the "outer" spread. If set to 0, the separator will be present with no page links. This option changes the links from
- # * "< Prev 2 3 4 [5] 6 7 8 Next >" with 10 total pages to:
- # * "< Prev ... 3 4 [5] 6 7 ... Next >" for :outer_spread = 0 and :inner_spread = 3
- # * "< Prev 1 ... 3 4 [5] 6 7 ... 10 Next >" for :outer_spread = 1 and :inner_spread = 3
- # * "< Prev 1 2 ... 3 4 [5] 6 7 ... 9 10 Next >" for :outer_spread = 2 and :inner_spread = 3 (outer_spread = number of absolute pages on each side)
- # * Outer spread pages will not be visible unless the current_page is more than :inner_spread away from the first or last page.
- # * <tt>:prev</tt> -- default: < Prev, set to nil to omit. This is an extra link on the left side of the page links that will go to the previous page
- # * <tt>:next</tt> -- default: Next >, set to nil to omit. This is an extra link on the right side of the page links that will go to the next page
+ # * <tt>:inner_spread</tt> -- default: 3, set to nil to show all pages, set 0 to show no page links. This represents how many choices available on each side of the current page
+ # * <tt>:outer_spread</tt> -- default: 1, set to nil to disable, set to 0 show no outer spread but the separator will still be present. This represents how many choices are in the "outer" spread.
+ # * <tt>:prev</tt> -- default: "< Prev", set to nil to omit. This is an extra link on the left side of the page links that will go to the previous page
+ # * <tt>:next</tt> -- default: "Next >", set to nil to omit. This is an extra link on the right side of the page links that will go to the next page
# * <tt>:first</tt> -- default: nil, set to nil to omit. This is an extra link on thefar left side of the page links that will go to the first page
# * <tt>:last</tt> -- default: nil, set to nil to omit. This is an extra link on the far right side of the page links that will go to the last page
def page_links(options = {})
View
1  lib/searchgasm/helpers/utilities.rb
@@ -7,6 +7,7 @@ def add_searchgasm_helper_defaults!(option, options)
options[:params_scope] = :search unless options.has_key?(:params_scope)
options[:search_obj] ||= instance_variable_get("@#{options[:params_scope]}")
raise(ArgumentError, "@search object could not be inferred, please specify: :search_obj => @search") unless options[:search_obj].is_a?(Searchgasm::Search::Base)
+ options[:is_remote] = Config.remote_helpers
options[:html] ||= {}
options[:html][:class] ||= ""
searchgasm_add_class!(options[:html], option)
View
2  lib/searchgasm/version.rb
@@ -67,7 +67,7 @@ def to_a
MAJOR = 1
MINOR = 1
- TINY = 1
+ TINY = 2
# The current version as a Version instance
CURRENT = new(MAJOR, MINOR, TINY)
Please sign in to comment.
Something went wrong with that request. Please try again.