diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 66 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 3 | ||||
-rw-r--r-- | t/app/controller/admin/report_edit.t | 4 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 6 | ||||
-rw-r--r-- | web/cobrands/zurich/base.scss | 4 | ||||
-rw-r--r-- | web/cobrands/zurich/layout.scss | 22 |
7 files changed, 47 insertions, 59 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 15da61f35..5fa573292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Stop asset layers obscuring marker layer. #1999 - Don't delete hidden field values when inspecting reports. #1999 - Fix text layout issues in /reports/…/summary dashboard charts. + - Fix post-edit issues on admin report edit page. - Admin improvements: - Inspectors can set non_public status of reports. #1992 - Development improvements: diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 85b6204fc..253840082 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -780,24 +780,10 @@ sub update_user : Private { return 0; } -sub report_edit : Path('report_edit') : Args(1) { - my ( $self, $c, $id ) = @_; - - my $problem = $c->cobrand->problems->search( { id => $id } )->first; - - $c->detach( '/page_error_404_not_found', [] ) - unless $problem; - - unless ( - $c->cobrand->moniker eq 'zurich' - || $c->user->has_permission_to(report_edit => $problem->bodies_str_ids) - ) { - $c->detach( '/page_error_403_access_denied', [] ); - } - - $c->stash->{problem} = $problem; +sub report_edit_display : Private { + my ( $self, $c ) = @_; - $c->forward('/auth/get_csrf_token'); + my $problem = $c->stash->{problem}; $c->stash->{page} = 'admin'; FixMyStreet::Map::display_map( @@ -814,27 +800,29 @@ sub report_edit : Path('report_edit') : Args(1) { : [], print_report => 1, ); +} - if (my $rotate_photo_param = $self->_get_rotate_photo_param($c)) { - $self->rotate_photo($c, $problem, @$rotate_photo_param); - if ( $c->cobrand->moniker eq 'zurich' ) { - # Clicking the photo rotation buttons should do nothing - # except for rotating the photo, so return the user - # to the report screen now. - $c->res->redirect( $c->uri_for( 'report_edit', $problem->id ) ); - return; - } else { - return 1; - } - } +sub report_edit : Path('report_edit') : Args(1) { + my ( $self, $c, $id ) = @_; - $c->forward('categories_for_point'); + my $problem = $c->cobrand->problems->search( { id => $id } )->first; - if ( $c->cobrand->moniker eq 'zurich' ) { - my $done = $c->cobrand->admin_report_edit(); - return if $done; + $c->detach( '/page_error_404_not_found', [] ) + unless $problem; + + unless ( + $c->cobrand->moniker eq 'zurich' + || $c->user->has_permission_to(report_edit => $problem->bodies_str_ids) + ) { + $c->detach( '/page_error_403_access_denied', [] ); } + $c->stash->{problem} = $problem; + + $c->forward('/auth/get_csrf_token'); + + $c->forward('categories_for_point'); + $c->forward('check_username_for_abuse', [ $problem->user ] ); $c->stash->{updates} = @@ -842,6 +830,16 @@ sub report_edit : Path('report_edit') : Args(1) { ->search( { problem_id => $problem->id }, { order_by => 'created' } ) ->all ]; + if (my $rotate_photo_param = $self->_get_rotate_photo_param($c)) { + $self->rotate_photo($c, $problem, @$rotate_photo_param); + $c->detach('report_edit_display'); + } + + if ( $c->cobrand->moniker eq 'zurich' ) { + my $done = $c->cobrand->admin_report_edit(); + $c->detach('report_edit_display') if $done; + } + if ( $c->get_param('resend') ) { $c->forward('/auth/check_csrf_token'); @@ -937,7 +935,7 @@ sub report_edit : Path('report_edit') : Args(1) { $problem->discard_changes; } - return 1; + $c->detach('report_edit_display'); } =head2 report_edit_category diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 5e85715a2..7062f481f 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -121,8 +121,7 @@ sub load_problem_or_display_error : Private { $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] ) unless $c->cobrand->show_unconfirmed_reports ; } - elsif ( $problem->hidden_states->{ $problem->state } or - (($problem->get_extra_metadata('closure_status')||'') eq 'hidden')) { + elsif ( $problem->hidden_states->{ $problem->state } ) { $c->detach( '/page_error_410_gone', [ _('That report has been removed from FixMyStreet.') ] # diff --git a/t/app/controller/admin/report_edit.t b/t/app/controller/admin/report_edit.t index a8a0bd143..e61f781f5 100644 --- a/t/app/controller/admin/report_edit.t +++ b/t/app/controller/admin/report_edit.t @@ -364,6 +364,10 @@ foreach my $test ( $mech->content_lacks( 'type="submit" name="resend"', 'no resend button' ); } + if ($report->state eq 'fixed') { + $mech->content_contains('pin-green'); + } + $test->{changes}->{flagged} = 1 if $test->{changes}->{flagged}; $test->{changes}->{non_public} = 1 if $test->{changes}->{non_public}; diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 385f7f077..7be6bd3b2 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -269,7 +269,7 @@ subtest "report_edit" => sub { $mech->get_ok( '/admin/report_edit/' . $report->id ); $mech->submit_form_ok( { with_fields => { state => 'hidden' } } ); - $mech->get_ok( '/admin/report_edit/' . $report->id ); + $mech->get_ok( '/report/' . $report->id, 'still visible as response not published yet' ); $report->discard_changes; is ( $report->get_extra_metadata('moderated_overdue'), 0, 'Still marked moderated_overdue' ); @@ -280,6 +280,7 @@ subtest "report_edit" => sub { or diag $report->get_column('extra'); # publishing actually sets hidden + $mech->get_ok( '/admin/report_edit/' . $report->id ); $mech->form_with_fields( 'status_update' ); $mech->submit_form_ok( { button => 'publish_response' } ); $mech->get_ok( '/admin/report_edit/' . $report->id ); @@ -288,7 +289,8 @@ subtest "report_edit" => sub { is ( $report->get_extra_metadata('closed_overdue'), 0, "Closing as hidden sets closed_overdue..." ); is ( $report->state, 'hidden', 'Closing as hidden sets state to hidden'); is ( $report->get_extra_metadata('closure_status'), undef, 'Closing as hidden unsets closure_status'); - + $mech->get( '/report/' . $report->id); + is $mech->res->code, 410; reset_report_state($report); is ( $report->get_extra_metadata('moderated_overdue'), undef, 'Sanity check' ); diff --git a/web/cobrands/zurich/base.scss b/web/cobrands/zurich/base.scss index 3b13a93cf..101118a02 100644 --- a/web/cobrands/zurich/base.scss +++ b/web/cobrands/zurich/base.scss @@ -223,6 +223,10 @@ h4.static-with-rule { input[type="checkbox"] + label.inline { margin-right: 0.2em; } + + table tr.is-deleted { + background-color: transparent; + } } .admin-label--inline { diff --git a/web/cobrands/zurich/layout.scss b/web/cobrands/zurich/layout.scss index a5e6735d7..d49f400e6 100644 --- a/web/cobrands/zurich/layout.scss +++ b/web/cobrands/zurich/layout.scss @@ -11,11 +11,6 @@ $mappage-header-height: 7em; color: #3c3c3c; } -// Fix positioning of images in the admin -body.admin .admin-nav-wrapper { - z-index: 1; -} - // Different header and logo #site-header { background-color: #fff; @@ -239,10 +234,6 @@ body.twothirdswidthpage { // Admin specific changes -body.fullwidthpage.admin .content { - width: 100%; -} - body.mappage.admin { // Shuffle things around so they're in the right place #map_box { @@ -254,11 +245,6 @@ body.mappage.admin { width: 40em; padding: 0; background: #fff url(/cobrands/zurich/admin-faux-columns.gif) top center repeat-y; - @include box-shadow(0 0 5px rgba(0,0,0,0.5)); - } - .content { - // To push down the admin navigation - margin-top: 6em; } } @@ -347,15 +333,9 @@ body.mappage.admin { } .admin-nav-wrapper { - background-color: white; padding: 1.5em 0 1em; } body.mappage .admin-nav-wrapper { - box-sizing: border-box; - padding-left: 10px; - padding-right: 10px; - position: fixed; - width: 100%; - @include box-shadow(0 0 5px rgba(0,0,0,0.5)); + margin-top: 6em; } |