aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-11-25 17:44:05 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-12-16 10:15:17 +0000
commitfddf7f9585e50a60acca01b84bc8f9cfc267dd0b (patch)
treec7b6d9e7bc457d8ff4b0883dd62ef9e2876b7f6c /perllib/FixMyStreet/App/View/Web.pm
parente1f11deee821dd6540a76966731c94d31effa826 (diff)
Add offline support of static files/fallback page.
Use a list to store JavaScript files, so it can be shared between the HTML footer and the appcache manifest.
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index f0bcad0be..22387f5f6 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -140,7 +140,8 @@ sub escape_js {
my %version_hash;
sub version {
- my ( $self, $c, $file ) = @_;
+ my ( $self, $c, $file, $url ) = @_;
+ $url ||= $file;
_version_get_mtime($file);
if ($version_hash{$file} && $file =~ /\.js$/) {
# See if there's an auto.min.js version and use that instead if there is
@@ -149,7 +150,7 @@ sub version {
$file = $file_min if $version_hash{$file_min} >= $version_hash{$file};
}
my $admin = $self->template->context->stash->{admin} ? FixMyStreet->config('ADMIN_BASE_URL') : '';
- return "$admin$file?$version_hash{$file}";
+ return "$admin$url?$version_hash{$file}";
}
sub _version_get_mtime {