kopia lustrzana https://github.com/wagtail/wagtail
Disable breadcrumbs on views outside of custom ModelViewSets/SnippetViewSets
rodzic
67757ce29c
commit
92c5be35e8
|
@ -22,6 +22,8 @@ class WagtailAdminTemplateMixin(TemplateResponseMixin, ContextMixin):
|
|||
page_title = ""
|
||||
page_subtitle = ""
|
||||
header_icon = ""
|
||||
# Breadcrumbs are opt-in until we have a design that can be consistently applied
|
||||
_show_breadcrumbs = False
|
||||
breadcrumbs_items = [{"url": reverse_lazy("wagtailadmin_home"), "label": _("Home")}]
|
||||
template_name = "wagtailadmin/generic/base.html"
|
||||
|
||||
|
@ -42,7 +44,9 @@ class WagtailAdminTemplateMixin(TemplateResponseMixin, ContextMixin):
|
|||
context["page_title"] = self.get_page_title()
|
||||
context["page_subtitle"] = self.get_page_subtitle()
|
||||
context["header_icon"] = self.get_header_icon()
|
||||
context["breadcrumbs_items"] = self.get_breadcrumbs_items()
|
||||
context["breadcrumbs_items"] = None
|
||||
if self._show_breadcrumbs:
|
||||
context["breadcrumbs_items"] = self.get_breadcrumbs_items()
|
||||
return context
|
||||
|
||||
def get_template_names(self):
|
||||
|
|
|
@ -52,6 +52,9 @@ class ModelViewSet(ViewSet):
|
|||
#: The view class to use for the inspect view; must be a subclass of ``wagtail.admin.views.generic.InspectView``.
|
||||
inspect_view_class = generic.InspectView
|
||||
|
||||
# Breadcrumbs can be turned off until we have a design that can be consistently applied
|
||||
_show_breadcrumbs = True
|
||||
|
||||
#: The prefix of template names to look for when rendering the admin views.
|
||||
template_prefix = ""
|
||||
|
||||
|
@ -119,6 +122,7 @@ class ModelViewSet(ViewSet):
|
|||
"edit_url_name": self.get_url_name("edit"),
|
||||
"delete_url_name": self.get_url_name("delete"),
|
||||
"header_icon": self.icon,
|
||||
"_show_breadcrumbs": self._show_breadcrumbs,
|
||||
**kwargs,
|
||||
}
|
||||
)
|
||||
|
|
|
@ -98,6 +98,7 @@ class LocaleViewSet(ModelViewSet):
|
|||
model = Locale
|
||||
permission_policy = locale_permission_policy
|
||||
add_to_reference_index = False
|
||||
_show_breadcrumbs = False
|
||||
|
||||
index_view_class = IndexView
|
||||
add_view_class = CreateView
|
||||
|
|
|
@ -52,6 +52,7 @@ class SiteViewSet(ModelViewSet):
|
|||
model = Site
|
||||
permission_policy = site_permission_policy
|
||||
add_to_reference_index = False
|
||||
_show_breadcrumbs = False
|
||||
|
||||
index_view_class = IndexView
|
||||
add_view_class = CreateView
|
||||
|
|
|
@ -79,6 +79,7 @@ class ModelIndexView(generic.IndexView):
|
|||
header_icon = "snippet"
|
||||
index_url_name = "wagtailsnippets:index"
|
||||
default_ordering = "name"
|
||||
_show_breadcrumbs = True
|
||||
|
||||
def setup(self, request, *args, **kwargs):
|
||||
super().setup(request, *args, **kwargs)
|
||||
|
|
|
@ -158,6 +158,7 @@ class GroupViewSet(ModelViewSet):
|
|||
icon = "group"
|
||||
model = Group
|
||||
add_to_reference_index = False
|
||||
_show_breadcrumbs = False
|
||||
|
||||
index_view_class = IndexView
|
||||
add_view_class = CreateView
|
||||
|
|
Ładowanie…
Reference in New Issue