activeadmin_dynamic_table 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/activeadmin_dynamic_table.gemspec +1 -1
- 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 +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 537aa432d0b52c8cf60622622c7893ccfb26094b9da6b48d3b529812266358e7
|
4
|
+
data.tar.gz: 5b7fdde7f367a01c537a3134e6db65c6e62478005bcc297db0dba9f13bea24a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1153e6d83dcea9a7a21607cda3dc34d72e6775bf3a0c5237135bcdbe9c8e01abce4bd97628578d876f025849f6f9c03071db31455cc594d667ccd64b08242a7
|
7
|
+
data.tar.gz: e0fed908ba563f7513d675136094f4b7a6acb649ef55697c75c0e9e7deb4474f0e921bf8e339ca129600e4a4a42bc32f129477bef59a6d55b392259d6a312ed5
|
data/Gemfile.lock
CHANGED
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
|
@@ -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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Biliaiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-19 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
|