table_sortable 1.0.0.pre.alpha.20 → 1.0.0.pre.alpha.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04cab9d2eef3f915659f14f5e66e0fb728fa16de
4
- data.tar.gz: 3b70c2d74f59fd9e8098da40a8e22994aed38ea3
3
+ metadata.gz: b1b612ec0723289bf2938d150cfd46f76ac7a769
4
+ data.tar.gz: 4f1f7b83dcc8797037fcfb1459fa846656b306f0
5
5
  SHA512:
6
- metadata.gz: c5fdbb1f32a4fed87af349256e9efa7a5bc8223169746078c204e35c7936f175baabc5d8e11974de3efa6632a5b90804b7f9dc9872746189da3caf6317356551
7
- data.tar.gz: 99a650cc56e05e39e1ce8d88b8c157a70d0c00e178684d5eb1f904ad4d39d01d6ec15cefeab45fdaa239c95b3011852d96c7eb0ed7c3adf81b0299374166c924
6
+ metadata.gz: '099ce2728c38b7bb77efe4dd4ec7fc6de274e8f3c74e018fa78a08f4b03325dde913f84089bf94b5c78c48e348d56b41d635433e756b32a216554b2025454011'
7
+ data.tar.gz: f776867d8b2801cca98e9de7acd9c8a9304f307beeca22d83d6a9a1595fda2f2509815effdd94276c40e714e310ee690186147fa41724128734fe335a118be62
@@ -3,16 +3,21 @@ module TableSortable
3
3
  class Filter
4
4
  include TableSortable::Concerns::Proc
5
5
 
6
- attr_accessor :query, :default_value, :collection, :sort_collection
6
+ attr_accessor :query, :default_value, :collection, :sort_collection, :static
7
7
 
8
8
  def initialize(*args)
9
9
  options = args.extract_options!
10
10
  @default_value = options[:filter_initial_value]
11
11
  @collection = options[:filter_collection]
12
+ @static = options[:filter_static] || false
12
13
  @sort_collection = options[:filter_sort_collection] || false
13
14
  super :filter, options
14
15
  end
15
16
 
17
+ def static?
18
+ static == true
19
+ end
20
+
16
21
  def array_proc
17
22
  -> (value, col=nil) { select{|record| col.value(record).to_s.downcase.include? value.downcase} }
18
23
  end
@@ -1,3 +1,3 @@
1
1
  module TableSortable
2
- VERSION = "1.0.0.pre.alpha.20"
2
+ VERSION = "1.0.0.pre.alpha.21"
3
3
  end
@@ -29,6 +29,10 @@ module TableSortable
29
29
  # th_options['data-priority'] = col.sort_priority if col.sort_priority
30
30
  th_options['data-filter'] = 'false' if col.filter.disabled?
31
31
  th_options['data-sorter'] = 'false' if col.sorter.disabled?
32
+ if col.filter.static? && col.filter.default_value.present?
33
+ th_options['data-filter'] = 'false' if col.filter.disabled?
34
+ th_options['data-filter-static'] = 'true'
35
+ end
32
36
  unless col.filter.collection.blank?
33
37
  th_options['data-filter-options'] = col.filter.collection.to_json
34
38
  th_options['class'] = 'filter-select-nosort' unless col.filter.sort_collection
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "factory_girl_rails", "~> 4.8"
37
37
  spec.add_development_dependency "activerecord", '>= 4.1.0', '< 5.3'
38
38
  spec.add_dependency "railties", '>= 4.1.0', '< 5.3'
39
- spec.add_dependency "i18n", '>= 0.7'
39
+ spec.add_dependency "i18n", '~> 0.7'
40
40
 
41
41
  # spec.add_dependency "activesupport", '~> 5.1', '>= 5.1.1'
42
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_sortable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha.20
4
+ version: 1.0.0.pre.alpha.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Davidov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-23 00:00:00.000000000 Z
11
+ date: 2018-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,14 +124,14 @@ dependencies:
124
124
  name: i18n
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ">="
127
+ - - "~>"
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0.7'
130
130
  type: :runtime
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ">="
134
+ - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0.7'
137
137
  description: TableSortable adds multi-column, server-side filtering, sorting and pagination