mincer 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mincer/action_view/sort_helper.rb +2 -2
- data/lib/mincer/processors/sort.rb +4 -4
- data/lib/mincer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e7dd6365cd2d30f20a4595d0c5200254069203c
|
4
|
+
data.tar.gz: d0ed94870519e2b8942ada6e8a832d036b4ab94e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64bdc85e7bfb0fb9f5be0cbd9e151c9da26360d3fdd01024ba5a7fcd9fcba320def5fa53ee171b6bac818ef3b50668664fc1631589fbb38a0577743b7d70cfb4
|
7
|
+
data.tar.gz: eee05868aa5857630101de2a085dcaf5275390b2a248c3ea5fe50c1226458cd8c5e932637f975c7add37f468a57ef3f427f67a7cbeacee3a59274b010507fb20
|
@@ -11,9 +11,9 @@ module Mincer
|
|
11
11
|
|
12
12
|
def opposite_order_for(collection, attribute)
|
13
13
|
return nil unless collection.sort_attribute == attribute.to_s
|
14
|
-
if collection.sort_order.to_s.
|
14
|
+
if collection.sort_order.to_s.downcase == 'asc'
|
15
15
|
'DESC'
|
16
|
-
elsif collection.sort_order.to_s.
|
16
|
+
elsif collection.sort_order.to_s.downcase == 'desc'
|
17
17
|
'ASC'
|
18
18
|
else
|
19
19
|
'ASC'
|
@@ -8,20 +8,20 @@ module Mincer
|
|
8
8
|
|
9
9
|
def apply
|
10
10
|
relation = @relation.order(sort_string)
|
11
|
-
@mincer.sort_attribute, @mincer.sort_order =
|
11
|
+
@mincer.sort_attribute, @mincer.sort_order = sort_attr, order_attr
|
12
12
|
relation
|
13
13
|
end
|
14
14
|
|
15
15
|
def sort_string
|
16
|
-
sort_attr ? "#{sort_attr} #{order_attr}, #{@mincer.default_sort_attribute}" : "#{@mincer.default_sort_attribute} #{order_attr}"
|
16
|
+
sort_attr ? "#{sort_attr} #{order_attr}, #{@mincer.send(:default_sort_attribute)}" : "#{@mincer.send(:default_sort_attribute)} #{order_attr}"
|
17
17
|
end
|
18
18
|
|
19
19
|
def sort_attr
|
20
|
-
@mincer.allowed_sort_attributes.include?(@args['sort']) && @args['sort']
|
20
|
+
@mincer.send(:allowed_sort_attributes).include?(@args['sort']) && @args['sort']
|
21
21
|
end
|
22
22
|
|
23
23
|
def order_attr
|
24
|
-
(%w{ASC DESC}.include?(@args['order']) && @args['order']) || @mincer.default_sort_order
|
24
|
+
(%w{ASC DESC}.include?(@args['order']) && @args['order']) || @mincer.send(:default_sort_order)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/lib/mincer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mincer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Krasinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|