diff --git a/src/c3nav/control/templates/control/base.html b/src/c3nav/control/templates/control/base.html index 553db437..11e972d7 100644 --- a/src/c3nav/control/templates/control/base.html +++ b/src/c3nav/control/templates/control/base.html @@ -2,7 +2,7 @@ {% load i18n %} {% block title %}{% trans 'c3nav control panel' %}{% endblock %} -{% block header_title %}{% trans 'c3nav control panel' %}{% endblock %} +{% block header_title %}{% trans 'control panel' %}{% endblock %} {% block header_title_url %}{% url 'control.index' %}{% endblock %} {% block content %} diff --git a/src/c3nav/settings.py b/src/c3nav/settings.py index 67a1a90e..2c7c7f18 100644 --- a/src/c3nav/settings.py +++ b/src/c3nav/settings.py @@ -280,6 +280,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'c3nav.site.context_processors.header_logo', ], 'loaders': template_loaders }, @@ -291,15 +292,16 @@ STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder', + 'c3nav.site.finders.HeaderLogoFinder', ) BOOTSTRAP3 = { 'success_css_class': '', } -STATICFILES_DIRS = ( +STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'c3nav/static'), -) +] COMPRESS_PRECOMPILERS = ( ('text/x-scss', 'django_libsass.SassCompiler'), @@ -312,6 +314,8 @@ COMPRESS_CSS_FILTERS = ( 'compressor.filters.cssmin.CSSCompressorFilter', ) +HEADER_LOGO = config.get('c3nav', 'header_logo', fallback=None) +HEADER_LOGO_NAME = ('logo/'+os.path.basename(HEADER_LOGO)) if HEADER_LOGO else None PRIMARY_COLOR = config.get('c3nav', 'primary_color', fallback='') HEADER_BACKGROUND_COLOR = config.get('c3nav', 'header_background_color', fallback='') HEADER_TEXT_COLOR = config.get('c3nav', 'header_text_color', fallback='') diff --git a/src/c3nav/site/context_processors.py b/src/c3nav/site/context_processors.py new file mode 100644 index 00000000..2a7f54ce --- /dev/null +++ b/src/c3nav/site/context_processors.py @@ -0,0 +1,7 @@ +from django.conf import settings + + +def header_logo(request): + return { + 'header_logo': settings.HEADER_LOGO_NAME + } diff --git a/src/c3nav/site/finders.py b/src/c3nav/site/finders.py new file mode 100644 index 00000000..9764e0e4 --- /dev/null +++ b/src/c3nav/site/finders.py @@ -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)] diff --git a/src/c3nav/site/static/site/css/c3nav.scss b/src/c3nav/site/static/site/css/c3nav.scss index 25683f25..c3a8a8ab 100644 --- a/src/c3nav/site/static/site/css/c3nav.scss +++ b/src/c3nav/site/static/site/css/c3nav.scss @@ -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; diff --git a/src/c3nav/site/templates/site/base.html b/src/c3nav/site/templates/site/base.html index 0f0c4e73..61f3c727 100644 --- a/src/c3nav/site/templates/site/base.html +++ b/src/c3nav/site/templates/site/base.html @@ -18,7 +18,15 @@
{% if not embed %}