aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2015-02-09 18:01:32 +0000
committerDave Arter <davea@mysociety.org>2015-10-06 09:09:24 +0100
commit34f3f5a36b6773ad51060256d4e95efd7c45b3c8 (patch)
tree5e656a15cc0bda3f930dc019d4dff664b8e035ac
parent2ff36453ebaa86e7f58f17ec63d2f95a88b8be99 (diff)
[Zurich] new status flags
Have moved the generation of banner text from the template into problem_as_hashref See mysociety/FixMyStreet-Commercial#672
-rw-r--r--perllib/FixMyStreet/App.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm13
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm19
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm4
-rw-r--r--templates/web/zurich/admin/report_edit.html5
-rw-r--r--templates/web/zurich/report/banner.html19
-rw-r--r--web/cobrands/zurich/base.scss4
7 files changed, 41 insertions, 26 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();
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index 50627eb48..1bf7c2a5c 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -101,11 +101,14 @@
['confirmed', loc('Open')],
['planned', loc('Planned')],
['hidden', loc('Hidden')],
+ ['investigating', loc('Wish')],
+ ['partial', loc('Not contactable')],
+ ['unable to fix', loc('Jurisdiction unknown')],
] %]
<option [% 'selected ' IF s.0 == problem.state %] value="[% s.0 %]">[% s.1 %]</option>
[% END %]
[% IF problem.state == 'closed' %]
- <option selected value="closed">[% loc('Closed') %]</option>
+ <option selected value="closed">[% loc('Extern') %]</option>
[% ELSIF problem.state == 'fixed - council' %]
<option selected value="fixed - council">[% loc('Closed') %]</option>
[% ELSIF problem.state == 'in progress' %]
diff --git a/templates/web/zurich/report/banner.html b/templates/web/zurich/report/banner.html
index eda70a0de..c10a99ef6 100644
--- a/templates/web/zurich/report/banner.html
+++ b/templates/web/zurich/report/banner.html
@@ -1,17 +1,6 @@
[% USE date %]
-[% BLOCK banner %]
- <div class="banner">
- <p id="[% id %]">[% text %]</p>
- </div>
-[% END %]
-
-[% IF problem.state == 'unconfirmed' %]
- [% INCLUDE banner, id = 'closed', text = loc('Submitted') %]
-[% ELSIF problem.state == 'confirmed' %]
- [% INCLUDE banner, id = 'closed', text = loc('Open') %]
-[% ELSIF problem.is_fixed OR problem.is_closed %]
- [% INCLUDE banner, id = 'fixed', text = loc('Closed') %]
-[% ELSIF problem.state == 'in progress' OR problem.state == 'planned' %]
- [% INCLUDE banner, id = 'progress', text = loc('In progress') %]
-[% END %]
+[% problem_hashref = c.cobrand.problem_as_hashref(problem, c) %]
+<div class="banner">
+ <p id="[% problem_hashref.banner_id %]">[% problem_hashref.state_t %]</p>
+</div>
diff --git a/web/cobrands/zurich/base.scss b/web/cobrands/zurich/base.scss
index 013c071bd..356757716 100644
--- a/web/cobrands/zurich/base.scss
+++ b/web/cobrands/zurich/base.scss
@@ -42,11 +42,11 @@
}
&#closed {
color: #1a1a1a;
- background: #e25436;
+ background: #e25436; // red
}
&#progress {
color: #1a1a1a;
- background: #f3d74b;
+ background: #f3d74b; //purple
}
}
}