Reset scheduled publishing fields when dialog is closed

pull/9226/head
Sage Abdullah 2022-08-01 23:20:26 +07:00 zatwierdzone przez Matt Westcott
rodzic 9a1606c809
commit 41c8512789
3 zmienionych plików z 18 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,10 @@
document.addEventListener('DOMContentLoaded', () => {
const dialog = document.getElementById('schedule-publishing-dialog');
dialog.addEventListener('hide', () => {
const goLiveAt = document.getElementById('id_go_live_at');
const expireAt = document.getElementById('id_expire_at');
goLiveAt.value = goLiveAt.defaultValue;
expireAt.value = expireAt.defaultValue;
});
});

Wyświetl plik

@ -47,6 +47,7 @@ module.exports = function exports(env, argv) {
'page-editor',
'preview-panel',
'privacy-switch',
'schedule-publishing',
'sidebar',
'task-chooser-modal',
'task-chooser',

Wyświetl plik

@ -18,6 +18,7 @@ from modelcluster.models import get_serializable_data_for_fields
from wagtail.admin import compare
from wagtail.admin.forms.comments import CommentForm
from wagtail.admin.staticfiles import versioned_static
from wagtail.admin.templatetags.wagtailadmin_tags import avatar_url, user_display_name
from wagtail.admin.ui.components import Component
from wagtail.admin.widgets import AdminPageChooser
@ -1094,6 +1095,12 @@ class PublishingPanel(MultiFieldPanel):
def show_panel_furniture(self):
return False
@property
def media(self):
return super().media + Media(
js=[versioned_static("wagtailadmin/js/schedule-publishing.js")],
)
class CommentPanel(Panel):
def get_form_options(self):