activeadmin_dynamic_table 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +70 -7
- data/activeadmin_dynamic_table.gemspec +5 -7
- data/app/assets/stylesheets/activeadmin_dynamic_table/all.scss +3 -1
- data/demo.gif +0 -0
- data/lib/activeadmin_dynamic_table/version.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba7175e5769ce38921f670c993df131448bc7b1b87087abd1d58befb05ea5df0
|
4
|
+
data.tar.gz: bfe6d0ca3328fe82c084a5c283b59bf8719c7114350aee2bbc76eed8879f6a49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f45638282a9d3eae1f882128623ee1a43afad08194ef05af73fd28435f85ffc4615415d6d4bb153ef8ffe5b2953dde6b51d301abbf9d125ca9e5fb43dc3a3faa
|
7
|
+
data.tar.gz: 04ef3684e999f357f3e600b1a10c7d1e9a7bc5c2507d0b57573ac6ce7c790e71fbbeddf2d3236784cb89cad7955a03a77029f4b45806c6a64f99b8df84722c93
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# ActiveadminDynamicTable
|
2
2
|
|
3
|
-
|
3
|
+
This is an [ActiveAdmin](https://github.com/activeadmin/activeadmin) extansion which allows to manage index table columns from the activeadmin UI.
|
4
4
|
|
5
|
-
|
5
|
+
## Goals
|
6
|
+
- Show/hide table columns from UI
|
7
|
+
- Resize columns
|
8
|
+
- Reorder columns
|
9
|
+
|
10
|
+
<img src="demo.gif" width="800" height="600">
|
6
11
|
|
7
12
|
## Installation
|
8
13
|
|
@@ -20,19 +25,77 @@ Or install it yourself as:
|
|
20
25
|
|
21
26
|
$ gem install activeadmin_dynamic_table
|
22
27
|
|
28
|
+
Add at the end of your ActiveAdmin styles (app/assets/stylesheets/active_admin.scss):
|
29
|
+
|
30
|
+
```scss
|
31
|
+
@import 'activeadmin_dynamic_table/all';
|
32
|
+
```
|
33
|
+
|
34
|
+
Add at the end of your ActiveAdmin javascripts (app/assets/javascripts/active_admin.js):
|
35
|
+
|
36
|
+
```
|
37
|
+
//= require activeadmin_dynamic_table/config
|
38
|
+
```
|
39
|
+
|
23
40
|
## Usage
|
24
41
|
|
25
|
-
|
42
|
+
For `index` block specify `dynamic_table` to be used instead of default `table`
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
index as: :dynamic_table do
|
46
|
+
# ...
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
Inside configuration block register columns that will be configurable through UI
|
51
|
+
|
52
|
+
### register_column
|
26
53
|
|
27
|
-
|
54
|
+
Method follows standard `column` dsl but also requires to provide at least `key` among options. This is key of the column in the provided URL params to detect whether or not column should be rendered.
|
28
55
|
|
29
|
-
|
56
|
+
`default: true` - specify column should be rendered by default (when columns are not specified in url params)
|
57
|
+
`width: 100` - default width of the column if it's not specified in the url params
|
30
58
|
|
31
|
-
|
59
|
+
### register_id_column
|
60
|
+
|
61
|
+
Method follows standard `id_column` dsl but also requires to provide at least `key` among options.
|
62
|
+
All other options are the same as for `register_column`
|
63
|
+
|
64
|
+
### register_actions
|
65
|
+
|
66
|
+
Method follows standard `column` dsl but also requires to provide at least `key` among options.
|
67
|
+
All other options are the same as for `register_column`
|
68
|
+
|
69
|
+
Expample:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
index as: :dynamic_table do
|
73
|
+
selectable_column
|
74
|
+
|
75
|
+
register_id_column 'Student ID', key: :id, default: true, width: 30
|
76
|
+
|
77
|
+
register_column :name, key: :name, default: true, width: 200, &:full_name
|
78
|
+
register_column :user_phone, key: :phone, default: true, width: 200, &proc { |st| link_to st.phone, user_path(st.user) }
|
79
|
+
|
80
|
+
register_column :teacher, key: :teacher, default: true, width: 200
|
81
|
+
register_column :country, key: :country, width: 150
|
82
|
+
register_column :updated_at, key: :updated_at, width: 100
|
83
|
+
|
84
|
+
register_column 'LPD', key: :lpd, &proc { |st| st.last_payment_date&.strftime('%d.%m.%y %H:%M') }
|
85
|
+
|
86
|
+
register_column 'SC', key: :sc, width: 200, default: true do |student|
|
87
|
+
student.schedule_slots.map do |slot|
|
88
|
+
"#{slot.day_of_week.capitalize}: #{slot.time_slot.utc.strftime('%H:%M')}"
|
89
|
+
end.join(', ')
|
90
|
+
end
|
91
|
+
|
92
|
+
register_actions 'Actions', key: :actions, default: true, width: 130
|
93
|
+
end
|
94
|
+
```
|
32
95
|
|
33
96
|
## Contributing
|
34
97
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
98
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/amdj15/activeadmin_dynamic_table.
|
36
99
|
|
37
100
|
## License
|
38
101
|
|
@@ -8,16 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Anton Biliaiev"]
|
9
9
|
spec.email = ["amdj15@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = ""
|
12
|
-
spec.description = ""
|
13
|
-
spec.homepage = ""
|
11
|
+
spec.summary = "Config activeadmin index tables on demand"
|
12
|
+
spec.description = "Allow to controll activeadmin table columns from the UI. (Show/hide/resize/reorder table columns)"
|
13
|
+
spec.homepage = "https://github.com/amdj15/activeadmin_dynamic_table"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.6.0"
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
20
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
19
|
|
22
20
|
# Specify which files should be added to the gem when it is released.
|
23
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/demo.gif
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_dynamic_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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: 2024-01-
|
11
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -24,7 +24,8 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.9'
|
27
|
-
description:
|
27
|
+
description: Allow to controll activeadmin table columns from the UI. (Show/hide/resize/reorder
|
28
|
+
table columns)
|
28
29
|
email:
|
29
30
|
- amdj15@gmail.com
|
30
31
|
executables: []
|
@@ -42,6 +43,7 @@ files:
|
|
42
43
|
- app/assets/stylesheets/activeadmin_dynamic_table/all.scss
|
43
44
|
- bin/console
|
44
45
|
- bin/setup
|
46
|
+
- demo.gif
|
45
47
|
- lib/activeadmin_dynamic_table.rb
|
46
48
|
- lib/activeadmin_dynamic_table/column_settings.rb
|
47
49
|
- lib/activeadmin_dynamic_table/configurator.rb
|
@@ -49,10 +51,12 @@ files:
|
|
49
51
|
- lib/activeadmin_dynamic_table/version.rb
|
50
52
|
- lib/activeadmin_dynamic_table/views/index_as_dynamic_table.rb
|
51
53
|
- sig/activeadmin_dynamic_table.rbs
|
52
|
-
homepage:
|
54
|
+
homepage: https://github.com/amdj15/activeadmin_dynamic_table
|
53
55
|
licenses:
|
54
56
|
- MIT
|
55
|
-
metadata:
|
57
|
+
metadata:
|
58
|
+
homepage_uri: https://github.com/amdj15/activeadmin_dynamic_table
|
59
|
+
source_code_uri: https://github.com/amdj15/activeadmin_dynamic_table
|
56
60
|
post_install_message:
|
57
61
|
rdoc_options: []
|
58
62
|
require_paths:
|
@@ -71,5 +75,5 @@ requirements: []
|
|
71
75
|
rubygems_version: 3.1.4
|
72
76
|
signing_key:
|
73
77
|
specification_version: 4
|
74
|
-
summary:
|
78
|
+
summary: Config activeadmin index tables on demand
|
75
79
|
test_files: []
|