kopia lustrzana https://github.com/wagtail/wagtail
Fix incorrect link to UsageView in EditView for snippets
Currently all links to UsageView in EditView link to `None` instead.pull/10458/head
rodzic
b5aa8e24be
commit
bd38c91163
|
@ -10,6 +10,7 @@ Changelog
|
|||
* Fix: Prevent choosers from failing when initial value is an unrecognised ID, e.g. when moving a page from a location where `parent_page_types` would disallow it (Dan Braghis)
|
||||
* Fix: Move comment notifications toggle to the comments side panel (Sage Abdullah)
|
||||
* Fix: Remove comment button on InlinePanel fields (Sage Abdullah)
|
||||
* Fix: Fix missing link to `UsageView` from `EditView` for snippets (Christer Jensen)
|
||||
* Docs: Document how to add non-ModelAdmin views to a `ModelAdminGroup` (Onno Timmerman)
|
||||
* Docs: Document how to add StructBlock data to a StreamField (Ramon Wenger)
|
||||
* Docs: Update ReadTheDocs settings to v2 to resolve urllib3 issue in linkcheck extension (Thibaud Colas)
|
||||
|
@ -27,6 +28,7 @@ Changelog
|
|||
* Fix: Pass the correct `for_update` value for `get_form_class` in `SnippetViewSet` edit views (Sage Abdullah)
|
||||
* Fix: Move comment notifications toggle to the comments side panel (Sage Abdullah)
|
||||
* Fix: Remove comment button on InlinePanel fields (Sage Abdullah)
|
||||
* Fix: Fix missing link to `UsageView` from `EditView` for snippets (Christer Jensen)
|
||||
* Docs: Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen)
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ depth: 1
|
|||
* Pass the correct `for_update` value for `get_form_class` in `SnippetViewSet` edit views (Sage Abdullah)
|
||||
* Move comment notifications toggle to the comments side panel (Sage Abdullah)
|
||||
* Remove comment button on InlinePanel fields (Sage Abdullah)
|
||||
* Fix missing link to `UsageView` from `EditView` for snippets (Christer Jensen)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ FieldPanels can now be marked as read-only with the `read_only=True` keyword arg
|
|||
* Prevent choosers from failing when initial value is an unrecognised ID, e.g. when moving a page from a location where `parent_page_types` would disallow it (Dan Braghis)
|
||||
* Move comment notifications toggle to the comments side panel (Sage Abdullah)
|
||||
* Remove comment button on InlinePanel fields (Sage Abdullah)
|
||||
* Fix missing link to `UsageView` from `EditView` for snippets (Christer Jensen)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class SnippetStatusSidePanel(BaseStatusSidePanel):
|
|||
inherit = [
|
||||
"view",
|
||||
"history_url",
|
||||
"usage_url",
|
||||
"workflow_history_url",
|
||||
"revisions_compare_url_name",
|
||||
"revision_enabled",
|
||||
|
|
|
@ -1210,6 +1210,12 @@ class TestSnippetEditView(BaseTestSnippetEditView):
|
|||
# History link should be present, one in the header and one in the status side panel
|
||||
self.assertContains(response, history_url, count=2)
|
||||
|
||||
usage_url = reverse(
|
||||
"wagtailsnippets_tests_advert:usage", args=[quote(self.test_snippet.pk)]
|
||||
)
|
||||
# Usage link should be present in the status side panel
|
||||
self.assertContains(response, usage_url)
|
||||
|
||||
# Live status and last updated info should be shown, with a link to the history page
|
||||
self.assertContains(response, "3\xa0weeks ago")
|
||||
self.assertTagInHTML(
|
||||
|
|
|
@ -299,6 +299,7 @@ class EditView(generic.CreateEditViewOptionalFeaturesMixin, generic.EditView):
|
|||
history_url_name = None
|
||||
preview_url_name = None
|
||||
revisions_compare_url_name = None
|
||||
usage_url_name = None
|
||||
permission_required = "change"
|
||||
template_name = "wagtailsnippets/snippets/edit.html"
|
||||
error_message = gettext_lazy("The snippet could not be saved due to errors.")
|
||||
|
@ -312,6 +313,9 @@ class EditView(generic.CreateEditViewOptionalFeaturesMixin, generic.EditView):
|
|||
def get_history_url(self):
|
||||
return reverse(self.history_url_name, args=[quote(self.object.pk)])
|
||||
|
||||
def get_usage_url(self):
|
||||
return reverse(self.usage_url_name, args=[quote(self.object.pk)])
|
||||
|
||||
def _get_action_menu(self):
|
||||
return SnippetActionMenu(
|
||||
self.request,
|
||||
|
@ -348,6 +352,7 @@ class EditView(generic.CreateEditViewOptionalFeaturesMixin, generic.EditView):
|
|||
"action_menu": action_menu,
|
||||
"side_panels": side_panels,
|
||||
"history_url": self.get_history_url(),
|
||||
"usage_url": self.get_usage_url(),
|
||||
"revisions_compare_url_name": self.revisions_compare_url_name,
|
||||
"media": media,
|
||||
}
|
||||
|
@ -909,6 +914,7 @@ class SnippetViewSet(ModelViewSet):
|
|||
preview_url_name=self.get_url_name("preview_on_edit"),
|
||||
lock_url_name=self.get_url_name("lock"),
|
||||
unlock_url_name=self.get_url_name("unlock"),
|
||||
usage_url_name=self.get_url_name("usage"),
|
||||
revisions_compare_url_name=self.get_url_name("revisions_compare"),
|
||||
revisions_unschedule_url_name=self.get_url_name("revisions_unschedule"),
|
||||
workflow_history_url_name=self.get_url_name("workflow_history"),
|
||||
|
@ -979,6 +985,7 @@ class SnippetViewSet(ModelViewSet):
|
|||
preview_url_name=self.get_url_name("preview_on_edit"),
|
||||
lock_url_name=self.get_url_name("lock"),
|
||||
unlock_url_name=self.get_url_name("unlock"),
|
||||
usage_url_name=self.get_url_name("usage"),
|
||||
revisions_compare_url_name=self.get_url_name("revisions_compare"),
|
||||
revisions_unschedule_url_name=self.get_url_name("revisions_unschedule"),
|
||||
revisions_revert_url_name=self.get_url_name("revisions_revert"),
|
||||
|
|
Ładowanie…
Reference in New Issue