kopia lustrzana https://github.com/wagtail/wagtail
Sort listing buttons and dropdown_buttons before rendering
rodzic
1a1fc5c1a7
commit
d34aba87b9
|
@ -164,7 +164,7 @@ class ButtonsColumnMixin:
|
|||
|
||||
def get_cell_context_data(self, instance, parent_context):
|
||||
context = super().get_cell_context_data(instance, parent_context)
|
||||
context["buttons"] = self.get_buttons(instance, parent_context)
|
||||
context["buttons"] = sorted(self.get_buttons(instance, parent_context))
|
||||
return context
|
||||
|
||||
def get_buttons(self, instance, parent_context):
|
||||
|
|
|
@ -148,7 +148,7 @@ class BaseDropdownMenuButton(Button):
|
|||
|
||||
def get_context_data(self, parent_context):
|
||||
return {
|
||||
"buttons": self.dropdown_buttons,
|
||||
"buttons": sorted(self.dropdown_buttons),
|
||||
"label": self.label,
|
||||
"title": self.aria_label,
|
||||
"toggle_classname": self.classname,
|
||||
|
@ -184,6 +184,4 @@ class ButtonWithDropdownFromHook(BaseDropdownMenuButton):
|
|||
buttons.extend(hook(self.page, self.page_perms, self.next_url))
|
||||
|
||||
buttons = [b for b in buttons if b.show]
|
||||
|
||||
buttons.sort()
|
||||
return buttons
|
||||
|
|
Ładowanie…
Reference in New Issue