diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-07-30 16:38:57 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-07-30 17:42:14 +0100 |
commit | 68fc33ac915bda5c5e737c037eb7854068039d29 (patch) | |
tree | af44e7bf990b18a6e9f471beeee7bae26df717a2 | |
parent | 25f16cc07a5c1daf721103d6f1f523df26fcbbf8 (diff) |
Add mark as sent button to admin.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 7 | ||||
-rw-r--r-- | t/app/controller/admin.t | 2 | ||||
-rw-r--r-- | templates/web/base/admin/report_edit.html | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 7b760d26d..6145a6eb0 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -705,6 +705,13 @@ sub report_edit : Path('report_edit') : Args(1) { $c->forward( 'log_edit', [ $id, 'problem', 'resend' ] ); } + elsif ( $c->get_param('mark_sent') ) { + $c->forward('check_token'); + $problem->whensent(\'ms_current_timestamp()'); + $problem->update(); + $c->stash->{status_message} = '<p><em>' . _('That problem has been marked as sent.') . '</em></p>'; + $c->forward( 'log_edit', [ $id, 'problem', 'marked sent' ] ); + } elsif ( $c->get_param('flaguser') ) { $c->forward('flag_user'); $c->stash->{problem}->discard_changes; diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index f63a72117..fb3ab1917 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -568,7 +568,7 @@ foreach my $test ( $report->discard_changes; - if ( $report->state eq 'confirmed' ) { + if ($report->state eq 'confirmed' && $report->whensent) { $mech->content_contains( 'type="submit" name="resend"', 'resend button' ); } else { $mech->content_lacks( 'type="submit" name="resend"', 'no resend button' ); diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html index 12560fdf3..f14c1616a 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/report_edit.html @@ -68,7 +68,10 @@ <li>[% loc('Phone:') %] [% problem.user.phone | html %]</li> <li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li> <li>[% loc('Confirmed:') %] [% PROCESS format_time time=problem.confirmed no_time='-' %]</li> -<li>[% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %] [% IF problem.state == 'confirmed' %]<input onclick="return confirm('[% loc('You really want to resend?') %]')" type="submit" name="resend" value="[% loc('Resend report') %]">[% END %]</li> +<li>[% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %] +[% IF problem.state == 'confirmed' AND problem.whensent %]<input onclick="return confirm('[% loc('You really want to resend?') %]')" type="submit" name="resend" value="[% loc('Resend report') %]">[% END %] +[% IF NOT problem.whensent %]<input type="submit" name="mark_sent" value="[% loc('Mark as sent') %]">[% END %] +</li> <li>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %]</li> <li>[% loc('Service:') %] [% problem.service %]</li> <li>[% loc('Cobrand:') %] [% problem.cobrand %]</li> |