diff options
Diffstat (limited to 'perllib')
-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 |
3 files changed, 13 insertions, 31 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 |