diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 30 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 2 | ||||
-rw-r--r-- | templates/web/bromley/index.html | 2 | ||||
-rw-r--r-- | templates/web/bromley/report/display.html | 8 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/_base.scss | 6 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/_layout.scss | 2 |
6 files changed, 45 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index afe180c29..cca625bd5 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -153,6 +153,36 @@ sub generate_map_tags : Private { return 1; } +sub delete :Local :Args(1) { + my ( $self, $c, $id ) = @_; + + $c->forward( 'load_problem_or_display_error', [ $id ] ); + my $p = $c->stash->{problem}; + + my $uri = $c->uri_for( '/report', $id ); + + return $c->res->redirect($uri) unless $c->user_exists; + + my $council = $c->user->obj->from_council; + return $c->res->redirect($uri) unless $council; + + my %councils = map { $_ => 1 } @{$p->councils}; + return $c->res->redirect($uri) unless $councils{$council}; + + $p->state('hidden'); + $p->lastupdate( \'ms_current_timestamp()' ); + $p->update; + + $c->model('DB::AdminLog')->create( { + admin_user => $c->user->email, + object_type => 'problem', + action => 'state_change', + object_id => $id, + } ); + + return $c->res->redirect($uri); +} + __PACKAGE__->meta->make_immutable; 1; diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 6788447d7..7f43d1a52 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -195,7 +195,7 @@ sub split_name { my ($first, $last) = $self->name =~ /^(\S*)(?: (.*))?$/; - return { first => $first, last => $last }; + return { first => $first || '', last => $last || '' }; } 1; diff --git a/templates/web/bromley/index.html b/templates/web/bromley/index.html index 4b95230df..aeb4cc01c 100644 --- a/templates/web/bromley/index.html +++ b/templates/web/bromley/index.html @@ -21,7 +21,7 @@ Modernizr.load({ <h1 class="main mob-only">Reporting a problem in Bromley’s streets or parks</h1> [% IF error %] - <p class="error">[% error %]</p> + <p class="form-error">[% error %]</p> [% END %] <div id="front-main"> diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html index fd74ac8db..c1a938b71 100644 --- a/templates/web/bromley/report/display.html +++ b/templates/web/bromley/report/display.html @@ -24,7 +24,13 @@ <div class="shadow-wrap"> <ul id="key-tools"> - <li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[% loc('Report abuse' ) %]</a></li> + [% IF c.user_exists AND c.user.council == 'Bromley Council' %] + <li><form method="post" action="/report/delete/[% problem.id %]"> + <input type="submit" class="abuse" value="Remove from site"> + </form></li> + [% ELSE %] + <li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[% loc('Report abuse') %]</a></li> + [% END %] <li><a rel="nofollow" id="key-tool-report-updates" class="feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => short_latitude, lon => short_longitude } ) %]">[% loc( 'Problems nearby' ) %]</a></li> </ul> diff --git a/web/cobrands/fixmystreet/_base.scss b/web/cobrands/fixmystreet/_base.scss index ef60a8bef..bc8616954 100644 --- a/web/cobrands/fixmystreet/_base.scss +++ b/web/cobrands/fixmystreet/_base.scss @@ -529,7 +529,11 @@ p.label-valid { &:last-child { border-right:none; } - a { + input[type=submit] { + width: 100%; + border: none; + } + a, input[type=submit] { display: block; background-color: #f5f5f5; background-repeat: no-repeat; diff --git a/web/cobrands/fixmystreet/_layout.scss b/web/cobrands/fixmystreet/_layout.scss index 5756d4df3..207c6a4c4 100644 --- a/web/cobrands/fixmystreet/_layout.scss +++ b/web/cobrands/fixmystreet/_layout.scss @@ -592,7 +592,7 @@ body.twothirdswidthpage { @include box-shadow(-0em 0px 1em 1em #fff); li { border:none; - a { + a, input[type=submit] { font-size: 0.75em; color:#666; padding: 0.5em 1.5em 0.5em 0; |