aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-07-13 15:48:30 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-07-13 15:48:30 +0100
commit932f88e1a7776eeb2567b91e003361bb5275bf5d (patch)
tree2d2f4005f41dcbb2b6b54edbae1a10e4b34d4d03
parent0000afc1f4b28c96365981fc24437a6983ee7ea2 (diff)
Move all_reports_style functionality to templates.
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm1
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm9
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm2
-rwxr-xr-xtemplates/web/default/reports/_list-entry.html6
-rw-r--r--templates/web/default/reports/_rss.html2
-rwxr-xr-xtemplates/web/default/reports/_ward-list.html9
-rwxr-xr-xtemplates/web/default/reports/council.html130
-rwxr-xr-xtemplates/web/fixmystreet/reports/_list-entry.html21
-rw-r--r--templates/web/fixmystreet/reports/_rss.html19
-rwxr-xr-xtemplates/web/fixmystreet/reports/_ward-list.html12
10 files changed, 98 insertions, 113 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index a52875819..62827eec1 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -10,7 +10,6 @@ sub council_id { return 2482; }
sub council_area { return 'Bromley'; }
sub council_name { return 'Bromley Council'; }
sub council_url { return 'bromley'; }
-sub all_reports_style { return 'detailed'; }
sub base_url {
return FixMyStreet->config('BASE_URL') if FixMyStreet->config('STAGING_SITE');
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index a73487ca4..5de8bac37 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -132,15 +132,6 @@ Parameter is QUERY
sub enter_postcode_text { '' }
-=head2 all_reports_style
-
-Return the type of problem information to display on the all reports
-pages for councils. Can be either simple or detailed.
-
-=cut
-
-sub all_reports_style { return 'simple'; }
-
=head2 set_lang_and_domain
my $set_lang = $cobrand->set_lang_and_domain( $lang, $unicode, $dir )
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index 33e071b66..65507b1a1 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -10,8 +10,6 @@ sub admin_base_url {
return 'https://secure.mysociety.org/admin/bci/';
}
-sub all_reports_style { return 'detailed'; }
-
sub allow_crosssell_adverts { return 1; }
1;
diff --git a/templates/web/default/reports/_list-entry.html b/templates/web/default/reports/_list-entry.html
new file mode 100755
index 000000000..14863c4a1
--- /dev/null
+++ b/templates/web/default/reports/_list-entry.html
@@ -0,0 +1,6 @@
+<li><a href="[% c.uri_for('/report/' _ problem.id) %]">[% problem.title | html %]</a>
+ [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small> [% END %]
+ [% IF c.cobrand.moniker != 'emptyhomes' %]
+ [% IF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small> [% END %]
+ [% END %]
+</li>
diff --git a/templates/web/default/reports/_rss.html b/templates/web/default/reports/_rss.html
new file mode 100644
index 000000000..9756f131d
--- /dev/null
+++ b/templates/web/default/reports/_rss.html
@@ -0,0 +1,2 @@
+<p><a href="[% rss_url %]"><img align="right" src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% tprintf(loc('RSS feed of problems in this %s'), thing) %]" border="0" hspace="4"></a>
+
diff --git a/templates/web/default/reports/_ward-list.html b/templates/web/default/reports/_ward-list.html
new file mode 100755
index 000000000..e78ac7d90
--- /dev/null
+++ b/templates/web/default/reports/_ward-list.html
@@ -0,0 +1,9 @@
+[% IF location == 'before' AND children.size %]
+<h2 style="clear:right">[% ward_text %]</h2>
+<p>[% loc('Follow a ward link to view only reports within that ward.') %]</p>
+<ul>
+[% FOR child IN children.values.sort('name') %]
+<li><a href="[% child.url %]">[% child.name %]</a></li>
+[% END %]
+</ul>
+[% END %]
diff --git a/templates/web/default/reports/council.html b/templates/web/default/reports/council.html
index b837bcee9..134c9d4fc 100755
--- a/templates/web/default/reports/council.html
+++ b/templates/web/default/reports/council.html
@@ -31,15 +31,7 @@
[% map_html %]
-[% IF c.cobrand.all_reports_style != 'detailed' AND children.size %]
-<h2 style="clear:right">[% ward_text %]</h2>
-<p>[% loc('Follow a ward link to view only reports within that ward.') %]</p>
-<ul>
-[% FOR child IN children.values.sort('name') %]
-<li><a href="[% child.url %]">[% child.name %]</a></li>
-[% END %]
-</ul>
-[% END %]
+[% INCLUDE 'reports/_ward-list.html', location = 'before' %]
</div>
<div id="side">
@@ -53,67 +45,38 @@
</h1>
[% IF council.generation_high == 10 AND c.cobrand.country == 'GB' %]
-<p id="unknown" class="alert">This council no longer exists.
-[% IF council.name.match('Penwith|Kerrier|Carrick|Restormel|Caradon|North Cornwall') %]
-Its area is now covered by <a href="/reports/Cornwall">Cornwall Council</a>.
-[% ELSIF council.name.match('Durham|Easington|Sedgefield|Teesdale|Wear Valley|Derwentside|Chester le Street') %]
-Its area is now covered by <a href="/reports/Durham+County">Durham County Council</a>.
-[% ELSIF council.name.match('Blyth Valley|Wansbeck|Castle Morpeth|Tynedale|Alnwick|Berwick upon Tweed') %]
-Its area is now covered by <a href="/reports/Northumberland">Northumberland County Council</a>.
-[% ELSIF council.name.match('North Shropshire|Oswestry|Shrewsbury and Atcham|South Shropshire|Bridgnorth') %]
-Its area is now covered by <a href="/reports/Shropshire">Shropshire Council</a>.
-[% ELSIF council.name.match('Salisbury|West Wiltshire|Kennet|North Wiltshire') %]
-Its area is now covered by <a href="/reports/Wiltshire">Wiltshire Council</a>.
-[% ELSIF council.name.match('Ellesmere Port and Neston|Vale Royal|Chester') %]
-Its area is now covered by <a href="/reports/Cheshire+West+and+Chester">Cheshire West and Chester Council</a>.
-[% ELSIF council.name.match('Macclesfield|Congleton|Crewe and Nantwich') %]
-Its area is now covered by <a href="/reports/Cheshire+East">Cheshire East Council</a>.
-[% ELSIF council.name.match('Mid Bedfordshire|South Bedfordshire') %]
-Its area is now covered by <a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>.
-[% ELSIF council.name.match('Cheshire') %]
-Its area is now covered by <a href="/reports/Cheshire+West+and+Chester">Cheshire West and Chester Council</a> or
-<a href="/reports/Cheshire+East">Cheshire East Council</a>.
-[% ELSIF council.name.match('Bedfordshire') %]
-Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a> or
-<a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>.
-[% END %]
-</p>
-[% ELSIF c.cobrand.all_reports_style == 'detailed' %]
- <div class="shadow-wrap">
- <ul id="key-tools"[% IF NOT children.size %] class="singleton"[% END %]>
- <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[%
- IF c.cobrand.moniker == 'bromley' AND thing == 'council';
- 'Get updates of reports in Bromley';
- ELSIF c.cobrand.moniker == 'bromley';
- 'Get updates of reports in this ward';
- ELSIF c.cobrand.is_council;
- tprintf(loc('Get updates of %s problems'), thing);
- ELSE;
- tprintf(loc('Get updates of problems in this %s'), thing);
- END
- %]</a></li>
- [% IF children.size %]
- <li><a href="#council_wards" id="key-tool-wards" class="chevron">[% ward_text %]</a></li>
- [% END %]
- </ul>
- </div>
+ <p id="unknown" class="alert">This council no longer exists.
+ [% IF council.name.match('Penwith|Kerrier|Carrick|Restormel|Caradon|North Cornwall') %]
+ Its area is now covered by <a href="/reports/Cornwall">Cornwall Council</a>.
+ [% ELSIF council.name.match('Durham|Easington|Sedgefield|Teesdale|Wear Valley|Derwentside|Chester le Street') %]
+ Its area is now covered by <a href="/reports/Durham+County">Durham County Council</a>.
+ [% ELSIF council.name.match('Blyth Valley|Wansbeck|Castle Morpeth|Tynedale|Alnwick|Berwick upon Tweed') %]
+ Its area is now covered by <a href="/reports/Northumberland">Northumberland County Council</a>.
+ [% ELSIF council.name.match('North Shropshire|Oswestry|Shrewsbury and Atcham|South Shropshire|Bridgnorth') %]
+ Its area is now covered by <a href="/reports/Shropshire">Shropshire Council</a>.
+ [% ELSIF council.name.match('Salisbury|West Wiltshire|Kennet|North Wiltshire') %]
+ Its area is now covered by <a href="/reports/Wiltshire">Wiltshire Council</a>.
+ [% ELSIF council.name.match('Ellesmere Port and Neston|Vale Royal|Chester') %]
+ Its area is now covered by <a href="/reports/Cheshire+West+and+Chester">Cheshire West and Chester Council</a>.
+ [% ELSIF council.name.match('Macclesfield|Congleton|Crewe and Nantwich') %]
+ Its area is now covered by <a href="/reports/Cheshire+East">Cheshire East Council</a>.
+ [% ELSIF council.name.match('Mid Bedfordshire|South Bedfordshire') %]
+ Its area is now covered by <a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>.
+ [% ELSIF council.name.match('Cheshire') %]
+ Its area is now covered by <a href="/reports/Cheshire+West+and+Chester">Cheshire West and Chester Council</a> or
+ <a href="/reports/Cheshire+East">Cheshire East Council</a>.
+ [% ELSIF council.name.match('Bedfordshire') %]
+ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a> or
+ <a href="/reports/Central+Bedfordshire">Central Bedfordshire Council</a>.
+ [% END %]
+ </p>
[% ELSE %]
- <p><a href="[% rss_url %]"><img align="right" src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% tprintf(loc('RSS feed of problems in this %s'), thing) %]" border="0" hspace="4"></a>
+ [% INCLUDE 'reports/_rss.html' %]
[% END %]
[% TRY %][% INCLUDE 'reports/cobrand_stats.html' %][% CATCH file %][% END %]
-[% IF c.cobrand.all_reports_style == 'detailed' AND children.size %]
-<section id="council_wards" class="hidden-js">
-<h2>[% ward_text %]</h2>
- <p>[% loc('Follow a ward link to view only reports within that ward.') %]</p>
- <ul class="issue-list-a full-width">
- [% FOR child IN children.values.sort('name') %]
- <li><a href="[% child.url %]"><span class="text">[% child.name %]</span></a></li>
- [% END %]
- </ul>
-</section>
-[% END %]
+[% INCLUDE 'reports/_ward-list.html', location = 'after' %]
[% IF c.cobrand.moniker == 'fixmystreet' %]
<p class="promo">
@@ -139,43 +102,8 @@ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a
[% IF problems %]
<ul class="issue-list-a">
-[% IF c.cobrand.all_reports_style == 'detailed' %]
-
[% FOREACH problem IN problems %]
- <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>
-[% END %]
-
-[% ELSE %]
-
-[% FOREACH problem IN problems %]
- <li><a href="[% c.uri_for('/report/' _ problem.id) %]">[% problem.title | html %]</a>
- [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small> [% END %]
- [% IF c.cobrand.moniker != 'emptyhomes' %]
- [% IF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small> [% END %]
- [% END %]
- </li>
-[% END %]
-
+ [% INCLUDE 'reports/_list-entry.html' %]
[% END %]
</ul>
diff --git a/templates/web/fixmystreet/reports/_list-entry.html b/templates/web/fixmystreet/reports/_list-entry.html
new file mode 100755
index 000000000..b25bdf318
--- /dev/null
+++ b/templates/web/fixmystreet/reports/_list-entry.html
@@ -0,0 +1,21 @@
+<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>
diff --git a/templates/web/fixmystreet/reports/_rss.html b/templates/web/fixmystreet/reports/_rss.html
new file mode 100644
index 000000000..f2d164bfa
--- /dev/null
+++ b/templates/web/fixmystreet/reports/_rss.html
@@ -0,0 +1,19 @@
+<div class="shadow-wrap">
+ <ul id="key-tools"[% IF NOT children.size %] class="singleton"[% END %]>
+ <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[%
+ IF c.cobrand.moniker == 'bromley' AND thing == 'council';
+ 'Get updates of reports in Bromley';
+ ELSIF c.cobrand.moniker == 'bromley';
+ 'Get updates of reports in this ward';
+ ELSIF c.cobrand.is_council;
+ tprintf(loc('Get updates of %s problems'), thing);
+ ELSE;
+ tprintf(loc('Get updates of problems in this %s'), thing);
+ END
+ %]</a></li>
+ [% IF children.size %]
+ <li><a href="#council_wards" id="key-tool-wards" class="chevron">[% ward_text %]</a></li>
+ [% END %]
+ </ul>
+</div>
+
diff --git a/templates/web/fixmystreet/reports/_ward-list.html b/templates/web/fixmystreet/reports/_ward-list.html
new file mode 100755
index 000000000..5e82a93cc
--- /dev/null
+++ b/templates/web/fixmystreet/reports/_ward-list.html
@@ -0,0 +1,12 @@
+[% IF location == 'after' AND children.size %]
+<section id="council_wards" class="hidden-js">
+<h2>[% ward_text %]</h2>
+ <p>[% loc('Follow a ward link to view only reports within that ward.') %]</p>
+ <ul class="issue-list-a full-width">
+ [% FOR child IN children.values.sort('name') %]
+ <li><a href="[% child.url %]"><span class="text">[% child.name %]</span></a></li>
+ [% END %]
+ </ul>
+</section>
+[% END %]
+