From 884a56b02b18fed01b7adea6f363a253e226cb45 Mon Sep 17 00:00:00 2001 From: Dan Brook Date: Fri, 2 Apr 2010 23:30:58 +0100 Subject: [PATCH] Made an attempt to fix the hardcoded CSS urls. --- lib/Gitalist/Controller/Root.pm | 8 +++++++ root/static/css/core.css | 38 ++++++++++++++++----------------- root/wrapper.tt2 | 2 +- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index 963a286..14ef8ee 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -18,6 +18,14 @@ sub index : Chained('base') PathPart('') Args(0) { $c->stash( search_text => $c->req->param('s') || '' ) # FIXME - XSS? } +# XXX Fragile much? +sub css : Chained('/root') PathPart('core.css') Args(0) { + my ( $self, $c ) = @_; + + $c->response->content_type('text/css'); + $c->stash(template => 'static/css/core.css'); +} + sub base : Chained('/root') PathPart('') CaptureArgs(0) { my($self, $c) = @_; diff --git a/root/static/css/core.css b/root/static/css/core.css index bcbc7f0..698445d 100755 --- a/root/static/css/core.css +++ b/root/static/css/core.css @@ -42,16 +42,16 @@ a img{ } #content_holder{ - background:transparent url(/static/i/bg_content.png) repeat-y center center; + background:transparent url([% c.uri_for('/static/i/bg_content.png') %]) repeat-y center center; } #content{ min-height:200px; padding:0 12px 40px 10px; - background:transparent url(/static/i/bg_bottom.png) no-repeat center bottom; + background:transparent url([% c.uri_for('/static/i/bg_bottom.png') %]) no-repeat center bottom; } #content_inner{ padding-bottom:30px; - background:transparent url(/static/i/bg_top.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/bg_top.png') %]) no-repeat; } #logo{ margin-left:-10px; @@ -105,13 +105,13 @@ a img{ text-decoration:none; } a#log_short{ - background:#666 url(/static/i/icons/shortlog.gif) no-repeat 15px center; + background:#666 url([% c.uri_for('/static/i/icons/shortlog.gif') %]) no-repeat 15px center; } a#log_full{ - background:#666 url(/static/i/icons/fulllog.gif) no-repeat 15px center; + background:#666 url([% c.uri_for('/static/i/icons/fulllog.gif') %]) no-repeat 15px center; } a#tree{ - background:#666 url(/static/i/icons/tree.gif) no-repeat 15px center; + background:#666 url([% c.uri_for('/static/i/icons/tree.gif') %]) no-repeat 15px center; } #nav_logs li a:hover{ text-decoration:underline; @@ -192,40 +192,40 @@ a:hover{ outline:none; } a.commit{ - background:transparent url(/static/i/icons/commit.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/commit.png') %]) no-repeat; } a.diff{ - background:transparent url(/static/i/icons/diff.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/diff.png') %]) no-repeat; } a.diffcurrent{ - background:transparent url(/static/i/icons/diffcurrent.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/diffcurrent.png') %]) no-repeat; } a.tree{ - background:transparent url(/static/i/icons/tree.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/tree.png') %]) no-repeat; } a.shortlog{ - background:transparent url(/static/i/icons/shortlog.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/shortlog.png') %]) no-repeat; } a.longlog{ - background:transparent url(/static/i/icons/longlog.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/longlog.png') %]) no-repeat; } a.blob{ - background:transparent url(/static/i/icons/blob.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/blob.png') %]) no-repeat; } a.blame{ - background:transparent url(/static/i/icons/blame.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/blame.png') %]) no-repeat; } a.history{ - background:transparent url(/static/i/icons/history.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/history.png') %]) no-repeat; } a.raw{ - background:transparent url(/static/i/icons/raw.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/raw.png') %]) no-repeat; } .sha1_holder{ - background:transparent url(/static/i/icons/button_sha1.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/button_sha1.png') %]) no-repeat; } .sha1_holder_invert{ - background:transparent url(/static/i/icons/button_sha1_invert.png) no-repeat; + background:transparent url([% c.uri_for('/static/i/icons/button_sha1_invert.png') %]) no-repeat; } .sha1_label{ padding-top:2px; @@ -233,7 +233,7 @@ a.raw{ } .msg{ padding:5px 10px 5px 35px; - background:#f0f0f0 url(/static/i/icons/attention.png) no-repeat 10px center; + background:#f0f0f0 url([% c.uri_for('/static/i/icons/attention.png') %]) no-repeat 10px center; border:1px solid #ddd; margin:30px 15px; } diff --git a/root/wrapper.tt2 b/root/wrapper.tt2 index 56fb860..e42e8d9 100755 --- a/root/wrapper.tt2 +++ b/root/wrapper.tt2 @@ -19,7 +19,7 @@ -%] (Gitalist) [% INCLUDE '_header_feeds.tt2' %] - +