aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-02-11 08:16:43 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-02-11 08:16:43 +0000
commit16dd4adc554c1bd240390325183cfe3905a8d372 (patch)
treeb94985c165a7c9e020172736dd4bf33681c11f6f
parent51d7011f8264a799d76483729ac1791f7dff99f9 (diff)
parentf39f0f4f02a035cb208c4ce208cf4b0f01e48e52 (diff)
Merge remote-tracking branch 'origin/1332-fix-back-photo-thing'
-rw-r--r--templates/web/base/questionnaire/index.html4
-rw-r--r--templates/web/base/report/new/form_report.html4
-rw-r--r--templates/web/base/report/update/form_update.html4
-rw-r--r--templates/web/bromley/report/display.html4
-rw-r--r--templates/web/bromley/report/new/fill_in_details_form.html4
-rw-r--r--templates/web/eastsussex/report/update-form.html4
-rw-r--r--templates/web/zurich/report/new/fill_in_details_form.html4
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js19
8 files changed, 10 insertions, 37 deletions
diff --git a/templates/web/base/questionnaire/index.html b/templates/web/base/questionnaire/index.html
index c8b6907a1..5a5efee30 100644
--- a/templates/web/base/questionnaire/index.html
+++ b/templates/web/base/questionnaire/index.html
@@ -80,10 +80,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this update. Note that you can attach a maximum of 3 to this update (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html
index a236b6a1f..d76d69ec0 100644
--- a/templates/web/base/report/new/form_report.html
+++ b/templates/web/base/report/new/form_report.html
@@ -29,10 +29,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/templates/web/base/report/update/form_update.html b/templates/web/base/report/update/form_update.html
index 3a46694cf..40260886c 100644
--- a/templates/web/base/report/update/form_update.html
+++ b/templates/web/base/report/update/form_update.html
@@ -11,10 +11,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this update. Note that you can attach a maximum of 3 to this update (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html
index 569275841..88a6fbddc 100644
--- a/templates/web/bromley/report/display.html
+++ b/templates/web/bromley/report/display.html
@@ -70,10 +70,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this update. Note that you can attach a maximum of 3 to this update (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/templates/web/bromley/report/new/fill_in_details_form.html b/templates/web/bromley/report/new/fill_in_details_form.html
index 2f853b506..c953f53c7 100644
--- a/templates/web/bromley/report/new/fill_in_details_form.html
+++ b/templates/web/bromley/report/new/fill_in_details_form.html
@@ -58,10 +58,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/templates/web/eastsussex/report/update-form.html b/templates/web/eastsussex/report/update-form.html
index 8c15db904..c2e445f22 100644
--- a/templates/web/eastsussex/report/update-form.html
+++ b/templates/web/eastsussex/report/update-form.html
@@ -70,10 +70,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this update. Note that you can attach a maximum of 3 to this update (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html
index 1e036c087..d24474084 100644
--- a/templates/web/zurich/report/new/fill_in_details_form.html
+++ b/templates/web/zurich/report/new/fill_in_details_form.html
@@ -52,10 +52,6 @@
<div id="form_photos">
[% IF upload_fileid %]
- <script>
- var fixmystreet = fixmystreet || {};
- fixmystreet.uploaded_files = "[% upload_fileid %]".split(',');
- </script>
<p>[% loc('You have already attached photos to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p>
[% FOREACH id IN upload_fileid.split(',') %]
<img align="right" src="/photo/[% id %].temp.jpeg" alt="">
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 7c0a752d2..21701ce5f 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -246,15 +246,16 @@ $(function(){
}
});
- if (typeof fixmystreet !== 'undefined') {
- $.each(fixmystreet.uploaded_files || [], function(i, f) {
- var mockFile = { name: f, server_id: f };
- photodrop.emit("addedfile", mockFile);
- photodrop.createThumbnailFromUrl(mockFile, '/photo/' + f + '.temp.jpeg');
- photodrop.emit("complete", mockFile);
- photodrop.options.maxFiles -= 1;
- });
- }
+ $.each($('input[name=upload_fileid]').val().split(','), function(i, f) {
+ if (!f) {
+ return;
+ }
+ var mockFile = { name: f, server_id: f };
+ photodrop.emit("addedfile", mockFile);
+ photodrop.createThumbnailFromUrl(mockFile, '/photo/' + f + '.temp.jpeg');
+ photodrop.emit("complete", mockFile);
+ photodrop.options.maxFiles -= 1;
+ });
}
/*