agilibox 1.0.3 → 1.0.4
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/CHANGELOG.md +5 -0
- data/app/models/concerns/agilibox/search.rb +1 -1
- data/app/sorters/agilibox/sorter.rb +26 -0
- data/db/migrate/20170502143330_enable_unaccent.rb +5 -0
- data/lib/agilibox/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34fb21a5843843694e3e1a1f239ee8aed148f238
|
4
|
+
data.tar.gz: a805c337e3420c19fc10cf95e40087b68c9839bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e17dff217f2407f24f223f22294cd29b9304b545d3becf42737eb1a88f1c4a1a3ccf2643793b61d2bc8e9d0266ca3771c7e9ca9ae1226033bf79f30f696f37a2
|
7
|
+
data.tar.gz: bb84424a5d72162939ee056a0474b9489ee7d612a681b32b1854ca432e2b38002a6a4d74a88fe8699c66f86bfed13fe8a9063b66e5b9bda2dd8cddc20513c116
|
data/CHANGELOG.md
CHANGED
@@ -14,7 +14,7 @@ module Agilibox::Search
|
|
14
14
|
|
15
15
|
sql_query = words.map.with_index do |word, index|
|
16
16
|
fields.map do |field|
|
17
|
-
"(
|
17
|
+
"(UNACCENT(CAST(#{field} AS TEXT)) ILIKE :w#{index})"
|
18
18
|
end.join(" OR ")
|
19
19
|
end.map{ |e| "(#{e})" }.join(" AND ")
|
20
20
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Agilibox::Sorter
|
2
|
+
include Agilibox::SortingHelper
|
3
|
+
|
4
|
+
attr_reader :collection, :sort_param, :column, :direction
|
5
|
+
|
6
|
+
def initialize(collection, sort_param)
|
7
|
+
@collection = collection
|
8
|
+
@sort_param = sort_param
|
9
|
+
@column, @direction = sortable_column_order(sort_param.to_s)
|
10
|
+
end
|
11
|
+
|
12
|
+
def sort
|
13
|
+
raise NotImplementedError
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
# Don't replace by `collection.reorder(sort)`
|
18
|
+
# #sort can change #collection and must be called before #collection
|
19
|
+
order = sort
|
20
|
+
collection.reorder(order)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.call(*args)
|
24
|
+
new(*args).call
|
25
|
+
end
|
26
|
+
end
|
data/lib/agilibox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilibox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|
@@ -79,10 +79,12 @@ files:
|
|
79
79
|
- app/serializers/agilibox/serializers.rb
|
80
80
|
- app/serializers/agilibox/serializers/base.rb
|
81
81
|
- app/serializers/agilibox/serializers/xlsx.rb
|
82
|
+
- app/sorters/agilibox/sorter.rb
|
82
83
|
- app/views/agilibox/search/_form.html.slim
|
83
84
|
- config/locales/common.en.yml
|
84
85
|
- config/locales/common.fr.yml
|
85
86
|
- config/routes.rb
|
87
|
+
- db/migrate/20170502143330_enable_unaccent.rb
|
86
88
|
- lib/agilibox.rb
|
87
89
|
- lib/agilibox/active_record_comma_type_cast.rb
|
88
90
|
- lib/agilibox/core_and_rails_ext.rb
|