Prepare LaySite 1.5.1 page routing and template updates

This commit is contained in:
2026-11-28 03:07:14 +08:00
parent 50fb30ff3b
commit 474cb766be
41 changed files with 354 additions and 146 deletions
+7 -12
View File
@@ -28,12 +28,12 @@ jQuery(function ($) {
$actionDialog.on('click', '[data-action-cancel]', () => $actionDialog.get(0).close());
$('[data-page-layout-editor]').each(function () {
const {pageLayoutEditor: kind, defaultId} = this.dataset;
const {pageLayoutEditor: kind, defaultSlug} = this.dataset;
const $link = $(this);
$('#studio-page-settings').on('change', '[name="' + kind + '_choice"]', function () {
const id = this.value || defaultId;
const slug = this.value ? this.selectedOptions[0]?.dataset.layoutSlug : defaultSlug;
$link.prop('hidden', this.value === 'hidden')
.attr('href', id && this.value !== 'hidden' ? '/admin/pages/layout--' + kind + '-' + id : '/admin/new-page?type=' + kind);
.attr('href', slug ? '/admin/pages/' + slug : '/admin/new-page?type=' + kind);
});
});
$('[data-palette-picker]').each(function () {
@@ -59,12 +59,6 @@ jQuery(function ($) {
});
updatePalette();
});
$('[data-new-page-type]').on('change', function () {
const ordinary = this.value === 'page';
$(this.form).find('[data-new-page-slug]').prop('hidden', !ordinary)
.find('input').prop({required: ordinary, disabled: !ordinary});
$('[data-open-page-templates]').prop('disabled', !ordinary);
}).trigger('change');
$('[data-provider-settings]').each(function () {
const $settings = $(this);
const $mode = $settings.find('[name=provider_mode]');
@@ -88,7 +82,8 @@ jQuery(function ($) {
const status = $status.val();
let count = 0;
$pages.each(function () {
const visible = (!status || this.dataset.pageItem === status) && this.dataset.pageLabel.toLowerCase().includes(query);
const visible = (!status || this.dataset.pageItem === status || this.dataset.pagePublicStatus === status)
&& this.dataset.pageLabel.toLowerCase().includes(query);
$(this).prop('hidden', !visible);
if (visible) count++;
});
@@ -204,14 +199,14 @@ jQuery(function ($) {
contentType: multipart ? false : 'application/x-www-form-urlencoded; charset=UTF-8',
dataType: 'json'
}).done(function (response) {
if ($form.is('[data-save-inline]') && response.saved === true) {
if ($form.is('[data-save-inline]') && response.saved === true && !response.redirect) {
$form.triggerHandler('studio:saved', [response, submitter]);
finish();
if (document.activeElement === document.body) submitter?.focus({preventScroll: true});
return;
}
if (response.redirect) {
$form.triggerHandler('studio:saved');
$form.triggerHandler('studio:saved', [response, submitter]);
window.location.assign(response.redirect);
return;
}