diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 16 | ||||
-rw-r--r-- | templates/web/zurich/admin/index-sdm.html | 4 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit-sdm.html | 40 |
4 files changed, 60 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index d40a4c61d..e9b4bb9a2 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -587,10 +587,6 @@ sub reports : Path('reports') { sub report_edit : Path('report_edit') : Args(1) { my ( $self, $c, $id ) = @_; - if ( $c->cobrand->moniker eq 'zurich' ) { - $c->cobrand->admin_bodies(); - } - my $site_restriction = $c->cobrand->site_restriction; my $problem = $c->cobrand->problems->search( @@ -604,6 +600,10 @@ sub report_edit : Path('report_edit') : Args(1) { $c->stash->{problem} = $problem; + if ( $c->cobrand->moniker eq 'zurich' ) { + $c->cobrand->admin_report_edit(); + } + $c->forward('get_token'); $c->forward('check_email_for_abuse', [ $problem->user->email ] ); diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 0c362f612..15397e0a2 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -110,17 +110,29 @@ sub admin { } } -sub admin_bodies { +sub admin_report_edit { my $self = shift; my $c = $self->{c}; my $type = $self->admin_type(); + my $problem = $c->stash->{problem}; + my $body = $c->stash->{body}; + + my %allowed_bodies = map { $_->id => 1 } ( $body->bodies->all, $body ); + $c->detach( '/page_error_404_not_found' ) + unless $allowed_bodies{$problem->bodies_str}; + if ($type eq 'dm') { - my $body = $c->stash->{body}; my @bodies = $c->model('DB::Body')->search( [ { parent => $body->parent->id }, { parent => $body->id } ] ); @bodies = sort { strcoll($a->name, $b->name) } @bodies; $c->stash->{bodies} = \@bodies; + } elsif ($type eq 'sdm') { + $c->stash->{template} = 'admin/report_edit-sdm.html'; + my @bodies = $c->model('DB::Body')->search( [ { id => $body->parent->id }, { id => $body->id } ] ); + @bodies = sort { strcoll($a->name, $b->name) } @bodies; + $c->stash->{bodies} = \@bodies; } + } 1; diff --git a/templates/web/zurich/admin/index-sdm.html b/templates/web/zurich/admin/index-sdm.html index c4659d56c..3d15940f7 100644 --- a/templates/web/zurich/admin/index-sdm.html +++ b/templates/web/zurich/admin/index-sdm.html @@ -19,7 +19,7 @@ <th>[% loc('Title') %]</th> <th>[% loc('Category') %]</th> <th>[% loc('Created') %]</th> - <!-- <th>*</th> --> + <th>*</th> </tr> [%- FOR problem IN problems %] <tr[% ' class="adminhidden"' IF problem.state == 'hidden' %]> @@ -27,7 +27,7 @@ <td>[% PROCESS value_or_nbsp value=problem.title %]</td> <td>[% problem.category %]</td> <td>[% PROCESS format_time time=problem.created %]</td> - <!-- <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> --> + <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> </tr> [%- END -%] </table> diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html new file mode 100644 index 000000000..bdbf2735b --- /dev/null +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -0,0 +1,40 @@ +[% INCLUDE 'admin/header.html' title=tprintf(loc('Editing problem %d'), problem.id ) -%] +[% PROCESS 'admin/report_blocks.html' %] + +[% status_message %] + +<form method="post" action="[% c.uri_for( 'report_edit', problem.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> + <input type="hidden" name="token" value="[% token %]" > + <input type="hidden" name="submit" value="1" > +<ul> + [%- cobrand_data = problem.cobrand_data %] + [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %] +<li><a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% loc('View report on site' )%]</a></li> +<li>[% loc('Details:') %] [% problem.detail | html %]</li> +<li>[% loc('Co-ordinates:') %] [% problem.latitude %], [% problem.longitude %] ( [% loc('originally entered') %] ‘[% problem.postcode | html %]’, [% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li> +<li>[% loc('Body:') %] + <select name="body"> + [% FOR body IN bodies %] + <option value="[% body.id %]"[% IF body.id == problem.bodies_str%] selected[% END %]>[% body.name %]</option> + [% END %] + </select> +</li> + +<li>[% loc('Internal notes:') %] [% problem.extra | html %] +<li>[% loc('Category:') %] [% problem.category | html %] </li> +<li>[% loc('Name:') %] [% problem.name | html %] +<li>[% loc('Email:') %] [% problem.user.email | html %] +[% IF NOT problem.anonymous %][% loc('Confirmed') %][% END %] +<li>[% loc('Phone:') %] [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</li> +<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li> + +<li><label for="status_update">[% loc('Update:') %]</label> +<textarea name='status_update' id='status_update' cols=60 rows=5></textarea></li> + +</ul> + +<input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" ></form> + +[% INCLUDE 'admin/list_updates.html' %] + +[% INCLUDE 'admin/footer.html' %] |