diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-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-- | templates/email/default/_email_bottom.html | 22 | ||||
-rw-r--r-- | templates/email/default/_email_settings.html | 9 | ||||
-rw-r--r-- | templates/email/default/_email_top.html | 23 | ||||
-rw-r--r-- | templates/email/fixamingata/_email_bottom.html | 22 | ||||
-rw-r--r-- | web/cobrands/zurich/base.scss | 4 | ||||
-rw-r--r-- | web/cobrands/zurich/layout.scss | 22 |
11 files changed, 94 insertions, 89 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c6bced606..5fa573292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,12 @@ - Front end improvements: - Improve questionnaire process. #1939 #1998 - Increase size of "sub map links" (hide pins, permalink, etc) #2003 + - Edge-to-edge email layout on narrow screens #2010 - Bugfixes: - 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 5c1ff9a0e..4ae9a0cde 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 ); @@ -293,6 +294,9 @@ subtest "report_edit" => sub { $report->discard_changes; is ( $report->state, 'hidden', 'Another internal note does not reopen'); + $mech->get( '/report/' . $report->id); + is $mech->res->code, 410; + reset_report_state($report); is ( $report->get_extra_metadata('moderated_overdue'), undef, 'Sanity check' ); is get_moderated_count(), 0; diff --git a/templates/email/default/_email_bottom.html b/templates/email/default/_email_bottom.html index 76e381201..0b2c0b697 100644 --- a/templates/email/default/_email_bottom.html +++ b/templates/email/default/_email_bottom.html @@ -1,17 +1,21 @@ </tr> - <tr> - <th colspan="[% email_columns %]" style="[% td_style %][% hint_style %]" class="hint"> - [%~ IF email_footer %] - [% email_footer %] - [%~ ELSE %] - This email was sent automatically, from an unmonitored email account. Please do not reply to it. - [%~ END %] - </th> - </tr> </table> </th> <th></th> </tr> </table> + <table [% wrapper_table %] style="[% wrapper_style %]"> + <tr> + <th></th> + <th width="[% wrapper_max_width %]" style="[% td_style %][% hint_style %]" class="hint"> + [%~ IF email_footer %] + [% email_footer %] + [%~ ELSE %] + This email was sent automatically, from an unmonitored email account. Please do not reply to it. + [%~ END %] + </th> + <th></th> + </tr> + </table> </body> </html> diff --git a/templates/email/default/_email_settings.html b/templates/email/default/_email_settings.html index 54abc2b50..f6db8334c 100644 --- a/templates/email/default/_email_settings.html +++ b/templates/email/default/_email_settings.html @@ -60,7 +60,7 @@ button_font_weight = "bold" # Variables used inside the email templates. table_reset = 'cellspacing="0" cellpadding="0" border="0" width="100%"' -wrapper_table = 'cellspacing="0" cellpadding="5" border="0" width="100%"' +wrapper_table = table_reset link_style = "color: $link_text_color;" link_hover_style = "text-decoration: none; color: $link_hover_text_color;" @@ -70,7 +70,12 @@ td_style = "font-family: $body_font_family; font-size: 16px; line-height: 21px; body_style = "margin: 0;" wrapper_style = "$td_style background: $body_background_color; color: $body_text_color;" -hint_style = "padding: ${ column_padding }px 0; color: $body_text_color; font-size: 12px; line-height: 18px;" +wrapper_max_width = 620 # in pixels without "px" suffix +wrapper_min_width = 520 # in pixels without "px" suffix + +hint_min_width = wrapper_min_width - (column_padding * 2) +hint_style = "min-width: ${ hint_min_width }px; padding: ${ column_padding }px; color: $body_text_color; font-size: 12px; line-height: 18px;" + header_style = "padding: $header_padding; background: $header_background_color; color: $header_text_color;" only_column_style = "padding: ${ column_padding }px; vertical-align: top; background-color: $primary_column_background_color; color: $primary_column_text_color;" diff --git a/templates/email/default/_email_top.html b/templates/email/default/_email_top.html index 102e23e59..d9e3becf2 100644 --- a/templates/email/default/_email_top.html +++ b/templates/email/default/_email_top.html @@ -22,14 +22,11 @@ font-family: [% body_font_family %] !important; } - [%~ # 550px = 5+5+5+520+5+5+5 %] - @media only screen and (max-width: 549px) { - #main { + @media only screen and (max-width: [% wrapper_min_width - 1 %]px) { + #main, .hint { min-width: 0 !important; } - } - @media only screen and (max-width: 500px) { #main table, #main tr, #main th { display: block !important; } @@ -45,14 +42,18 @@ <table [% wrapper_table %] style="[% wrapper_style %]"> <tr> <th></th> - <th width="620" style="[% td_style %] min-width: 520px;" id="main"> + <th width="[% wrapper_max_width %]" style="[% td_style %][% hint_style %]" class="hint"> + [% email_summary %] + </th> + <th></th> + </tr> + </table> + <table [% wrapper_table %] style="[% wrapper_style %]"> + <tr> + <th></th> + <th width="[% wrapper_max_width %]" style="[% td_style %] min-width: [% wrapper_min_width %]px;" id="main"> <table [% table_reset %]> <tr> - <th colspan="[% email_columns %]" style="[% td_style %][% hint_style %]" class="hint"> - [% email_summary %] - </th> - </tr> - <tr> <th colspan="[% email_columns %]" style="[% td_style %][% header_style %]"> [%~ IF file_exists("web/cobrands/${ img_dir }/images/email-logo.gif") ~%] <img src="[% inline_image('web/cobrands/' _ img_dir _ '/images/email-logo.gif') %]" width="[% logo_width %]" height="[% logo_height %]" alt="[% site_name %]" style="[% logo_style %]"/> diff --git a/templates/email/fixamingata/_email_bottom.html b/templates/email/fixamingata/_email_bottom.html index dab4486cd..0a8c95c1c 100644 --- a/templates/email/fixamingata/_email_bottom.html +++ b/templates/email/fixamingata/_email_bottom.html @@ -1,17 +1,21 @@ </tr> - <tr> - <th colspan="[% email_columns %]" style="[% td_style %][% hint_style %]" class="hint"> - [%~ IF email_footer %] - [% email_footer %] - [%~ ELSE %] - Det går inte att svara på detta mail - [%~ END %] - </th> - </tr> </table> </th> <th></th> </tr> </table> + <table [% wrapper_table %] style="[% wrapper_style %]"> + <tr> + <th></th> + <th width="[% wrapper_max_width %]" style="[% td_style %][% hint_style %]" class="hint"> + [%~ IF email_footer %] + [% email_footer %] + [%~ ELSE %] + Det går inte att svara på detta mail + [%~ END %] + </th> + <th></th> + </tr> + </table> </body> </html> 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; } |