diff options
author | Struan Donald <struan@exo.org.uk> | 2012-09-05 17:03:50 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-09-05 17:03:50 +0100 |
commit | be0edc0f4ced36a82cf0733b32a81f27bd22f1d1 (patch) | |
tree | 625f616eac5cb691afc35856a2d967f1e4935875 | |
parent | 70d64b6ab219c7c627b1bea3af49a1c98d803540 (diff) |
add non public status editing of contacts to admin
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 1 | ||||
-rw-r--r-- | t/app/controller/admin.t | 29 | ||||
-rw-r--r-- | templates/web/default/admin/council_contacts.html | 9 | ||||
-rw-r--r-- | templates/web/default/admin/council_edit.html | 3 |
4 files changed, 37 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 28e77de98..ef299d224 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -301,6 +301,7 @@ sub update_contacts : Private { $contact->email( $email ); $contact->confirmed( $c->req->param('confirmed') ? 1 : 0 ); $contact->deleted( $c->req->param('deleted') ? 1 : 0 ); + $contact->non_public( $c->req->param('non_public') ? 1 : 0 ); $contact->note( $c->req->param('note') ); $contact->whenedited( \'ms_current_timestamp()' ); $contact->editor( $editor ); diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 035dec39c..839bfd6b9 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -163,19 +163,32 @@ subtest 'check contact creation' => sub { $mech->get_ok('/admin/council_contacts/2650'); $mech->submit_form_ok( { with_fields => { - category => 'test category', - email => 'test@example.com', - note => 'test note', + category => 'test category', + email => 'test@example.com', + note => 'test note', + non_public => undef, } } ); $mech->content_contains( 'test category' ); $mech->content_contains( '<td>test@example.com' ); $mech->content_contains( '<td>test note' ); + $mech->content_contains( '<td>Public' ); + + $mech->submit_form_ok( { with_fields => { + category => 'private category', + email => 'test@example.com', + note => 'test note', + non_public => 'on', + } } ); + + $mech->content_contains( 'private category' ); + $mech->content_contains( '<td>Non Public' ); $mech->submit_form_ok( { with_fields => { category => 'test/category', email => 'test@example.com', note => 'test/note', + non_public => 'on', } } ); $mech->get_ok('/admin/council_edit/2650/test/category'); @@ -187,11 +200,21 @@ subtest 'check contact editing' => sub { $mech->submit_form_ok( { with_fields => { email => 'test2@example.com', note => 'test2 note', + non_public => undef, } } ); $mech->content_contains( 'test category' ); $mech->content_contains( '<td>test2@example.com' ); $mech->content_contains( '<td>test2 note' ); + $mech->content_contains( '<td>Public' ); + + $mech->submit_form_ok( { with_fields => { + email => 'test2@example.com', + note => 'test2 note', + non_public => 'on', + } } ); + + $mech->content_contains( '<td>Non Public' ); $mech->get_ok('/admin/council_edit/2650/test%20category'); $mech->content_contains( '<td><strong>test2@example.com' ); diff --git a/templates/web/default/admin/council_contacts.html b/templates/web/default/admin/council_contacts.html index e35c8cda2..60e270c7c 100644 --- a/templates/web/default/admin/council_contacts.html +++ b/templates/web/default/admin/council_contacts.html @@ -38,6 +38,7 @@ <th>[% loc('Deleted') %]</th> <th>[% loc('Last editor') %]</th> <th>[% loc('Note') %]</th> + <th>[% loc('Public') %]</th> <th>[% loc('When edited') %]</th> <th>[% loc('Confirm') %]</th> </tr> @@ -49,6 +50,7 @@ <td>[% IF contact.deleted %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% contact.editor %]</td> <td>[% contact.note | html %]</td> + <td>[% contact.non_public ? loc('Non Public') : loc('Public') %]</td> <td>[% contact.whenedited.ymd _ ' ' _ contact.whenedited.hms %]</td> <td><input type="checkbox" name="confirmed" value="[% contact.category %]"></td> </tr> @@ -81,7 +83,7 @@ <input type="checkbox" name="confirmed" value="1" id="confirmed"> <label for="confirmed">[% loc('Confirmed') %]</label> - <input type="checkbox" name="deleted" value="1"id="deleted"> + <input type="checkbox" name="deleted" value="1" id="deleted"> <label for="deleted">[% loc('Deleted') %]</label> </p> @@ -90,6 +92,11 @@ </p> <p> + <input type="checkbox" name="non_public" value="1" id="non_public"> + <label for="non_public">[% loc('Private') %]</label> + </p> + + <p> <input type="hidden" name="area_id" value="[% area_id %]" > <input type="hidden" name="posted" value="new" > <input type="hidden" name="token" value="[% token %]" > diff --git a/templates/web/default/admin/council_edit.html b/templates/web/default/admin/council_edit.html index 0968d3570..9ec0578ff 100644 --- a/templates/web/default/admin/council_edit.html +++ b/templates/web/default/admin/council_edit.html @@ -26,7 +26,8 @@ <strong>[% loc('Email:') %] </strong> <input type="text" name="email" value="[% contact.email | html %]" size="30"> <input type="checkbox" name="confirmed" value="1" id="confirmed"[% ' checked' IF contact.confirmed %]> <label for="confirmed">[% loc('Confirmed' ) %]</label> - <input type="checkbox" name="deleted" value="1" id="deleted"[% ' checked' IF contact.deleted %]> <label for="deleted">[% loc('Deleted') %]</label><br> + <input type="checkbox" name="deleted" value="1" id="deleted"[% ' checked' IF contact.deleted %]> <label for="deleted">[% loc('Deleted') %]</label> + <input type="checkbox" name="non_public" value="1" id="non_public"[% ' checked' IF contact.non_public %]> <label for="non_public">[% loc('Private') %]</label><br> <strong>[% loc('Note:') %] </strong><textarea name="note" rows="3" cols="40">[% contact.note | html %]</textarea> <br> |