diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 42 | ||||
-rwxr-xr-x | templates/web/fixmystreet/reports/council.html | 42 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/base.scss | 2 |
3 files changed, 9 insertions, 77 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 815debe14..5d70ae113 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -101,7 +101,6 @@ sub ward : Path : Args(2) { $c->forward( 'load_parent' ); $c->forward( 'check_canonical_url', [ $council ] ); $c->forward( 'load_and_group_problems' ); - $c->forward( 'sort_problems' ); my $council_short = $c->cobrand->short_name( $c->stash->{council}, $c->stash->{areas_info} ); $c->stash->{rss_url} = '/rss/reports/' . $council_short; @@ -353,7 +352,7 @@ sub load_and_group_problems : Private { $c->stash->{pager} = $problems->pager; $problems = $problems->cursor; # Raw DB cursor for speed - my ( %fixed, %open, @pins ); + my ( %problems, @pins ); my $re_councils = join('|', keys %{$c->stash->{areas_info}}); my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'duration', 'age', 'confirmed', 'photo' ); while ( my @problem = $problems->next ) { @@ -363,7 +362,7 @@ sub load_and_group_problems : Private { # Problem was not sent to any council, add to possible councils $problem{councils} = 0; while ($problem{areas} =~ /,($re_councils)(?=,)/g) { - add_row( \%problem, $1, \%fixed, \%open, \@pins ); + add_row( \%problem, $1, \%problems, \@pins ); } } else { # Add to councils it was sent to @@ -372,37 +371,19 @@ sub load_and_group_problems : Private { $problem{councils} = scalar @council; foreach ( @council ) { next if $c->stash->{council} && $_ != $c->stash->{council}->{id}; - add_row( \%problem, $_, \%fixed, \%open, \@pins ); + add_row( \%problem, $_, \%problems, \@pins ); } } } $c->stash( - fixed => \%fixed, - open => \%open, + problems => \%problems, pins => \@pins, ); return 1; } -sub sort_problems : Private { - my ( $self, $c ) = @_; - - my $id = $c->stash->{council}->{id}; - my $fixed = $c->stash->{fixed}; - my $open = $c->stash->{open}; - - foreach (qw/new old/) { - $c->stash->{fixed}{$id}{$_} = [ sort { $a->{duration} <=> $b->{duration} } @{$fixed->{$id}{$_}} ] - if $fixed->{$id}{$_}; - } - foreach (qw/new older unknown/) { - $c->stash->{open}{$id}{$_} = [ sort { $a->{age} <=> $b->{age} } @{$open->{$id}{$_}} ] - if $open->{$id}{$_}; - } -} - sub redirect_index : Private { my ( $self, $c ) = @_; my $url = '/reports'; @@ -420,20 +401,9 @@ sub redirect_area : Private { $c->res->redirect( $c->uri_for($url) ); } -my $fourweeks = 4*7*24*60*60; sub add_row { - my ( $problem, $council, $fixed, $open, $pins ) = @_; - my $duration_str = ( $problem->{duration} > 2 * $fourweeks ) ? 'old' : 'new'; - my $type = ( $problem->{duration} > 2 * $fourweeks ) - ? 'unknown' - : ($problem->{age} > $fourweeks ? 'older' : 'new'); - # Fixed problems are either old or new - push @{$fixed->{$council}{$duration_str}}, $problem if - exists FixMyStreet::DB::Result::Problem->fixed_states()->{$problem->{state}}; - # Open problems are either unknown, older, or new - push @{$open->{$council}{$type}}, $problem if - exists FixMyStreet::DB::Result::Problem->open_states->{$problem->{state}}; - + my ( $problem, $council, $problems, $pins ) = @_; + push @{$problems->{$council}}, $problem; push @$pins, { latitude => $problem->{latitude}, longitude => $problem->{longitude}, diff --git a/templates/web/fixmystreet/reports/council.html b/templates/web/fixmystreet/reports/council.html index 6b71eb4f9..7ed4c45b1 100755 --- a/templates/web/fixmystreet/reports/council.html +++ b/templates/web/fixmystreet/reports/council.html @@ -93,56 +93,18 @@ [% INCLUDE 'pagination.html', param = 'p' %] <section class="full-width"> - <menu id="problems-nav" class="tab-nav"> - <ul> - [% IF fixed.${council.id}.new %]<li><a href="#recently_fixed">[% loc('Recently fixed') %]</a></li>[% END %] - [% IF open.${council.id}.new %]<li><a href="#new_problems">[% loc( 'New problems' ) %]</a></li>[% END %] - [% IF open.${council.id}.older%]<li><a href="#older_problems">[% loc( 'Older problems' ) %]</a></li>[% END %] - [% IF open.${council.id}.unknown %]<li><a href="#old_unknown_problems">[% loc( 'Old / unknown problems' ) %]</a></li>[% END %] - [% IF fixed.${council.id}.old %]<li><a href="#old_fixed">[% loc( 'Old fixed' ) %]</a></li>[% END %] - </ul> - </menu> - [% INCLUDE column - title = loc('Recently fixed') - tab_id = 'recently_fixed' - problems = fixed.${council.id}.new - %] - [% INCLUDE column - title = loc('New problems') - tab_id = 'new_problems' - problems = open.${council.id}.new - %] - - [% INCLUDE column - title = loc('Older problems') - tab_id = 'older_problems' - problems = open.${council.id}.older - %] - - [% INCLUDE column - title = loc('Old / unknown problems') - tab_id = 'old_unknown_problems' - problems = open.${council.id}.unknown - %] - - [% INCLUDE column - title = loc('Old fixed') - tab_id = 'old_fixed' - problems = fixed.${council.id}.old + problems = problems.${council.id} %] </section> - </div> [% INCLUDE 'footer.html' %] [% BLOCK column %] [% IF problems %] -<h3 class="hidden-js">[% title %]</h3> - -<ul id="[% tab_id %]" class="issue-list-a tab"> +<ul class="issue-list-a"> [% FOREACH problem IN problems %] <li> <a href="[% c.uri_for('/report/' _ problem.id) %]"> diff --git a/web/cobrands/fixmystreet/base.scss b/web/cobrands/fixmystreet/base.scss index 8b49d2c6a..7f014bf67 100644 --- a/web/cobrands/fixmystreet/base.scss +++ b/web/cobrands/fixmystreet/base.scss @@ -872,7 +872,7 @@ a:hover.button-left { } } .text { - padding:0.5em 1em; + padding:0.25em 1em; h4 { margin:0; } |