diff options
-rw-r--r-- | perllib/FixMyStreet/App/View/Web.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 20 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 13 | ||||
-rw-r--r-- | templates/web/base/admin/list_updates.html | 2 | ||||
-rw-r--r-- | templates/web/base/admin/problem_row.html | 2 | ||||
-rw-r--r-- | templates/web/base/admin/report_blocks.html | 19 | ||||
-rw-r--r-- | templates/web/base/admin/stats_by_state.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/_item.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/_state_select_field.html | 4 | ||||
-rw-r--r-- | templates/web/base/report/inspect/state_groups_select.html | 13 | ||||
-rw-r--r-- | templates/web/base/report/state-list.html | 21 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/state_groups_select.html | 9 |
12 files changed, 40 insertions, 78 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 496463700..fe200a8fc 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -18,6 +18,7 @@ __PACKAGE__->config( expose_methods => [ 'tprintf', 'prettify_dt', 'version', 'decode', + 'prettify_state', ], FILTERS => { add_links => \&add_links, @@ -167,5 +168,15 @@ sub decode { return $text; } +sub prettify_state { + my ($self, $c, $text) = @_; + # New template to prevent interaction with current one + my $tt = FixMyStreet::Template->new({ INCLUDE_PATH => $self->{include_path} }); + my $var; + $tt->process('report/state-list.html', { state => $text }, \$var); + $var =~ s/ - .*//; + return $var; +} + 1; diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 815c5cd81..d59245c15 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -174,22 +174,6 @@ sub photos { return \@photos; } -=head2 problem_state_display - -Returns a string suitable for display lookup in the update meta section. -Removes the '- council/user' bit from fixed states. - -=cut - -sub problem_state_display { - my $self = shift; - - my $state = $self->problem_state; - $state =~ s/ -.*$//; - - return $state; -} - =head2 latest_moderation_log_entry Return most recent ModerationLog object @@ -269,7 +253,7 @@ sub meta_line { } elsif ($self->mark_open) { $update_state = _( 'reopened' ); } elsif ($self->problem_state) { - my $state = $self->problem_state_display; + my $state = $self->problem_state; if ($state eq 'confirmed') { if ($c->stash->{last_state}) { @@ -285,7 +269,7 @@ sub meta_line { $update_state = _( 'marked as action scheduled' ) } elsif ($state eq 'closed') { $update_state = _( 'marked as closed' ) - } elsif ($state eq 'fixed') { + } elsif ($state =~ /^fixed/) { $update_state = _( 'marked as fixed' ) } elsif ($state eq 'unable to fix') { $update_state = _( 'marked as no further action' ) diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 84db41490..c9fd56773 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -609,19 +609,6 @@ sub is_visible { return exists $self->visible_states->{ $self->state } ? 1 : 0; } -=head2 state_display - -Returns a string suitable for display lookup in the update meta section. -Removes the '- council/user' bit from fixed states. - -=cut - -sub state_display { - my $self = shift; - (my $state = $self->state) =~ s/ -.*$//; - return $state; -} - =head2 meta_line Returns a string to be used on a problem report page, describing some of the diff --git a/templates/web/base/admin/list_updates.html b/templates/web/base/admin/list_updates.html index 35f7adf66..d759a2354 100644 --- a/templates/web/base/admin/list_updates.html +++ b/templates/web/base/admin/list_updates.html @@ -34,7 +34,7 @@ <td>[% IF update.user.id == update.problem.user_id %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% IF update.user.belongs_to_body( update.problem.bodies_str ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% update.cobrand %]<br>[% update.cobrand_data | html %]</td> - <td>[% state_pretty.${update.state} %]<br><small> + <td>[% prettify_state(update.state) %]<br><small> [% loc('Created:') %] [% PROCESS format_time time=update.created %] <br>[% loc('Confirmed:') %] [% PROCESS format_time time=update.confirmed %] </small></td> diff --git a/templates/web/base/admin/problem_row.html b/templates/web/base/admin/problem_row.html index 577e36992..e7e18dee9 100644 --- a/templates/web/base/admin/problem_row.html +++ b/templates/web/base/admin/problem_row.html @@ -30,7 +30,7 @@ [%- END -%] <br>[% problem.cobrand %]<br>[% problem.cobrand_data | html %] </td> - <td>[% state_pretty.${problem.state} %]<br><small> + <td>[% prettify_state(problem.state) %]<br><small> [% loc('Created') %]: [% PROCESS format_time time=problem.created %] <br>[% loc('When sent') %]: [% PROCESS format_time time=problem.whensent %] [%- IF problem.is_visible %]<br>[% loc('Confirmed:' ) %] [% PROCESS format_time time=problem.confirmed %][% END -%] diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html index 9231dd1c2..933521b94 100644 --- a/templates/web/base/admin/report_blocks.html +++ b/templates/web/base/admin/report_blocks.html @@ -2,25 +2,6 @@ SET report_blocks_included = 1; -SET state_pretty = { - 'confirmed' = loc('Open') - 'investigating' = loc('Investigating') - 'planned' = loc('Planned') - 'in progress' = loc('In progress') - 'action scheduled' = loc('Action Scheduled') - 'fixed' = loc('Fixed') - 'fixed - user' = loc('Fixed - User') - 'fixed - council' = loc('Fixed - Council') - 'unable to fix' = loc('No further action') - 'not responsible' = loc('Not Responsible') - 'duplicate' = loc('Duplicate') - 'closed' = loc('Closed') - 'internal referral' = loc('Internal referral') - 'hidden' = loc('Hidden') - 'partial' = loc('Partial') - 'unconfirmed' = loc('Unconfirmed') -}; - SET state_groups = [ [ loc('Open'), [ 'confirmed', 'investigating', 'planned', 'in progress', 'action scheduled' ] ], [ loc('Fixed'), [ 'fixed', 'fixed - user', 'fixed - council' ] ], diff --git a/templates/web/base/admin/stats_by_state.html b/templates/web/base/admin/stats_by_state.html index b003d934e..6bcd35f88 100644 --- a/templates/web/base/admin/stats_by_state.html +++ b/templates/web/base/admin/stats_by_state.html @@ -4,7 +4,7 @@ [%- BLOCK states -%] [%- FOREACH state IN list %] [%- '<ul>' IF loop.first %] - <li>[% object.$state %] [% state_pretty.$state %]</li> + <li>[% object.$state %] [% prettify_state(state) %]</li> [%- "\n</ul>" IF loop.last %] [%- END %] [% END -%] diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 6896aa86e..dc53e81aa 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -92,7 +92,7 @@ </div> <div> <h4>[% loc('State') %]</h4> - <p>[% state_pretty.${problem.state} %]</p> + <p>[% prettify_state(problem.state) %]</p> </div> <div> <h4>[% loc('Priority') %]</h4> diff --git a/templates/web/base/report/_state_select_field.html b/templates/web/base/report/_state_select_field.html index adec1ff06..c580c897d 100644 --- a/templates/web/base/report/_state_select_field.html +++ b/templates/web/base/report/_state_select_field.html @@ -9,12 +9,12 @@ [% END ~%] [% END ~%] [% IF NOT found ~%] - <option selected value="[% current_state %]">[% state_pretty.$current_state %]</option> + <option selected value="[% current_state %]">[% prettify_state(current_state) %]</option> [% END ~%] [% FOREACH group IN state_groups %] <optgroup label="[% group.0 %]"> [% FOREACH state IN group.1 %] - <option [% 'selected ' IF state == current_state %]value="[% state %]">[% state_pretty.$state %]</option> + <option [% 'selected ' IF state == current_state %]value="[% state %]">[% prettify_state(state) %]</option> [% END %] </optgroup> [% END %] diff --git a/templates/web/base/report/inspect/state_groups_select.html b/templates/web/base/report/inspect/state_groups_select.html index c344bf6d0..af41c6770 100644 --- a/templates/web/base/report/inspect/state_groups_select.html +++ b/templates/web/base/report/inspect/state_groups_select.html @@ -1,17 +1,4 @@ [% -SET state_pretty = { - 'confirmed' = loc('Open') - 'investigating' = loc('Investigating') - 'in progress' = loc('In progress') - 'action scheduled' = loc('Action Scheduled') - 'fixed - council' = loc('Fixed - Council') - 'fixed - user' = loc('Fixed - User') - 'unable to fix' = loc('No further action') - 'not responsible' = loc('Not Responsible') - 'duplicate' = loc('Duplicate') - 'internal referral' = loc('Internal referral') - 'hidden' = loc('Hidden') -}; SET state_groups = [ [ loc('Open'), [ 'confirmed', 'investigating', 'in progress', 'action scheduled' ] ], diff --git a/templates/web/base/report/state-list.html b/templates/web/base/report/state-list.html new file mode 100644 index 000000000..e137c81e2 --- /dev/null +++ b/templates/web/base/report/state-list.html @@ -0,0 +1,21 @@ +[% +SET state_pretty = { + 'confirmed' = loc('Open') + 'investigating' = loc('Investigating') + 'planned' = loc('Planned') + 'in progress' = loc('In progress') + 'action scheduled' = loc('Action Scheduled') + 'fixed' = loc('Fixed') + 'fixed - user' = loc('Fixed - User') + 'fixed - council' = loc('Fixed - Council') + 'unable to fix' = loc('No further action') + 'not responsible' = loc('Not Responsible') + 'duplicate' = loc('Duplicate') + 'closed' = loc('Closed') + 'internal referral' = loc('Internal referral') + 'hidden' = loc('Hidden') + 'partial' = loc('Partial') + 'unconfirmed' = loc('Unconfirmed') +}; +state_pretty.$state +~%] diff --git a/templates/web/oxfordshire/report/inspect/state_groups_select.html b/templates/web/oxfordshire/report/inspect/state_groups_select.html index 529e6f403..dcb24c982 100644 --- a/templates/web/oxfordshire/report/inspect/state_groups_select.html +++ b/templates/web/oxfordshire/report/inspect/state_groups_select.html @@ -1,13 +1,4 @@ [% -SET state_pretty = { - 'confirmed' = loc('Open') - 'investigating' = loc('Investigating') - 'action scheduled' = loc('Action Scheduled') - 'fixed - council' = loc('Fixed') - 'not responsible' = loc('Not Responsible') - 'duplicate' = loc('Duplicate') - 'unable to fix' = loc('No further action') -}; SET state_groups = [ [ loc('New'), [ 'confirmed', 'investigating' ] ], |