aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm9
-rw-r--r--perllib/FixMyStreet/Cobrand/Hart.pm72
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm12
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm3
5 files changed, 95 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm
index c00264315..bbef1f8d8 100644
--- a/perllib/FixMyStreet/App/Controller/My.pm
+++ b/perllib/FixMyStreet/App/Controller/My.pm
@@ -45,6 +45,7 @@ sub my : Path : Args(0) {
} )->page( $p_page );
while ( my $problem = $rs->next ) {
+ $c->stash->{has_content}++;
push @$pins, {
latitude => $problem->latitude,
longitude => $problem->longitude,
@@ -64,7 +65,9 @@ sub my : Path : Args(0) {
order_by => { -desc => 'confirmed' },
rows => 50
} )->page( $u_page );
+
my @updates = $rs->all;
+ $c->stash->{has_content} += scalar @updates;
$c->stash->{updates} = \@updates;
$c->stash->{updates_pager} = $rs->pager;
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 7fe92bd70..fcab4e49a 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -666,6 +666,15 @@ sub setup_categories_and_bodies : Private {
}
}
+ if ($c->cobrand->can('hidden_categories')) {
+ my %hidden_categories = map { $_ => 1 }
+ $c->cobrand->hidden_categories;
+
+ @category_options = grep {
+ !$hidden_categories{$_}
+ } @category_options;
+ }
+
# put results onto stash for display
$c->stash->{bodies} = \%bodies;
$c->stash->{all_body_names} = [ map { $_->name } values %bodies ];
diff --git a/perllib/FixMyStreet/Cobrand/Hart.pm b/perllib/FixMyStreet/Cobrand/Hart.pm
new file mode 100644
index 000000000..cab834b69
--- /dev/null
+++ b/perllib/FixMyStreet/Cobrand/Hart.pm
@@ -0,0 +1,72 @@
+package FixMyStreet::Cobrand::Hart;
+use parent 'FixMyStreet::Cobrand::UKCouncils';
+
+use strict;
+use warnings;
+
+sub council_id { return 2333; } # http://mapit.mysociety.org/area/2333.html
+sub council_area { return 'Hart'; }
+sub council_name { return 'Hart Council'; }
+sub council_url { return 'hart'; }
+sub is_two_tier { return 1; }
+
+# Different to councils parent due to this being a two-tier council. If we get
+# more, this can be genericised in the parent.
+sub problems_clause {
+ return { bodies_str => { like => '%2333%' } };
+}
+
+sub path_to_web_templates {
+ my $self = shift;
+ return [
+ FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify,
+ FixMyStreet->path_to( 'templates/web/fixmystreet' )->stringify
+ ];
+}
+
+sub disambiguate_location {
+ my $self = shift;
+ my $string = shift;
+
+ my $town = 'Hart, Hampshire';
+
+ return {
+ %{ $self->SUPER::disambiguate_location() },
+ town => $town,
+ # these are taken from mapit http://mapit.mysociety.org/area/2333/geometry -- should be automated?
+ centre => '51.284839,-0.8974600',
+ span => '0.180311,0.239375',
+ bounds => [ 51.186005, -1.002295, 51.366316, -0.762920 ],
+ };
+}
+
+sub example_places {
+ return ( 'GU51 4JX', 'Primrose Drive' );
+}
+
+sub hidden_categories {
+ return (
+ 'Graffiti on bridges/subways',
+ );
+}
+
+sub send_questionnaires {
+ return 0;
+}
+
+sub ask_ever_reported {
+ return 0;
+}
+
+sub contact_email {
+ my $self = shift;
+ return join( '@', 'info', 'hart.gov.uk' );
+}
+sub contact_name { 'Hart District Council (do not reply)'; }
+
+sub default_map_zoom { 3 }
+
+sub reports_per_page { return 20; }
+
+1;
+
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index 2c18d4e22..ec3423f35 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -99,13 +99,19 @@ sub recent_photos {
return $self->problems->recent_photos( $num, $lat, $lon, $dist );
}
+# Returns true if the cobrand owns the problem.
+sub owns_problem {
+ my ($self, $report) = @_;
+ my $bodies = $report->bodies;
+ my %areas = map { %{$_->areas} } values %$bodies;
+ return $areas{$self->council_id} ? 1 : undef;
+}
+
# If we ever link to a county problem report, needs to be to main FixMyStreet
sub base_url_for_report {
my ( $self, $report ) = @_;
if ( $self->is_two_tier ) {
- my $bodies = $report->bodies;
- my %areas = map { %{$_->areas} } values %$bodies;
- if ( $areas{$self->council_id} ) {
+ if ( $self->owns_problem( $report ) ) {
return $self->base_url;
} else {
return FixMyStreet->config('BASE_URL');
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index a2784950a..cc4fc67fc 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -58,6 +58,7 @@ sub email_alerts ($) {
while (my $row = $query->fetchrow_hashref) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->{alert_cobrand})->new();
+ $cobrand->set_lang_and_domain( $row->{alert_lang}, 1, FixMyStreet->path_to('locale')->stringify );
# Cobranded and non-cobranded messages can share a database. In this case, the conf file
# should specify a vhost to send the reports for each cobrand, so that they don't get sent
@@ -204,7 +205,7 @@ sub _send_aggregated_alert_email(%) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($data{cobrand})->new();
- $cobrand->set_lang_and_domain( $data{lang}, 1 );
+ $cobrand->set_lang_and_domain( $data{lang}, 1, FixMyStreet->path_to('locale')->stringify );
if (!$data{alert_email}) {
my $user = FixMyStreet::App->model('DB::User')->find( {