Don't change page template if there is no page template field, OR if the template is of type default, or not set

Fixes https://github.com/getgrav/grav-plugin-admin/issues/1059
Fixes https://github.com/getgrav/grav/issues/1403
Fixes https://github.com/getgrav/grav-plugin-admin/issues/1062
This commit is contained in:
Flavio Copes
2017-04-12 14:09:50 +02:00
parent a1f5970a9c
commit 9961e28304
5 changed files with 52 additions and 38 deletions

View File

@@ -1,3 +1,9 @@
# v1.3.3
## 04/xx/2017
1. [](#bugfix)
* Fix for regression introduced in the automatic page template switch when changing page parent [#1059](https://github.com/getgrav/grav-plugin-admin/issues/1059) [grav#1403](https://github.com/getgrav/grav/issues/1403) [#1062](https://github.com/getgrav/grav-plugin-admin/issues/1062)
# v1.3.2
## 04/10/2017

View File

@@ -1362,7 +1362,8 @@ class AdminController extends AdminBaseController
$this->admin->json_response = [
'status' => 'success',
'child_type' => 'default'
'child_type' => '',
'message' => $this->admin->translate('PLUGIN_ADMIN.NO_CHILD_TYPE')
];
return true;

View File

@@ -50,12 +50,18 @@ $(document).on('change', '[name="data[route]"]', (event) => {
const pageTemplate = $('[name="data[name]"]');
const URI = `${config.base_url_relative}/ajax.json/task${config.param_sep}getChildTypes`;
if (pageTemplate.length === 0) {
return;
}
request(URI, {
method: 'post',
body: { rawroute }
}, (response) => {
const type = response.child_type || 'default';
const type = response.child_type;
if (type !== '' && type !== 'default') {
pageTemplate.val(type);
pageTemplate.data('selectize').setValue(type);
}
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long