diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-05-02 10:54:46 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-05-02 10:54:46 +0100 |
commit | 12e3f1a37bc13d4f9a85e5a0eea9cb79e5b1ac9c (patch) | |
tree | 07dbd6504b2d98fcb8e5c718ca273cb4836c0d94 | |
parent | 4105b3b68b07d99497e731e4fc477a93313da19d (diff) |
Fix bug in admin user search, and add council ID search.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 11 | ||||
-rw-r--r-- | templates/web/default/admin/council_contacts.html | 4 | ||||
-rw-r--r-- | templates/web/default/admin/search_users.html | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index acdaf7c04..55372afb5 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -483,6 +483,10 @@ sub search_reports : Path('search_reports') { $query = [ 'me.id' => int($1), ]; + } elsif ($search =~ /^area:(\d+)$/) { + $query = [ + 'me.areas' => { like => ",$1," } + ]; } else { $query = [ 'me.id' => $search_n, @@ -523,6 +527,8 @@ sub search_reports : Path('search_reports') { 'problem.id' => int($1), %{ $site_restriction }, ]; + } elsif ($search =~ /^area:(\d+)$/) { + $query = []; } else { $query = [ 'me.id' => $search_n, @@ -534,7 +540,8 @@ sub search_reports : Path('search_reports') { %{ $site_restriction }, ]; } - my $updates = $c->model('DB::Comment')->search( + my $updates; + $updates = $c->model('DB::Comment')->search( { -or => $query, }, @@ -543,7 +550,7 @@ sub search_reports : Path('search_reports') { prefetch => [qw/user problem/], order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] } - ); + ) if @$query; $c->stash->{updates} = [ $updates->all ]; diff --git a/templates/web/default/admin/council_contacts.html b/templates/web/default/admin/council_contacts.html index acfec3ed4..da7223aa6 100644 --- a/templates/web/default/admin/council_contacts.html +++ b/templates/web/default/admin/council_contacts.html @@ -10,7 +10,11 @@ [% IF example_pc %] <a href="[% c.uri_for_email( '/around', { pc => example_pc } ) %]">[% tprintf( loc('Example postcode %s'), example_pc ) | html %]</a> | [% END %] +[% IF c.cobrand.moniker == 'emptyhomes' %] +<a href="[% c.uri_for( 'search_reports', search => 'area:' _ area_id ) %]">[% loc('List all reported problems' ) %]</a> +[% ELSE %] <a href="[% c.uri_for_email( '/reports/' _ area_id ) %]">[% loc('List all reported problems' ) %]</a> +[% END %] <a href="[% c.uri_for( 'council_contacts', area_id, { text => 1 } ) %]">[% loc('Text only version') %]</a> </p> diff --git a/templates/web/default/admin/search_users.html b/templates/web/default/admin/search_users.html index 98723e6ef..18c964dfe 100644 --- a/templates/web/default/admin/search_users.html +++ b/templates/web/default/admin/search_users.html @@ -18,7 +18,7 @@ [%- FOREACH user IN users %] <tr> <td>[% PROCESS value_or_nbsp value=user.name %]</td> - <td><a href="[% c.uri_for( 'search_reports', user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> + <td><a href="[% c.uri_for( 'search_reports', search => user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> <td>[% PROCESS value_or_nbsp value=user.from_council %]</td> <td>[% user.flagged ? loc('Yes') : ' ' %]</td> <td><a href="[% c.uri_for( 'user_edit', user.id ) %]">[% loc('Edit') %]</a></td> |