spotlight_search 0.3.4 → 0.3.6
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/helpers.rb +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: fa62b0fa1fa56fc1ace4c5698acd5fbcac37d8cd895caeb4fdcbb399ff1095c6
|
4
|
+
data.tar.gz: fc1971734fe1a8bb28ba0f9dffaaac626c878ab182f3161041d1c4826260cc69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de74c86292dfbbe18f45c13ea1d8964348ad2fa2fc3f2685e5b8161631da6879641ef40ad4948b86f4509aa14226722cfaedb0beae22549bdd9a3a9a9f1faf62
|
7
|
+
data.tar.gz: 8899bf1b1de3a1f2673e4305f988d9d17e681a5372d94ca3c004eac902a3cf5b4ff216474ac7d629a4bf07f9542412341097a43906e308ffd55539d6ece28241
|
data/Gemfile.lock
CHANGED
@@ -156,14 +156,14 @@ module SpotlightSearch
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
current_page = content_tag :li do
|
159
|
-
tag.button class: 'cm-pagination__item', data: {sort_column: facets.sort[:sort_column], sort_direction: facets.sort[:sort_direction], page: facets.current_page, behaviour: 'current-page' } do
|
159
|
+
tag.button class: 'cm-pagination__item btn btn-bordered mx-2', data: {sort_column: facets.sort[:sort_column], sort_direction: facets.sort[:sort_direction], page: facets.current_page, behaviour: 'current-page' } do
|
160
160
|
"Showing #{facets.current_page} of #{facets.total_pages} pages"
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
164
|
if facets.next_page != false
|
165
165
|
next_page = tag.li do
|
166
|
-
tag.button class: 'cm-pagination__item', data: { behaviour: 'next-page'} do
|
166
|
+
tag.button class: 'cm-pagination__item btn btn-bordered mx-2', data: { behaviour: 'next-page'} do
|
167
167
|
tag.span "Next"
|
168
168
|
end
|
169
169
|
end
|
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.6
|
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.
|