aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm13
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm21
-rw-r--r--perllib/FixMyStreet/App/Controller/Root.pm5
-rw-r--r--perllib/FixMyStreet/TestMech.pm25
5 files changed, 14 insertions, 54 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 35e8c2537..5575d915e 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -200,6 +200,10 @@ sub setup_request {
$c->stash->{site_name} = Utils::trim_text($c->render_fragment('site-name.html'));
+ if (my $template = $c->forward('/about/find_template', [ 'homepage' ])) {
+ $c->stash->{homepage_template} = $template;
+ }
+
$c->model('DB::Problem')->set_restriction( $cobrand->site_key() );
Memcached::set_namespace( FixMyStreet->config('FMS_DB_NAME') . ":" );
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 81abba3ac..040579e9f 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -28,14 +28,11 @@ Redirect to homepage unless C<id> parameter in query, in which case redirect to
sub index : Path('') : Args(0) {
my ( $self, $c ) = @_;
- my $id = $c->get_param('id');
-
- my $uri =
- $id
- ? $c->uri_for( '/report', $id )
- : $c->uri_for('/');
-
- $c->res->redirect($uri);
+ if ($c->stash->{homepage_template}) {
+ $c->stash->{template} = 'index.html';
+ } else {
+ $c->res->redirect('/');
+ }
}
=head2 report_display
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 024a23872..8f068f0ec 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -384,8 +384,6 @@ sub load_and_group_problems : Private {
$c->forward('stash_report_sort', [ $c->cobrand->reports_ordering ]);
my $page = $c->get_param('p') || 1;
- # NB: If 't' is specified, it will override 'status'.
- my $type = $c->get_param('t') || 'all';
my $category = [ $c->get_param_list('filter_category', 1) ];
my $states = $c->stash->{filter_problem_states};
@@ -413,25 +411,6 @@ sub load_and_group_problems : Private {
$where->{'me.id'} = { -not_in => $shortlisted_ids };
}
- my $not_open = [ FixMyStreet::DB::Result::Problem::fixed_states(), FixMyStreet::DB::Result::Problem::closed_states() ];
- if ( $type eq 'new' ) {
- $where->{confirmed} = { '>', \"current_timestamp - INTERVAL '4 week'" };
- $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] };
- } elsif ( $type eq 'older' ) {
- $where->{confirmed} = { '<', \"current_timestamp - INTERVAL '4 week'" };
- $where->{lastupdate} = { '>', \"current_timestamp - INTERVAL '8 week'" };
- $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] };
- } elsif ( $type eq 'unknown' ) {
- $where->{lastupdate} = { '<', \"current_timestamp - INTERVAL '8 week'" };
- $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] };
- } elsif ( $type eq 'fixed' ) {
- $where->{lastupdate} = { '>', \"current_timestamp - INTERVAL '8 week'" };
- $where->{state} = $not_open;
- } elsif ( $type eq 'older_fixed' ) {
- $where->{lastupdate} = { '<', \"current_timestamp - INTERVAL '8 week'" };
- $where->{state} = $not_open;
- }
-
if (@$category) {
$where->{category} = $category;
}
diff --git a/perllib/FixMyStreet/App/Controller/Root.pm b/perllib/FixMyStreet/App/Controller/Root.pm
index 4f098dfc3..64d7fa6ae 100644
--- a/perllib/FixMyStreet/App/Controller/Root.pm
+++ b/perllib/FixMyStreet/App/Controller/Root.pm
@@ -58,6 +58,11 @@ sub index : Path : Args(0) {
return;
}
+ if ($c->stash->{homepage_template}) {
+ $c->stash->{template} = $c->stash->{homepage_template};
+ $c->detach;
+ }
+
$c->forward('/auth/get_csrf_token');
}
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index eef767ce6..188e99a5c 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -485,31 +485,6 @@ sub extract_problem_list {
return $result->{ problems } || [];
}
-=head2 extract_report_stats
-
- $stats = $mech->extract_report_stats
-
-Returns a hash ref keyed by council name of all the council stats from the all reports
-page. Each value is an array ref with the first element being the council name and the
-rest being the stats in the order the appear in each row.
-
-=cut
-
-sub extract_report_stats {
- my $mech = shift;
-
- my $result = scraper {
- process 'tr[align=center]', 'councils[]' => scraper {
- process 'td.title a', 'council', 'TEXT',
- process 'td', 'stats[]', 'TEXT'
- }
- }->scrape( $mech->response );
-
- my %councils = map { $_->{council} => $_->{stats} } @{ $result->{councils} };
-
- return \%councils;
-}
-
=head2 visible_form_values
$hashref = $mech->visible_form_values( );