diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 68469472e..974777ee7 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -277,17 +277,22 @@ sub by_category_ajax_data : Private { $non_public ? ( non_public => JSON->true ) : (), }; + if ( $c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1 ) { + my $disable_form = $c->forward('disable_form_message'); + $body->{disable_form} = $disable_form if %$disable_form; + + # Remove the full disable_form extras, as included in disable form output + @{$c->stash->{category_extras}->{$c->stash->{category}}} = grep { + !$_->{disable_form} || $_->{disable_form} ne 'true' + } @{$c->stash->{category_extras}->{$c->stash->{category}}}; + } + if (($c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1) or $c->stash->{unresponsive}->{$category} or $c->stash->{report_extra_fields}) { $body->{category_extra} = $c->render_fragment('report/new/category_extras.html', $vars); $body->{category_extra_json} = $c->forward('generate_category_extra_json'); } - if ( $c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1 ) { - my $disable_form = $c->forward('disable_form_message'); - $body->{disable_form} = $disable_form if %$disable_form; - } - my $unresponsive = $c->stash->{unresponsive}->{$category}; $unresponsive ||= $c->stash->{unresponsive}->{ALL} || '' if $type eq 'one'; @@ -332,6 +337,7 @@ sub disable_form_message : Private { } } } + return \%out; } |