From dbc7cf45ef1904d8195245d2391fb9ba98257d56 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 29 Jan 2015 13:22:57 +0000 Subject: [PATCH] Documentation for replacing branding using django-overextends (+ rename admin_logo to branding_logo with the plan of being consistent with #934) --- docs/howto/change_logo_dashboard.rst | 24 -------------- docs/howto/custom_branding.rst | 31 +++++++++++++++++++ docs/howto/index.rst | 1 + .../templates/wagtailadmin/base.html | 2 +- 4 files changed, 33 insertions(+), 25 deletions(-) delete mode 100644 docs/howto/change_logo_dashboard.rst create mode 100644 docs/howto/custom_branding.rst diff --git a/docs/howto/change_logo_dashboard.rst b/docs/howto/change_logo_dashboard.rst deleted file mode 100644 index 4fa386d77..000000000 --- a/docs/howto/change_logo_dashboard.rst +++ /dev/null @@ -1,24 +0,0 @@ -Change Logo in Dashboard -======================== - -In your projects with Wagtail, maybe need switch the default logo to other image. For this, you need override the block ``logo_admin``:: - - {% extends "wagtailadmin/base.html" %} - - {% block admin_logo %} - Custom Project - {% endblock %} - - -Save this in your app, for example, ``dashboard`` to ``dashboard/templates/wagtailadmin/base.html`` and register before ``wagtailadmin``:: - - INSTALLED_APPS = ( - # ... - - 'dashboard', - - 'wagtail.wagtailcore', - 'wagtail.wagtailadmin', - - # ... - ) diff --git a/docs/howto/custom_branding.rst b/docs/howto/custom_branding.rst new file mode 100644 index 000000000..7fd1ad28a --- /dev/null +++ b/docs/howto/custom_branding.rst @@ -0,0 +1,31 @@ +Custom branding +=============== + +In your projects with Wagtail, you may wish to replace elements such as the Wagtail logo within the admin interface with your own branding. This can be done through Django's template inheritance mechanism, along with the `django-overextends `_ package. + +Install django-overextends with ``pip install django-overextends`` (or add ``django-overextends`` to your project's requirements file), and add ``'overextends'`` to your project's ``INSTALLED_APPS``. You now need to create a ``templates/wagtailadmin/`` folder within one of your apps - this may be an existing one, or a new one created for this purpose, for example, ``dashboard``. This app must be registered in ``INSTALLED_APPS`` before ``wagtail.wagtailadmin``:: + + INSTALLED_APPS = ( + # ... + + 'overextends', + 'dashboard', + + 'wagtail.wagtailcore', + 'wagtail.wagtailadmin', + + # ... + ) + +The template blocks that are available to be overridden are as follows: + +branding_logo +------------- + +To replace the default logo, create a template file ``dashboard/templates/wagtailadmin/base.html`` that overrides the block ``branding_logo``:: + + {% overextends "wagtailadmin/base.html" %} + + {% block branding_logo %} + Custom Project + {% endblock %} diff --git a/docs/howto/index.rst b/docs/howto/index.rst index c9826e4d5..5e92a73c9 100644 --- a/docs/howto/index.rst +++ b/docs/howto/index.rst @@ -9,4 +9,5 @@ How to deploying performance multilingual_sites + custom_branding contributing diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/base.html b/wagtail/wagtailadmin/templates/wagtailadmin/base.html index 1da6b4f97..3383887f3 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/base.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/base.html @@ -5,7 +5,7 @@