Permalink
Browse files

Fix bug in admin user search, and add council ID search.

  • Loading branch information...
1 parent 4105b3b commit 12e3f1a37bc13d4f9a85e5a0eea9cb79e5b1ac9c @dracos dracos committed May 2, 2012
View
11 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 ];
View
4 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>
View
2 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') : '&nbsp;' %]</td>
<td><a href="[% c.uri_for( 'user_edit', user.id ) %]">[% loc('Edit') %]</a></td>

0 comments on commit 12e3f1a

Please sign in to comment.