spotlight_search 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/spotlight_search.rb +1 -1
- data/lib/spotlight_search/exportable_columns.rb +3 -3
- data/lib/spotlight_search/helpers.rb +2 -2
- data/lib/spotlight_search/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e9cd4941331e8c05faf205f5e88b871d70281e28b537ff8884a873c4c039c01
|
4
|
+
data.tar.gz: 65588a311e3dd0ca07e73064f65eb38dd92eaf21c525da71866a4621edf419bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e0877a70a4340f373fbcb5cad506bdb70311db3f04cb57a9ff8985f1b1321388e9e37f9109c2a262b798b450b233449b0401f1a8799ff76808733f8ec39499
|
7
|
+
data.tar.gz: b7a088d2af85d00e71663cc50a37cacc149432f188e84907c33d138a2380ed705f0fb5fad8252c841d3f33d9736e0891c1b90f8e3d310ef05bb6c62a6e8d837b
|
data/README.md
CHANGED
data/lib/spotlight_search.rb
CHANGED
@@ -13,7 +13,7 @@ module SpotlightSearch
|
|
13
13
|
module ClassMethods
|
14
14
|
def filter_by(page, filter_params = {}, sort_params = {})
|
15
15
|
filtered_result = OpenStruct.new
|
16
|
-
sort_column = self.column_names.include?(sort_params[:sort_column]) ? sort_params[:sort_column] : "created_at"
|
16
|
+
sort_column = self.column_names.include?(sort_params[:sort_column]) ? sort_params[:sort_column] : "#{self.table_name}.created_at"
|
17
17
|
sort_direction = %w[asc desc].include?(sort_params[:sort_direction]) ? sort_params[:sort_direction] : "asc"
|
18
18
|
sort_params = {sort_column: sort_column, sort_direction: sort_direction}
|
19
19
|
raw_data = self.filter(filter_params).sort_list(sort_column, sort_direction)
|
@@ -5,7 +5,7 @@ module SpotlightSearch
|
|
5
5
|
module ClassMethods
|
6
6
|
# Enables or disables export and specifies which all columns can be
|
7
7
|
# exported. For enabling export for all columns in all models
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# class ApplicationRecord < ActiveRecord::Base
|
10
10
|
# export_columns enabled: true
|
11
11
|
# end
|
@@ -16,7 +16,7 @@ module SpotlightSearch
|
|
16
16
|
# export_columns enabled: false
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
# For allowing export for only specific columns in a model
|
19
|
+
# For allowing export for only specific columns in a model
|
20
20
|
#
|
21
21
|
# class Person < ActiveRecord::Base
|
22
22
|
# export_columns enabled: true, only: [:created_at, :updated_at]
|
@@ -62,7 +62,7 @@ module SpotlightSearch
|
|
62
62
|
# Validates whether the selected columns are allowed for export
|
63
63
|
def validate_exportable_columns(columns)
|
64
64
|
unless columns.is_a?(Array)
|
65
|
-
raise SpotlightSearch::Exceptions::InvalidValue.new('
|
65
|
+
raise SpotlightSearch::Exceptions::InvalidValue.new('Expected Array. Invalid type received')
|
66
66
|
end
|
67
67
|
unless (self.enabled_columns & columns.map(&:to_sym)) == columns.size
|
68
68
|
return false
|
@@ -3,12 +3,12 @@ module SpotlightSearch
|
|
3
3
|
include ActionView::Helpers::FormTagHelper
|
4
4
|
include ActionView::Helpers::TagHelper
|
5
5
|
|
6
|
-
def sortable(column, title =
|
6
|
+
def sortable(column, title = "Title", sort_column="created_at", sort_direction="asc")
|
7
7
|
title ||= column.titleize
|
8
8
|
css_class = column == sort_column ? "current #{sort_direction}" : nil
|
9
9
|
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
|
10
10
|
# link_to title, '#', {:class => css_class, data: {sort: column, direction: direction}}
|
11
|
-
content_tag("a",
|
11
|
+
content_tag("a", title, class: css_class, data: {sort_column: column, sort_direction: direction, behaviour: 'sort', type: 'anchor-filter'})
|
12
12
|
end
|
13
13
|
|
14
14
|
def exportable(email, klass)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotlight_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anbazhagan Palani
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.0.
|
149
|
+
rubygems_version: 3.0.3
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: This gem should help reduce the efforts in the admin panel. It has search,
|