aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm8
-rw-r--r--templates/web/default/admin/list_flagged.html33
-rw-r--r--templates/web/default/admin/problem_row.html30
-rw-r--r--templates/web/default/admin/search_reports.html31
4 files changed, 39 insertions, 63 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index de90321a0..c0e6a9475 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -448,9 +448,11 @@ sub search_reports : Path('search_reports') {
}
);
+ # we need to pass this in as an array as we can't
+ # query the object in the template as the quoting
+ # will have been turned off
$c->stash->{problems} = [ $problems->all ];
-
$c->stash->{edit_council_contacts} = 1
if ( grep {$_ eq 'councilcontacts'} keys %{$c->stash->{allowed_pages}});
@@ -722,7 +724,9 @@ sub list_flagged : Path('list_flagged') : Args(0) {
my $problems = $c->model('DB::Problem')->search( { flagged => 1 } );
- $c->stash->{problems} = $problems;
+ # pass in as array ref as using same template as search_reports
+ # which has to use an array ref for sql quoting reasons
+ $c->stash->{problems} = [ $problems->all ];
my $users = $c->model('DB::User')->search( { flagged => 1 } );
diff --git a/templates/web/default/admin/list_flagged.html b/templates/web/default/admin/list_flagged.html
index 6a4252abf..dfa07c7a2 100644
--- a/templates/web/default/admin/list_flagged.html
+++ b/templates/web/default/admin/list_flagged.html
@@ -3,7 +3,7 @@
<h2>[% loc( 'Problems' ) %]</h2>
-[% IF problems %]
+[% IF problems.size > 0 %]
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<th>[% loc('ID') %]</th>
@@ -19,36 +19,7 @@
<th>[% loc('When sent') %]</th>
<th>*</th>
</tr>
-[%- WHILE ( problem = problems.next ) %]
- <tr[% ' class="hidden"' IF problem.state == 'hidden' %]>
- <td>[%- IF problem.state == 'confirmed' || problem.state == 'fixed' -%]
- [%- cobrand_data = problem.cobrand_data %]
- [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
- <a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% problem.id %]</a>
- [%- ELSE %]
- [%- problem.id %]
- [%- END -%]</td>
- <td>[% PROCESS value_or_nbsp value=problem.title %]</td>
- <td>[% PROCESS value_or_nbsp value=problem.name %]</td>
- <td>[% PROCESS value_or_nbsp value=problem.user.email %]</td>
- <td>[%- IF edit_council_contacts -%]
- <a href="[% c.uri_for('council_contacts', problem.council ) %]">[% PROCESS value_or_nbsp value=problem.council %]</a>
- [%- ELSE -%]
- [%- PROCESS value_or_nbsp value=problem.council -%]
- [%- END -%]</td>
- <td>[% PROCESS value_or_nbsp value=problem.category %]</td>
- <td>[% IF problem.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
- <td>[% problem.cobrand %]<br>[% problem.cobrand_data | html %]</td>
- <td>[% PROCESS format_time time=problem.created %]</td>
- <td>[% problem.state %]<small>
- [%- IF problem.state == 'fixed' || problem.state == 'confirmed' %]<br>[% loc('Confirmed:' ) %]&nbsp;[% PROCESS format_time time=problem.confirmed %][% END -%]
- [%- IF problem.state == 'fixed' %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]
- [%- IF problem.state == 'confirmed' %]<br>[% loc('Last&nbsp;update:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]</small>
- </td>
- <td>[% PROCESS format_time time=problem.whensent %]</td>
- <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td>
- </tr>
-[%- END -%]
+ [% INCLUDE 'admin/problem_row.html' %]
</table>
[% ELSE %]
<p>
diff --git a/templates/web/default/admin/problem_row.html b/templates/web/default/admin/problem_row.html
new file mode 100644
index 000000000..664ff1b13
--- /dev/null
+++ b/templates/web/default/admin/problem_row.html
@@ -0,0 +1,30 @@
+[%- FOR problem IN problems %]
+ <tr[% ' class="hidden"' IF problem.state == 'hidden' %]>
+ <td>[%- IF problem.state == 'confirmed' || problem.state == 'fixed' -%]
+ [%- cobrand_data = problem.cobrand_data %]
+ [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
+ <a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% problem.id %]</a>
+ [%- ELSE %]
+ [%- problem.id %]
+ [%- END -%]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.title %]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.name %]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.user.email %]</td>
+ <td>[%- IF edit_council_contacts -%]
+ <a href="[% c.uri_for('council_contacts', problem.council ) %]">[% PROCESS value_or_nbsp value=problem.council %]</a>
+ [%- ELSE -%]
+ [%- PROCESS value_or_nbsp value=problem.council -%]
+ [%- END -%]</td>
+ <td>[% PROCESS value_or_nbsp value=problem.category %]</td>
+ <td>[% IF problem.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
+ <td>[% problem.cobrand %]<br>[% problem.cobrand_data | html %]</td>
+ <td>[% PROCESS format_time time=problem.created %]</td>
+ <td>[% problem.state %]<small>
+ [%- IF problem.state == 'fixed' || problem.state == 'confirmed' %]<br>[% loc('Confirmed:' ) %]&nbsp;[% PROCESS format_time time=problem.confirmed %][% END -%]
+ [%- IF problem.state == 'fixed' %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]
+ [%- IF problem.state == 'confirmed' %]<br>[% loc('Last&nbsp;update:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]</small>
+ </td>
+ <td>[% PROCESS format_time time=problem.whensent %]</td>
+ <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td>
+ </tr>
+[%- END -%]
diff --git a/templates/web/default/admin/search_reports.html b/templates/web/default/admin/search_reports.html
index 3809965f6..9702c16a7 100644
--- a/templates/web/default/admin/search_reports.html
+++ b/templates/web/default/admin/search_reports.html
@@ -22,36 +22,7 @@
<th>[% loc('When sent') %]</th>
<th>*</th>
</tr>
-[%- FOREACH problem IN problems %]
- <tr[% ' class="hidden"' IF problem.state == 'hidden' %]>
- <td>[%- IF problem.state == 'confirmed' || problem.state == 'fixed' -%]
- [%- cobrand_data = problem.cobrand_data %]
- [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
- <a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% problem.id %]</a>
- [%- ELSE %]
- [%- problem.id %]
- [%- END -%]</td>
- <td>[% PROCESS value_or_nbsp value=problem.title %]</td>
- <td>[% PROCESS value_or_nbsp value=problem.name %]</td>
- <td>[% PROCESS value_or_nbsp value=problem.user.email %]</td>
- <td>[%- IF edit_council_contacts -%]
- <a href="[% c.uri_for('council_contacts', problem.council ) %]">[% PROCESS value_or_nbsp value=problem.council %]</a>
- [%- ELSE -%]
- [%- PROCESS value_or_nbsp value=problem.council -%]
- [%- END -%]</td>
- <td>[% PROCESS value_or_nbsp value=problem.category %]</td>
- <td>[% IF problem.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
- <td>[% problem.cobrand %]<br>[% problem.cobrand_data | html %]</td>
- <td>[% PROCESS format_time time=problem.created %]</td>
- <td>[% problem.state %]<small>
- [%- IF problem.state == 'fixed' || problem.state == 'confirmed' %]<br>[% loc('Confirmed:' ) %]&nbsp;[% PROCESS format_time time=problem.confirmed %][% END -%]
- [%- IF problem.state == 'fixed' %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]
- [%- IF problem.state == 'confirmed' %]<br>[% loc('Last&nbsp;update:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]</small>
- </td>
- <td>[% PROCESS format_time time=problem.whensent %]</td>
- <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td>
- </tr>
-[%- END -%]
+ [% INCLUDE 'admin/problem_row.html' %]
</table>
[% INCLUDE 'admin/list_updates.html' %]