mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 17:36:49 +01:00
Move 'sort menu order' URL logic to PageListingSortMenuOrderButton
This commit is contained in:
parent
f1ef9bd22c
commit
981ca512e5
@ -230,7 +230,7 @@ class TestPageListingMoreButtonsHooks(TestButtonsHooks):
|
||||
button for button in buttons if button.label == "Sort menu order"
|
||||
)
|
||||
|
||||
self.assertEqual(reorder_button.url, "?ordering=ord")
|
||||
self.assertEqual(reorder_button.url, "/admin/pages/%d/?ordering=ord" % page.id)
|
||||
|
||||
|
||||
class TestPageHeaderButtonsHooks(TestButtonsHooks):
|
||||
|
@ -368,6 +368,10 @@ class PageListingSortMenuOrderButton(PageListingButton):
|
||||
def show(self):
|
||||
return self.page_perms.can_reorder_children()
|
||||
|
||||
@cached_property
|
||||
def url(self):
|
||||
return reverse("wagtailadmin_explore", args=[self.page.id]) + "?ordering=ord"
|
||||
|
||||
|
||||
@hooks.register("register_page_listing_more_buttons")
|
||||
def page_listing_more_buttons(page, page_perms, next_url=None):
|
||||
@ -432,7 +436,6 @@ def page_listing_more_buttons(page, page_perms, next_url=None):
|
||||
yield PageListingSortMenuOrderButton(
|
||||
page=page,
|
||||
page_perms=page_perms,
|
||||
url="?ordering=ord",
|
||||
priority=60,
|
||||
)
|
||||
|
||||
@ -487,7 +490,6 @@ def page_header_buttons(page, page_perms, next_url=None):
|
||||
yield PageListingSortMenuOrderButton(
|
||||
page=page,
|
||||
page_perms=page_perms,
|
||||
url=reverse("wagtailadmin_explore", args=[page.id]) + "?ordering=ord",
|
||||
priority=70,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user