diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2015-02-09 18:01:32 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2015-10-06 09:09:24 +0100 |
commit | 34f3f5a36b6773ad51060256d4e95efd7c45b3c8 (patch) | |
tree | 5e656a15cc0bda3f930dc019d4dff664b8e035ac /perllib | |
parent | 2ff36453ebaa86e7f58f17ec63d2f95a88b8be99 (diff) |
[Zurich] new status flags
Have moved the generation of banner text from the template into
problem_as_hashref
See mysociety/FixMyStreet-Commercial#672
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 19 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 4 |
4 files changed, 31 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index c5d628ab6..c9286b177 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -207,7 +207,8 @@ sub setup_request { # XXX Put in cobrand / do properly if ($c->cobrand->moniker eq 'zurich') { - FixMyStreet::DB::Result::Problem->visible_states_add_unconfirmed(); + FixMyStreet::DB::Result::Problem->visible_states_add('unconfirmed'); + FixMyStreet::DB::Result::Problem->visible_states_remove('investigating'); } if (FixMyStreet->test_mode) { diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 279994e47..3aaa3e201 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -99,13 +99,20 @@ sub load_problem_or_display_error : Private { my $problem = ( !$id || $id =~ m{\D} ) # is id non-numeric? ? undef # ...don't even search - : $c->cobrand->problems->find( { id => $id } ); + : $c->cobrand->problems->find( { id => $id } ) + or $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] ); # check that the problem is suitable to show. - if ( !$problem || ($problem->state eq 'unconfirmed' && !$c->cobrand->show_unconfirmed_reports) || $problem->state eq 'partial' ) { + # hidden_states includes partial and unconfirmed, but they have specific handling, + # so we check for them first. + if ( $problem->state eq 'partial' ) { $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] ); } - elsif ( $problem->state eq 'hidden' ) { + elsif ( $problem->state eq 'unconfirmed' ) { + $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] ) + unless $c->cobrand->show_unconfirmed_reports ; + } + elsif ( $problem->hidden_states->{ $problem->state } ) { $c->detach( '/page_error_410_gone', [ _('That report has been removed from FixMyStreet.') ] # diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 6b362d5a2..c08d48161 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -135,16 +135,35 @@ sub problem_as_hashref { $hashref->{title} = _('This report is awaiting moderation.'); $hashref->{state} = 'submitted'; $hashref->{state_t} = _('Submitted'); + $hashref->{banner_id} = 'closed'; } else { if ( $problem->state eq 'confirmed' ) { $hashref->{state} = 'open'; $hashref->{state_t} = _('Open'); + $hashref->{banner_id} = 'closed'; + } elsif ( $problem->state eq 'closed' ) { + $hashref->{state} = 'extern'; # is this correct? + $hashref->{banner_id} = 'closed'; + $hashref->{state_t} = _('Extern'); + } elsif ( $problem->state eq 'unable to fix' ) { + $hashref->{state} = 'jurisdiction unknown'; # is this correct? + $hashref->{state_t} = _('Jurisdiction Unknown'); + $hashref->{banner_id} = 'fixed'; # green + } elsif ( $problem->state eq 'partial' ) { + $hashref->{state} = 'not contactable'; # is this correct? + $hashref->{state_t} = _('Not contactable'); + # no banner_id as hidden + } elsif ( $problem->state eq 'investigating' ) { + $hashref->{state} = 'wish'; # is this correct? + $hashref->{state_t} = _('Wish'); } elsif ( $problem->is_fixed ) { $hashref->{state} = 'closed'; + $hashref->{banner_id} = 'fixed'; $hashref->{state_t} = _('Closed'); } elsif ( $problem->state eq 'in progress' || $problem->state eq 'planned' ) { $hashref->{state} = 'in progress'; $hashref->{state_t} = _('In progress'); + $hashref->{banner_id} = 'progress'; } } diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 637f4acbf..3b7f8bcfd 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -323,10 +323,6 @@ sub visible_states_remove { } } -sub visible_states_add_unconfirmed { - $_[0]->visible_states_add('unconfirmed') -} - =head2 @states = FixMyStreet::DB::Problem::council_states(); |