Commit 45f6be4
committed
Render the visibility toggle as a plain link
The toggle carried an onclick that called toggleVisibility, which fetched
the url and swapped the icon by hand. Only the clicked icon though - rows
inheriting the value, as variants inherit "published" from their base
record, kept showing the old state until someone reloaded. Reproducing the
inheritance rules in the browser was never realistic.
The link now carries nothing but the scroll offset action. The server
flips the value and the list is rendered anew, so inherited states are
right without anyone tracking them client side. The handler redirects to
the list afterwards, which the toggle action does not render itself - of
no consequence while the answer was thrown away by an ajax call, but the
browser shows it now, and it keeps the url idempotent.
Two things surfaced by doing it:
The inline script that wires the drag and drop sorting declared "const
table" globally. It sits inside a loop, so it could already collide on a
page with several groups, and Turbo re-executes the scripts of a swapped
body - the toggle threw "Identifier 'table' has already been declared"
on every click. Scoped in a function expression now.
Three docblocks had piled up above buildToggleAttributes, two of them
stranded from an earlier extraction: buildCommand and buildDeepLinkTarget
stood without one while their text sat elsewhere. Handed back.
Verified: the variant case that started this is fixed - toggling the base
record updates all three inheriting rows without a reload, other groups
stay untouched, three runs in a row. Toggle 6/6 with no javascript errors
where there were two, drag and drop still persists, regression 19/19,
display conditions 5/5, legends 10/10, tree 5/5, back url 3/3, edit all
4/4, picker 6/6. phpcq unchanged.1 parent 36bfc88 commit 45f6be4
3 files changed
Lines changed: 49 additions & 41 deletions
File tree
- src
- Contao/View/Contao2BackendView
- ActionHandler
- Resources/contao/templates
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
170 | 177 | | |
171 | 178 | | |
172 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | | - | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
| |||
313 | 311 | | |
314 | 312 | | |
315 | 313 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | 314 | | |
342 | 315 | | |
343 | 316 | | |
344 | | - | |
345 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
346 | 321 | | |
347 | 322 | | |
348 | 323 | | |
349 | | - | |
| 324 | + | |
350 | 325 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 326 | + | |
357 | 327 | | |
358 | 328 | | |
359 | 329 | | |
| |||
379 | 349 | | |
380 | 350 | | |
381 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
382 | 362 | | |
383 | 363 | | |
384 | 364 | | |
385 | 365 | | |
386 | 366 | | |
387 | 367 | | |
388 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
389 | 384 | | |
390 | 385 | | |
391 | 386 | | |
| |||
407 | 402 | | |
408 | 403 | | |
409 | 404 | | |
410 | | - | |
| 405 | + | |
411 | 406 | | |
412 | 407 | | |
413 | 408 | | |
| |||
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| |||
0 commit comments