aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2015-11-24 18:05:57 +0000
committerMatthew Somerville <matthew@mysociety.org>2015-12-16 17:58:16 +0000
commitcbdfcad63e598447c318ce78738d477383f273d7 (patch)
tree3b9b8c9a807beae1d340916eee94e3083f8857ac /perllib/FixMyStreet/App/Controller/Report/New.pm
parent749fe96b5b987bec29fb608acfcbdb81e57aaebf (diff)
Add multiple photo upload support.
Three file inputs, progressively enhanced with dropzone. This moves the photo input higher up, so that photos can upload while you're filling out the form. It standardises and improves photo error handling. [fixmystreet.com] Guidance for what photos should and shouldn’t include.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm18
1 files changed, 7 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 246facbee..4632f450d 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -426,26 +426,21 @@ sub initialize_report : Private {
for (1) { # use as pseudo flow control
- # did we find a token
- last unless $partial;
-
# is it in the database
my $token =
$c->model("DB::Token")
- ->find( { scope => 'partial', token => $partial } ) #
+ ->find( { scope => 'partial', token => $partial } )
|| last;
# can we get an id from it?
- my $id = $token->data #
- || last;
+ my $id = $token->data || last;
# load the related problem
- $report = $c->cobrand->problems #
- ->search( { id => $id, state => 'partial' } ) #
+ $report = $c->cobrand->problems
+ ->search( { id => $id, state => 'partial' } )
->first;
if ($report) {
-
# log the problem creation user in to the site
$c->authenticate( { email => $report->user->email },
'no_password' );
@@ -453,9 +448,10 @@ sub initialize_report : Private {
# save the token to delete at the end
$c->stash->{partial_token} = $token if $report;
- }
- else {
+ # Stash the photo IDs for "already got" display
+ $c->stash->{upload_fileid} = $report->get_photoset($c)->data;
+ } else {
# no point keeping it if it is done.
$token->delete;
}