mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-25 05:02:57 +01:00
fix: InlinePanel - take 1st child when configuring up and down js events
Issue was appearing when there was nested inline panels. currentChild. find would match the parent up/down button but also all the ones of the nested inline panels Fixes #5919
This commit is contained in:
parent
bfa29201c3
commit
58ebfe1fb1
@ -12,6 +12,7 @@ Changelog
|
||||
* Fix: Fix typo in `__str__` for MySQL search index (Jake Howard)
|
||||
* Fix: Ensure that unit tests correctly check for migrations in all core Wagtail apps (Matt Westcott)
|
||||
* Fix: Correctly handle `date` objects on `human_readable_date` template tag (Jhonatan Lopes)
|
||||
* Fix: Ensure re-ordering buttons work correctly when using a nested InlinePanel (Adrien Hamraoui)
|
||||
* Docs: Add contributing development documentation on how to work with a fork of Wagtail (Nix Asteri, Dan Braghis)
|
||||
* Docs: Make sure the settings panel is listed in tabbed interface examples (Tibor Leupold)
|
||||
* Docs: Update multiple pages in the reference sections and multiple page names to their US spelling instead of UK spelling (Victoria Poromon)
|
||||
|
@ -798,6 +798,7 @@
|
||||
* Hossein
|
||||
* Andre Delorme
|
||||
* arshyia3000
|
||||
* Adrien Hamraoui
|
||||
|
||||
## Translators
|
||||
|
||||
|
@ -52,8 +52,10 @@ export class InlinePanel extends ExpandingFormset {
|
||||
const childId = 'inline_child_' + prefix;
|
||||
const deleteInputId = 'id_' + prefix + '-DELETE';
|
||||
const currentChild = $('#' + childId);
|
||||
const $up = currentChild.find('[data-inline-panel-child-move-up]');
|
||||
const $down = currentChild.find('[data-inline-panel-child-move-down]');
|
||||
const $up = currentChild.find('[data-inline-panel-child-move-up]:first ');
|
||||
const $down = currentChild.find(
|
||||
'[data-inline-panel-child-move-down]:first ',
|
||||
);
|
||||
|
||||
$('#' + deleteInputId + '-button').on('click', () => {
|
||||
/* set 'deleted' form field to true */
|
||||
@ -148,8 +150,14 @@ export class InlinePanel extends ExpandingFormset {
|
||||
forms.each(function updateButtonStates(i) {
|
||||
const isFirst = i === 0;
|
||||
const isLast = i === forms.length - 1;
|
||||
$('[data-inline-panel-child-move-up]', this).prop('disabled', isFirst);
|
||||
$('[data-inline-panel-child-move-down]', this).prop('disabled', isLast);
|
||||
$('[data-inline-panel-child-move-up]:first', this).prop(
|
||||
'disabled',
|
||||
isFirst,
|
||||
);
|
||||
$('[data-inline-panel-child-move-down]:first', this).prop(
|
||||
'disabled',
|
||||
isLast,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ depth: 1
|
||||
* Fix typo in `__str__` for MySQL search index (Jake Howard)
|
||||
* Ensure that unit tests correctly check for migrations in all core Wagtail apps (Matt Westcott)
|
||||
* Correctly handle `date` objects on `human_readable_date` template tag (Jhonatan Lopes)
|
||||
* Ensure re-ordering buttons work correctly when using a nested InlinePanel (Adrien Hamraoui)
|
||||
|
||||
|
||||
### Documentation
|
||||
|
Loading…
Reference in New Issue
Block a user