diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-04-15 15:11:15 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-04-15 15:11:15 +0100 |
commit | e2aa1d9fc4837442aebf8481864c26285e98beca (patch) | |
tree | b6964e4ea31c7d91e2edace43b1e75b9dc4e5a1a /perllib/FixMyStreet/App.pm | |
parent | cbecebc34457364e4d1cbc50427748aeb5b187ab (diff) |
Use cobrand::url in ->uri_for
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 4e992d4f9..a5ba6bc5d 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -182,7 +182,7 @@ sub setup_request { FixMyStreet::Map::set_map_class( $c->request->param('map') ); - return $cobrand; + return $c; } =head2 setup_dev_overrides @@ -300,6 +300,30 @@ sub send_email { return $email; } +=head2 uri_for + + $uri = $c->uri_for( ... ); + +Like C<uri_for> except that it passes the uri to the cobrand to be altered if +needed. + +=cut + +sub uri_for { + my $c = shift; + my @args = @_; + + my $uri = $c->next::method(@args); + + # Currently the cobrand expect and return the url as a string. + my $cobranded_uri = $c->cobrand->url( $uri->as_string ); + + # check to see if the returned string looks like a url (cities does not) + return $cobranded_uri =~ m{^https?://} + ? URI->new($cobranded_uri) + : $cobranded_uri; +} + =head2 uri_for_email $uri = $c->uri_for_email( ... ); |