Permalink
Browse files

Released v1.2.1

  • Loading branch information...
binarylogic committed Sep 26, 2008
1 parent aa92d67 commit 66d97e481842e034600bd068f72c48ce2da452d2
Showing with 9 additions and 7 deletions.
  1. +7 −5 lib/searchgasm/helpers/control_types/link.rb
  2. +1 −1 lib/searchgasm/search/ordering.rb
  3. +1 −1 lib/searchgasm/version.rb
@@ -147,6 +147,7 @@ def order_as_link(order_as, options = {})
# === Options
# * <tt>:activate_text</tt> -- default: "Show #{column_name.to_s.humanize} first"
# * <tt>:deactivate_text</tt> -- default: "Don't show #{column_name.to_s.humanize} first", text for the link, text for the link
+ # * <tt>:column_name</tt> -- default: column_name.to_s.humanize, automatically inferred by what you are ordering by and is added into the active_text and deactive_text strings.
# * <tt>:text</tt> -- default: :activate_text or :deactivate_text depending on if its active or not, Overwriting this will make this text stay the same, no matter way. A good alternative would be "Toggle featured first"
# * <tt>:html</tt> -- html arrtributes for the <a> tag.
#
@@ -257,14 +258,15 @@ def add_order_as_link_defaults!(order_as, options = {})
def add_priority_order_by_link_defaults!(priority_order_by, priority_order_as, options = {})
add_searchgasm_control_defaults!(:priority_order_by, options)
- options[:activate_text] ||= "Show #{determine_order_by_text(priority_order_by)} first"
- options[:deactivate_text] ||= "Don't show #{determine_order_by_text(priority_order_by)} first"
+ options[:column_name] ||= determine_order_by_text(priority_order_by).downcase
+ options[:activate_text] ||= "Show #{options[:column_name]} first"
+ options[:deactivate_text] ||= "Don't show #{options[:column_name]} first"
active = deep_stringify(options[:search_obj].priority_order_by) == priority_order_by && options[:search_obj].priority_order_as == priority_order_as
- options[:text] += active ? options[:deactivate_text] : options[:activate_text]
+ options[:text] ||= active ? options[:deactivate_text] : options[:activate_text]
if active
- options.merge(:search_params => {:priority_order_by => priority_order_by, :priority_order_as => priority_order_as})
+ options.merge!(:search_params => {:priority_order_by => nil, :priority_order_as => nil})
else
- options.merge(:exclude_search_params => [:priority_order_by, :priority_order_as])
+ options.merge!(:search_params => {:priority_order_by => priority_order_by, :priority_order_as => priority_order_as})
end
options[:url] = searchgasm_params(options)
options
@@ -150,7 +150,7 @@ def priority_order_as=(value)
raise(ArgumentError, "priority_order_as only accepts a blank string / nil or a string as 'ASC' or 'DESC'") if !value.blank? && !["ASC", "DESC"].include?(value)
if @priority_order_by
@priority_order = order_by_to_order(@priority_order_by, value)
- elsif order
+ elsif priority_order
@priority_order.gsub!(/(ASC|DESC)/i, value)
end
@priority_order_as = value
@@ -67,7 +67,7 @@ def to_a
MAJOR = 1
MINOR = 2
- TINY = 0
+ TINY = 1
# The current version as a Version instance
CURRENT = new(MAJOR, MINOR, TINY)

0 comments on commit 66d97e4

Please sign in to comment.