newellista-searchlogic 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/searchlogic/rails_helpers.rb +6 -1
- data/searchlogic.gemspec +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -13,13 +13,18 @@ module Searchlogic
|
|
13
13
|
# * <tt>:ascend_scope</tt> - what scope to call for ascending the data, defaults to "ascend_by_:by"
|
14
14
|
# * <tt>:descend_scope</tt> - what scope to call for descending the data, defaults to "descend_by_:by"
|
15
15
|
# * <tt>:params_scope</tt> - the name of the params key to scope the order condition by, defaults to :search
|
16
|
+
# * <tt>:tri_state</tt> - true turns sort into tri-state sort, eg: ascending, descending, off. Defaults to false
|
16
17
|
def order(search, options = {}, html_options = {})
|
17
18
|
options[:params_scope] ||= :search
|
18
19
|
options[:as] ||= options[:by].to_s.humanize
|
19
20
|
options[:ascend_scope] ||= "ascend_by_#{options[:by]}"
|
20
21
|
options[:descend_scope] ||= "descend_by_#{options[:by]}"
|
22
|
+
|
21
23
|
ascending = search.order.to_s == options[:ascend_scope]
|
22
|
-
|
24
|
+
|
25
|
+
tri_state = options[:tri_state].to_s == "true"
|
26
|
+
new_scope = ascending ? options[:descend_scope] : ( tri_state ? "" : options[:ascend_scope] )
|
27
|
+
|
23
28
|
selected = [options[:ascend_scope], options[:descend_scope]].include?(search.order.to_s)
|
24
29
|
if selected
|
25
30
|
css_classes = html_options[:class] ? html_options[:class].split(" ") : []
|
data/searchlogic.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{searchlogic}
|
5
|
-
s.version = "2.0.
|
5
|
+
s.version = "2.0.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ben Johnson of Binary Logic"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-24}
|
10
10
|
s.email = %q{bjohnson@binarylogic.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newellista-searchlogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Johnson of Binary Logic
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|