forked from laysense/laysense.cn
Enable in-place editing for page sections and media
This commit is contained in:
@@ -49,10 +49,12 @@ jQuery(function ($) {
|
||||
const multipart = $form.attr('enctype') === 'multipart/form-data';
|
||||
$form.attr('aria-busy', 'true').children('.ajax-feedback').prop('hidden', true);
|
||||
$submit.prop('disabled', true);
|
||||
$form.triggerHandler('studio:busy', [true]);
|
||||
|
||||
function finish() {
|
||||
$form.removeAttr('aria-busy');
|
||||
$submit.prop('disabled', false);
|
||||
$form.triggerHandler('studio:busy', [false]);
|
||||
}
|
||||
|
||||
function submit(canRetryLogin) {
|
||||
@@ -71,11 +73,12 @@ jQuery(function ($) {
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
if (response.redirect) {
|
||||
$form.triggerHandler('studio:saved');
|
||||
window.location.assign(response.redirect);
|
||||
return;
|
||||
}
|
||||
formError($form, '未收到保存结果,请刷新页面确认。');
|
||||
finish();
|
||||
formError($form, '未收到保存结果,请刷新页面确认。');
|
||||
}).fail(function (request) {
|
||||
const response = request.responseJSON;
|
||||
refreshToken(response);
|
||||
@@ -83,8 +86,8 @@ jQuery(function ($) {
|
||||
submit(false);
|
||||
return;
|
||||
}
|
||||
formError($form, response?.message || '请求未完成,请稍后重试。', request.status);
|
||||
finish();
|
||||
formError($form, response?.message || '请求未完成,请稍后重试。', request.status);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user