diff options
author | Struan Donald <struan@exo.org.uk> | 2012-05-17 18:01:24 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-05-17 18:01:24 +0100 |
commit | 9704d2dbe53dec030a19746f32e87ef0740e52a7 (patch) | |
tree | ada10491ff01c0fc442e26ed240ff654b37e7537 | |
parent | 6b4c2307c9f82d04bc987829079d906d1a7014e4 (diff) |
use is_council as used for bromley and reduce template duplication
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 6 | ||||
-rw-r--r-- | templates/web/barnet/alert/_list.html | 89 | ||||
-rw-r--r-- | templates/web/barnet/alert/index.html | 38 | ||||
-rwxr-xr-x | templates/web/default/reports/council.html | 4 | ||||
-rw-r--r-- | templates/web/fixmystreet/alert/_list.html | 4 | ||||
-rw-r--r-- | templates/web/fixmystreet/alert/index.html | 15 |
6 files changed, 23 insertions, 133 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 923cd435d..b012be48e 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -7,6 +7,10 @@ use warnings; use Carp; use URI::Escape; +sub is_council { + return 1; +} + sub site_restriction { my $self = shift; return ( "and council='" . $self->council_id . "'", $self->council_url, { council => sprintf('%d', $self->council_id) } ); @@ -75,7 +79,5 @@ sub recent_photos { return $self->problems->recent_photos( $num, $lat, $lon, $dist ); } -sub is_council_cobrand { return 1 } - 1; diff --git a/templates/web/barnet/alert/_list.html b/templates/web/barnet/alert/_list.html deleted file mode 100644 index b281fd54f..000000000 --- a/templates/web/barnet/alert/_list.html +++ /dev/null @@ -1,89 +0,0 @@ - <input type="hidden" name="type" value="local"> - <input type="hidden" name="pc" value="[% pc | html %]"> - <input type="hidden" name="latitude" value="[% latitude | html %]"> - <input type="hidden" name="longitude" value="[% longitude | html %]"> - - <p> - [% IF pretty_pc %] - [% tprintf( loc('Here are the types of local problem alerts for ‘%s’.'), pretty_pc ) %] - [% END %] - [% loc('Select which type of alert you\'d like and click the button for an RSS feed, or enter your email address to subscribe to an email alert.') %] - </p> - - [% INCLUDE 'errors.html' %] - - <p> - [% loc('The simplest alert is our geographic one:') %] - </p> - - <p> - <input type="radio" name="feed" id="[% rss_feed_id %]" value="[% rss_feed_id %]"[% IF rss_feed_id == selected_feed || selected_feed == '' %] checked[% END %]> - <label class="inline" for="[% rss_feed_id %]">[% tprintf( loc('Problems within %.1fkm of this location'), population_radius ) %]</label> - <a href='[% rss_feed_uri %]'><img src='/i/feed.png' width='16' height='16' title='[% loc('RSS feed of nearby problems') %]' alt='[% loc('RSS feed') %]' border='0'></a> - <br /> - [% loc('(a default distance which covers roughly 200,000 people)') %] - </p> - - <p id="rss_local_alt"> - [% loc('(alternatively the RSS feed can be customised, within') %] - <a href="[% rss_feed_2k %]">2km</a> / <a href="[% rss_feed_5k %]">5km</a> / <a href="[% rss_feed_10k %]">10km</a> / <a href="[% rss_feed_20k %]">20km</a>) - </p> - - <p> - Or you can subscribe to an alert for all council problems or one based upon what ward you’re in: - </p> - - [% IF reported_to_options %] - <p><strong> - [% loc('Problems within the boundary of:') %] - </strong></p> - <ul class="plain-list"> - [% ELSE %] - <ul id="rss_feed" class="plain-list"> - [% END %] - - [% FOREACH option IN options %] - <li[% IF ! (loop.count % 2) %] class="a"[% END %]> - <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> - <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" -title="[% option.rss_text %]" alt="RSS feed" border="0"></a> - <label class="inline" for="[% option.id %]">[% option.text %]</label> - </li> - [% END %] -</ul> - [% IF reported_to_options %] - <p><strong> - [% loc('Or problems reported to:') %] - </strong></p> - <ul class="plain-list"> - [% FOREACH option IN reported_to_options %] - <li[% IF ! (loop.count % 2) %] class="a"[% END %]> - <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> - <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" - title="[% option.rss_text %]" alt="RSS feed" border="0"></a> - <label class="inline" for="[% option.id %]">[% option.text %]</label> - </li> - [% END %] - </ul> - <p><small> - [% loc( 'FixMyStreet sends different categories of problem -to the appropriate council, so problems within the boundary of a particular council -might not match the problems sent to that council. For example, a graffiti report -will be sent to the district council, so will appear in both of the district -council’s alerts, but will only appear in the "Within the boundary" alert -for the county council.' ) %] - </small></p> - [% END %] - - <input id="alert_rss_button" class="green-btn" type="submit" name="rss" value="[% loc('Give me an RSS feed') %]"> - - <p id="alert_or"> - [% loc('or') %] - </p> - - [% UNLESS c.user_exists %] - <label for="rznvy">[% loc('Your email') %]</label> - <input type="text" id="rznvy" name="rznvy" value="[% rznvy | html %]"> - [% END %] - <input id="alert_email_button" style="margin-top:1em;" class="green-btn" type="submit" name="alert" value="[% loc('Subscribe me to an email alert') %]"> - diff --git a/templates/web/barnet/alert/index.html b/templates/web/barnet/alert/index.html deleted file mode 100644 index 1cc39e130..000000000 --- a/templates/web/barnet/alert/index.html +++ /dev/null @@ -1,38 +0,0 @@ -[% INCLUDE 'header.html', title = loc('Local RSS feeds and email alerts'), bodyclass = 'twothirdswidthpage' %] - -<h1>[% loc('Local RSS feeds and email alerts') %]</h1> - -<p> -You can subscribe to an RSS feed and email alerts for problems, including alerts for all problems within Barnet or in a particular ward, or all problems within a certain distance of a particular location. To find out what alerts we have for you, please enter a Barnet postcode or street name and area -</p> - -[% IF location_offshore %] - <div class="error">[% loc('That location does not appear to be covered by a council, perhaps it is offshore - please try somewhere more specific.') %]</div> -[% ELSIF location_error %] - <div class="error">[% location_error %]</div> -[% ELSE %] - [% INCLUDE 'errors.html' %] -[% END %] - -<form method="get" action="/alert/list" class="full-width"> - <fieldset> - <div class="form-txt-submit-box"> - <input type="text" name="pc" value="[% pc | html %]" placeholder="[% tprintf(loc('e.g. ā%sā or ā%sā'), c.cobrand.example_places) %]"> - <input class="green-btn" type="submit" value="[% loc('Go') %]"> - </div> - </fieldset> -</form> - -[% IF photos.size %] -<div class="sticky-sidebar"> - <aside> - <h2>[% loc('Some photos of recent reports') %]</h2> - [% FOREACH p IN photos %] - <a href="/report/[% p.id %]"><img border="0" height="100" - src="/photo/[% p.id %].tn.jpeg" alt="[% p.title | html %]" title="[% p.title | html %]"></a> - [% END %] - </aside> -</div> -[% END %] - -[% INCLUDE 'footer.html' %] diff --git a/templates/web/default/reports/council.html b/templates/web/default/reports/council.html index 1610a98cb..5fec0b00b 100755 --- a/templates/web/default/reports/council.html +++ b/templates/web/default/reports/council.html @@ -8,7 +8,7 @@ %] [% END %] -[% IF c.cobrand.is_council_cobrand %] +[% IF c.cobrand.is_council %] [% ward_text = loc( 'View reports by ward' ) %] [% ELSE %] [% ward_text = loc( 'Wards of this council' ) %] @@ -75,7 +75,7 @@ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a [% 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.is_council_cobrand %][% tprintf(loc('Get updates of %s problems'), thing) %][% ELSE %][% tprintf(loc('Get updates of problems in this %s'), thing) %][% END %]</a></li> + <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[% IF 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 %] diff --git a/templates/web/fixmystreet/alert/_list.html b/templates/web/fixmystreet/alert/_list.html index e9f877466..e14d394f2 100644 --- a/templates/web/fixmystreet/alert/_list.html +++ b/templates/web/fixmystreet/alert/_list.html @@ -30,7 +30,11 @@ </p> <p> + [% IF c.cobrand.is_council %] + Or you can subscribe to an alert for all council problems or one based upon what ward you’re in: + [% ELSE %] [% loc("Or you can subscribe to an alert based upon what ward or council you’re in:") %] + [% END %] </p> [% IF reported_to_options %] diff --git a/templates/web/fixmystreet/alert/index.html b/templates/web/fixmystreet/alert/index.html index 8d4459c01..03d9843f6 100644 --- a/templates/web/fixmystreet/alert/index.html +++ b/templates/web/fixmystreet/alert/index.html @@ -3,9 +3,15 @@ <h1>[% loc('Local RSS feeds and email alerts') %]</h1> <p> +[% IF c.cobrand.is_council %] +FixMyStreet has a variety of RSS feeds and email alerts for local problems, including +alerts for all problems within a particular ward, or all problems +within a certain distance of a particular location. +[% ELSE %] [% loc('FixMyStreet has a variety of RSS feeds and email alerts for local problems, including alerts for all problems within a particular ward or council, or all problems within a certain distance of a particular location.') %] +[% END %] </p> [% IF location_offshore %] @@ -16,8 +22,13 @@ within a certain distance of a particular location.') %] [% INCLUDE 'errors.html' %] [% END %] -<p>[% loc('To find out what local alerts we have for you, please enter your GB - postcode or street name and area' ) %]</p> +<p> +[% IF c.cobrand.is_council %] +To find out what local alerts we have for you, please enter your [% c.cobrand.council_area %] postcode or street name and area: +[% ELSE %] +[% loc('To find out what local alerts we have for you, please enter your GB postcode or street name and area' ) %] +[% END %] +</p> <form method="get" action="/alert/list" class="full-width"> <fieldset> <div class="form-txt-submit-box"> |