From 6d69e02f9265a0be1c762e0798e22ac764f2dafc Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Thu, 3 Sep 2009 09:00:44 +0200 Subject: [PATCH 1/1] =?utf8?q?Templaty=20u=C5=BCywaj=C4=85=20teraz=20?= =?utf8?q?=C5=9Bcie=C5=BCek=20z=20konfiguracji=20dal=20plik=C3=B3w=20staty?= =?utf8?q?cznych.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apps/explorer/context_processors.py | 9 +++++++++ project/settings.py | 2 +- project/templates/base.html | 6 +++--- project/templates/explorer/editor.html | 18 +++++++++--------- .../templates/explorer/panels/xmleditor.html | 6 +++--- project/urls.py | 4 ++-- 6 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 apps/explorer/context_processors.py diff --git a/apps/explorer/context_processors.py b/apps/explorer/context_processors.py new file mode 100644 index 00000000..634b0155 --- /dev/null +++ b/apps/explorer/context_processors.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 +__author__="lreqc" +__date__ ="$2009-09-03 08:34:10$" + +def settings(request): + from django.conf import settings + return {'MEDIA_URL': settings.MEDIA_URL, 'STATIC_URL': settings.STATIC_URL} + + diff --git a/project/settings.py b/project/settings.py index 22d9bdd2..b2c7f851 100644 --- a/project/settings.py +++ b/project/settings.py @@ -66,7 +66,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", - "django.core.context_processors.media", + "explorer.context_processors.settings", "django.core.context_processors.request", ) diff --git a/project/templates/base.html b/project/templates/base.html index ec326166..bf7ed04e 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -4,9 +4,9 @@ {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} - - - + + + {% block extrahead %} {% endblock %} diff --git a/project/templates/explorer/editor.html b/project/templates/explorer/editor.html index c7eadbf2..bba8e1d1 100644 --- a/project/templates/explorer/editor.html +++ b/project/templates/explorer/editor.html @@ -1,15 +1,15 @@ {% extends "base.html" %} {% block extrahead %} - - - - - - - - - + + + + + + + + + {% endblock extrahead %} {% block breadcrumbs %}Platforma Redakcyjna ❯ plik {{ hash }}{% endblock breadcrumbs %} diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index 0f26ccf3..e2e6b0b4 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -25,8 +25,8 @@ panel_hooks = { var texteditor = CodeMirror.fromTextArea(textareaId, { parserfile: 'parsexml.js', - path: "/static/js/codemirror/", - stylesheet: "/static/css/xmlcolors.css", + path: "{{STATIC_URL}}js/codemirror/", + stylesheet: "{{STATIC_URL}}css/xmlcolors.css", parserConfig: {useHTMLKludges: false}, onChange: function() { panel.trigger('panel:contentChanged', self); @@ -64,7 +64,7 @@ panel_hooks = { opacity: 0.9, background: "#FBFBC6", padding: "1px", - fontSize: "12px", + fontSize: "12px" } }); diff --git a/project/urls.py b/project/urls.py index ec919ae3..972c33dd 100644 --- a/project/urls.py +++ b/project/urls.py @@ -37,9 +37,9 @@ urlpatterns = patterns('', # Static files -if settings.DEBUG: +if settings.DEBUG and not hasattr(settings, 'DONT_SERVE_STATIC'): urlpatterns += patterns('', - url(r'^%s(?P.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', + url(r'^%s(?P.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), url(r'^%s(?P.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), -- 2.20.1