spotlight_search 0.3.4 → 0.3.5
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/Gemfile.lock +2 -2
- data/lib/spotlight_search/version.rb +1 -1
- data/lib/spotlight_search.rb +4 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 646c00400902f5857da5ce10b480cc0c20f4de422997b3b53535782732f574a3
|
4
|
+
data.tar.gz: 2933106dbeffb2227ba5d425567768b8ffffcdbc46e69761ce6e5b7d57856efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b656c2b2874b0228ed30de5d9ecbf35093af7416daee9511b4d28cf0b54d706089deb4dc5b62a8980e58348f01ec706110d96a70832556108b27df7e465dec
|
7
|
+
data.tar.gz: 292ce3d5b8db57df4cdcd6651e459e71436a86acc02db7ee75cf96faf9a7ab55e278f73fa0553e2a654d2c364bffc1bdb628919484beb294171363d2d3e6e8b7
|
data/Gemfile.lock
CHANGED
data/lib/spotlight_search.rb
CHANGED
@@ -6,6 +6,8 @@ require 'spotlight_search/utils'
|
|
6
6
|
require 'spotlight_search/railtie' if defined?(Rails)
|
7
7
|
require 'active_support'
|
8
8
|
require 'active_support/rails'
|
9
|
+
require 'ostruct'
|
10
|
+
|
9
11
|
|
10
12
|
module SpotlightSearch
|
11
13
|
extend ActiveSupport::Concern
|
@@ -21,7 +23,7 @@ module SpotlightSearch
|
|
21
23
|
|
22
24
|
module ClassMethods
|
23
25
|
def filter_by(page, filter_params = {}, sort_params = {})
|
24
|
-
filtered_result = OpenStruct.new
|
26
|
+
filtered_result = ::OpenStruct.new
|
25
27
|
sort_column = self.column_names.include?(sort_params[:sort_column]) ? sort_params[:sort_column] : "#{self.table_name}.created_at"
|
26
28
|
sort_direction = %w[asc desc].include?(sort_params[:sort_direction]) ? sort_params[:sort_direction] : "asc"
|
27
29
|
sort_params = {sort_column: sort_column, sort_direction: sort_direction}
|
@@ -53,7 +55,7 @@ module SpotlightSearch
|
|
53
55
|
def paginate(page, total_count)
|
54
56
|
page = page.presence || 1
|
55
57
|
per_page = 30
|
56
|
-
facets = OpenStruct.new # initializing OpenStruct instance
|
58
|
+
facets = ::OpenStruct.new # initializing OpenStruct instance
|
57
59
|
facets.total_count = total_count
|
58
60
|
facets.filtered_count = total_count
|
59
61
|
facets.total_pages = (total_count/per_page.to_f).ceil
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotlight_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anbazhagan Palani
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-05-29 00:00:00.000000000 Z
|
@@ -132,7 +132,7 @@ homepage: https://github.com/commutatus/spotlight-search
|
|
132
132
|
licenses:
|
133
133
|
- MIT
|
134
134
|
metadata: {}
|
135
|
-
post_install_message:
|
135
|
+
post_install_message:
|
136
136
|
rdoc_options: []
|
137
137
|
require_paths:
|
138
138
|
- lib
|
@@ -147,8 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
-
signing_key:
|
150
|
+
rubygems_version: 3.5.9
|
151
|
+
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: This gem should help reduce the efforts in the admin panel. It has search,
|
154
154
|
sort and pagination included.
|