activeadmin_dynamic_table 0.2.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 537aa432d0b52c8cf60622622c7893ccfb26094b9da6b48d3b529812266358e7
4
- data.tar.gz: 5b7fdde7f367a01c537a3134e6db65c6e62478005bcc297db0dba9f13bea24a7
3
+ metadata.gz: 990ccd171d2daf1f4367c43f1bed286aa2a240ec23705a60f3bcd6b9ffa33954
4
+ data.tar.gz: 66cbb973719a88e5cd8b50fce56a7befbc3688160502416acbb3d57c134f7b47
5
5
  SHA512:
6
- metadata.gz: f1153e6d83dcea9a7a21607cda3dc34d72e6775bf3a0c5237135bcdbe9c8e01abce4bd97628578d876f025849f6f9c03071db31455cc594d667ccd64b08242a7
7
- data.tar.gz: e0fed908ba563f7513d675136094f4b7a6acb649ef55697c75c0e9e7deb4474f0e921bf8e339ca129600e4a4a42bc32f129477bef59a6d55b392259d6a312ed5
6
+ metadata.gz: 7e8dcad15d77a6849d0a539a71d8c1c0a561975563dc3b99d54fdcf78252e6c44c7d97694b1280c48995e1d533267c76c03246d8e7d599125573da17369ef671
7
+ data.tar.gz: 38a0fb7181c0e438b0673fccef9fe25cc2b3efcb97ced41f0c4183a7a42f6688d396b4a5054e470b118ae151da74327eb2f3f8c83eda53692c9e944e7a1f121d
data/Gemfile.lock CHANGED
@@ -1,65 +1,90 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activeadmin_dynamic_table (0.2.0)
4
+ activeadmin_dynamic_table (0.2.2)
5
5
  activeadmin (>= 2.9, < 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (7.0.3)
11
- actionview (= 7.0.3)
12
- activesupport (= 7.0.3)
13
- rack (~> 2.0, >= 2.2.0)
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.0)
16
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (7.0.3)
18
- activesupport (= 7.0.3)
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.4)
21
- rails-dom-testing (~> 2.0)
22
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activeadmin (2.13.1)
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
- formtastic (>= 3.1, < 5.0)
26
- formtastic_i18n (~> 0.4)
28
+ csv
29
+ formtastic (>= 3.1)
30
+ formtastic_i18n (>= 0.4)
27
31
  inherited_resources (~> 1.7)
28
- jquery-rails (~> 4.2)
29
- kaminari (~> 1.0, >= 1.2.1)
30
- railties (>= 6.1, < 7.1)
31
- ransack (>= 2.1.1, < 4)
32
- activemodel (7.0.3)
33
- activesupport (= 7.0.3)
34
- activerecord (7.0.3)
35
- activemodel (= 7.0.3)
36
- activesupport (= 7.0.3)
37
- activesupport (7.0.3)
38
- concurrent-ruby (~> 1.0, >= 1.0.2)
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
- tzinfo (~> 2.0)
42
- arbre (1.5.0)
43
- activesupport (>= 3.0.0, < 7.1)
44
- ruby2_keywords (>= 0.0.2, < 1.0)
45
- builder (3.2.4)
46
- concurrent-ruby (1.1.10)
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
- erubi (1.10.0)
49
- formtastic (4.0.0)
50
- actionpack (>= 5.2.0)
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.0)
72
+ has_scope (0.8.2)
53
73
  actionpack (>= 5.2)
54
74
  activesupport (>= 5.2)
55
- i18n (1.8.11)
75
+ i18n (1.14.7)
56
76
  concurrent-ruby (~> 1.0)
57
- inherited_resources (1.13.1)
58
- actionpack (>= 5.2, < 7.1)
59
- has_scope (~> 0.6)
60
- railties (>= 5.2, < 7.1)
61
- responders (>= 2, < 4)
62
- jquery-rails (4.5.0)
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.2)
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
- loofah (2.18.0)
103
+ logger (1.7.0)
104
+ loofah (2.24.0)
79
105
  crass (~> 1.0.2)
80
- nokogiri (>= 1.5.9)
81
- method_source (1.0.0)
82
- minitest (5.15.0)
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
- racc (1.6.0)
86
- rack (2.2.3.1)
87
- rack-test (1.1.0)
88
- rack (>= 1.0, < 3)
89
- rails-dom-testing (2.0.3)
90
- activesupport (>= 4.2.0)
110
+ pp (0.6.2)
111
+ prettyprint
112
+ prettyprint (0.2.0)
113
+ psych (5.2.5)
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.4.2)
93
- loofah (~> 2.3)
94
- railties (7.0.3)
95
- actionpack (= 7.0.3)
96
- activesupport (= 7.0.3)
97
- method_source
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.5)
138
+ thor (~> 1.0, >= 1.2.2)
139
+ zeitwerk (~> 2.6)
101
140
  rake (13.0.6)
102
- ransack (2.5.0)
103
- activerecord (>= 5.2.4)
104
- activesupport (>= 5.2.4)
141
+ ransack (4.3.0)
142
+ activerecord (>= 6.1.5)
143
+ activesupport (>= 6.1.5)
105
144
  i18n
106
- responders (3.0.1)
107
- actionpack (>= 5.0)
108
- railties (>= 5.0)
145
+ rdoc (6.13.1)
146
+ psych (>= 4.0.0)
147
+ reline (0.6.1)
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
- thor (1.2.1)
111
- tzinfo (2.0.4)
153
+ securerandom (0.4.1)
154
+ stringio (3.1.7)
155
+ thor (1.3.2)
156
+ timeout (0.4.3)
157
+ tzinfo (2.0.6)
112
158
  concurrent-ruby (~> 1.0)
113
- zeitwerk (2.5.4)
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!
@@ -54,12 +54,12 @@ $(function() {
54
54
  const elem = $(this)
55
55
 
56
56
  return {
57
- width: elem.width(),
57
+ width: elem.outerWidth(),
58
58
  key: elem.data('column-key'),
59
59
  };
60
60
  })
61
- .toArray()
62
- .reduce((acc, item) => Object.assign(acc, { [item.key]: item.width }), {});
61
+ .toArray()
62
+ .reduce((acc, item) => Object.assign(acc, { [item.key]: item.width }), {});
63
63
  }
64
64
 
65
65
  function filterEmptyKeys(params) {
@@ -73,21 +73,33 @@ $(function() {
73
73
  }, {});
74
74
  }
75
75
 
76
+ let clone = null;
77
+
76
78
  preferencesBtn.on('click', function() {
77
79
  const offset = preferencesBtn.offset();
78
80
  offset.top += preferencesBtn.outerHeight();
79
81
 
80
- tableConfig.removeClass('hidden').offset(offset);
82
+ clone = tableConfig.clone();
83
+
84
+ clone.removeClass('hidden');
85
+ clone.offset(offset);
86
+ offset.top += preferencesBtn.outerHeight();
87
+
88
+ $('.index_content').prepend(clone);
81
89
 
82
90
  return false;
83
91
  });
84
92
 
85
- document.addEventListener('click', () => {
86
- if (!tableConfig.length || tableConfig.hasClass('hidden')) {
93
+ $(document).on('click', '.dynamic_table_configuration', function(event) {
94
+ event.stopPropagation();
95
+ });
96
+
97
+ $(document).on('click', () => {
98
+ if (!clone) {
87
99
  return;
88
100
  }
89
101
 
90
- const selected = tableConfig.find('input').filter(function() {
102
+ const selected = clone.find('input').filter(function() {
91
103
  return $(this).is(':checked');
92
104
  }).map(function() {
93
105
  return $(this).attr('name');
@@ -105,12 +117,10 @@ $(function() {
105
117
  });
106
118
  const searchString = stringifyParams(params);
107
119
 
108
- tableConfig.addClass('hidden');
109
- window.location.search = searchString;
110
- });
120
+ clone.remove();
121
+ clone = null;
111
122
 
112
- tableConfig.on('click', function(event) {
113
- event.stopPropagation();
123
+ window.location.search = searchString;
114
124
  });
115
125
 
116
126
  columns.resizable({
@@ -12,14 +12,6 @@
12
12
  }
13
13
  }
14
14
 
15
- .dynamic_table_configuration {
16
- position: absolute;
17
- background: #fff;
18
- padding: 8px;
19
- border: 1px solid #c9d0d6;
20
- width: max-content;
21
- }
22
-
23
15
  .dynamic_table {
24
16
  table-layout: fixed;
25
17
  width: min-content;
@@ -42,3 +34,13 @@
42
34
  }
43
35
  }
44
36
  }
37
+
38
+ .dynamic_table_configuration {
39
+ position: absolute;
40
+ background: #fff;
41
+ padding: 8px;
42
+ border: 1px solid #c9d0d6;
43
+ width: max-content;
44
+ z-index: 10;
45
+ list-style: none;
46
+ }
@@ -27,11 +27,9 @@ module ActiveadminDynamicTable
27
27
  def columns
28
28
  applicable_columns.each do |applicable_column|
29
29
  next @context.id_column *applicable_column.args if applicable_column.method == :id_column
30
- next @context.actions(applicable_column.args[1] || applicable_column.args[0]) if applicable_column.method == :actions
30
+ next @context.actions(applicable_column.args[1] || applicable_column.args[0], &applicable_column.block) if applicable_column.method == :actions
31
31
  next @context.index_column *applicable_column.args if applicable_column.method == :index_column
32
32
 
33
- # next @context.selectable_column *applicable_column.args if applicable_column.method == :selectable_column
34
-
35
33
  @context.public_send(applicable_column.method, *applicable_column.args, &applicable_column.block)
36
34
  end
37
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveadminDynamicTable
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
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.2.0
4
+ version: 0.2.2
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-02-19 00:00:00.000000000 Z
11
+ date: 2025-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.1.4
83
+ rubygems_version: 3.5.3
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Config activeadmin index tables on demand