awesome_sort 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/awesome_sort/awesome_sort_helper.rb +10 -0
- data/lib/awesome_sort/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0f25fd57e06d861fae2d99696273dd6065d0a42ee2a3e0744cc141c2371b416
|
4
|
+
data.tar.gz: 5fe97c959a6dac645f2e99465c3acea1711911b967db918c3edf125768e4c122
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfe404d2416d95098979c2e1bbb1c36bc4c7ef801a732738f41f41cd1f532e3ece2e267ce3a983f4df6171b8f76e840f492f16b48e47818b21e11579612e2b12
|
7
|
+
data.tar.gz: 01edde9ad693507d4ac80b3dfc3d4e63b2c7ea084b64819dd03dd291f71181ec07012b33cf9251667dab890a1e9a9f99b45aeb1e125962b09f40e559b30d4474
|
@@ -1,5 +1,14 @@
|
|
1
1
|
module AwesomeSort
|
2
2
|
module AwesomeSortHelper
|
3
|
+
ALLOWED_SORT_ORDERS = [
|
4
|
+
'asc',
|
5
|
+
'desc',
|
6
|
+
'ASC',
|
7
|
+
'DESC',
|
8
|
+
:asc,
|
9
|
+
:desc,
|
10
|
+
]
|
11
|
+
|
3
12
|
def column_sort(args = {})
|
4
13
|
args[:extra] ||= {}
|
5
14
|
# Should pass it column_name, link_name, controller_name and
|
@@ -30,6 +39,7 @@ module AwesomeSort
|
|
30
39
|
|
31
40
|
def sort(scope, sort_by, sort_order)
|
32
41
|
klass = scope.model.name.tableize.to_sym
|
42
|
+
sort_order = (ALLOWED_SORT_ORDERS & sort_order).first || 'asc'
|
33
43
|
|
34
44
|
if sort_by
|
35
45
|
if sorter = AwesomeSort.sorters[klass][sort_by.to_sym]
|
data/lib/awesome_sort/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_sort
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Diaconu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.0.
|
142
|
+
rubygems_version: 3.0.6
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Responsive sortable table
|