diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-04-11 12:37:59 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-04-11 12:37:59 +0100 |
commit | 6c675d28e4e170ef1fc1d33e5985b706e7431675 (patch) | |
tree | 983c700369eea38ecb1f3b5d73d928405ad6303a /perllib/FixMyStreet/App.pm | |
parent | 71ae36012ab91254910247a48824983c3d6a8f37 (diff) |
Added 'uri_for_email' method and switched some tokens over to it
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 2ae90c2fa..8e6766f58 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -292,6 +292,27 @@ sub send_email { return $email; } +=head2 uri_for_email + + $uri = $c->uri_for_email( ... ); + +Like C<uri_for> except that it checks the cobrand for an email specific url base +and uses that. + +=cut + +sub uri_for_email { + my $c = shift; + my @args = @_; + + my $normal_uri = $c->uri_for(@_); + my $base = $c->cobrand->base_url_for_emails(); + + my $email_uri = $base . $normal_uri->path_query; + + return URI->new($email_uri); +} + =head1 SEE ALSO L<FixMyStreet::App::Controller::Root>, L<Catalyst> |