Documentation for replacing branding using django-overextends (+ rename admin_logo to branding_logo with the plan of being consistent with #934)

This commit is contained in:
Matt Westcott 2015-01-29 13:22:57 +00:00
parent 01b67760c0
commit dbc7cf45ef
4 changed files with 33 additions and 25 deletions

View file

@ -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 %}
<img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
{% 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',
# ...
)

View file

@ -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 <https://github.com/stephenmcd/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 %}
<img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
{% endblock %}

View file

@ -9,4 +9,5 @@ How to
deploying
performance
multilingual_sites
custom_branding
contributing

View file

@ -5,7 +5,7 @@
<div class="nav-wrapper">
<div class="inner">
<a href="{% url 'wagtailadmin_home' %}" class="logo" title="Wagtail v.{% wagtail_version %}">
{% block admin_logo %}
{% block branding_logo %}
<img src="{{ STATIC_URL }}wagtailadmin/images/wagtail-logo.svg" alt="Wagtail" width="80" />
{% endblock %}
<span>{% trans "Dashboard" %}</span>