diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-10 16:10:14 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-08-09 18:32:04 +0100 |
commit | 68461d28992628ff394e05d56ab3ab962d048db0 (patch) | |
tree | 94e85687003872d346d62f256ba1907b105dc0be /perllib/FixMyStreet/App/Controller/Admin.pm | |
parent | 6b36242db723267716552efee5a8e1ba88ed0e1c (diff) |
abuse table search
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 191782d82..e1ced4a25 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -695,6 +695,26 @@ sub update_edit : Path('update_edit') : Args(1) { return 1; } +sub search_abuse : Path('search_abuse') : Args(0) { + my ( $self, $c ) = @_; + + $c->forward('set_allowed_pages'); + + my $search = $c->req->param('search'); + + if ($search) { + my $emails = $c->model('DB::Abuse')->search( + { + email => { ilike => "\%$search\%" } + } + ); + + $c->stash->{emails} = [ $emails->all ]; + } + + return 1; +} + =head2 set_allowed_pages Sets up the allowed_pages stash entry for checking if the current page is @@ -714,6 +734,7 @@ sub set_allowed_pages : Private { 'search_reports' => [_('Search Reports'), 2], 'timeline' => [_('Timeline'), 3], 'questionnaire' => [_('Survey Results'), 4], + 'search_abuse' => [_('Search Abuse'), 5], 'council_contacts' => [undef, undef], 'council_edit' => [undef, undef], 'report_edit' => [undef, undef], |