Skip to content

Commit

Permalink
Fix bug in admin user search, and add council ID search.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed May 2, 2012
1 parent 4105b3b commit 12e3f1a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions perllib/FixMyStreet/App/Controller/Admin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
},
Expand All @@ -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 ];

Expand Down
4 changes: 4 additions & 0 deletions templates/web/default/admin/council_contacts.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion templates/web/default/admin/search_users.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 12e3f1a

Please sign in to comment.