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
+3 -3
View File
@@ -25,7 +25,6 @@
.admin-license-list span { display: block; font-family: var(--mono); font-size: .85rem; }
.admin-about-links { display: flex; flex-wrap: wrap; gap: .55rem .75rem; }
.admin-about-links a { display: inline-flex; align-items: center; flex-wrap: wrap; min-height: 2.75rem; gap: .2rem .45rem; padding: .4rem .75rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--white); text-decoration: none; }
.admin-about-links span { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.admin-about-links svg { inline-size: 1rem; block-size: 1rem; flex: none; }
.admin-about-links a:hover { border-color: var(--accent); }
@media (max-width: 31rem) {
@@ -427,9 +426,10 @@
/* Studio source, media controls and layer tree */
.media-upload-fields, .media-filters { align-items: start; }
.media-upload-fields input[type=file] { padding: .4rem; min-width: 0; font-size: .9rem; }
.media-upload-fields input { block-size: 3rem; }
.media-upload-fields input[type=file] { padding: .3rem .4rem; min-width: 0; font-size: .9rem; }
.media-upload-fields input::file-selector-button {
margin-inline-end: .6rem; border: 0; border-radius: .35rem; padding: .55rem .75rem;
margin-inline-end: .6rem; border: 0; border-radius: .35rem; padding: .45rem .75rem;
color: var(--accent-deep); background: var(--accent-light); font: inherit; cursor: pointer;
}
.media-filters { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
+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;
}
+1
View File
@@ -40,6 +40,7 @@ jQuery(function ($) {
$detail.find('[data-template-live]').attr('href', '/admin/page-templates/' + key + '/preview');
$form.find('[name=template], [name=slug]').val(key);
$form.find('[name=name]').val(name);
$form.find('[name=type]').val($('[data-new-page-type]').val() || 'page');
$form.children('.ajax-feedback').prop('hidden', true);
showPanel('detail');
})
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+50
View File
@@ -226,3 +226,53 @@
.theme-gather .hero { background: var(--paper); }
.theme-dispatch .hero-copy { padding-inline: .8rem; }
}
.theme-atrium {
--white: #fffdf8;
--paper: #f3ebe1;
--ink: #302521;
--muted: #68534a;
--line: #e0cec1;
--accent: #984631;
--accent-deep: #72321f;
--accent-light: #f3dcd0;
}
.theme-atrium .hero { background: radial-gradient(ellipse at 78% 28%, #fff9eb, transparent 52%), var(--paper); }
.theme-atrium :is(h1, h2, h3) { font-family: 'Noto Serif CJK SC', 'Songti SC', Georgia, serif; font-weight: 580; }
.theme-atrium .app-frame { border-radius: 46% 46% .5rem .5rem / 44% 44% .5rem .5rem; background: var(--white); }
.theme-atrium .app-frame img { object-fit: cover; }
.theme-atrium .button { border-radius: .25rem; }
.theme-harbor {
--white: #f8faf9;
--paper: #e4efee;
--ink: #183039;
--muted: #476065;
--line: #c1d5d3;
--accent: #176471;
--accent-deep: #154752;
--accent-light: #f4e5b5;
}
.theme-harbor .hero { background: radial-gradient(ellipse at 87% 90%, #eed88d 0 16%, transparent 16.2%), var(--paper); }
.theme-harbor .app-frame { padding: .4rem; border-color: #719891; border-radius: 1.5rem; background: var(--white); }
.theme-harbor .app-frame img { object-fit: cover; border-radius: 1.15rem; }
.theme-harbor .button { border-radius: 2rem; }
.theme-index {
--white: #fbfaff;
--paper: #efedf6;
--ink: #28213b;
--muted: #5d5570;
--line: #d6cee4;
--accent: #554381;
--accent-deep: #3d2d60;
--accent-light: #e9e1f6;
}
.theme-index .hero { background: repeating-linear-gradient(0deg, transparent 0 31px, #dfd9ec 31px 32px), var(--paper); }
.theme-index .hero-copy { padding: 1rem; border-inline-start: 3px solid var(--accent); background: var(--paper); }
.theme-index .app-frame { border-radius: .4rem; background: #2c2440; }
.theme-index .button { border-radius: .25rem; }
@media (max-width: 40rem) {
.theme-harbor .hero { background: var(--paper); }
}
+8 -3
View File
@@ -682,6 +682,10 @@ jQuery(function ($) {
}
$settings.on('studio:saved', (_event, saved, submitter) => {
if (saved?.saved && saved.redirect) {
$(window).off('beforeunload.studioPage');
return;
}
if (!Array.isArray(saved?.sections)) return;
const versions = new Map(saved.sections.map((section) => [section.key, section]));
const dynamic = [];
@@ -747,7 +751,7 @@ jQuery(function ($) {
$layout.prop('inert', busy);
$settings.prop('inert', busy);
});
$(window).on('beforeunload', (event) => {
$(window).on('beforeunload.studioPage', (event) => {
if (sectionChanges(false).length || pageInput('provider_secret').filter(':enabled').val()
|| initialOrder !== undefined && canvasOrder() !== initialOrder
|| JSON.stringify(settingsSnapshot(true)) !== savedSettings) {
@@ -1368,8 +1372,9 @@ jQuery(function ($) {
});
pageInput('palette_id').on('change.canvas', function () {
$doc.find('[data-page-palette]').remove();
if (this.value) {
$('<link>', {rel: 'stylesheet', href: '/palette/' + this.value + '.css', 'data-page-palette': ''})
const href = this.selectedOptions[0]?.dataset.paletteCss;
if (href) {
$('<link>', {rel: 'stylesheet', href, 'data-page-palette': ''})
.one('load', syncFormatControls).appendTo($doc.find('head'));
} else syncFormatControls();
pageInput('palette_id').trigger('change.palettePicker');