From: Łukasz Rekucki Date: Thu, 3 Sep 2009 07:00:44 +0000 (+0200) Subject: Templaty używają teraz ścieżek z konfiguracji dal plików statycznych. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/6d69e02f9265a0be1c762e0798e22ac764f2dafc?hp=3c0f69b2b4d62eaeb05403edc7b4c171622edc9a Templaty używają teraz ścieżek z konfiguracji dal plików statycznych. --- 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}),