Templaty używają teraz ścieżek z konfiguracji dal plików statycznych.
authorŁukasz Rekucki <lrekucki@gmail.com>
Thu, 3 Sep 2009 07:00:44 +0000 (09:00 +0200)
committerŁukasz Rekucki <lrekucki@gmail.com>
Thu, 3 Sep 2009 07:00:44 +0000 (09:00 +0200)
apps/explorer/context_processors.py [new file with mode: 0644]
project/settings.py
project/templates/base.html
project/templates/explorer/editor.html
project/templates/explorer/panels/xmleditor.html
project/urls.py

diff --git a/apps/explorer/context_processors.py b/apps/explorer/context_processors.py
new file mode 100644 (file)
index 0000000..634b015
--- /dev/null
@@ -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}
+
+
index 22d9bdd..b2c7f85 100644 (file)
@@ -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",
 )
 
index ec32616..bf7ed04 100644 (file)
@@ -4,9 +4,9 @@
     <head>
         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
         <title>{% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%}</title>
-        <link rel="stylesheet" href="/static/css/master.css" type="text/css" />
-        <script src="/static/js/jquery.js" type="text/javascript" charset="utf-8"></script>
-               <script src="/static/js/jquery.logging.js" type="text/javascript" charset="utf-8"></script> 
+        <link rel="stylesheet" href="{{ STATIC_URL }}css/master.css" type="text/css" />
+        <script src="{{ STATIC_URL }}js/jquery.js" type="text/javascript" charset="utf-8"></script>
+               <script src="{{ STATIC_URL }}js/jquery.logging.js" type="text/javascript" charset="utf-8"></script>
         {% block extrahead %}
         {% endblock %}
     </head>
index c7eadbf..bba8e1d 100644 (file)
@@ -1,15 +1,15 @@
 {% extends "base.html" %}
 
 {% block extrahead %}
-    <link rel="stylesheet" href="/static/css/toolbar.css" type="text/css" />
-    <script src="/static/js/jquery.lazyload.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/codemirror/codemirror.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/jquery.autoscroll.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/jquery.wtooltip.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/jquery.hpanel.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/jquery.json.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
-    <script src="/static/js/editor.js" type="text/javascript" charset="utf-8"></script>
+    <link rel="stylesheet" href="{{STATIC_URL}}css/toolbar.css" type="text/css" />
+    <script src="{{STATIC_URL}}js/jquery.lazyload.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/codemirror/codemirror.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/jquery.autoscroll.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/jquery.wtooltip.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/jquery.hpanel.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/jquery.json.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/editor.js" type="text/javascript" charset="utf-8"></script>
 {% endblock extrahead %}
 
 {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
index 0f26ccf..e2e6b0b 100644 (file)
@@ -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"
             }
         });
 
index ec919ae..972c33d 100644 (file)
@@ -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<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', 
+        url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve',
             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
         url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),