diff --git a/content_manager/wagtail_hooks.py b/content_manager/wagtail_hooks.py new file mode 100644 index 00000000..89e03028 --- /dev/null +++ b/content_manager/wagtail_hooks.py @@ -0,0 +1,7 @@ +from wagtail import hooks + + +# Doesn't remove everything if used from the dashboard app +@hooks.register("construct_homepage_summary_items") +def remove_all_summary_items(request, items): + items.clear() diff --git a/dashboard/templates/wagtailadmin/home.html b/dashboard/templates/wagtailadmin/home.html new file mode 100644 index 00000000..a9ce8a0a --- /dev/null +++ b/dashboard/templates/wagtailadmin/home.html @@ -0,0 +1,6 @@ +{% extends "wagtailadmin/home.html" %} +{% load i18n %} + +{% block branding_welcome %} + {% translate "Welcome to the administration panel of Sites faciles" %} +{% endblock %} diff --git a/dashboard/wagtail_hooks.py b/dashboard/wagtail_hooks.py index 3332654c..9e8aa45f 100644 --- a/dashboard/wagtail_hooks.py +++ b/dashboard/wagtail_hooks.py @@ -1,9 +1,13 @@ +from django.contrib.admin.utils import quote from django.templatetags.static import static from django.urls import reverse from django.utils.html import format_html +from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from wagtail import hooks from wagtail.admin.menu import MenuItem +from wagtail.admin.ui.components import Component +from wagtail.models import Site @hooks.register("insert_global_admin_css") @@ -45,3 +49,35 @@ def render(self, request) -> str: @hooks.register("construct_wagtail_userbar") def add_page_api_link_item(request, items): return items.append(UserbarPageAPILinkItem()) + + +class MainLinksPanel(Component): + order = 50 + + def render_html(self, parent_context): + site = Site.objects.filter(is_default_site=True).first() + home_page = site.root_page + home_page_edit = reverse("wagtailadmin_pages:edit", args=(quote(home_page.pk),)) + + pages_list = reverse("wagtailadmin_explore", args=(quote(home_page.pk),)) + + return mark_safe( + f"""
+ +
""" + ) + + +@hooks.register("construct_homepage_panels") +def add_main_links_panel(request, panels): + panels.append(MainLinksPanel()) diff --git a/pyproject.toml b/pyproject.toml index 47796090..f14566cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ extend-exclude = ''' [tool.djlint] max_blank_lines = 1 -ignore = "H030,H031,H006,D018" +ignore = "H030,H031,H006,D018,T003" indent = 2 [tool.pyright]