From: Magnus Hagander Date: Sat, 28 Dec 2013 16:39:05 +0000 (+0100) Subject: Add support for the new dynamic CSS on the main site X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=866ce9eab3dfbeec4b4b994a50550c0ab9afea85;p=pgarchives.git Add support for the new dynamic CSS on the main site We still need a fallback view to deal with local changes, but this should make the common case faster - and open up for future changes where we can add versioning to the file. --- diff --git a/django/archives/mailarchives/views.py b/django/archives/mailarchives/views.py index 213dd89..95895e7 100644 --- a/django/archives/mailarchives/views.py +++ b/django/archives/mailarchives/views.py @@ -531,6 +531,20 @@ def legacy(request, listname, year, month, msgnum): def mbox(request, listname, mboxname): return HttpResponse('This needs to be handled by the webserver. This view should never be called.', content_type='text/plain') +@cache(hours=8) +def base_css(request): + # Generate a hardcoded list of CSS imports. This will only be used + # in development installs - in production, it will use the CSS from + # the main website. + return HttpResponse("""@import url("/media/css/global.css"); +@import url("/media/css/layout.css"); +@import url("/media/css/text.css"); +@import url("/media/css/navigation.css"); +@import url("/media/css/table.css"); + +@import url("/media/css/iefixes.css"); +""", mimetype='text/css') + # Redirect to the requested url, with a slash first. This is used to remove # trailing slashes on messageid links by doing a permanent redirect. This is # better than just eating them, since this way we only end up with one copy diff --git a/django/archives/urls.py b/django/archives/urls.py index 18809c8..d524999 100644 --- a/django/archives/urls.py +++ b/django/archives/urls.py @@ -44,6 +44,10 @@ urlpatterns = patterns('', # Legacy forwarding from old archives site (r'^message-id/legacy/([\w-]+)/(\d+)-(\d+)/msg(\d+).php$', 'archives.mailarchives.views.legacy'), + # Normally served off www.postgresql.org, but manually handled here for + # development installs. + (r'^dyncss/base.css', 'archives.mailarchives.views.base_css'), + # Normally served by the webserver, but needed for development installs (r'^media/(.*)$', 'django.views.static.serve', { 'document_root': '../media', diff --git a/django/media/css/archives.css b/django/media/css/archives.css index e25f9e0..1c0504b 100644 --- a/django/media/css/archives.css +++ b/django/media/css/archives.css @@ -1,12 +1,5 @@ /* replacement for base.css used on archives */ -@import url("/media/css/global.css"); -@import url("/media/css/layout.css"); -@import url("/media/css/text.css"); -@import url("/media/css/navigation.css"); -@import url("/media/css/table.css"); - -@import url("/media/css/iefixes.css"); - +@import url("/dyncss/base.css"); a { text-decoration: underline; }