Hook for adding CSS to all admin pages

pull/2275/merge
Tom Dyson 2016-02-24 17:53:56 +02:00 zatwierdzone przez Matt Westcott
rodzic ce918daa61
commit 985a987436
4 zmienionych plików z 24 dodań i 0 usunięć

Wyświetl plik

@ -14,6 +14,7 @@ Changelog
* Refactored the way forms are constructed for the page editor, to allow custom forms to be used
* Notification message on publish now indicates whether the page is being published now or scheduled for publication in future (Chris Rogers)
* Server errors when uploading images / documents through the chooser modal are now reported back to the user (Nigel Fletton)
* Added a hook `insert_global_admin_css` for inserting custom CSS throughout the admin backend (Tom Dyson)
* New translations for Hungarian, Swedish (Sweden) and Turkish
* Fix: Custom page managers no longer raise an error when used on an abstract model
* Fix: Wagtail's migrations are now all reversible (benjaoming)

Wyświetl plik

@ -244,6 +244,27 @@ Hooks for customising the editing interface for pages and snippets.
+ 'demo/css/vendor/font-awesome/css/font-awesome.min.css">')
.. _insert_global_admin_css:
``insert_global_admin_css``
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Add additional CSS files or snippets to all admin pages.
.. code-block:: python
from django.utils.html import format_html
from django.conf import settings
from wagtail.wagtailcore import hooks
@hooks.register('insert_global_admin_css')
def global_admin_css():
return format_html('<link rel="stylesheet" href="' \
+ settings.STATIC_URL \
+ 'my/wagtail/theme.css">')
.. _insert_editor_js:
``insert_editor_js``

Wyświetl plik

@ -48,6 +48,7 @@ Minor features
* Refactored the way forms are constructed for the page editor, to allow custom forms to be used
* Notification message on publish now indicates whether the page is being published now or scheduled for publication in future (Chris Rogers)
* Server errors when uploading images / documents through the chooser modal are now reported back to the user (Nigel Fletton)
* Added a hook ``insert_global_admin_css`` for inserting custom CSS throughout the admin backend (Tom Dyson)
* New translations for Hungarian, Swedish (Sweden) and Turkish

Wyświetl plik

@ -5,6 +5,7 @@
<link rel="stylesheet" href="{% static 'wagtailadmin/css/vendor/jquery-ui/jquery-ui-1.10.3.verdant.css' %}" />
<link rel="stylesheet" href="{% static 'wagtailadmin/css/vendor/jquery.tagit.css' %}">
<link rel="stylesheet" href="{% static 'wagtailadmin/css/core.css' %}" type="text/css" />
{% hook_output 'insert_global_admin_css' %}
{% block extra_css %}{% endblock %}
{% endblock %}