header logo
This commit is contained in:
parent
ae4652529a
commit
4402ff9f54
6 changed files with 52 additions and 4 deletions
7
src/c3nav/site/context_processors.py
Normal file
7
src/c3nav/site/context_processors.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def header_logo(request):
|
||||
return {
|
||||
'header_logo': settings.HEADER_LOGO_NAME
|
||||
}
|
20
src/c3nav/site/finders.py
Normal file
20
src/c3nav/site/finders.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles.finders import BaseFinder
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
|
||||
class HeaderLogoFinder(BaseFinder):
|
||||
def find(self, path, all=False):
|
||||
if path == settings.HEADER_LOGO_NAME:
|
||||
return [settings.HEADER_LOGO] if all else settings.HEADER_LOGO
|
||||
return []
|
||||
|
||||
def list(self, ignore_patterns):
|
||||
if not settings.HEADER_LOGO:
|
||||
return []
|
||||
basedir, filename = os.path.split(settings.HEADER_LOGO)
|
||||
storage = FileSystemStorage(location=basedir)
|
||||
storage.prefix = 'logo'
|
||||
return [(filename, storage)]
|
|
@ -47,6 +47,15 @@ header h1 {
|
|||
}
|
||||
header h1 a, header h1 a:hover {
|
||||
color: $color-header-primary;
|
||||
line-height: 50px;
|
||||
display: block;
|
||||
height: 50px;
|
||||
}
|
||||
header h1 img {
|
||||
height: 50px;
|
||||
vertical-align: top;
|
||||
margin-left: -10px;
|
||||
max-width: none;
|
||||
}
|
||||
header #user {
|
||||
text-align: right;
|
||||
|
|
|
@ -18,7 +18,15 @@
|
|||
<body>
|
||||
{% if not embed %}
|
||||
<header>
|
||||
<h1><a href="{% block header_title_url %}/{% endblock %}">{% block header_title %}c3nav{% endblock %}</a></h1>
|
||||
<h1><a href="{% block header_title_url %}/{% endblock %}">
|
||||
{% spaceless %}
|
||||
{% if header_logo %}
|
||||
<img src="{% static header_logo %}">
|
||||
{% else %}
|
||||
c3nav
|
||||
{% endif %}
|
||||
{% endspaceless %}{% block header_title %}{% endblock %}
|
||||
</a></h1>
|
||||
<a href="/account/" id="user">
|
||||
<span>{{ request.user_data.title }}</span>
|
||||
<small>{% if request.user_data.subtitle %}{{ request.user_data.subtitle }}{% endif %}</small>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue