From c4d726bacd492bd4281b9eddbdc29d3190444d3c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 20 Jan 2015 12:51:07 +0000 Subject: Rename 'body_edit' admin endpoint to 'body'. --- perllib/FixMyStreet/App/Controller/Admin.pm | 9 ++- perllib/FixMyStreet/Cobrand/Zurich.pm | 1 - t/app/controller/admin.t | 12 ++-- templates/web/base/admin/body.html | 2 +- templates/web/base/admin/body_edit.html | 103 ---------------------------- templates/web/base/admin/category_edit.html | 103 ++++++++++++++++++++++++++++ templates/web/zurich/admin/body.html | 2 +- 7 files changed, 115 insertions(+), 117 deletions(-) delete mode 100644 templates/web/base/admin/body_edit.html create mode 100644 templates/web/base/admin/category_edit.html diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 3e5a1a95a..de13a76de 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -427,7 +427,7 @@ sub update_contacts : Private { # Remove any others $c->stash->{body}->body_areas->search( { area_id => [ keys %current ] } )->delete; - $c->stash->{updated} = _('Configuration updated - contacts will be generated automatically later'); + $c->stash->{updated} = _('Values updated'); } } @@ -485,13 +485,13 @@ sub lookup_body : Private { } # This is for if the category name contains a '/' -sub body_edit_all : Path('body_edit') { +sub category_edit_all : Path('body') { my ( $self, $c, $body_id, @category ) = @_; my $category = join( '/', @category ); - $c->go( 'body_edit', [ $body_id, $category ] ); + $c->go( 'category_edit', [ $body_id, $category ] ); } -sub body_edit : Path('body_edit') : Args(2) { +sub category_edit : Path('body') : Args(2) { my ( $self, $c, $body_id, $category ) = @_; $c->stash->{body_id} = $body_id; @@ -1201,7 +1201,6 @@ sub set_allowed_pages : Private { 'config' => [ _('Configuration'), 8], 'user_edit' => [undef, undef], 'body' => [undef, undef], - 'body_edit' => [undef, undef], 'report_edit' => [undef, undef], 'update_edit' => [undef, undef], 'abuse_edit' => [undef, undef], diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 087d9046b..577da9dd5 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -296,7 +296,6 @@ sub admin_pages { $pages = { %$pages, 'bodies' => [_('Bodies'), 1], 'body' => [undef, undef], - 'body_edit' => [undef, undef], }; return $pages if $type eq 'dm'; diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 9ff5b5c90..58d7e0e96 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -201,12 +201,12 @@ subtest 'check contact creation' => sub { note => 'test/note', non_public => 'on', } } ); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test/category'); + $mech->get_ok('/admin/body/' . $body->id . '/test/category'); }; subtest 'check contact editing' => sub { - $mech->get_ok('/admin/body_edit/' . $body->id .'/test%20category'); + $mech->get_ok('/admin/body/' . $body->id .'/test%20category'); $mech->submit_form_ok( { with_fields => { email => 'test2@example.com', @@ -219,7 +219,7 @@ subtest 'check contact editing' => sub { $mech->content_contains( 'test2 note' ); $mech->content_contains( 'Private: No' ); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->submit_form_ok( { with_fields => { email => 'test2@example.com', note => 'test2 note', @@ -228,12 +228,12 @@ subtest 'check contact editing' => sub { $mech->content_contains( 'Private: Yes' ); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->content_contains( 'test2@example.com' ); }; subtest 'check contact updating' => sub { - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->content_like(qr{test2\@example.com[^<]*[^<]*No}s); $mech->get_ok('/admin/body/' . $body->id); @@ -243,7 +243,7 @@ subtest 'check contact updating' => sub { $mech->submit_form_ok({form_number => 1}); $mech->content_like(qr'test2@example.com[^<]*\s*Confirmed: Yes's); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->content_like(qr{test2\@example.com[^<]*[^<]*Yes}s); }; diff --git a/templates/web/base/admin/body.html b/templates/web/base/admin/body.html index e67cb2b07..1e3a8f824 100644 --- a/templates/web/base/admin/body.html +++ b/templates/web/base/admin/body.html @@ -61,7 +61,7 @@ [% WHILE ( cat = contacts.next ) %] - [% cat.category %] + [% cat.category %]
[% cat.email | html %] [% loc('Confirmed') %]:  diff --git a/templates/web/base/admin/body_edit.html b/templates/web/base/admin/body_edit.html deleted file mode 100644 index ef7a0a11c..000000000 --- a/templates/web/base/admin/body_edit.html +++ /dev/null @@ -1,103 +0,0 @@ -[% INCLUDE 'admin/header.html' title=tprintf(loc('Council contacts for %s'), body.name) -%] - -[% BLOCK highlightchanged_yesno %] -[%- output = loc('No') %] -[%- IF new.$value %][% output = loc('Yes') %][% END %] -[%- IF old && old.$value != new.$value %][% output %][% ELSE %][% output %][% END %] -[%- END %] - -[% BLOCK highlightchanged %] -[%- IF old && old.$value != new.$value %][% new.$value %][% ELSE %][% new.$value %][% END %] -[%- END %] -

-[% updated %] -

- -

-[% IF example_pc %] -[% tprintf( loc('Example postcode %s'), example_pc ) | html %] -[% END %] -

- -
-

[% loc('Category:') %] [% contact.category | html %] - - -

[% loc('Email:') %] - - -

- [% IF c.cobrand.moniker != 'zurich' %] - - - [% ELSE %] - - [% END %] - - - [% IF c.cobrand.moniker != 'zurich' %] - - - [% END %] -

- -

[% loc('Note:') %] - - [% IF body.can_be_devolved %] -

[% loc('Configure Endpoint') %]

- -

- - -

- -

- - -

- -

- - -

- -

- - -

- [% END %] - - -

-

- -

[% loc('History') %]

- - - - - - - - - - [%- prev = '' %] - [%- WHILE ( contact = history.next ) %] - - - - - - - - - [%- prev = contact %] - [%- END %] -
[% loc('When edited') %][% loc('Email') %][% loc('Confirmed') %][% loc('Deleted') %][% loc('Editor') %][% loc('Note') %]
[% contact.whenedited.ymd _ ' ' _ contact.whenedited.hms %][% PROCESS highlightchanged old=prev new=contact value='email' %][% PROCESS highlightchanged_yesno old=prev new=contact value='confirmed' %][% PROCESS highlightchanged_yesno old=prev new=contact value='deleted' %][% contact.editor %][% contact.note | html %]
- -[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/category_edit.html b/templates/web/base/admin/category_edit.html new file mode 100644 index 000000000..ef7a0a11c --- /dev/null +++ b/templates/web/base/admin/category_edit.html @@ -0,0 +1,103 @@ +[% INCLUDE 'admin/header.html' title=tprintf(loc('Council contacts for %s'), body.name) -%] + +[% BLOCK highlightchanged_yesno %] +[%- output = loc('No') %] +[%- IF new.$value %][% output = loc('Yes') %][% END %] +[%- IF old && old.$value != new.$value %][% output %][% ELSE %][% output %][% END %] +[%- END %] + +[% BLOCK highlightchanged %] +[%- IF old && old.$value != new.$value %][% new.$value %][% ELSE %][% new.$value %][% END %] +[%- END %] +

+[% updated %] +

+ +

+[% IF example_pc %] +[% tprintf( loc('Example postcode %s'), example_pc ) | html %] +[% END %] +

+ +
+

[% loc('Category:') %] [% contact.category | html %] + + +

[% loc('Email:') %] + + +

+ [% IF c.cobrand.moniker != 'zurich' %] + + + [% ELSE %] + + [% END %] + + + [% IF c.cobrand.moniker != 'zurich' %] + + + [% END %] +

+ +

[% loc('Note:') %] + + [% IF body.can_be_devolved %] +

[% loc('Configure Endpoint') %]

+ +

+ + +

+ +

+ + +

+ +

+ + +

+ +

+ + +

+ [% END %] + + +

+

+ +

[% loc('History') %]

+ + + + + + + + + + [%- prev = '' %] + [%- WHILE ( contact = history.next ) %] + + + + + + + + + [%- prev = contact %] + [%- END %] +
[% loc('When edited') %][% loc('Email') %][% loc('Confirmed') %][% loc('Deleted') %][% loc('Editor') %][% loc('Note') %]
[% contact.whenedited.ymd _ ' ' _ contact.whenedited.hms %][% PROCESS highlightchanged old=prev new=contact value='email' %][% PROCESS highlightchanged_yesno old=prev new=contact value='confirmed' %][% PROCESS highlightchanged_yesno old=prev new=contact value='deleted' %][% contact.editor %][% contact.note | html %]
+ +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/zurich/admin/body.html b/templates/web/zurich/admin/body.html index 4cedc9838..771f1e537 100644 --- a/templates/web/zurich/admin/body.html +++ b/templates/web/zurich/admin/body.html @@ -19,7 +19,7 @@ [% WHILE ( cat = contacts.next ) %] - [% cat.category %] + [% cat.category %] [% cat.email | html %] [% cat.editor %] [% cat.note | html %] -- cgit v1.2.3