forked from laysense/laysite
Add visual header and footer layout editors
This commit is contained in:
+12
-3
@@ -3,10 +3,18 @@
|
||||
jQuery(function ($) {
|
||||
$('[data-layout-components]').on('click', '[data-component-move]', function () {
|
||||
const $item = $(this).closest('li');
|
||||
if (this.dataset.componentMove === '-1') $item.prev().before($item);
|
||||
else $item.next().after($item);
|
||||
if (this.dataset.componentMove === '-1') $item.prevAll(':visible').first().before($item);
|
||||
else $item.nextAll(':visible').first().after($item);
|
||||
$(this).closest('[data-layout-components]').trigger('layout:order');
|
||||
$(this).trigger('focus');
|
||||
});
|
||||
$('[data-page-layout-editor]').each(function () {
|
||||
const {pageLayoutEditor: kind, defaultId} = this.dataset;
|
||||
const $link = $(this);
|
||||
$('#studio-page-settings').on('change', '[name="' + kind + '_id"]', function () {
|
||||
$link.attr('href', '/admin/design/' + kind + '/' + (this.value || defaultId || 'new?default=1'));
|
||||
});
|
||||
});
|
||||
$('[data-provider-settings]').each(function () {
|
||||
const $settings = $(this);
|
||||
const $form = $settings.closest('form');
|
||||
@@ -15,7 +23,7 @@ jQuery(function ($) {
|
||||
const $mode = $settings.find('[name=provider_mode]');
|
||||
const sync = () => {
|
||||
const mode = $mode.val();
|
||||
const active = $preset.val() === 'member' && $account.is(':checked');
|
||||
const active = $preset.filter(':checked').val() === 'member' && $account.is(':checked');
|
||||
$settings.prop({hidden: !active, disabled: !active});
|
||||
$settings.find('[data-provider-field]').prop('hidden', !mode);
|
||||
$settings.find('[data-provider-mode]').each(function () {
|
||||
@@ -165,6 +173,7 @@ jQuery(function ($) {
|
||||
return;
|
||||
}
|
||||
finish();
|
||||
if (response?.field) $form.triggerHandler('studio:invalid', [response.field]);
|
||||
if (!designFieldError($form, response)) {
|
||||
formError($form, response?.message || '请求未完成,请稍后重试。', request.status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user