diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 21 | ||||
-rw-r--r-- | templates/web/default/report/update.html | 22 | ||||
-rw-r--r-- | templates/web/default/report/updates.html | 52 | ||||
-rw-r--r-- | templates/web/fixmystreet/report/update.html | 28 | ||||
-rw-r--r-- | templates/web/fixmystreet/report/updates.html | 36 |
5 files changed, 90 insertions, 69 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 59e3a4410..bb7c8dea0 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -51,7 +51,7 @@ sub display : Path('') : Args(1) { return $c->res->redirect( $c->uri_for($1), 301 ); } - $c->forward('load_problem_or_display_error', [ $id ] ); + $c->forward( 'load_problem_or_display_error', [ $id ] ); $c->forward( 'load_updates' ); $c->forward( 'format_problem_for_display' ); } @@ -88,7 +88,24 @@ sub load_updates : Private { { order_by => 'confirmed' } ); - $c->stash->{updates} = $updates; + my $questionnaires = $c->model('DB::Questionnaire')->search( + { + problem_id => $c->stash->{problem}->id, + whenanswered => { '!=', undef }, + old_state => 'confirmed', new_state => 'confirmed', + }, + { order_by => 'whenanswered' } + ); + + my @combined; + while (my $update = $updates->next) { + push @combined, [ $update->{confirmed}, $update ]; + } + while (my $update = $questionnaires->next) { + push @combined, [ $update->{whenanswered}, $update ]; + } + @combined = map { $_->[1] } sort { $a->[0] <=> $b->[0] } @combined; + $c->stash->{updates} = \@combined; return 1; } diff --git a/templates/web/default/report/update.html b/templates/web/default/report/update.html new file mode 100644 index 000000000..048968eae --- /dev/null +++ b/templates/web/default/report/update.html @@ -0,0 +1,22 @@ +[% IF loop.first %] +<div id="updates"> + <h2 class="problem-update-list-header">[% loc('Updates') %]</h2> +[% END %] + <div><div class="problem-update"><p><a name="update_[% update.id %]"></a><em> + [% INCLUDE meta_line %] + </em></p></div> +[% IF NOT update.whenanswered %] + <div class="update-text"> + [% add_links( update.text ) | html_para %] + + [% INCLUDE 'report/photo.html' object=update %] + + [% IF c.cobrand.allow_update_reporting %] + <p align="right"> + <small><a rel="nofollow" class="unsuitable-problem" href="[% c.uri_for( '/contact', { id => update.problem_id, update_id => update.id } ) %]">[% loc('Offensive? Unsuitable? Tell us') %]</a></small> + </p> + [% END %] + </div> +[% END %] + </div> +[% '</div>' IF loop.last %] diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index 4fd3c75d4..d49cb8f58 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -1,36 +1,26 @@ -[% FOREACH update IN updates.all %] -[% IF loop.first %] -<div id="updates"> - <h2 class="problem-update-list-header">[% loc('Updates') %]</h2> +[% FOREACH update IN updates %] +[% INCLUDE 'report/update.html' %] [% END %] - <div><div class="problem-update"><p><a name="update_[% update.id %]"></a><em> - [% IF update.anonymous || update.name == '' %] - [% tprintf( loc( 'Posted anonymously at %s' ), prettify_epoch( update.confirmed_local.epoch ) ) -%] - [%- ELSIF update.user.from_council %] - [% user_name = update.user.name | html %] - [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, update.user.council, prettify_epoch( update.confirmed_local.epoch ) ) -%] - [%- ELSE %] - [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_epoch( update.confirmed_local.epoch ) ) | html -%] - [%- END -%] - [%- c.cobrand.extra_update_meta_text(update) -%] - [%- ", " _ loc( 'marked as fixed' ) IF update.mark_fixed %] - [%- ", " _ loc( 'reopened' ) IF update.mark_open %] - [%- ", " _ tprintf(loc( 'marked as %s' ), update.meta_problem_state) IF update.problem_state %] - </em></p> - </div> +[% BLOCK meta_line %] - <div class="update-text"> - [% add_links( update.text ) | html_para %] + [% IF update.whenanswered %] + [%# A questionnaire update, currently saying report is still open %] + [% tprintf( loc( 'Reporter confirmed report open, via questionnaire at %s' ), prettify_epoch( update.whenanswered_local.epoch ) ) %] + [% RETURN %] + [% END %] - [% INCLUDE 'report/photo.html' object=update %] - - [% IF c.cobrand.allow_update_reporting %] - <p align="right"> - <small><a rel="nofollow" class="unsuitable-problem" href="[% c.uri_for( '/contact', { id => update.problem_id, update_id => update.id } ) %]">[% loc('Offensive? Unsuitable? Tell us') %]</a></small> - </p> - [% END %] - </div> - </div> -[% '</div>' IF loop.last %] + [% IF update.anonymous || update.name == '' %] + [% tprintf( loc( 'Posted anonymously at %s' ), prettify_epoch( update.confirmed_local.epoch ) ) -%] + [%- ELSIF update.user.from_council %] + [% user_name = update.user.name | html %] + [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, update.user.council, prettify_epoch( update.confirmed_local.epoch ) ) -%] + [%- ELSE %] + [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_epoch( update.confirmed_local.epoch ) ) | html -%] + [%- END -%] + [%- c.cobrand.extra_update_meta_text(update) -%] + [%- ", " _ loc( 'marked as fixed' ) IF update.mark_fixed %] + [%- ", " _ loc( 'reopened' ) IF update.mark_open %] + [%- ", " _ tprintf(loc( 'marked as %s' ), update.meta_problem_state) IF update.problem_state %] [% END %] + diff --git a/templates/web/fixmystreet/report/update.html b/templates/web/fixmystreet/report/update.html new file mode 100644 index 000000000..0803ac758 --- /dev/null +++ b/templates/web/fixmystreet/report/update.html @@ -0,0 +1,28 @@ +[% IF loop.first %] +<section class="full-width"> + <h4 class="static-with-rule">[% loc('Updates') %]</h4> + <ul class="issue-list"> +[% END %] + <li> + <div class="update-wrap"> + [% IF update.whenanswered %] + <div class="update-text"> + <p class="meta-2"> [% INCLUDE meta_line %] </p> + </div> + [% ELSE %] + <div class="update-text"> + [% add_links( update.text ) | html_para %] + + <p class="meta-2"> + <a name="update_[% update.id %]"></a> + [% INCLUDE meta_line %] + </p> + </div> + [% INCLUDE 'report/photo.html' object=update %] + [% END %] + </div> + </li> +[% IF loop.last %] + </ul> +</section> +[% END %] diff --git a/templates/web/fixmystreet/report/updates.html b/templates/web/fixmystreet/report/updates.html deleted file mode 100644 index 508e2aacc..000000000 --- a/templates/web/fixmystreet/report/updates.html +++ /dev/null @@ -1,36 +0,0 @@ -[% FOREACH update IN updates.all %] -[% IF loop.first %] -<section class="full-width"> - <h4 class="static-with-rule">[% loc('Updates') %]</h4> - <ul class="issue-list"> -[% END %] - <li> - <div class="update-wrap"> - <div class="update-text"> - [% add_links( update.text ) | html_para %] - - <p class="meta-2"> - <a name="update_[% update.id %]"></a> - [% IF update.anonymous || update.name == '' %] - [% tprintf( loc( 'Posted anonymously at %s' ), prettify_epoch( update.confirmed_local.epoch ) ) -%] - [%- ELSIF update.user.from_council %] - [% user_name = update.user.name | html %] - [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, update.user.council, prettify_epoch( update.confirmed_local.epoch ) ) -%] - [%- ELSE %] - [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_epoch( update.confirmed_local.epoch ) ) | html -%] - [%- END -%] - [%- c.cobrand.extra_update_meta_text(update) -%] - [%- ", " _ loc( 'marked as fixed' ) IF update.mark_fixed %] - [%- ", " _ loc( 'reopened' ) IF update.mark_open %] - [%- ", " _ tprintf(loc( 'marked as %s' ), update.meta_problem_state) IF update.problem_state %] - </p> - </div> - - [% INCLUDE 'report/photo.html' object=update %] - </div> - </li> -[% IF loop.last %] - </ul> -</section> -[% END %] -[% END %]
\ No newline at end of file |