tabulatr2 0.9.38 → 0.9.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tabulatr/_events.js +4 -0
- data/lib/tabulatr/data/data.rb +4 -4
- data/lib/tabulatr/data/formatting.rb +1 -1
- data/lib/tabulatr/data/proxy.rb +1 -1
- data/lib/tabulatr/data/sorting.rb +7 -3
- data/lib/tabulatr/renderer/column.rb +13 -0
- data/lib/tabulatr/renderer/renderer.rb +4 -0
- data/lib/tabulatr/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd922d9e3607591509ce645ab120be41b1684a9186cf3cd3ee8349aa448d4b3
|
4
|
+
data.tar.gz: 9437dec7454741490fb08c3866189ddaa52fd880c383554141d65de70351214e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aacfc00dd329b4182964a50417616822ecd53bab1dc971dc7f3ac0ac8575728c0f5d71124fdd1d84dee973cd580bb99b0948473dfbc7d74ad7c37cf86becb83
|
7
|
+
data.tar.gz: '091abbb6286cb6277814faa00503786c31b775793b82cc2fb1541e7ca4a03d08aefb3bea5684c1b4ca36e53197b7e9b45e4c05c8a994d3c24c944465ea489357'
|
@@ -86,6 +86,10 @@ function tabulatrInitialize() {
|
|
86
86
|
$(this).parents('form.tabulatr_filter_form').submit();
|
87
87
|
});
|
88
88
|
|
89
|
+
$('form.tabulatr_filter_form input').on('dp.change', function(){
|
90
|
+
$(this).parents('form.tabulatr_filter_form').submit();
|
91
|
+
});
|
92
|
+
|
89
93
|
$('form.tabulatr_filter_form').submit(function(){
|
90
94
|
var tableId = $(this).data('table');
|
91
95
|
var table_obj;
|
data/lib/tabulatr/data/data.rb
CHANGED
@@ -110,10 +110,10 @@ class Tabulatr::Data
|
|
110
110
|
# Params
|
111
111
|
#++
|
112
112
|
|
113
|
-
def filter_params(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_filter"] end
|
114
|
-
def search_param(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_search"] end
|
115
|
-
def sort_params(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_sort"] end
|
116
|
-
def batch_params(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_batch"] end
|
113
|
+
def filter_params(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_filter"] || params["filter"] end
|
114
|
+
def search_param(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_search"] || params["search"] end
|
115
|
+
def sort_params(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_sort"] || params["sort"] end
|
116
|
+
def batch_params(params) params["#{Tabulatr::Utility.formatted_name(@base.name)}_batch"] || params["batch"] end
|
117
117
|
def check_params(params)
|
118
118
|
tabulatr_checked = params["tabulatr_checked"]
|
119
119
|
if tabulatr_checked.present?
|
@@ -24,7 +24,7 @@
|
|
24
24
|
module Tabulatr::Data::Formatting
|
25
25
|
|
26
26
|
def apply_formats(locals: {}, controller: nil)
|
27
|
-
view = Data::Proxy.new(locals: locals, controller: controller)
|
27
|
+
view = Tabulatr::Data::Proxy.new(locals: locals, controller: controller)
|
28
28
|
return @relation.map do |record|
|
29
29
|
view.record = record
|
30
30
|
h = HashWithIndifferentAccess.new
|
data/lib/tabulatr/data/proxy.rb
CHANGED
@@ -41,9 +41,13 @@ module Tabulatr::Data::Sorting
|
|
41
41
|
end
|
42
42
|
sort_by(column, orientation)
|
43
43
|
elsif @default_order.present?
|
44
|
-
|
44
|
+
if @default_order.is_a? String
|
45
|
+
@relation = @relation.reorder(Arel.sql @default_order)
|
46
|
+
else
|
47
|
+
@relation = @relation.reorder(@default_order)
|
48
|
+
end
|
45
49
|
else
|
46
|
-
@relation = @relation.reorder("#{@table_name}.#{@base.primary_key} desc")
|
50
|
+
@relation = @relation.reorder(Arel.sql "#{@table_name}.#{@base.primary_key} desc")
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
@@ -52,7 +56,7 @@ module Tabulatr::Data::Sorting
|
|
52
56
|
if sort_sql.respond_to? :call
|
53
57
|
@relation = sort_sql.call(@relation, orientation, "#{@table_name}.#{@base.primary_key}", @base)
|
54
58
|
else
|
55
|
-
@relation = @relation.reorder("#{sort_sql} #{orientation}")
|
59
|
+
@relation = @relation.reorder(Arel.sql "#{sort_sql} #{orientation}, #{@table_name}.id desc")
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
@@ -108,6 +108,19 @@ class Tabulatr::Renderer::Column
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
def to_json
|
112
|
+
{
|
113
|
+
name: "#{table_name}:#{name}",
|
114
|
+
# name: name,
|
115
|
+
header: human_name,
|
116
|
+
# klassname: klassname,
|
117
|
+
# table_name: table_name,
|
118
|
+
filter: col_options.filter,
|
119
|
+
sortable: col_options.sortable,
|
120
|
+
data_html: col_options.data_html,
|
121
|
+
header_html: col_options.header_html,
|
122
|
+
}
|
123
|
+
end
|
111
124
|
|
112
125
|
private
|
113
126
|
|
@@ -99,6 +99,10 @@ class Tabulatr::Renderer
|
|
99
99
|
new(klass, view, toptions).build_table(columns, filters, tabulatr_data_class, &block)
|
100
100
|
end
|
101
101
|
|
102
|
+
def columns_json(tabulatr_data_class_name=nil)
|
103
|
+
get_data_class(tabulatr_data_class_name).table_columns.map(&:to_json)
|
104
|
+
end
|
105
|
+
|
102
106
|
private
|
103
107
|
|
104
108
|
def get_requested_columns(available_columns, requested_columns)
|
data/lib/tabulatr/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
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.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Horn
|
8
8
|
- Florian Thomas
|
9
9
|
- René Sprotte
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -263,7 +263,7 @@ homepage: http://github.com/metaminded/tabulatr2
|
|
263
263
|
licenses:
|
264
264
|
- MIT
|
265
265
|
metadata: {}
|
266
|
-
post_install_message:
|
266
|
+
post_install_message:
|
267
267
|
rdoc_options:
|
268
268
|
- "--charset=UTF-8"
|
269
269
|
require_paths:
|
@@ -279,9 +279,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
279
|
- !ruby/object:Gem::Version
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
|
-
|
283
|
-
|
284
|
-
signing_key:
|
282
|
+
rubygems_version: 3.0.3
|
283
|
+
signing_key:
|
285
284
|
specification_version: 4
|
286
285
|
summary: A tight DSL to build tables of ActiveRecord models with sorting, pagination,
|
287
286
|
finding/filtering, selecting and batch actions.
|