Просмотр исходного кода

Tiny cleanup for site root page chooser (#7407)

* Pulling in _editor_js.html is unnecessary - the only JS dependency that isn't in form media is now modal_workflow.js. (So close to being able to ditch the template override entirely!)
* Omit the 'clear' button, as this is a required field.
Matt Westcott 3 лет назад
Родитель
Сommit
07402a545a

+ 1 - 0
CHANGELOG.txt

@@ -11,6 +11,7 @@ Changelog
  * Fix: Delete button is now correct colour on snippets and modeladmin listings (Brandon Murch)
  * Fix: Ensure that StreamBlock / ListBlock-level validation errors are counted towards error counts (Matt Westcott)
  * Fix: InlinePanel add button is now keyboard navigatable (Jesse Menn)
+ * Fix: Remove redundant 'clear' button from site root page chooser (Matt Westcott)
 
 
 2.14 (02.08.2021)

+ 1 - 0
docs/releases/2.15.rst

@@ -26,6 +26,7 @@ Bug fixes
  * Delete button is now correct colour on snippets and modeladmin listings (Brandon Murch)
  * Ensure that StreamBlock / ListBlock-level validation errors are counted towards error counts (Matt Westcott)
  * InlinePanel add button is now keyboard navigatable (Jesse Menn)
+ * Remove redundant 'clear' button from site root page chooser (Matt Westcott)
 
 Upgrade considerations
 ======================

+ 2 - 1
wagtail/sites/forms.py

@@ -9,7 +9,8 @@ class SiteForm(forms.ModelForm):
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
         self.fields['root_page'].widget = AdminPageChooser(
-            choose_one_text=_('Choose a root page'), choose_another_text=_('Choose a different root page')
+            choose_one_text=_('Choose a root page'), choose_another_text=_('Choose a different root page'),
+            show_clear_link=False
         )
 
     required_css_class = "required"

+ 2 - 1
wagtail/sites/templates/wagtailsites/create.html

@@ -1,6 +1,7 @@
 {% extends "wagtailadmin/generic/create.html" %}
+{% load wagtailadmin_tags %}
 
 {% block extra_js %}
     {{ block.super }}
-    {% include "wagtailadmin/pages/_editor_js.html" %}
+    <script src="{% versioned_static 'wagtailadmin/js/modal-workflow.js' %}"></script>
 {% endblock %}

+ 2 - 1
wagtail/sites/templates/wagtailsites/edit.html

@@ -1,6 +1,7 @@
 {% extends "wagtailadmin/generic/edit.html" %}
+{% load wagtailadmin_tags %}
 
 {% block extra_js %}
     {{ block.super }}
-    {% include "wagtailadmin/pages/_editor_js.html" %}
+    <script src="{% versioned_static 'wagtailadmin/js/modal-workflow.js' %}"></script>
 {% endblock %}