make logo configurable via HYDRA_LOGO env var

This commit is contained in:
Rob Vermaas 2011-04-18 08:21:27 +00:00
parent d4c96a47c9
commit a8b3ebd514
2 changed files with 25 additions and 18 deletions

View file

@ -17,10 +17,10 @@ sub begin :Private {
$c->stash->{version} = $ENV{"HYDRA_RELEASE"} || "<devel>";
$c->stash->{nixVersion} = $ENV{"NIX_RELEASE"} || "<devel>";
$c->stash->{curTime} = time;
$c->stash->{logo} = $ENV{"HYDRA_LOGO"} ? "/logo" : "/static/images/hydra.png" ;
if (scalar(@args) == 0 || $args[0] ne "static") {
$c->stash->{nrRunningBuilds} = $c->model('DB::BuildSchedulingInfo')->search({ busy => 1 }, {})->count();
$c->stash->{nrQueuedBuilds} = $c->model('DB::BuildSchedulingInfo')->count();
$c->stash->{nrRunningBuilds} = $c->model('DB::BuildSchedulingInfo')->search({ busy => 1 }, {})->count();
$c->stash->{nrQueuedBuilds} = $c->model('DB::BuildSchedulingInfo')->count();
}
}
@ -224,4 +224,11 @@ sub change_password_submit : Path('change-password/submit') : Args(0) {
$c->res->redirect("/");
}
sub logo :Local {
my ($self, $c) = @_;
my $path = $ENV{"HYDRA_LOGO"} or die("Logo not set!");
$c->serve_static_file($path);
}
1;

View file

@ -76,7 +76,7 @@
<div id="page">
<div id="header">
<div id="logo"><a class="no-hover" href="/"><img src="/static/images/hydra.png" alt="Hydra Logo" /></a></div>
<div id="logo"><a class="no-hover" href="/"><img src="[% logo %]" alt="Hydra Logo" /></a></div>
[% PROCESS topbar.tt %]
[% PROCESS contextbar.tt %]
</div>