lib/searchlogic/rails_helpers.rb in joost-searchlogic-2.1.7.1 vs lib/searchlogic/rails_helpers.rb in joost-searchlogic-2.2.3.1

- old
+ new

@@ -17,10 +17,11 @@ # # * <tt>:by</tt> - the name of the named scope. This helper will prepend this value with "ascend_by_" and "descend_by_" # * <tt>:as</tt> - the text used in the link, defaults to whatever is passed to :by # * <tt>:ascend_scope</tt> - what scope to call for ascending the data, defaults to "ascend_by_:by" # * <tt>:descend_scope</tt> - what scope to call for descending the data, defaults to "descend_by_:by" + # * <tt>:params</tt> - hash with additional params which will be added to generated url # * <tt>:params_scope</tt> - the name of the params key to scope the order condition by, defaults to :search # * <tt>:default_scope</tt> - either :asc or :desc, defaults to ascend_scope # * <tt>:arrow</tt> - set to true if you want an ascii arrow showing the ordering # * <tt>:css_classes</tt> - Array of what css classes you want to add, defaults to [:asc, :desc]. For old behaviour use [:ascending, :descending] here def order(search, options = {}, html_options = {}) @@ -43,11 +44,14 @@ end html_options[:class] = css_classes.join(" ") else new_scope = (options[:default_scope] == :desc) ? options[:descend_scope] : options[:ascend_scope] end - link_to options[:as], url_for(options[:params_scope] => search.conditions.merge( { :order => new_scope } ) ), html_options + url_options = { + options[:params_scope] => search.conditions.merge( { :order => new_scope } ) + }.deep_merge(options[:params] || {}) + link_to options[:as], url_for(url_options), html_options end # Automatically makes the form method :get if a Searchlogic::Search and sets # the params scope to :search def form_for_with_searchlogic(*args, &block) @@ -71,6 +75,6 @@ end fields_for_without_searchlogic(*args, &block) end end -end \ No newline at end of file +end