From a978842dd64094d7f70a7558a56e297d91b4e982 Mon Sep 17 00:00:00 2001
From: Zarino Zappia
Date: Tue, 1 Aug 2017 17:06:08 +0100
Subject: Make map image in HTML emails clickable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Emails that contain a report’s title, description, and location in the
”sidebar” will now have a map that takes you to the report’s web page
when clicked.
Fixes #1596. Thanks to @MyfanwyNixon for the suggestion!
---
templates/email/default/_email_sidebar.html | 17 +++++++++++++++--
.../email/default/problem-confirm-not-sending.html | 2 +-
templates/email/default/problem-confirm.html | 2 +-
templates/email/default/questionnaire.html | 2 +-
.../email/fixamingata/problem-confirm-not-sending.html | 2 +-
templates/email/fixamingata/problem-confirm.html | 2 +-
templates/email/fixamingata/questionnaire.html | 2 +-
7 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/templates/email/default/_email_sidebar.html b/templates/email/default/_email_sidebar.html
index 291584195..7897d168c 100644
--- a/templates/email/default/_email_sidebar.html
+++ b/templates/email/default/_email_sidebar.html
@@ -1,6 +1,19 @@
-[% DEFAULT report = object ~%]
+[%
+
+# There are cases (eg: when sending email about an update on a problem)
+# where `object` might not be a report. So in those cases, you can pass
+# in a `report` argument, which should be the report the email is about.
+# Otherwise, we assume the `object` you passed is a report.
+DEFAULT report = object;
+
+# There are cases (eg: when confirming a not-yet-published report) where
+# you will want the map image to link to somewhere other than the report
+# page. So in those cases, you can pass in a custom `url` argument.
+DEFAULT url = cobrand.base_url_for_report(report) _ report.url
+
+~%]
-
+
[% start_padded_box %]
[%~ IF object.photo %]
diff --git a/templates/email/default/problem-confirm-not-sending.html b/templates/email/default/problem-confirm-not-sending.html
index dad5b64bc..827a49d55 100644
--- a/templates/email/default/problem-confirm-not-sending.html
+++ b/templates/email/default/problem-confirm-not-sending.html
@@ -22,7 +22,7 @@ council.
If you no longer wish to publish this report, please take no further action.
[% end_padded_box %]
|
-[% WRAPPER '_email_sidebar.html' object = report %]
+[% WRAPPER '_email_sidebar.html' object = report, url = token_url %]
[% report.title | html %]
[% report.detail | html %]
[% END %]
diff --git a/templates/email/default/problem-confirm.html b/templates/email/default/problem-confirm.html
index f69449b52..904cf7777 100644
--- a/templates/email/default/problem-confirm.html
+++ b/templates/email/default/problem-confirm.html
@@ -25,7 +25,7 @@ of problem, so it will instead be sent to [% report.body %].
If you no longer wish to send this report, please take no further action.
[% end_padded_box %]
-[% WRAPPER '_email_sidebar.html' object = report %]
+[% WRAPPER '_email_sidebar.html' object = report, url = token_url %]
[% report.title | html %]
[% report.detail | html %]
[% END %]
diff --git a/templates/email/default/questionnaire.html b/templates/email/default/questionnaire.html
index ab5783d17..6d9c32af4 100644
--- a/templates/email/default/questionnaire.html
+++ b/templates/email/default/questionnaire.html
@@ -22,7 +22,7 @@ INCLUDE '_email_top.html';
Thank you! Your feedback is really valuable.
[% end_padded_box %]
-[% WRAPPER '_email_sidebar.html' object = report %]
+[% WRAPPER '_email_sidebar.html' object = report, url = url %]
[% title %]
[% report.detail | html %]
[% END %]
diff --git a/templates/email/fixamingata/problem-confirm-not-sending.html b/templates/email/fixamingata/problem-confirm-not-sending.html
index 0a06d2880..665288a02 100644
--- a/templates/email/fixamingata/problem-confirm-not-sending.html
+++ b/templates/email/fixamingata/problem-confirm-not-sending.html
@@ -22,7 +22,7 @@ skickas till kommunen.
Om du inte vill skicka din rapport så behöver du inte göra något.
[% end_padded_box %]
-[% WRAPPER '_email_sidebar.html' object = report %]
+[% WRAPPER '_email_sidebar.html' object = report, url = token_url %]
[% report.title | html %]
[% report.detail | html %]
[% END %]
diff --git a/templates/email/fixamingata/problem-confirm.html b/templates/email/fixamingata/problem-confirm.html
index 8e2828f25..937743fc6 100644
--- a/templates/email/fixamingata/problem-confirm.html
+++ b/templates/email/fixamingata/problem-confirm.html
@@ -21,7 +21,7 @@ måste du klicka på nedanstående knapp.
Om du inte vill skicka din rapport så behöver du inte göra något.
[% end_padded_box %]
-[% WRAPPER '_email_sidebar.html' object = report %]
+[% WRAPPER '_email_sidebar.html' object = report, url = token_url %]
[% report.title | html %]
[% report.detail | html %]
[% END %]
diff --git a/templates/email/fixamingata/questionnaire.html b/templates/email/fixamingata/questionnaire.html
index efcfbff89..0f15b478e 100644
--- a/templates/email/fixamingata/questionnaire.html
+++ b/templates/email/fixamingata/questionnaire.html
@@ -22,7 +22,7 @@ INCLUDE '_email_top.html';
Tack! Din feedback är värdefull.
[% end_padded_box %]
-[% WRAPPER '_email_sidebar.html' object = report %]
+[% WRAPPER '_email_sidebar.html' object = report, url = url %]
[% title %]
[% report.detail | html %]
[% END %]
--
cgit v1.2.3