aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-10-18 13:35:51 +0100
committerDave Arter <davea@mysociety.org>2016-10-18 13:35:51 +0100
commit95806201712d53f76a94509f46a87ec76a0f7c98 (patch)
treed3fa3c9158cbe20165d163801200a4c65ecb1d3d
parentfbe159d78ce133cadf79645660f49ddf7bfbc569 (diff)
[Zurich] Fix bug on image thumbnail in admin
Clicking the thumbnail on a report admin page was causing the 'rotating photo will discard changes' alert to appear unnecessarily. This was due to the data-confirm attribute on the parent <dd>, the meaning of which was changed by f5b171f. Fixed by using a different attribute name. Spotted another bug that I think caused the dialog to never actually be shown with the correct message because 'this' was the form and not the clicked button element.
-rw-r--r--templates/web/zurich/admin/report_edit.html2
-rw-r--r--web/cobrands/zurich/js.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index ec65cf99f..f87dcb5cf 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -107,7 +107,7 @@
<dd>[% problem.get_time_spent %]</dd>
[% IF problem.photo %]
- <dd data-confirm="[% loc('Rotating this photo will discard unsaved changes to the report.') | html %]">
+ <dd data-confirm-msg="[% loc('Rotating this photo will discard unsaved changes to the report.') | html %]">
[% FOR photo IN problem.photos %]
<div class="update-img">
<a href="[% c.cobrand.base_url %][% photo.url_temp_full %]" rel="fancy">
diff --git a/web/cobrands/zurich/js.js b/web/cobrands/zurich/js.js
index d895789f1..f3977161c 100644
--- a/web/cobrands/zurich/js.js
+++ b/web/cobrands/zurich/js.js
@@ -122,7 +122,7 @@ $(function() {
// If the user has clicked to rotate a photo and has edited other
// fields, ask for confirmation before submitting the form
if (/rotate_photo/.test(clicked) && form_fields_changed) {
- var message = $(this).parent().data('confirm');
+ var message = $(this).find("input[name="+clicked+"]").parent().data('confirmMsg');
if (!confirm(message)) {
return false;
}