mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-05 04:46:03 +01:00
Fixed issue where Adding a new page and canceling from within Editing would alter the Parent location of the edited page (fixes #2067)
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# v1.10.9
|
||||
## mm/dd/2021
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fixed issue where Adding a new page and canceling from within Editing would alter the Parent location of the edited page [#2067](https://github.com/getgrav/grav-plugin-admin/issues/2067)
|
||||
|
||||
# v1.10.8
|
||||
## 03/19/2021
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ $(document).on('click', '[data-parents]', (event) => {
|
||||
const target = $(event.currentTarget);
|
||||
let field = target.closest('.parents-wrapper').find('input[name]');
|
||||
let fieldName = field.attr('name');
|
||||
let selectedField = null;
|
||||
|
||||
if (!field.length) {
|
||||
fieldName = target.data('parents');
|
||||
@@ -235,7 +236,7 @@ $(document).on('click', '[data-parents]', (event) => {
|
||||
}
|
||||
|
||||
modal.data('parents', Instances[`${fieldName}-${modal.data('remodalId')}`]);
|
||||
|
||||
modal.data('parents-selectedField', field);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -244,6 +245,7 @@ $(document).on('click', '[data-parents]', (event) => {
|
||||
$(document).on('click', '[data-remodal-id].parents-container [data-parents-select]', (event) => {
|
||||
const modal = $(event.currentTarget).closest('[data-remodal-id]');
|
||||
const parents = modal.data('parents');
|
||||
const selectedField = modal.data('parentsSelectedField');
|
||||
const finder = parents.finder;
|
||||
const field = parents.field;
|
||||
const parentLabel = parents.parentLabel;
|
||||
@@ -252,11 +254,19 @@ $(document).on('click', '[data-remodal-id].parents-container [data-parents-selec
|
||||
const value = selection._item[finder.config.valueKey];
|
||||
const name = selection._item[finder.config.labelKey];
|
||||
|
||||
console.log('click [data-parents-select]', selectedField);
|
||||
if (selectedField.closest('.remodal').length) {
|
||||
const index = field.index(selectedField) - 1;
|
||||
selectedField.val(value);
|
||||
$(parentLabel[index]).text(value);
|
||||
$(parentName[index]).text(name);
|
||||
} else {
|
||||
field.val(value);
|
||||
parentLabel.text(value);
|
||||
parentName.text(name);
|
||||
finder.config.defaultPath = value;
|
||||
|
||||
}
|
||||
const remodal = $.remodal.lookup[$(`[data-remodal-id="${modal.data('remodalId')}"]`).data('remodal')];
|
||||
remodal.close();
|
||||
});
|
||||
|
||||
2
themes/grav/js/admin.min.js
vendored
2
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user