diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-02-10 10:08:33 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-02-10 10:08:33 +0000 |
commit | f39f0f4f02a035cb208c4ce208cf4b0f01e48e52 (patch) | |
tree | e8486f21fc2e75b91cf79861eb57cbf56a7d9773 /web | |
parent | ce25130c2a9789ad832848db1098f36065045673 (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')
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 19 |
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; + }); } /* |