aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-07-13 17:39:07 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-07-13 17:39:07 +0100
commitbe9141945396909f285110b4267e2adf27d2a6e6 (patch)
treeaaf1ff85696a1c31ff95e6575cfcad65b4d75b46
parent4ca9e95be61444a4b410a7eb28d597d87c36a462 (diff)
Factor all list display report items into one template.
-rw-r--r--templates/web/fixmystreet/around/around_map_list_items.html22
-rw-r--r--templates/web/fixmystreet/around/on_map_list_items.html19
-rw-r--r--templates/web/fixmystreet/index.html14
-rw-r--r--templates/web/fixmystreet/my/my.html22
-rw-r--r--templates/web/fixmystreet/report/_item.html24
-rwxr-xr-xtemplates/web/fixmystreet/reports/_list-entry.html22
6 files changed, 33 insertions, 90 deletions
diff --git a/templates/web/fixmystreet/around/around_map_list_items.html b/templates/web/fixmystreet/around/around_map_list_items.html
index 7dce76ce1..612b37d00 100644
--- a/templates/web/fixmystreet/around/around_map_list_items.html
+++ b/templates/web/fixmystreet/around/around_map_list_items.html
@@ -1,24 +1,8 @@
[% IF around_map.size %]
[% FOREACH p IN around_map %]
-
- [% dist = tprintf("%.1f", (p.distance || 0) ) %]
-
- <li>
- <a href="[% c.uri_for('/report', p.problem.id ) %]">
- <div class="text">
- <h4>[% p.problem.title | html %]</h4>
- <small>[% prettify_epoch( p.problem.confirmed_local.epoch, 1 ) %], [% dist %]km</small>
- [% IF p.problem.is_fixed %]
- <small>[% loc('(fixed)') %]</small>
- [% END %]
- </div>
- [% IF p.problem.photo %]
- <div class="img">
- <img height="60" width="90" src="/photo/[% p.problem.id %].fp.jpeg" alt="">
- </div>
- [% END %]
- </a>
- </li>
+ [% INCLUDE 'report/_item.html'
+ problem = p.problem,
+ dist = tprintf("%.1f", (p.distance || 0) ) %]
[% END %]
[% ELSE %]
<li><p>[% loc('No problems found.') %]</p></li>
diff --git a/templates/web/fixmystreet/around/on_map_list_items.html b/templates/web/fixmystreet/around/on_map_list_items.html
index 9329e6833..7b66d4267 100644
--- a/templates/web/fixmystreet/around/on_map_list_items.html
+++ b/templates/web/fixmystreet/around/on_map_list_items.html
@@ -1,21 +1,6 @@
[% IF on_map.size %]
- [% FOREACH p IN on_map %]
- <li>
- <a href="[% c.uri_for('/report', p.id ) %]">
- <div class="text">
- <h4>[% p.title | html %]</h4>
- <small>[% prettify_epoch( p.confirmed_local.epoch, 1 ) %]</small>
- [% IF p.is_fixed %]
- <small>[% loc('(fixed)') %]</small>
- [% END %]
- </div>
- [% IF p.photo %]
- <div class="img">
- <img height="60" width="90" src="/photo/[% p.id %].fp.jpeg" alt="">
- </div>
- [% END %]
- </a>
- </li>
+ [% FOREACH problem IN on_map %]
+ [% INCLUDE 'report/_item.html' %]
[% END %]
[% ELSE %]
<li><p>[% loc('No problems have been reported yet.') %]</p></li>
diff --git a/templates/web/fixmystreet/index.html b/templates/web/fixmystreet/index.html
index b7b2cbe77..70155b029 100644
--- a/templates/web/fixmystreet/index.html
+++ b/templates/web/fixmystreet/index.html
@@ -89,18 +89,8 @@ kinds of problems like missed bins use our
<section class="full-width">
<ul class="issue-list-a">
- [% FOREACH p IN recent_photos %]
- <li>
- <a href="/report/[% p.id %]">
- <div class="text">
- <h4>[% p.title | html %]</h4>
- <small>[% prettify_epoch( p.confirmed_local.epoch, 1 ) %]</small>
- </div>
- <div class="img">
- <img alt="[% p.title | html %]" title="[% p.title | html %]" height="60" width="90" src="/photo/[% p.id %].fp.jpeg">
- </div>
- </a>
- </li>
+ [% FOREACH problem IN recent_photos %]
+ [% INCLUDE 'report/_item.html', no_fixed = 1 %]
[% END %]
</ul>
</section>
diff --git a/templates/web/fixmystreet/my/my.html b/templates/web/fixmystreet/my/my.html
index 4793989f8..e170202de 100644
--- a/templates/web/fixmystreet/my/my.html
+++ b/templates/web/fixmystreet/my/my.html
@@ -65,26 +65,6 @@ END %]
[% BLOCK problem %]
[% "<ul class='issue-list-a full-width'>" IF loop.first %]
-
- <li>
- <a href="[% c.uri_for( '/report', p.id ) %]">
- <div class="text">
- <h4>[% p.title | html %]</h4>
- <small>
- [% IF p.whensent %]
- [% tprintf( loc("Reported %s, to %s"), prettify_epoch( p.confirmed_local.epoch, 'date' ), p.body(c) ) %]
- [% ELSE %]
- [% tprintf( loc("Reported %s"), prettify_epoch( p.confirmed_local.epoch, 'date' ) ) %]
- [% END %]
- </small>
- </div>
- [% IF p.photo %]
- <div class="img">
- <img height="60" width="90" src="/photo/[% p.id %].fp.jpeg" alt="">
- </div>
- [% END %]
- </a>
- </li>
-
+ [% INCLUDE 'report/_item.html', problem = p, no_fixed =1 %]
[% "</ul>" IF loop.last %]
[% END %]
diff --git a/templates/web/fixmystreet/report/_item.html b/templates/web/fixmystreet/report/_item.html
new file mode 100644
index 000000000..95d2c5b92
--- /dev/null
+++ b/templates/web/fixmystreet/report/_item.html
@@ -0,0 +1,24 @@
+<li>
+<a href="[% c.uri_for('/report', problem.id ) %]">
+ <div class="text">
+ <h4>[% problem.title | html %]</h4>
+ <small>[% prettify_epoch( problem.confirmed_local.epoch, 1 ) %]
+ [%- IF dist %], [% dist %]km[% END %]
+ [%- IF include_lastupdate AND problem.confirmed != problem.lastupdate AND problem.whensent != problem.lastupdate %], last updated [% prettify_epoch( problem.lastupdate, 1 ) %]
+ [%- END %]</small>
+ [% IF include_lastupdate %]
+ [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small>
+ [% ELSIF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small>
+ [% END %]
+ [% END %]
+ [% IF NOT no_fixed AND problem.is_fixed %]
+ <small>[% loc('(fixed)') %]</small>
+ [% END %]
+ </div>
+ [% IF problem.photo %]
+ <div class="img">
+ <img height="60" width="90" src="/photo/[% problem.id %].fp.jpeg" alt="">
+ </div>
+ [% END %]
+</a>
+</li>
diff --git a/templates/web/fixmystreet/reports/_list-entry.html b/templates/web/fixmystreet/reports/_list-entry.html
index b25bdf318..8509df376 100755
--- a/templates/web/fixmystreet/reports/_list-entry.html
+++ b/templates/web/fixmystreet/reports/_list-entry.html
@@ -1,21 +1 @@
-<li>
- <a href="[% c.uri_for('/report/' _ problem.id) %]">
- <div class="text">
- <h4>[% problem.title | html %]</h4>
- <small>[% prettify_epoch( problem.confirmed, 1 ) %]
- [%- IF problem.confirmed != problem.lastupdate AND problem.whensent != problem.lastupdate %], last updated [% prettify_epoch( problem.lastupdate, 1 ) %]
- [%- END %]</small>
- [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small>
- [% ELSIF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small>
- [% END %]
- [% IF problem.is_fixed %]
- <small>[% loc('(fixed)') %]</small>
- [% END %]
- </div>
- [% IF problem.photo %]
- <div class="img">
- <img height="60" width="90" src="/photo/[% problem.id %].fp.jpeg" alt="">
- </div>
- [% END %]
- </a>
-</li>
+[% INCLUDE 'report/_item.html', include_lastupdate = 1 %]