aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Offline.pm32
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm5
-rw-r--r--perllib/FixMyStreet/Cobrand/Base.pm14
3 files changed, 49 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Offline.pm b/perllib/FixMyStreet/App/Controller/Offline.pm
new file mode 100644
index 000000000..9acb33f7e
--- /dev/null
+++ b/perllib/FixMyStreet/App/Controller/Offline.pm
@@ -0,0 +1,32 @@
+package FixMyStreet::App::Controller::Offline;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller'; }
+
+=head1 NAME
+
+FixMyStreet::App::Controller::Offline - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Offline pages Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+sub manifest : Path("/offline/appcache.manifest") {
+ my ($self, $c) = @_;
+ $c->res->content_type('text/cache-manifest; charset=utf-8');
+ $c->res->header(Cache_Control => 'no-cache, no-store');
+}
+
+sub appcache : Path("/offline/appcache") {
+ my ($self, $c) = @_;
+ $c->detach('/page_error_404_not_found', []) if keys %{$c->req->params};
+}
+
+__PACKAGE__->meta->make_immutable;
+
+1;
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 {
diff --git a/perllib/FixMyStreet/Cobrand/Base.pm b/perllib/FixMyStreet/Cobrand/Base.pm
index 5a9842233..a9eed0018 100644
--- a/perllib/FixMyStreet/Cobrand/Base.pm
+++ b/perllib/FixMyStreet/Cobrand/Base.pm
@@ -38,6 +38,20 @@ sub moniker {
return $last_part;
}
+=head2 asset_moniker
+
+ $moniker = $cobrand_class->asset_moniker();
+
+Same as moniker, except for the cobrand with the 'fixmystreet' moniker, when it
+returns 'fixmystreet.com', as to avoid confusion that's where its assets are.
+
+=cut
+
+sub asset_moniker {
+ my $self = shift;
+ return $self->moniker eq 'fixmystreet' ? 'fixmystreet.com' : $self->moniker;
+}
+
=head2 is_default
$bool = $cobrand->is_default();