aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-02-10 10:08:33 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-02-10 10:08:33 +0000
commitf39f0f4f02a035cb208c4ce208cf4b0f01e48e52 (patch)
treee8486f21fc2e75b91cf79861eb57cbf56a7d9773 /web/cobrands
parentce25130c2a9789ad832848db1098f36065045673 (diff)
Show remembered uploaded photos when Back used.
The uploaded_files solution in cbdfcad6, to show already uploaded files stored in upload_fileid, worked if you submitted the form to the server and had it returned, but did not show remembered photos if you used the browser's Back button to return to the form from another page. Instead, always read the data from upload_fileid, which works whichever way you have come to the page. Fixes #1332.
Diffstat (limited to 'web/cobrands')
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js19
1 files changed, 10 insertions, 9 deletions
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;
+ });
}
/*