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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c0ea70816711ee5ddc92a80692e72fba928b39161c2d24deb08b4ab58484f16
4
- data.tar.gz: 27427b059ab99ac747e3239b5bf5e3675924966f724eecac804185c8b7198132
3
+ metadata.gz: 3e9cd4941331e8c05faf205f5e88b871d70281e28b537ff8884a873c4c039c01
4
+ data.tar.gz: 65588a311e3dd0ca07e73064f65eb38dd92eaf21c525da71866a4621edf419bc
5
5
  SHA512:
6
- metadata.gz: b898869bc37e815628e98a1851e63cdb854b5f5a3b5056cefca336aef92430fbb6755d07f22c33fde9cb43635ac25d88a9298e8c4b90dbd6c7b96f688acaa92f
7
- data.tar.gz: 0e740359d3610928b62382c6eecf38f81faff3e82039236c63e6c3909e82ce8e0536ee96e313b610417650888f7f1ac9955284177a4fa5051435c66f4492abeb
6
+ metadata.gz: e4e0877a70a4340f373fbcb5cad506bdb70311db3f04cb57a9ff8985f1b1321388e9e37f9109c2a262b798b450b233449b0401f1a8799ff76808733f8ec39499
7
+ data.tar.gz: b7a088d2af85d00e71663cc50a37cacc149432f188e84907c33d138a2380ed705f0fb5fad8252c841d3f33d9736e0891c1b90f8e3d310ef05bb6c62a6e8d837b
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/spotlight_search.svg)](https://badge.fury.io/rb/spotlight_search)
2
+
1
3
  # SpotlightSearch
2
4
 
3
5
  It helps filtering, sorting and exporting tables easier.
@@ -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('Excepted Array. Invalid type received')
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 = nil, sort_column="created_at", sort_direction="asc")
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","Title", class: css_class, data: {sort_column: column, sort_direction: direction, behaviour: 'sort', type: 'anchor-filter'})
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)
@@ -1,3 +1,3 @@
1
1
  module SpotlightSearch
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
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.7
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.1
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,