aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-05-30 16:12:30 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-05-31 16:55:17 +0100
commita752a967ffd846e2ea6eb7f6a4789b0bf1a8dbf0 (patch)
tree3a2c29cad99775c96333097b241af7193d717cb4
parent1bb94cd0bf0821927b3f449d832a9982b0397fa9 (diff)
Add update URL model method.
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm3
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm5
-rw-r--r--templates/email/default/other-updated.html2
-rw-r--r--templates/email/default/other-updated.txt2
-rw-r--r--templates/web/base/my/my.html2
-rw-r--r--templates/web/base/tokens/confirm_update.html5
6 files changed, 12 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index b98bdbcc7..5a077d8c3 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -168,8 +168,7 @@ sub prepare_params_for_email : Private {
if ( $c->stash->{update} ) {
- $c->stash->{problem_url} = $base_url . '/report/' . $c->stash->{update}->problem_id
- . '#update_' . $c->stash->{update}->id;
+ $c->stash->{problem_url} = $base_url . $c->stash->{update}->url;
$c->stash->{admin_url} = $admin_url . '/update_edit/' . $c->stash->{update}->id;
$c->stash->{complaint} = sprintf(
"Complaint about update %d on report %d",
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index cf1ba444d..815c5cd81 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -149,6 +149,11 @@ sub confirm {
$self->confirmed( \'current_timestamp' );
}
+sub url {
+ my $self = shift;
+ return "/report/" . $self->problem_id . '#update_' . $self->id;
+}
+
sub photos {
my $self = shift;
my $photoset = $self->get_photoset;
diff --git a/templates/email/default/other-updated.html b/templates/email/default/other-updated.html
index fbae37268..27eba9007 100644
--- a/templates/email/default/other-updated.html
+++ b/templates/email/default/other-updated.html
@@ -13,7 +13,7 @@ INCLUDE '_email_top.html';
<h1 style="[% h1_style %]">Your update has been&nbsp;logged</h1>
<p style="[% p_style %]">Your update has been logged on [% site_name %]:</p>
<p style="margin: 20px auto; text-align: center">
- <a style="[% button_style %]" href="[% cobrand.base_url_for_report(problem) %][% problem.url %]#update_[% update.id %]">View my update</a>
+ <a style="[% button_style %]" href="[% cobrand.base_url_for_report(problem) %][% update.url %]">View my update</a>
</p>
[% end_padded_box %]
</th>
diff --git a/templates/email/default/other-updated.txt b/templates/email/default/other-updated.txt
index 4900f6c29..7e5631ef1 100644
--- a/templates/email/default/other-updated.txt
+++ b/templates/email/default/other-updated.txt
@@ -4,7 +4,7 @@ Hello [% update.name %],
Your update has been logged on [% site_name %]:
-[% cobrand.base_url_for_report(problem) %][% problem.url %]#update_[% update.id %]
+[% cobrand.base_url_for_report(problem) %][% update.url %]
Your update reads:
diff --git a/templates/web/base/my/my.html b/templates/web/base/my/my.html
index a61a8ea44..1aaad6dc9 100644
--- a/templates/web/base/my/my.html
+++ b/templates/web/base/my/my.html
@@ -66,7 +66,7 @@
<p class="meta-2">
[% tprintf( loc("Added %s"), prettify_dt( u.confirmed, 'date' ) ) %]
&ndash;
- <a href="[% c.uri_for( '/report', u.problem_id ) %]#update_[% u.id %]">
+ <a href="[% u.url %]">
[% u.problem.title | html %]
</a>
</p>
diff --git a/templates/web/base/tokens/confirm_update.html b/templates/web/base/tokens/confirm_update.html
index 01ac992ab..005a8a7ac 100644
--- a/templates/web/base/tokens/confirm_update.html
+++ b/templates/web/base/tokens/confirm_update.html
@@ -1,9 +1,10 @@
[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Confirmation');
DEFAULT problem = update.problem;
-SET problem_url = c.uri_for('/report', problem.id);
IF update;
- problem_url = problem_url _ '#update_' _ update.id;
+ SET problem_url = update.url;
+ELSE;
+ SET problem_url = problem.url;
END;
%]