rails_admin_next 3.0.2 → 4.0.0
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 +3 -0
- data/README.md +25 -7
- data/app/assets/stylesheets/rails_admin/skin.css +240 -7
- data/app/assets/stylesheets/rails_admin/tokens.css +4 -0
- data/app/controllers/rails_admin_next/bulk_deletions_controller.rb +27 -0
- data/app/controllers/rails_admin_next/main_controller.rb +34 -5
- data/app/helpers/rails_admin_next/application_helper.rb +17 -2
- data/app/helpers/rails_admin_next/main_helper.rb +64 -0
- data/app/jobs/rails_admin_next/bulk_delete_job.rb +65 -0
- data/app/views/layouts/rails_admin_next/_head.html.erb +14 -6
- data/app/views/layouts/rails_admin_next/content.html.erb +1 -0
- data/app/views/rails_admin_next/bulk_deletions/_banner.html.erb +30 -0
- data/app/views/rails_admin_next/main/_batch.html.erb +9 -0
- data/app/views/rails_admin_next/main/_history_row.html.erb +32 -0
- data/app/views/rails_admin_next/main/_list_row.html.erb +19 -0
- data/app/views/rails_admin_next/main/_next_batch.html.erb +21 -0
- data/app/views/rails_admin_next/main/_selection_bar.html.erb +30 -0
- data/app/views/rails_admin_next/main/bulk_delete.html.erb +26 -6
- data/app/views/rails_admin_next/main/export.html.erb +1 -0
- data/app/views/rails_admin_next/main/history.html.erb +5 -36
- data/app/views/rails_admin_next/main/index.html.erb +28 -57
- data/config/importmap.rails_admin.rb +7 -2
- data/config/locales/rails_admin_next.en.yml +37 -4
- data/config/routes.rb +2 -0
- data/docs/UPGRADING.md +195 -2
- data/docs/security.md +18 -8
- data/docs/upstream-parity.md +1 -1
- data/lib/rails_admin_next/adapters/active_record.rb +7 -0
- data/lib/rails_admin_next/bulk_deletion/progress.rb +70 -0
- data/lib/rails_admin_next/bulk_deletion.rb +99 -0
- data/lib/rails_admin_next/config/actions/base.rb +7 -0
- data/lib/rails_admin_next/config/actions/bulk_delete.rb +94 -31
- data/lib/rails_admin_next/config/actions/export.rb +4 -0
- data/lib/rails_admin_next/config/actions/history_index.rb +1 -1
- data/lib/rails_admin_next/config/actions/history_show.rb +1 -1
- data/lib/rails_admin_next/config/actions/index.rb +6 -1
- data/lib/rails_admin_next/config/fields/types/action_text.rb +11 -0
- data/lib/rails_admin_next/config/sections/list.rb +1 -2
- data/lib/rails_admin_next/engine.rb +1 -0
- data/lib/rails_admin_next/extensions/paper_trail/auditing_adapter.rb +8 -3
- data/lib/rails_admin_next/support/action_text_editor.rb +36 -0
- data/lib/rails_admin_next/support/paginated_collection.rb +4 -5
- data/lib/rails_admin_next/version.rb +4 -5
- data/lib/rails_admin_next.rb +3 -0
- data/skills/rails-admin-next/SKILL.md +3 -3
- data/src/rails_admin/controllers/alert_controller.js +3 -1
- data/src/rails_admin/controllers/bulk_progress_controller.js +53 -0
- data/src/rails_admin/controllers/bulk_selection_controller.js +151 -0
- data/src/rails_admin/controllers/dropdown_controller.js +7 -5
- data/src/rails_admin/controllers/filtering_multiselect_controller.js +4 -0
- data/src/rails_admin/controllers/filtering_select_controller.js +4 -0
- data/src/rails_admin/controllers/index.js +6 -0
- data/src/rails_admin/controllers/infinite_scroll_controller.js +79 -0
- data/src/rails_admin/controllers/modal_controller.js +3 -1
- data/src/rails_admin/controllers/nested_form_controller.js +3 -2
- data/src/rails_admin/controllers/sidescroll_controller.js +41 -10
- data/src/rails_admin/interactions.js +4 -12
- metadata +24 -5
- data/app/views/rails_admin_next/main/_pagination.html.erb +0 -54
|
@@ -3,21 +3,52 @@ import { Controller } from "@hotwired/stimulus";
|
|
|
3
3
|
// Positions the sticky (frozen) columns of a horizontally scrollable list table.
|
|
4
4
|
// Each sticky cell is offset by its distance from the first sticky cell in the
|
|
5
5
|
// row so the frozen columns stack flush against the left edge while the rest of
|
|
6
|
-
// the table scrolls under them.
|
|
6
|
+
// the table scrolls under them. Every row shares the header's column widths, so
|
|
7
|
+
// the offsets are measured once on the header row and written to every row.
|
|
7
8
|
//
|
|
8
9
|
// It runs on connect: Turbo Drive re-inserts #sidescroll on each visit, so the
|
|
9
10
|
// controller reconnects and recomputes the offsets automatically without a
|
|
10
|
-
// separate dom_ready listener.
|
|
11
|
+
// separate dom_ready listener. Rows appended by a later batch take the current
|
|
12
|
+
// offsets as they connect, and the whole table is measured again before the
|
|
13
|
+
// next paint, since a wider cell in a new row can move every column.
|
|
11
14
|
export default class extends Controller {
|
|
15
|
+
static targets = ["row"];
|
|
16
|
+
|
|
17
|
+
#offsets;
|
|
18
|
+
#pendingFrame;
|
|
19
|
+
|
|
12
20
|
connect() {
|
|
13
|
-
this
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
this.#position();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
disconnect() {
|
|
25
|
+
cancelAnimationFrame(this.#pendingFrame);
|
|
26
|
+
this.#pendingFrame = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
rowTargetConnected(row) {
|
|
30
|
+
if (!this.#offsets) return;
|
|
31
|
+
|
|
32
|
+
this.#apply(row);
|
|
33
|
+
this.#pendingFrame ??= requestAnimationFrame(() => {
|
|
34
|
+
this.#pendingFrame = null;
|
|
35
|
+
this.#position();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#position() {
|
|
40
|
+
const cells = [...this.element.querySelectorAll("thead tr .sticky")];
|
|
41
|
+
const first = cells[0]?.offsetLeft;
|
|
42
|
+
const offsets = cells.map((cell) => cell.offsetLeft - first);
|
|
43
|
+
if (this.#offsets?.join() === offsets.join()) return;
|
|
44
|
+
|
|
45
|
+
this.#offsets = offsets;
|
|
46
|
+
this.element.querySelectorAll("tr").forEach((row) => this.#apply(row));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#apply(row) {
|
|
50
|
+
row.querySelectorAll("th.sticky, td.sticky").forEach((cell, index) => {
|
|
51
|
+
cell.style.left = `${this.#offsets[index]}px`;
|
|
21
52
|
});
|
|
22
53
|
}
|
|
23
54
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Document-level page interactions: global, delegated behaviors with no single
|
|
2
|
-
// host element (
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// host element (the bulk-action menu links, sortable column headers, the
|
|
3
|
+
// export field pickers), so they stay plain delegated DOM listeners rather
|
|
4
|
+
// than per-element Stimulus controllers.
|
|
5
5
|
// Field/widget behaviors (datetime, file upload, rich text, the inline-edit
|
|
6
6
|
// modal) are Stimulus controllers instead.
|
|
7
7
|
//
|
|
@@ -45,14 +45,6 @@ document.addEventListener("click", (event) => {
|
|
|
45
45
|
form.setAttribute("novalidate", "true");
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
// --- Index list: select-all bulk checkboxes ----------------------------------
|
|
49
|
-
document.addEventListener("change", (event) => {
|
|
50
|
-
if (!event.target.matches("#list input.toggle")) return;
|
|
51
|
-
document
|
|
52
|
-
.querySelectorAll("#list [name='bulk_ids[]']")
|
|
53
|
-
.forEach((checkbox) => (checkbox.checked = event.target.checked));
|
|
54
|
-
});
|
|
55
|
-
|
|
56
48
|
// --- Index list: sortable column headers -------------------------------------
|
|
57
49
|
document.addEventListener("click", (event) => {
|
|
58
50
|
const header = event.target.closest("th.header");
|
|
@@ -67,7 +59,7 @@ document.addEventListener("click", (event) => {
|
|
|
67
59
|
if (!link) return;
|
|
68
60
|
event.preventDefault();
|
|
69
61
|
const action = document.getElementById("bulk_action");
|
|
70
|
-
if (action) action.value = link.dataset.
|
|
62
|
+
if (action) action.value = link.dataset.bulkAction;
|
|
71
63
|
// Native submit (full navigation): the bulk action renders its confirmation
|
|
72
64
|
// page with a 200, which Turbo's form handling would reject as "must
|
|
73
65
|
// redirect".
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_admin_next
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel López Prat
|
|
@@ -44,6 +44,9 @@ dependencies:
|
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '2.0'
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: 2.0.2
|
|
47
50
|
type: :runtime
|
|
48
51
|
prerelease: false
|
|
49
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -51,6 +54,9 @@ dependencies:
|
|
|
51
54
|
- - "~>"
|
|
52
55
|
- !ruby/object:Gem::Version
|
|
53
56
|
version: '2.0'
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 2.0.2
|
|
54
60
|
- !ruby/object:Gem::Dependency
|
|
55
61
|
name: propshaft
|
|
56
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,7 +105,7 @@ dependencies:
|
|
|
99
105
|
requirements:
|
|
100
106
|
- - ">="
|
|
101
107
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
108
|
+
version: '2.0'
|
|
103
109
|
- - "<"
|
|
104
110
|
- !ruby/object:Gem::Version
|
|
105
111
|
version: '3'
|
|
@@ -109,7 +115,7 @@ dependencies:
|
|
|
109
115
|
requirements:
|
|
110
116
|
- - ">="
|
|
111
117
|
- !ruby/object:Gem::Version
|
|
112
|
-
version: '
|
|
118
|
+
version: '2.0'
|
|
113
119
|
- - "<"
|
|
114
120
|
- !ruby/object:Gem::Version
|
|
115
121
|
version: '3'
|
|
@@ -146,10 +152,12 @@ files:
|
|
|
146
152
|
- app/assets/stylesheets/rails_admin/skin.css
|
|
147
153
|
- app/assets/stylesheets/rails_admin/tokens.css
|
|
148
154
|
- app/controllers/rails_admin_next/application_controller.rb
|
|
155
|
+
- app/controllers/rails_admin_next/bulk_deletions_controller.rb
|
|
149
156
|
- app/controllers/rails_admin_next/main_controller.rb
|
|
150
157
|
- app/helpers/rails_admin_next/application_helper.rb
|
|
151
158
|
- app/helpers/rails_admin_next/form_builder.rb
|
|
152
159
|
- app/helpers/rails_admin_next/main_helper.rb
|
|
160
|
+
- app/jobs/rails_admin_next/bulk_delete_job.rb
|
|
153
161
|
- app/views/layouts/rails_admin_next/_head.html.erb
|
|
154
162
|
- app/views/layouts/rails_admin_next/_navigation.html.erb
|
|
155
163
|
- app/views/layouts/rails_admin_next/_secondary_navigation.html.erb
|
|
@@ -157,6 +165,8 @@ files:
|
|
|
157
165
|
- app/views/layouts/rails_admin_next/application.html.erb
|
|
158
166
|
- app/views/layouts/rails_admin_next/content.html.erb
|
|
159
167
|
- app/views/layouts/rails_admin_next/modal.js.erb
|
|
168
|
+
- app/views/rails_admin_next/bulk_deletions/_banner.html.erb
|
|
169
|
+
- app/views/rails_admin_next/main/_batch.html.erb
|
|
160
170
|
- app/views/rails_admin_next/main/_dashboard_history.html.erb
|
|
161
171
|
- app/views/rails_admin_next/main/_delete_notice.html.erb
|
|
162
172
|
- app/views/rails_admin_next/main/_form_action_text.html.erb
|
|
@@ -173,7 +183,10 @@ files:
|
|
|
173
183
|
- app/views/rails_admin_next/main/_form_nested_one.html.erb
|
|
174
184
|
- app/views/rails_admin_next/main/_form_polymorphic_association.html.erb
|
|
175
185
|
- app/views/rails_admin_next/main/_form_text.html.erb
|
|
176
|
-
- app/views/rails_admin_next/main/
|
|
186
|
+
- app/views/rails_admin_next/main/_history_row.html.erb
|
|
187
|
+
- app/views/rails_admin_next/main/_list_row.html.erb
|
|
188
|
+
- app/views/rails_admin_next/main/_next_batch.html.erb
|
|
189
|
+
- app/views/rails_admin_next/main/_selection_bar.html.erb
|
|
177
190
|
- app/views/rails_admin_next/main/_submit_buttons.html.erb
|
|
178
191
|
- app/views/rails_admin_next/main/bulk_delete.html.erb
|
|
179
192
|
- app/views/rails_admin_next/main/dashboard.html.erb
|
|
@@ -201,6 +214,8 @@ files:
|
|
|
201
214
|
- lib/rails_admin_next/adapters/active_record/association.rb
|
|
202
215
|
- lib/rails_admin_next/adapters/active_record/object_extension.rb
|
|
203
216
|
- lib/rails_admin_next/adapters/active_record/property.rb
|
|
217
|
+
- lib/rails_admin_next/bulk_deletion.rb
|
|
218
|
+
- lib/rails_admin_next/bulk_deletion/progress.rb
|
|
204
219
|
- lib/rails_admin_next/config.rb
|
|
205
220
|
- lib/rails_admin_next/config/actions.rb
|
|
206
221
|
- lib/rails_admin_next/config/actions/base.rb
|
|
@@ -295,6 +310,7 @@ files:
|
|
|
295
310
|
- lib/rails_admin_next/extensions/pundit/authorization_adapter.rb
|
|
296
311
|
- lib/rails_admin_next/extensions/url_for_extension.rb
|
|
297
312
|
- lib/rails_admin_next/icons.rb
|
|
313
|
+
- lib/rails_admin_next/support/action_text_editor.rb
|
|
298
314
|
- lib/rails_admin_next/support/composite_keys_serializer.rb
|
|
299
315
|
- lib/rails_admin_next/support/csv_converter.rb
|
|
300
316
|
- lib/rails_admin_next/support/hash_helper.rb
|
|
@@ -306,6 +322,8 @@ files:
|
|
|
306
322
|
- src/rails_admin/application.js
|
|
307
323
|
- src/rails_admin/base.js
|
|
308
324
|
- src/rails_admin/controllers/alert_controller.js
|
|
325
|
+
- src/rails_admin/controllers/bulk_progress_controller.js
|
|
326
|
+
- src/rails_admin/controllers/bulk_selection_controller.js
|
|
309
327
|
- src/rails_admin/controllers/collapse_controller.js
|
|
310
328
|
- src/rails_admin/controllers/dropdown_controller.js
|
|
311
329
|
- src/rails_admin/controllers/feedback_controller.js
|
|
@@ -313,6 +331,7 @@ files:
|
|
|
313
331
|
- src/rails_admin/controllers/filtering_multiselect_controller.js
|
|
314
332
|
- src/rails_admin/controllers/filtering_select_controller.js
|
|
315
333
|
- src/rails_admin/controllers/index.js
|
|
334
|
+
- src/rails_admin/controllers/infinite_scroll_controller.js
|
|
316
335
|
- src/rails_admin/controllers/modal_controller.js
|
|
317
336
|
- src/rails_admin/controllers/nested_form_controller.js
|
|
318
337
|
- src/rails_admin/controllers/polymorphic_controller.js
|
|
@@ -340,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
340
359
|
requirements:
|
|
341
360
|
- - ">="
|
|
342
361
|
- !ruby/object:Gem::Version
|
|
343
|
-
version: 4.0.
|
|
362
|
+
version: 4.0.10
|
|
344
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
364
|
requirements:
|
|
346
365
|
- - ">="
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<%# locals: (collection:, url_proc:, mode: :numbered) -%>
|
|
2
|
-
<nav aria-label="Page navigation">
|
|
3
|
-
<ul class="pagination">
|
|
4
|
-
<% if mode == :limited %>
|
|
5
|
-
<%# Count-free pager: prev when not on the first page, next while the page is full. %>
|
|
6
|
-
<% unless collection.first_page? %>
|
|
7
|
-
<li class="page-item prev">
|
|
8
|
-
<%= link_to raw(t('admin.pagination.previous')), url_proc.call(collection.current_page - 1), class: 'page-link' %>
|
|
9
|
-
</li>
|
|
10
|
-
<% end %>
|
|
11
|
-
<% if collection.full_page? %>
|
|
12
|
-
<li class="page-item next">
|
|
13
|
-
<%= link_to raw(t('admin.pagination.next')), url_proc.call(collection.current_page + 1), class: 'page-link' %>
|
|
14
|
-
</li>
|
|
15
|
-
<% else %>
|
|
16
|
-
<li class="page-item next disabled">
|
|
17
|
-
<%= link_to raw(t('admin.pagination.next')), '#', class: 'page-link' %>
|
|
18
|
-
</li>
|
|
19
|
-
<% end %>
|
|
20
|
-
<% else %>
|
|
21
|
-
<% current = collection.current_page %>
|
|
22
|
-
<% total = collection.total_pages %>
|
|
23
|
-
<% if collection.first_page? %>
|
|
24
|
-
<li class="page-item prev disabled">
|
|
25
|
-
<%= link_to raw(t('admin.pagination.previous')), '#', class: 'page-link' %>
|
|
26
|
-
</li>
|
|
27
|
-
<% else %>
|
|
28
|
-
<li class="page-item prev">
|
|
29
|
-
<%= link_to raw(t('admin.pagination.previous')), url_proc.call(current - 1), class: 'page-link' %>
|
|
30
|
-
</li>
|
|
31
|
-
<% end %>
|
|
32
|
-
<% (1..total).each do |number| %>
|
|
33
|
-
<% if (current - number).abs <= 4 %>
|
|
34
|
-
<li class="<%= number == current ? 'page-item active' : 'page-item' %>">
|
|
35
|
-
<%= link_to number, url_proc.call(number), class: 'page-link' %>
|
|
36
|
-
</li>
|
|
37
|
-
<% elsif number == 1 || (current - (number - 1)).abs <= 4 %>
|
|
38
|
-
<li class="page-item disabled">
|
|
39
|
-
<a href="#" class="page-link"><%= raw(t('admin.pagination.truncate')) %></a>
|
|
40
|
-
</li>
|
|
41
|
-
<% end %>
|
|
42
|
-
<% end %>
|
|
43
|
-
<% if collection.last_page? %>
|
|
44
|
-
<li class="page-item next disabled">
|
|
45
|
-
<%= link_to raw(t('admin.pagination.next')), '#', class: 'page-link' %>
|
|
46
|
-
</li>
|
|
47
|
-
<% else %>
|
|
48
|
-
<li class="page-item next">
|
|
49
|
-
<%= link_to raw(t('admin.pagination.next')), url_proc.call(current + 1), class: 'page-link' %>
|
|
50
|
-
</li>
|
|
51
|
-
<% end %>
|
|
52
|
-
<% end %>
|
|
53
|
-
</ul>
|
|
54
|
-
</nav>
|