templates: Use uri_for to reference static paths.

This commit is provided by (zsh syntax):

sed -i 's|/static[^"]*|[% c.uri_for("&") %]|;s/\[% size %\]/${size}/' **/*.tt

And the reason for this change is to make it easier to change the base
path with headers like X-Request-Base to be served within a URI prefix,
especially when behind a reverse proxy.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig
2013-09-25 12:34:13 +02:00
committed by Eelco Dolstra
parent a2491f76a4
commit 0b202580ce
8 changed files with 44 additions and 44 deletions

View File

@@ -40,7 +40,7 @@
<tr class="product">
<td>
<a href="[% contents %]">
<img src="/static/images/error_32.png" alt="Source" />
<img src="[% c.uri_for("/static/images/error_32.png") %]" alt="Source" />
Failed build produced output. Click here to inspect the output.
</a>
[% WRAPPER makePopover title="Help" classes="btn-mini" %]
@@ -59,7 +59,7 @@
<td>
[% uri = c.uri_for('/build' build.id 'nix' 'pkg' "${build.nixname}-${build.system}.nixpkg") %]
<a href="[% uri %]">
<img src="/static/images/nix-build.png" alt="Source" />
<img src="[% c.uri_for("/static/images/nix-build.png") %]" alt="Source" />
One-click install of Nix package <tt>[% build.nixname %]</tt>
</a>
[% WRAPPER makePopover title="Help" classes="btn-mini" %]
@@ -87,7 +87,7 @@
[% uri = c.uri_for('/build' build.id 'nix' 'closure' filename ) %]
<a href="[% uri %]">
<img src="/static/images/nix-build.png" alt="Source" />
<img src="[% c.uri_for("/static/images/nix-build.png") %]" alt="Source" />
Nix closure of path <tt>[% product.path %]</tt>
</a>
@@ -127,17 +127,17 @@
<a href="[% uri %]">
[% SWITCH product.subtype %]
[% CASE "source-dist" %]
<img src="/static/images/source-dist.png" alt="Source" /> Source distribution <tt>[% product.name %]</tt>
<img src="[% c.uri_for("/static/images/source-dist.png") %]" alt="Source" /> Source distribution <tt>[% product.name %]</tt>
[% CASE "rpm" %]
<img src="/static/images/rpm.png" alt="RPM" /> RPM package <tt>[% product.name %]</tt>
<img src="[% c.uri_for("/static/images/rpm.png") %]" alt="RPM" /> RPM package <tt>[% product.name %]</tt>
[% CASE "srpm" %]
<img src="/static/images/rpm.png" alt="Source RPM" /> Source RPM package <tt>[% product.name %]</tt>
<img src="[% c.uri_for("/static/images/rpm.png") %]" alt="Source RPM" /> Source RPM package <tt>[% product.name %]</tt>
[% CASE "deb" %]
<img src="/static/images/debian.png" alt="RPM" /> Debian package <tt>[% product.name %]</tt>
<img src="[% c.uri_for("/static/images/debian.png") %]" alt="RPM" /> Debian package <tt>[% product.name %]</tt>
[% CASE "iso" %]
<img src="/static/images/iso.png" alt="ISO" /> ISO-9660 CD/DVD image <tt>[% product.name %]</tt>
<img src="[% c.uri_for("/static/images/iso.png") %]" alt="ISO" /> ISO-9660 CD/DVD image <tt>[% product.name %]</tt>
[% CASE "binary-dist" %]
<img src="/static/images/binary-dist.png" alt="Binary distribution" /> Binary distribution <tt>[% product.name %]</tt>
<img src="[% c.uri_for("/static/images/binary-dist.png") %]" alt="Binary distribution" /> Binary distribution <tt>[% product.name %]</tt>
[% CASE DEFAULT %]
File <tt>[% product.name %]</tt> of type <tt>[% product.subtype %]</tt>
[% END %]
@@ -160,7 +160,7 @@
<tr class="product">
<td>
<a href="[% uri %]">
<img src="/static/images/report.png" alt="Report" />
<img src="[% c.uri_for("/static/images/report.png") %]" alt="Report" />
[% SWITCH product.subtype %]
[% CASE "coverage" %]
Code coverage analysis report
@@ -177,9 +177,9 @@
<td>
<a href="[% uri %]">
[% IF product.type == "doc-pdf" %]
<img src="/static/images/pdf.png" alt="PDF document" />
<img src="[% c.uri_for("/static/images/pdf.png") %]" alt="PDF document" />
[% ELSE %]
<img src="/static/images/document.png" alt="Document" />
<img src="[% c.uri_for("/static/images/document.png") %]" alt="Document" />
[% END %]
[% SWITCH product.subtype %]
[% CASE "readme" %]