activeadmin_dynamic_table 0.1.1 → 0.2.1
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 +4 -4
- data/Gemfile.lock +121 -72
- data/README.md +2 -2
- data/activeadmin_dynamic_table.gemspec +1 -1
- data/app/assets/javascripts/activeadmin_dynamic_table/dynamic_table.js +3 -3
- data/lib/activeadmin_dynamic_table/dynamic_csv_builder.rb +34 -0
- data/lib/activeadmin_dynamic_table/resource_dsl.rb +11 -0
- data/lib/activeadmin_dynamic_table/version.rb +1 -1
- data/lib/activeadmin_dynamic_table.rb +2 -0
- metadata +13 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e287fac2e75d9882250facdbf17c560f948808e8a84989edf27bf025379ee44
|
4
|
+
data.tar.gz: 1b5aee79738d0768d16b31197340edfe5f407423f1983034ab523b2abbf40a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7402df6b9f8da665bb118318bf659ddb936f6e5233e6811f14f6f646286d966d9d95819959b77a1d8fe7b3870d8415a3b0484e71c0f4f94e02a6c531a164e02
|
7
|
+
data.tar.gz: 1c39766ff5b1e30f433b438443f56ca02f109bd3385aec4947b1d876cdc958f4ef920a58e034d0e6e070bc0fa2d71f7e04abf3129faf86979db318c2b8f49277
|
data/Gemfile.lock
CHANGED
@@ -1,65 +1,90 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activeadmin_dynamic_table (0.
|
5
|
-
activeadmin (
|
4
|
+
activeadmin_dynamic_table (0.2.1)
|
5
|
+
activeadmin (>= 2.9, < 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (
|
11
|
-
actionview (=
|
12
|
-
activesupport (=
|
13
|
-
|
10
|
+
actionpack (8.0.1)
|
11
|
+
actionview (= 8.0.1)
|
12
|
+
activesupport (= 8.0.1)
|
13
|
+
nokogiri (>= 1.8.5)
|
14
|
+
rack (>= 2.2.4)
|
15
|
+
rack-session (>= 1.0.1)
|
14
16
|
rack-test (>= 0.6.3)
|
15
|
-
rails-dom-testing (~> 2.
|
16
|
-
rails-html-sanitizer (~> 1.
|
17
|
-
|
18
|
-
|
17
|
+
rails-dom-testing (~> 2.2)
|
18
|
+
rails-html-sanitizer (~> 1.6)
|
19
|
+
useragent (~> 0.16)
|
20
|
+
actionview (8.0.1)
|
21
|
+
activesupport (= 8.0.1)
|
19
22
|
builder (~> 3.1)
|
20
|
-
erubi (~> 1.
|
21
|
-
rails-dom-testing (~> 2.
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
activeadmin (
|
23
|
+
erubi (~> 1.11)
|
24
|
+
rails-dom-testing (~> 2.2)
|
25
|
+
rails-html-sanitizer (~> 1.6)
|
26
|
+
activeadmin (3.3.0)
|
24
27
|
arbre (~> 1.2, >= 1.2.1)
|
25
|
-
|
26
|
-
|
28
|
+
csv
|
29
|
+
formtastic (>= 3.1)
|
30
|
+
formtastic_i18n (>= 0.4)
|
27
31
|
inherited_resources (~> 1.7)
|
28
|
-
jquery-rails (
|
29
|
-
kaminari (
|
30
|
-
railties (>= 6.1
|
31
|
-
ransack (>=
|
32
|
-
activemodel (
|
33
|
-
activesupport (=
|
34
|
-
activerecord (
|
35
|
-
activemodel (=
|
36
|
-
activesupport (=
|
37
|
-
|
38
|
-
|
32
|
+
jquery-rails (>= 4.2)
|
33
|
+
kaminari (>= 1.2.1)
|
34
|
+
railties (>= 6.1)
|
35
|
+
ransack (>= 4.0)
|
36
|
+
activemodel (8.0.1)
|
37
|
+
activesupport (= 8.0.1)
|
38
|
+
activerecord (8.0.1)
|
39
|
+
activemodel (= 8.0.1)
|
40
|
+
activesupport (= 8.0.1)
|
41
|
+
timeout (>= 0.4.0)
|
42
|
+
activesupport (8.0.1)
|
43
|
+
base64
|
44
|
+
benchmark (>= 0.3)
|
45
|
+
bigdecimal
|
46
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
47
|
+
connection_pool (>= 2.2.5)
|
48
|
+
drb
|
39
49
|
i18n (>= 1.6, < 2)
|
50
|
+
logger (>= 1.4.2)
|
40
51
|
minitest (>= 5.1)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
52
|
+
securerandom (>= 0.3)
|
53
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
54
|
+
uri (>= 0.13.1)
|
55
|
+
arbre (1.7.0)
|
56
|
+
activesupport (>= 3.0.0)
|
57
|
+
ruby2_keywords (>= 0.0.2)
|
58
|
+
base64 (0.2.0)
|
59
|
+
benchmark (0.4.0)
|
60
|
+
bigdecimal (3.1.9)
|
61
|
+
builder (3.3.0)
|
62
|
+
concurrent-ruby (1.3.5)
|
63
|
+
connection_pool (2.5.0)
|
47
64
|
crass (1.0.6)
|
48
|
-
|
49
|
-
|
50
|
-
|
65
|
+
csv (3.3.2)
|
66
|
+
date (3.4.1)
|
67
|
+
drb (2.2.1)
|
68
|
+
erubi (1.13.1)
|
69
|
+
formtastic (5.0.0)
|
70
|
+
actionpack (>= 6.0.0)
|
51
71
|
formtastic_i18n (0.7.0)
|
52
|
-
has_scope (0.8.
|
72
|
+
has_scope (0.8.2)
|
53
73
|
actionpack (>= 5.2)
|
54
74
|
activesupport (>= 5.2)
|
55
|
-
i18n (1.
|
75
|
+
i18n (1.14.7)
|
56
76
|
concurrent-ruby (~> 1.0)
|
57
|
-
inherited_resources (1.
|
58
|
-
actionpack (>=
|
59
|
-
has_scope (
|
60
|
-
railties (>=
|
61
|
-
responders (>= 2
|
62
|
-
|
77
|
+
inherited_resources (1.14.0)
|
78
|
+
actionpack (>= 6.0)
|
79
|
+
has_scope (>= 0.6)
|
80
|
+
railties (>= 6.0)
|
81
|
+
responders (>= 2)
|
82
|
+
io-console (0.8.0)
|
83
|
+
irb (1.15.1)
|
84
|
+
pp (>= 0.6.0)
|
85
|
+
rdoc (>= 4.0.0)
|
86
|
+
reline (>= 0.4.2)
|
87
|
+
jquery-rails (4.6.0)
|
63
88
|
rails-dom-testing (>= 1, < 3)
|
64
89
|
railties (>= 4.2.0)
|
65
90
|
thor (>= 0.14, < 2.0)
|
@@ -75,45 +100,69 @@ GEM
|
|
75
100
|
activerecord
|
76
101
|
kaminari-core (= 1.2.2)
|
77
102
|
kaminari-core (1.2.2)
|
78
|
-
|
103
|
+
logger (1.6.6)
|
104
|
+
loofah (2.24.0)
|
79
105
|
crass (~> 1.0.2)
|
80
|
-
nokogiri (>= 1.
|
81
|
-
|
82
|
-
|
83
|
-
nokogiri (1.11.5-arm64-darwin)
|
106
|
+
nokogiri (>= 1.12.0)
|
107
|
+
minitest (5.25.4)
|
108
|
+
nokogiri (1.18.3-arm64-darwin)
|
84
109
|
racc (~> 1.4)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
110
|
+
pp (0.6.2)
|
111
|
+
prettyprint
|
112
|
+
prettyprint (0.2.0)
|
113
|
+
psych (5.2.3)
|
114
|
+
date
|
115
|
+
stringio
|
116
|
+
racc (1.8.1)
|
117
|
+
rack (3.1.11)
|
118
|
+
rack-session (2.1.0)
|
119
|
+
base64 (>= 0.1.0)
|
120
|
+
rack (>= 3.0.0)
|
121
|
+
rack-test (2.2.0)
|
122
|
+
rack (>= 1.3)
|
123
|
+
rackup (2.2.1)
|
124
|
+
rack (>= 3)
|
125
|
+
rails-dom-testing (2.2.0)
|
126
|
+
activesupport (>= 5.0.0)
|
127
|
+
minitest
|
91
128
|
nokogiri (>= 1.6)
|
92
|
-
rails-html-sanitizer (1.
|
93
|
-
loofah (~> 2.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
129
|
+
rails-html-sanitizer (1.6.2)
|
130
|
+
loofah (~> 2.21)
|
131
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
132
|
+
railties (8.0.1)
|
133
|
+
actionpack (= 8.0.1)
|
134
|
+
activesupport (= 8.0.1)
|
135
|
+
irb (~> 1.13)
|
136
|
+
rackup (>= 1.0.0)
|
98
137
|
rake (>= 12.2)
|
99
|
-
thor (~> 1.0)
|
100
|
-
zeitwerk (~> 2.
|
138
|
+
thor (~> 1.0, >= 1.2.2)
|
139
|
+
zeitwerk (~> 2.6)
|
101
140
|
rake (13.0.6)
|
102
|
-
ransack (
|
103
|
-
activerecord (>=
|
104
|
-
activesupport (>=
|
141
|
+
ransack (4.3.0)
|
142
|
+
activerecord (>= 6.1.5)
|
143
|
+
activesupport (>= 6.1.5)
|
105
144
|
i18n
|
106
|
-
|
107
|
-
|
108
|
-
|
145
|
+
rdoc (6.12.0)
|
146
|
+
psych (>= 4.0.0)
|
147
|
+
reline (0.6.0)
|
148
|
+
io-console (~> 0.5)
|
149
|
+
responders (3.1.1)
|
150
|
+
actionpack (>= 5.2)
|
151
|
+
railties (>= 5.2)
|
109
152
|
ruby2_keywords (0.0.5)
|
110
|
-
|
111
|
-
|
153
|
+
securerandom (0.4.1)
|
154
|
+
stringio (3.1.5)
|
155
|
+
thor (1.3.2)
|
156
|
+
timeout (0.4.3)
|
157
|
+
tzinfo (2.0.6)
|
112
158
|
concurrent-ruby (~> 1.0)
|
113
|
-
|
159
|
+
uri (1.0.3)
|
160
|
+
useragent (0.16.11)
|
161
|
+
zeitwerk (2.7.2)
|
114
162
|
|
115
163
|
PLATFORMS
|
116
164
|
arm64-darwin-21
|
165
|
+
arm64-darwin-24
|
117
166
|
|
118
167
|
DEPENDENCIES
|
119
168
|
activeadmin_dynamic_table!
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ActiveadminDynamicTable
|
2
2
|
|
3
|
-
This is an [ActiveAdmin](https://github.com/activeadmin/activeadmin)
|
3
|
+
This is an [ActiveAdmin](https://github.com/activeadmin/activeadmin) extension that allows managing index table columns from the activeadmin UI.
|
4
4
|
|
5
5
|
## Goals
|
6
6
|
- Show/hide table columns from UI
|
@@ -66,7 +66,7 @@ All other options are the same as for `register_column`
|
|
66
66
|
Method follows standard `column` dsl but also requires to provide at least `key` among options.
|
67
67
|
All other options are the same as for `register_column`
|
68
68
|
|
69
|
-
|
69
|
+
Example:
|
70
70
|
|
71
71
|
```ruby
|
72
72
|
index as: :dynamic_table do
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
# Uncomment to register a new dependency of your gem
|
32
|
-
spec.add_dependency "activeadmin", "
|
32
|
+
spec.add_dependency "activeadmin", ">= 2.9", "< 4.0"
|
33
33
|
|
34
34
|
# For more information and examples about making a new gem, check out our
|
35
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
@@ -54,12 +54,12 @@ $(function() {
|
|
54
54
|
const elem = $(this)
|
55
55
|
|
56
56
|
return {
|
57
|
-
width: elem.
|
57
|
+
width: elem.outerWidth(),
|
58
58
|
key: elem.data('column-key'),
|
59
59
|
};
|
60
60
|
})
|
61
|
-
|
62
|
-
|
61
|
+
.toArray()
|
62
|
+
.reduce((acc, item) => Object.assign(acc, { [item.key]: item.width }), {});
|
63
63
|
}
|
64
64
|
|
65
65
|
function filterEmptyKeys(params) {
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module ActiveAdmin
|
2
|
+
class DynamicCSVBuilder < CSVBuilder
|
3
|
+
def exec_columns(view_context = nil)
|
4
|
+
@view_context = view_context
|
5
|
+
settings = ActiveadminDynamicTable::SettingStringParser.new(@view_context.params[:columns])
|
6
|
+
|
7
|
+
@configurator = ActiveadminDynamicTable::Configurator.new(self, settings.parse)
|
8
|
+
@columns = [] # we want to re-render these every instance
|
9
|
+
|
10
|
+
instance_exec &@block
|
11
|
+
@configurator.columns
|
12
|
+
|
13
|
+
columns
|
14
|
+
end
|
15
|
+
|
16
|
+
def build_row(resource, columns, options)
|
17
|
+
columns.map do |column|
|
18
|
+
content = call_method_or_proc_on(resource, column.data)
|
19
|
+
encode view_context.strip_tags(content.to_s), options
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def register_column(*args, &block)
|
24
|
+
@configurator.register_column(:column, *args, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def register_id_column(*args, &block)
|
28
|
+
@configurator.register_column(:column, :id, key: :id)
|
29
|
+
end
|
30
|
+
|
31
|
+
def register_actions(*args, &block); end
|
32
|
+
def selectable_column; end
|
33
|
+
end
|
34
|
+
end
|
@@ -5,6 +5,8 @@ require_relative "activeadmin_dynamic_table/version"
|
|
5
5
|
require_relative "activeadmin_dynamic_table/configurator"
|
6
6
|
require_relative "activeadmin_dynamic_table/setting_string_parser"
|
7
7
|
require_relative "activeadmin_dynamic_table/column_settings"
|
8
|
+
require_relative "activeadmin_dynamic_table/resource_dsl"
|
9
|
+
require_relative "activeadmin_dynamic_table/dynamic_csv_builder"
|
8
10
|
require_relative "activeadmin_dynamic_table/views/index_as_dynamic_table"
|
9
11
|
|
10
12
|
module ActiveadminDynamicTable
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_dynamic_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Biliaiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.9'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '2.9'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.0'
|
27
33
|
description: Allow to controll activeadmin table columns from the UI. (Show/hide/resize/reorder
|
28
34
|
table columns)
|
29
35
|
email:
|
@@ -47,6 +53,8 @@ files:
|
|
47
53
|
- lib/activeadmin_dynamic_table.rb
|
48
54
|
- lib/activeadmin_dynamic_table/column_settings.rb
|
49
55
|
- lib/activeadmin_dynamic_table/configurator.rb
|
56
|
+
- lib/activeadmin_dynamic_table/dynamic_csv_builder.rb
|
57
|
+
- lib/activeadmin_dynamic_table/resource_dsl.rb
|
50
58
|
- lib/activeadmin_dynamic_table/setting_string_parser.rb
|
51
59
|
- lib/activeadmin_dynamic_table/version.rb
|
52
60
|
- lib/activeadmin_dynamic_table/views/index_as_dynamic_table.rb
|
@@ -72,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
80
|
- !ruby/object:Gem::Version
|
73
81
|
version: '0'
|
74
82
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.5.3
|
76
84
|
signing_key:
|
77
85
|
specification_version: 4
|
78
86
|
summary: Config activeadmin index tables on demand
|