This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba1f437
commit e7daf7d
Showing
7 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.. _customising: | ||
|
||
Customising Paperless | ||
##################### | ||
|
||
Currently, the Paperless' interface is just the default Django admin, which | ||
while powerful, is rather boring. If you'd like to give the site a bit of a | ||
face-lift, or if you simply want to adjust the colours, contrast, or font size | ||
to make things easier to read, you can do that by adding your own CSS or | ||
Javascript quite easily. | ||
|
||
|
||
.. _customising-overrides: | ||
|
||
Overrides | ||
========= | ||
|
||
On every page load, Paperless looks for two files in your media root directory | ||
(the directory defined by your ``PAPERLESS_MEDIADIR`` configuration variable or | ||
the default, ``<project root>/media/``) for two files: | ||
|
||
* ``overrides.css`` | ||
* ``overrides.js`` | ||
|
||
If it finds either or both of those files, they'll be loaded into the page: the | ||
CSS in the ``<head>``, and the Javascript stuffed into the last line of the | ||
``<body>``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ Contents | |
utilities | ||
guesswork | ||
migrating | ||
customising | ||
extending | ||
troubleshooting | ||
scanners | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% extends 'admin/base_site.html' %} | ||
|
||
{# NOTE: This should probably be extending base.html. See CSS comment below details. #} | ||
|
||
|
||
{% load custom_css from customisation %} | ||
{% load custom_js from customisation %} | ||
|
||
|
||
{% block blockbots %} | ||
|
||
{% comment %} | ||
This really should be extending `extrastyle`, but the the | ||
django-flat-responsive package decided that it wanted to put its CSS in | ||
this block, so to make sure that overrides are in fact overriding | ||
everything else, we have to do the Wrong Thing here. | ||
|
||
Once we switch to Django 2.x and drop django-flat-responsive, we should | ||
switch this to `extrastyle` where it should be. | ||
{% endcomment %} | ||
|
||
{{ block.super }} | ||
|
||
{% custom_css %} | ||
|
||
{% endblock blockbots %} | ||
|
||
|
||
{% block footer %} | ||
|
||
{% comment %} | ||
The Django admin doesn't have a block for Javascript you'd want placed in | ||
the footer, so we have to use this one instead. | ||
{% endcomment %} | ||
|
||
{{ block.super }} | ||
|
||
{% custom_js %} | ||
|
||
{% endblock footer %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
|
||
from django import template | ||
from django.conf import settings | ||
from django.utils.safestring import mark_safe | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.simple_tag() | ||
def custom_css(): | ||
theme_path = os.path.join( | ||
settings.MEDIA_ROOT, | ||
"overrides.css" | ||
) | ||
if os.path.exists(theme_path): | ||
return mark_safe( | ||
'<link rel="stylesheet" type="text/css" href="{}" />'.format( | ||
os.path.join(settings.MEDIA_URL, "overrides.css") | ||
) | ||
) | ||
return "" | ||
|
||
|
||
@register.simple_tag() | ||
def custom_js(): | ||
theme_path = os.path.join( | ||
settings.MEDIA_ROOT, | ||
"overrides.js" | ||
) | ||
if os.path.exists(theme_path): | ||
return mark_safe( | ||
'<script src="{}"></script>'.format( | ||
os.path.join(settings.MEDIA_URL, "overrides.js") | ||
) | ||
) | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters