diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 20 | ||||
-rw-r--r-- | web/js/fixmystreet.js | 3 |
2 files changed, 10 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 0b46992e1..4419ecd92 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -131,21 +131,17 @@ sub report_form_ajax : Path('ajax') : Args(0) { sub category_extras_ajax : Path('category_extras') : Args(0) { my ( $self, $c ) = @_; - my $contacts - = $c - ->model('DB::Contact') - ->not_deleted - ->search( { area_id => $c->req->param('area_id'), category => $c->req->param('category') } ); + $c->forward('initialize_report'); + $c->forward('determine_location') or return 0; + $c->forward('setup_categories_and_councils'); my $category_extra = ''; - if ( my $contact = $contacts->first ) { - if ( $contact->extra ) { - $c->stash->{report_meta} = {}; - $c->stash->{report} = { category => $c->req->param('category') }; - $c->stash->{category_extras} = { $c->req->param('category' ) => $contact->extra }; + if ( $c->stash->{category_extras}->{ $c->req->param('category') } ) { + $c->stash->{report_meta} = {}; + $c->stash->{report} = { category => $c->req->param('category') }; + $c->stash->{category_extras} = { $c->req->param('category' ) => $c->stash->{category_extras}->{ $c->req->param('category') } }; - $category_extra= $c->view('Web')->render( $c, 'report/new/category_extras.html'); - } + $category_extra= $c->view('Web')->render( $c, 'report/new/category_extras.html'); } my $body = JSON->new->utf8(1)->encode( diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index dc180151c..97d2892af 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -5,7 +5,8 @@ function form_category_onchange() { $.getJSON('/report/new/category_extras', { - area_id: 2649, + latitude: fixmystreet.latitude, + longitude: fixmystreet.longitude, category: this.options[ this.selectedIndex ].text, }, function(data) { if ( data.category_extra ) { |