mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-18 03:00:56 +01:00
When creating a new page, automatically select the Page Template based on Parent Page Child Type (fixes #1008)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* Added new **toolbox** with `Direct-Install` option via ZIP or URL.
|
||||
* Added an option to reinstall a plugin/theme already installed [#984](https://github.com/getgrav/grav-plugin-admin/issues/984)
|
||||
* Added a new **range field** [#995](https://github.com/getgrav/grav-plugin-admin/issues/995)
|
||||
* When creating a new page, automatically select the Page Template based on Parent Page Child Type [#1008](https://github.com/getgrav/grav-plugin-admin/issues/1008)
|
||||
1. [](#improved)
|
||||
* Separated user details and avatar in separate twig to allow more granular overriding in plugins [#989](https://github.com/getgrav/grav-plugin-admin/issues/989)
|
||||
* Nicer layout of themes list on wider screen
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import '../../utils/jquery-utils';
|
||||
import request from '../../utils/request';
|
||||
import { config } from 'grav-config';
|
||||
|
||||
let custom = false;
|
||||
let folder = $('[data-remodal-id="modal"] input[name="data[folder]"], [data-remodal-id="modular"] input[name="data[folder]"]');
|
||||
@@ -42,3 +44,18 @@ folder.on('input', (event) => {
|
||||
});
|
||||
|
||||
folder.on('focus blur', (event) => getFields('title', event.currentTarget).title.trigger('input'));
|
||||
|
||||
$(document).on('change', '[name="data[route]"]', (event) => {
|
||||
const rawroute = $(event.currentTarget).val();
|
||||
const pageTemplate = $('[name="data[name]"]');
|
||||
const URI = `${config.base_url_relative}/ajax.json/task${config.param_sep}getChildTypes`;
|
||||
|
||||
request(URI, {
|
||||
method: 'post',
|
||||
body: { rawroute }
|
||||
}, (response) => {
|
||||
const type = response.child_type || 'default';
|
||||
pageTemplate.val(type);
|
||||
pageTemplate.data('selectize').setValue(type);
|
||||
});
|
||||
});
|
||||
|
||||
32
themes/grav/js/admin.min.js
vendored
32
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
52
themes/grav/js/vendor.min.js
vendored
52
themes/grav/js/vendor.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user