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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72ea11d1aa8fcb19809cda764f56ce8033cefc1391f174bbce11b77244bc9c0a
4
- data.tar.gz: 3eb561003b0d682e34bbc885cf257079a4aa3084bf78d5038f3a3e64d7d9a2a5
3
+ metadata.gz: d0f25fd57e06d861fae2d99696273dd6065d0a42ee2a3e0744cc141c2371b416
4
+ data.tar.gz: 5fe97c959a6dac645f2e99465c3acea1711911b967db918c3edf125768e4c122
5
5
  SHA512:
6
- metadata.gz: '09206b0dd24ce6fcd458ff00e3bd2211c7aad4616538cf48e497b253c09ba8dedcadeab779a567ae820f1d44a00c077663985936d54a54a5fc058b4db5be43ff'
7
- data.tar.gz: 91ef44bbcd125ea418abee918863f1d9903925fde9ca4c846cea0b498246bfb46b1286fe0a92a0c9b54db967d7d7746f03f0acd04cba71fdb87449c235db1a9c
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]
@@ -1,3 +1,3 @@
1
1
  module AwesomeSort
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.3
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: 2019-08-01 00:00:00.000000000 Z
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.4
142
+ rubygems_version: 3.0.6
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Responsive sortable table