tabulatr2 0.9.45 → 0.9.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tabulatr/data/dsl.rb +1 -0
- data/lib/tabulatr/data/filtering.rb +8 -3
- data/lib/tabulatr/params_builder.rb +3 -1
- data/lib/tabulatr/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dcccfb8018a85997ce1e6645fbc01a16a4db014fc25eee4a364b561a846fce2
|
4
|
+
data.tar.gz: 0ed7c9e6ddf4dde151edc68ff914c2a30f3cfe6720df3fb928b36310f9d3776e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ecf2a9df11419a27f87c57947985f90fb8782d11c89b6430544df8d73d02cd375a5f86d558847f141edbb63207c70dd067ef9bba92ecaaf8e3ec954feca222
|
7
|
+
data.tar.gz: cf1627feddae12607afcff88995223837d07907705649303ce2a72f0cd1e0186e408647594f44ba720a7131e444ed83d032b33cc05de4fc7d2ac7a94a0e6b683
|
data/lib/tabulatr/data/dsl.rb
CHANGED
@@ -42,8 +42,13 @@ module Tabulatr::Data::Filtering
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def apply_filters(filter_params)
|
45
|
-
|
46
|
-
|
45
|
+
default_filters = table_columns.map do |col|
|
46
|
+
next if col.col_options.default_filter.nil?
|
47
|
+
["#{col.table_name}:#{col.name}", col.col_options.default_filter]
|
48
|
+
end.compact.to_h
|
49
|
+
return unless filter_params || default_filters.present?
|
50
|
+
filters = default_filters.merge(filter_params&.permit! || {})
|
51
|
+
filters.to_hash.with_indifferent_access.each do |param|
|
47
52
|
name, value = param
|
48
53
|
next unless value.present?
|
49
54
|
|
@@ -84,7 +89,7 @@ module Tabulatr::Data::Filtering
|
|
84
89
|
when 'this_month' then date_in_between(today.at_beginning_of_month.beginning_of_day,
|
85
90
|
today.at_end_of_month.end_of_day, n)
|
86
91
|
when 'last_30_days' then date_in_between((today - 29.day).beginning_of_day, today.at_end_of_day, n)
|
87
|
-
when 'from_to' then date_in_between((
|
92
|
+
when 'from_to' then date_in_between((Time.zone.parse(cond['from']) rescue nil), (Time.zone.parse(cond['to']) rescue nil), n)
|
88
93
|
end
|
89
94
|
end
|
90
95
|
|
@@ -2,7 +2,9 @@ module Tabulatr
|
|
2
2
|
class ParamsBuilder
|
3
3
|
ALLOWED_PARAMS = [:header, :filter, :sortable, :data_html,
|
4
4
|
:header_html, :filter_sql, :sort_sql, :sql, :width,
|
5
|
-
:align, :wrap, :format, :filter_label, :name, :classes
|
5
|
+
:align, :wrap, :format, :filter_label, :name, :classes,
|
6
|
+
:default_filter
|
7
|
+
]
|
6
8
|
DEPRECATED_PARAMS = []
|
7
9
|
|
8
10
|
attr_accessor *ALLOWED_PARAMS
|
data/lib/tabulatr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabulatr2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Horn
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-03-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -279,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
279
|
- !ruby/object:Gem::Version
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
|
-
rubygems_version: 3.
|
282
|
+
rubygems_version: 3.1.4
|
283
283
|
signing_key:
|
284
284
|
specification_version: 4
|
285
285
|
summary: A tight DSL to build tables of ActiveRecord models with sorting, pagination,
|