diff options
author | Dave Whiteland <dave@mysociety.org> | 2013-09-06 08:16:38 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2013-09-06 08:16:38 +0100 |
commit | cadf212ed4dcace68dff5dc724785b0ecfeffc66 (patch) | |
tree | 10496758e33f7e3f222da2877c8fe86bbd1469fb | |
parent | 991ed7a90e3fbfdab04f06f699bf7587ad858834 (diff) | |
parent | af5932eb9fd26d148efb092fcabb2c63dfbde795 (diff) |
Merge branch 'admin-notes'
-rw-r--r-- | conf/general.yml-example | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 17 | ||||
-rw-r--r-- | templates/web/default/admin/bodies.html | 92 | ||||
-rw-r--r-- | templates/web/default/admin/body-form.html | 145 | ||||
-rw-r--r-- | templates/web/default/admin/body.html | 78 | ||||
-rw-r--r-- | templates/web/default/admin/edit-league.html | 7 | ||||
-rw-r--r-- | templates/web/default/admin/flagged.html | 39 | ||||
-rw-r--r-- | templates/web/default/admin/index.html | 8 | ||||
-rw-r--r-- | templates/web/default/admin/reports.html | 6 | ||||
-rw-r--r-- | templates/web/default/admin/user-form.html | 40 | ||||
-rw-r--r-- | templates/web/default/admin/users.html | 10 | ||||
-rw-r--r-- | templates/web/default/common_header_tags.html | 6 | ||||
-rw-r--r-- | web/cobrands/sass/_layout.scss | 76 | ||||
-rw-r--r-- | web/js/fixmystreet-admin.js | 59 |
14 files changed, 510 insertions, 74 deletions
diff --git a/conf/general.yml-example b/conf/general.yml-example index d30c494ca..e35bb4979 100644 --- a/conf/general.yml-example +++ b/conf/general.yml-example @@ -166,3 +166,4 @@ LONDON_REPORTIT_KEY: '' LONDON_REPORTIT_SECRET: '' AUTH_SHARED_SECRET: '' HEARFROMYOURMP_BASE_URL: '' + diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 133c83024..ba8f22a05 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -130,6 +130,8 @@ sub index : Path : Args(0) { $c->stash->{categories} = $c->cobrand->problems->categories_summary(); + $c->stash->{total_bodies} = $c->model('DB::Body')->count(); + return 1; } @@ -430,6 +432,7 @@ sub display_contacts : Private { my $contacts = $c->stash->{body}->contacts->search(undef, { order_by => [ 'category' ] } ); $c->stash->{contacts} = $contacts; + $c->stash->{live_contacts} = $contacts->search({ deleted => 0 }); if ( $c->req->param('text') && $c->req->param('text') == 1 ) { $c->stash->{template} = 'admin/council_contacts.txt'; @@ -1024,8 +1027,20 @@ sub flagged : Path('flagged') : Args(0) { $c->stash->{problems} = [ $problems->all ]; my $users = $c->model('DB::User')->search( { flagged => 1 } ); + my @users = $users->all; + my %email2user = map { $_->email => $_ } @users; + $c->stash->{users} = [ @users ]; + + my @abuser_emails = $c->model('DB::Abuse')->all(); - $c->stash->{users} = $users; + foreach my $email (@abuser_emails) { + # Slight abuse of the boolean flagged value + if ($email2user{$email->email}) { + $email2user{$email->email}->flagged( 2 ); + } else { + push @{$c->stash->{users}}, { email => $email->email, flagged => 2 }; + } + } return 1; } diff --git a/templates/web/default/admin/bodies.html b/templates/web/default/admin/bodies.html index e0cf013d8..fabaf8923 100644 --- a/templates/web/default/admin/bodies.html +++ b/templates/web/default/admin/bodies.html @@ -2,51 +2,61 @@ [% INCLUDE 'admin/edit-league.html' %] -<table cellspacing="0" cellpadding="2" border="1"> - <tr> - <th>[% loc('Name') %]</th> +[% IF bodies.size == 0 %] + <p class="fms-admin-info"> + [% loc('Currently no bodies have been created.') %] + <br> + [% loc('You need to add bodies (such as councils or departments) so that you can then add + the categories of problems they can handle (such as potholes or streetlights) and the + contacts (such as an email address) to which reports are sent.') %] + </p> +[% ELSE %] + <table cellspacing="0" cellpadding="2" border="1"> + <tr> + <th>[% loc('Name') %]</th> + [% IF c.cobrand.moniker == 'zurich' %] + <th>[% loc('Email') %]</th> + [% ELSE %] + <th>[% loc('Category') %]</th> + [% END %] + </tr> + [%- FOREACH body IN bodies %] + [%- SET id = body.id %] + [% NEXT IF c.cobrand.moniker == 'zurich' AND admin_type == 'dm' AND (body.parent OR body.bodies) %] + <tr> + <td> + [% IF c.cobrand.moniker == 'zurich' %] + [% FILTER repeat(4*body.api_key) %] [% END %] + [% IF admin_type == 'super' %] + <a href="[% c.uri_for( 'body', id ) %]">[% body.name %]</a> + [% ELSE %] + [% body.name %] + [% END %] + [% ELSE %] [%# not Zurich: all bodies should be links %] + <a href="[% c.uri_for( 'body', id ) %]">[% body.name %]</a> + [%- ', ' _ body.parent.name IF body.parent -%] + [% END %] + </td> [% IF c.cobrand.moniker == 'zurich' %] - <th>[% loc('Email') %]</th> + <td>[% body.endpoint %]</td> [% ELSE %] - <th>[% loc('Category') %]</th> - [% END %] - </tr> -[%- FOREACH body IN bodies %] - [%- SET id = body.id %] - [% NEXT IF c.cobrand.moniker == 'zurich' AND admin_type == 'dm' AND (body.parent OR body.bodies) %] - <tr> - <td> - [% IF c.cobrand.moniker == 'zurich' %] - [% FILTER repeat(4*body.api_key) %] [% END %] - [% END %] - [% IF admin_type == 'super' %] - <a href="[% c.uri_for( 'body', id ) %]">[% body.name %]</a> + <td> + [% IF counts.$id %] + [% tprintf( loc('%d addresses'), counts.$id.c) IF c.cobrand.moniker != 'emptyhomes' %] + [% IF counts.$id.deleted %] + (1+ deleted) + [% ELSIF counts.$id.confirmed != counts.$id.c %] + (some unconfirmed) + [% END %] [% ELSE %] - [% body.name %] - [% END %] - [% IF c.cobrand.moniker != 'zurich' %] - [%- ', ' _ body.parent.name IF body.parent -%] + no categories [% END %] - </td> - [% IF c.cobrand.moniker == 'zurich' %] - <td>[% body.endpoint %]</td> - [% ELSE %] - <td> - [% IF counts.$id %] - [% tprintf( loc('%d addresses'), counts.$id.c) IF c.cobrand.moniker != 'emptyhomes' %] - [% IF counts.$id.deleted %] - (1+ deleted) - [% ELSIF counts.$id.confirmed != counts.$id.c %] - (some unconfirmed) - [% END %] - [% ELSE %] - no categories - [% END %] - </td> - [% END %] - </tr> -[%- END %] -</table> + </td> + [% END %] + </tr> + [%- END %] + </table> +[% END %] [% IF c.cobrand.moniker == 'zurich' %] [% IF admin_type == 'super' %] diff --git a/templates/web/default/admin/body-form.html b/templates/web/default/admin/body-form.html index 039d83ae2..de30a5a17 100644 --- a/templates/web/default/admin/body-form.html +++ b/templates/web/default/admin/body-form.html @@ -1,10 +1,32 @@ <form method="post" action="[% body ? c.uri_for('body', body.id) : c.uri_for('bodies') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> - + <div class="fms-admin-info"> + [% loc( + "Add a <strong>body</strong> for each administrative body, such as a council or department + to which problem reports can be sent. You can add one or more contacts (for different + categories of problem) to each body." + ) %] + </div> + <div class="admin-hint"> + <p> + [% loc( + "The body's <strong>name</strong> identifies the body (for example, <em>Borsetshire District Council</em>) + and may be displayed publically." + ) %] + </p> + </div> <p> <label for="name">[% loc('Name') %]</label> <input type="text" name="name" id="name" value="[% body.name %]" size="50"> </p> + <div class="admin-hint"> + <p> + [% loc( + "Identify a <strong>parent</strong> if this body is itself part of another body. + For basic installations, you don't need to join bodies in this way." + ) %] + </p> + </div> <p> <label for="parent">[% loc('Parent') %]</label> <select name="parent" id="parent"> @@ -15,6 +37,24 @@ </select> </p> + [% IF areas.size == 0 AND c.config.MAPIT_URL AND (NOT c.config.MAPIT_TYPES OR c.config.MAPIT_TYPES.size==O) %] + <p class="fms-admin-warning"> + [% tprintf( loc( + '<code>MAPIT_URL</code> is set (<code>%s</code>) but no <code>MAPIT_TYPES</code>.<br> + This is probably why "area covered" is empty (below).<br> + Maybe add some <code>MAPIT_TYPES</code> to your config file?'), c.config.MAPIT_URL) + %] + </p> + [% END %] + + <div class="admin-hint"> + <p> + [% loc( + "This body will only be sent reports for problems that are located in the <strong>area covered</strong>. + A body will not receive any reports unless it covers at least one area." + ) %] + </p> + </div> <p> <label for="area_ids">[% loc('Area covered') %]</label> <select name="area_ids" id="area_ids" multiple> @@ -26,6 +66,14 @@ </select> </p> + <div class="admin-hint"> + <p> + [% loc( + "The <strong>send method</strong> determines how problem reports will be sent to the body. + If you leave this blank, <strong>send method defaults to email</strong>." + ) %] + </p> + </div> <p> <label for="send_method">Send Method</label> <select name="send_method" id="send_method"> @@ -36,46 +84,127 @@ </select> </p> + <div class="admin-open311-only"> + <p class="fms-admin-info"> + [% loc( + "These settings are for bodies that use Open311 (or other back-end integration) to receive problem reports.<br> + <strong>You don't need to set them if the Send Method is email.</strong>. + For more information on Open311, see + <a href='http://www.mysociety.org/2013/01/17/open311-explained//'>this article</a>. + " + ) %] + </p> + + <div class="admin-hint"> + <p> + [% loc( + "The <strong>endpoint</strong> is the URL of the service that FixMyStreet will connect to + when sending reports to this body." + ) %] + </p> + </div> <p> <label for="endpoint">[% loc('Endpoint') %]</label> <input type="text" name="endpoint" id="endpoint" value="[% body.endpoint %]" size="50"> </p> + <div class="admin-hint"> + <p> + [% loc( + "The <strong>jurisdiction</strong> is only needed if the endpoint is serving more + than one. If the body is running its own endpoint, you can usually leave this blank." + ) %] + </p> + </div> <p> <label for="jurisdiction">Open311 Jurisdiction</label> <input type="text" name="jurisdiction" id="jurisdiction" value="[% body.jurisdiction %]" size="50"> </p> + <div class="admin-hint"> + <p> + [% loc( + "Some endpoints require an <strong>API key</strong> to indicate that the reports are being + sent from your FixMyStreet installation." + ) %] + </p> + </div> <p> <label for="api_key">Open311 API Key</label> <input type="text" name="api_key" id="api_key" value="[% body.api_key %]" size="25"> </p> + <div class="admin-hint"> + <p> + [% loc( + "Enable <strong>Open311 update-sending</strong> if the endpoint will send and receive + updates to existing reports. If you're not sure, it probably does not, so leave this unchecked. + For more information, see + <a href='http://www.mysociety.org/2013/02/20/open311-extended/'>this article</a>." + ) %] + </p> + </div> <p> <input type="checkbox" id="send_comments" name="send_comments"[% ' checked' IF body.send_comments %]> - <label for="send_comments" class="inline">Use Open311 comment sending extension</label> + <label for="send_comments" class="inline">Use Open311 update-sending extension</label> </p> + <div class="admin-hint"> + <p> + [% loc( + "If you've enabled Open311 update-sending above, you must identify which + FixMyStreet <strong>user</strong> will be attributed as the creator of those updates + when they are shown on the site. Enter the ID (number) of that user." + ) %] + </p> + </div> <p> <label for"comment_user_id">User ID to attribute fetched comments to</label> <input type="text" name="comment_user_id" value="[% body.comment_user_id %]"> </p> + <div class="admin-hint"> + <p> + [% loc( + "If you've enabled Open311 update-sending above, enable <strong>suppression of alerts</strong> + if you do <strong>not</strong> want that user to be notified whenever these updates are created." + ) %] + </p> + </div> <p> <input type="checkbox" id="suppress_alerts" name="suppress_alerts"[% ' checked' IF body.suppress_alerts %]> <label for="suppress_alerts" class="inline">Do not send email alerts on fetched comments to problem creator</label> </p> + <div class="admin-hint"> + <p> + [% loc( + "If you've enabled Open311 update-sending above, Open311 usually only accepts OPEN or CLOSED status in + its updates. Enable <strong>extended Open311 stauses</strong> if you want to allow extra states to be passed. + Check that your cobrand supports this feature before switching it on." + ) %] + </p> + </div> <p> - <input type="checkbox" id="can_be_devolved" name="can_be_devolved"[% ' checked' IF body.can_be_devolved %]> - <label for="can_be_devolved" class="inline">Endpoint lookup can be devolved to contacts</label> + <input type="checkbox" id="send_extended_statuses" name="send_extended_statuses"[% ' checked' IF conf.send_extended_statuses %]> + <label for="send_extended_statuses" class="inline">Send extended Open311 statuses with service request updates</label> </p> - + </div> + + <div class="admin-hint"> + <p> + [% loc( + "Enable this <strong>can be devolved</strong> setting if one or more contacts have a + different endpoint (and send method) from the body's. For example, if reports for some categories of + problem must be emailed, while others can be sent over Open311." + ) %] + </p> + </div> <p> - <label for="send_extended_statuses">Send extended open311 statuses with service request updates</label>: - <input type="checkbox" id="send_extended_statuses" name="send_extended_statuses"[% ' checked' IF conf.send_extended_statuses %]> + <input type="checkbox" id="can_be_devolved" name="can_be_devolved"[% ' checked' IF body.can_be_devolved %]> + <label for="can_be_devolved" class="inline">Send method or endpoints can be devolved to contacts (i.e, can be different from the body's)</label> </p> - + <p> <input type="hidden" name="posted" value="body"> <input type="hidden" name="token" value="[% token %]"> diff --git a/templates/web/default/admin/body.html b/templates/web/default/admin/body.html index 120a07da9..9cb9125a6 100644 --- a/templates/web/default/admin/body.html +++ b/templates/web/default/admin/body.html @@ -11,9 +11,9 @@ <a href="[% c.uri_for_email( '/around', { pc => example_pc } ) %]">[% tprintf( loc('Example postcode %s'), example_pc ) | html %]</a> | [% END %] [% IF c.cobrand.moniker == 'emptyhomes' %] -<a href="[% c.uri_for( 'reports', search => 'body:' _ body_id ) %]">[% loc('List all reported problems' ) %]</a> +<a href="[% c.uri_for( 'reports', search => 'body:' _ body_id ) %]">[% loc('List all reported problems' ) %]</a> | [% ELSE %] -<a href="[% c.uri_for_email( '/reports/' _ body_id ) %]">[% loc('List all reported problems' ) %]</a> +<a href="[% c.uri_for_email( '/reports/' _ body_id ) %]">[% loc('List all reported problems' ) %]</a> | [% END %] <a href="[% c.uri_for( 'body', body_id, { text => 1 } ) %]">[% loc('Text only version') %]</a> </p> @@ -28,6 +28,14 @@ <p class="error">Do not give these out except to people at the council.</p> [% END %] +[% IF live_contacts == 0 %] + <p class="fms-admin-warning"> + [% loc("This body has no contacts. This means that currently problems reported to this body <strong>will not be sent</strong>.") %] + <br> + [% loc("Add a contact using the form below.") %] + </p> +[% END %] + <form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <table cellspacing="0" cellpadding="2" border="1"> @@ -44,11 +52,11 @@ <th>[% loc('Confirm') %]</th> </tr> [% WHILE ( contact = contacts.next ) %] - <tr> - <td><a href="[% c.uri_for( 'body_edit', body_id, contact.category ) %]">[% contact.category %]</a></td> + <tr [% IF contact.deleted %]class="is-deleted"[% END %]> + <td class="contact-category"><a href="[% c.uri_for( 'body_edit', body_id, contact.category ) %]">[% contact.category %]</a></td> <td>[% contact.email | html %]</td> <td>[% IF contact.confirmed %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> - <td>[% IF contact.deleted %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> + <td>[% IF contact.deleted %]<strong>[% loc('Yes') %]</strong>[% ELSE %][% loc('No') %][% END %]</td> <td>[% IF body.can_be_devolved && contact.send_method %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% contact.editor %]</td> <td>[% contact.note | html %]</td> @@ -66,32 +74,90 @@ </p> </form> + <h2>[% loc('Add new category') %]</h2> + <p class="fms-admin-info"> + [% loc("Each contact for the body has a category, which is displayed to the public. + Different categories <strong>can have the same contact</strong> (email address). + This means you can add many categories even if you only have one contact for the body. + ") %] + </p> <form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> [% IF c.cobrand.moniker != 'emptyhomes' %] + <div class="admin-hint"> + <p> + [% loc('Choose a <strong>category</strong> name that makes sense to the public (e.g., "Pothole", "Street lighting") but is helpful + to the body too. These will appear in the drop-down menu on the report-a-problem page.') %] + <br> + [% loc("If two or more bodies serve the same location, FixMyStreet combines identical categories into a single entry in + the menu. Make sure you use the same category name in the bodies if you want this to happen.") %] + </p> + </div> <p> <strong>[% loc('Category:') %] </strong><input type="text" name="category" size="30"> </p> [% END %] + <div class="admin-hint"> + <p> + [% loc("The <strong>email address</strong> is the destination to which reports about this category will be sent. + Other categories for this body may have the same email address.") %] + </p> + [% IF (body.send_method AND body.send_method != 'Email') OR body.can_be_devolved %] + <p> + [% loc("If you're using <strong>a send method that is not email</strong>, enter the service ID (Open311) or equivalent identifier here.") %] + </p> + [% END %] + </div> + <p> - <strong>[% loc('Email:') %] </strong><input type="text" name="email" size="30"> + <strong>[% loc('Email address:') %] </strong><input type="text" name="email" size="30"> </p> + <div class="admin-hint"> + <p> + [% loc("Check <strong>confirmed</strong> to indicate that this contact has been confirmed as correct. + If you are not sure of the origin or validity of the contact, leave this unchecked.") %] + </p> + </div> <p> <input type="checkbox" name="confirmed" value="1" id="confirmed"> <label for="confirmed" class="inline">[% loc('Confirmed') %]</label> + </p> + <div class="admin-hint"> + <p> + [% loc("Check <strong>deleted</strong> to remove the category from use. + It will not appear as an available category in the drop-down menu on the report-a-problem page.") %] + </p> + </div> + <p> <input type="checkbox" name="deleted" value="1" id="deleted"> <label for="deleted" class="inline">[% loc('Deleted') %]</label> </p> + <div class="admin-hint"> + <p> + [% loc("Use the <strong>note</strong> to record details that are only displayed in the admin. Notes are not shown publicly, and are not sent to the body.") %] + </p> + </div> <p> <strong>[% loc('Note:') %] </strong> <textarea name="note" rows="3" cols="40"></textarea> </p> + <div class="admin-hint"> + <p> + [% loc("Check <strong>private</strong> if reports in this category should <strong>never be displayed on the website</strong>. + <br> + Normally, categories are not private. + <br> + This is suitable for issues that you want to allow users to report to the body, but for which there is no public + interest in displaying the report. In the UK, we've used this for services like requesting an extra rubbish bin + at a specific address.") %] + </p> + </div> <p> <input type="checkbox" name="non_public" value="1" id="non_public"> <label for="non_public" class="inline">[% loc('Private') %]</label> diff --git a/templates/web/default/admin/edit-league.html b/templates/web/default/admin/edit-league.html index 6bf71537e..4f31eeb2e 100644 --- a/templates/web/default/admin/edit-league.html +++ b/templates/web/default/admin/edit-league.html @@ -1,3 +1,10 @@ +<div class="admin-hint"> + <p> + [% loc( + "The diligency prize league table shows editors' activity (who's been editing the most records)." + ) %] + </p> +</div> <h2>[% loc('Diligency prize league table') %]</h2> [% IF edit_activity.count %] <ul> diff --git a/templates/web/default/admin/flagged.html b/templates/web/default/admin/flagged.html index fc8b1fae1..518d1b14e 100644 --- a/templates/web/default/admin/flagged.html +++ b/templates/web/default/admin/flagged.html @@ -1,6 +1,11 @@ -[% INCLUDE 'admin/header.html' title=loc('Search Reports') %] +[% INCLUDE 'admin/header.html' title=loc('Flagged reports and users') %] [% PROCESS 'admin/report_blocks.html' %] +<p class="fms-admin-info"> + [% loc("You can flag any report or user by editing them, and they will be listed on this page. + For example, this can useful if you want to keep an eye on a user who has posted inappropriate + reports in the past.") %] +</p> <h2>[% loc( 'Problems' ) %]</h2> [% IF problems.size > 0 %] @@ -16,29 +21,41 @@ [% INCLUDE 'admin/problem_row.html' %] </table> [% ELSE %] -<p> -[% loc('No flagged problems found') %] -</p> + <p class="fms-admin-warning"> + [% loc('No flagged problems found.') %] + </p> [% END %] <h2>[% loc( 'Users' ) %]</h2> -[% IF users%] +<p class="fms-admin-info"> + [% loc("Flagged users are not restricted in any way. This is just a list of users that have been marked for attention.") %] +</p> + +[% IF users.size %] <table cellspacing="0" cellpadding="2" border="1"> <tr> <th>[% loc('Name') %]</th> <th>[% loc('Email') %]</th> + <th>[% loc('In abuse table?') %]</th> + <th> </th> </tr> -[% WHILE ( user = users.next ) -%] - <tr> + [%- FOREACH user IN users %] + <tr [% IF user.flagged == 2 %]class="is-deleted"[% END %]> <td>[% user.name | html %]</td> <td>[% user.email | html %]</td> - <td><a href="[% c.uri_for( 'reports', search => user.email ) %]">list content</a></td> + <td> + [% IF user.flagged == 2 %] <strong>[% loc('Yes') %]</strong> [% ELSE %] [% END %] + </td> + <td> + <a href="[% c.uri_for( 'reports', search => user.email ) %]">list content</a> + [% IF user.id %] | <a href="[% c.uri_for( 'user_edit', user.id ) %]">[% loc('edit user') %]</a>[% END %] + </td> </tr> -[%- END %] + [%- END %] </table> [%- ELSE %] -<p> -[% loc('No flagged users found') %] +<p class="fms-admin-warning"> + [% loc('No flagged users found.') %] </p> [%- END %] diff --git a/templates/web/default/admin/index.html b/templates/web/default/admin/index.html index 2c5ee55db..5415222ab 100644 --- a/templates/web/default/admin/index.html +++ b/templates/web/default/admin/index.html @@ -1,5 +1,13 @@ [% INCLUDE 'admin/header.html' title=loc('Summary') -%] +[% IF total_bodies == 0 %] + <p class="fms-admin-info"> + [% loc('Currently no bodies have been created.') %] + <br> + [% tprintf( loc('You need to <a href="%s">add some bodies</a> (such as councils or departments) before any reports can be sent.'), c.uri_for('bodies')) %] + </p> +[% END %] + [%- BLOCK states -%] <h2>[% title %]</h2> diff --git a/templates/web/default/admin/reports.html b/templates/web/default/admin/reports.html index d57b2f53e..7267dd11d 100644 --- a/templates/web/default/admin/reports.html +++ b/templates/web/default/admin/reports.html @@ -20,6 +20,12 @@ [% INCLUDE 'pagination.html', admin = 1, param = 'p' IF pager %] +[% ELSIF searched %] + +<div class="fms-admin-warning"> + [% loc("Searching found no reports.") %] +</div> + [% END %] [% INCLUDE 'admin/list_updates.html' %] diff --git a/templates/web/default/admin/user-form.html b/templates/web/default/admin/user-form.html index 9c60ec940..489752d8c 100644 --- a/templates/web/default/admin/user-form.html +++ b/templates/web/default/admin/user-form.html @@ -2,16 +2,50 @@ <input type="hidden" name="token" value="[% token %]" > <input type="hidden" name="submit" value="1" > <ul class="no-bullets"> - <li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% user.name | html %]'></li> + <li> + <div class="admin-hint"> + <p> + [% loc( + "The user's <strong>name</strong> is displayed publicly on reports that have not been marked <em>anonymous</em>. + Names are not necessarily unique.") + %] + </p> + </div> + [% loc('Name:') %] <input type='text' name='name' id='name' value='[% user.name | html %]'> + </li> <li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% user.email | html %]'></li> - <li>[% loc('Body:') %] <select id='body' name='body'> + <li> + <div class="admin-hint"> + <p> + [% loc( + "Normal (public) users should not be associated with any <strong>body</strong>.<br> + Authorised staff users can be associated with the body they represent.<br> + Depending on the implementation, staff users may have access to the dashboard (summary of + activity across their body), the ability to hide reports or set special report statuses.") + %] + </p> + </div> + [% loc('Body:') %] <select id='body' name='body'> <option value=''>[% loc('No body') %]</option> [% FOR body IN bodies %] <option value="[% body.id %]"[% ' selected' IF body.id == user.from_body.id %]>[% body.name %]</option> [% END %] + </li> </select> [% IF c.cobrand.moniker != 'zurich' %] - <li>[% loc('Flagged:') %] <input type="checkbox" id="flagged" name="flagged"[% user.flagged ? ' checked' : '' %]></li> + <li> + <div class="admin-hint"> + <p> + [% loc("Mark users whose behaviour you want to keep a check on as <strong>flagged</strong>.") %] + <br> + [% tprintf(loc("Flagged users are listed on the <a href='%s'>flagged</a> page."), c.uri_for( 'flagged' )) %] + <br> + [% loc("You can add an abusive user's email to the abuse list, which automatically hides (and never sends) reports they create.") %] + </p> + </div> + + [% loc('Flagged:') %] <input type="checkbox" id="flagged" name="flagged"[% user.flagged ? ' checked' : '' %]> + </li> [% END %] </ul> <input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" > diff --git a/templates/web/default/admin/users.html b/templates/web/default/admin/users.html index 70833ff85..db97c7d59 100644 --- a/templates/web/default/admin/users.html +++ b/templates/web/default/admin/users.html @@ -1,6 +1,9 @@ [% INCLUDE 'admin/header.html' title=loc('Search Users') %] [% PROCESS 'admin/report_blocks.html' %] +<div class="fms-admin-info"> + [% loc("User search finds matches in users' names and email addresses.") %] +</div> <form method="get" action="[% c.uri_for('users') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <p><label for="search">[% loc('Search:') %]</label> <input type="text" name="search" size="30" id="search" value="[% searched | html %]"> </form> @@ -30,12 +33,17 @@ [%- END -%] </table> +[% ELSIF searched %] + +<div class="fms-admin-warning"> + [% loc("Searching found no users.") %] +</div> + [% END %] [% IF NOT searched %] <h2>[% loc('Add user') %]</h2> [% INCLUDE 'admin/user-form.html', user = '' %] - [% END %] [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/default/common_header_tags.html b/templates/web/default/common_header_tags.html index 346d53693..bec3844be 100644 --- a/templates/web/default/common_header_tags.html +++ b/templates/web/default/common_header_tags.html @@ -4,13 +4,17 @@ <script type="text/javascript" src="/js/validation_rules.js?[% Math.int( date.now / 3600 ) %]"></script> <script type="text/javascript" src="/js/translation_strings.[% lang_code %].js?[% Math.int( date.now / 3600 ) %]"></script> -<script type="text/javascript" src="/jslib/jquery-1.7.2.min.js"></script> +<script type="text/javascript" src="[% start %]/jslib/jquery-1.7.2.min.js"></script> <script src="[% version('/js/jquery.validate.min.js') %]" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" src="[% version('/js/geo.min.js') %]"></script> <script type="text/javascript" src="[% version('/js/fixmystreet.js') %]"></script> <script type="text/javascript" src="[% version(js_override || '/js/fixmystreet-old-box.js') %]"></script> +[% IF admin %] +<script type="text/javascript" src="[% version(start _ '/js/fixmystreet-admin.js') %]"></script> +[% END %] + [% map_js %] [% IF category_extras_json && category_extras_json != '{}' %] diff --git a/web/cobrands/sass/_layout.scss b/web/cobrands/sass/_layout.scss index 07f944ffa..4d32f6062 100644 --- a/web/cobrands/sass/_layout.scss +++ b/web/cobrands/sass/_layout.scss @@ -1032,11 +1032,83 @@ $button_bg_col: #a1a1a1; // also search bar (tables) border: none; padding: 3px 0.5em; } + tr.is-deleted { + background-color: #ffdddd; + td.contact-category { + text-decoration: line-through; + } + } + } + .fms-admin-warning, .fms-admin-info { + padding: 1em; + font-size: 90%; + border-style: solid; + border-width: 1px; + border-left-width: 1em; + margin-bottom: 1em; + } + .fms-admin-warning { + border-color: #f99; + background-color: #ffe1e1; + } + .fms-admin-info { + border-color: #9f9; + background-color: #e1ffe1; + } + .admin-open311-only { + border:1px solid #666; + padding:1em; + margin: 1em 0; + } + .admin-hint { + font-size: 80%; // little question marks are small + cursor: pointer; + display: block; + float:left; + overflow: hidden; + padding: 0.2em; + margin-right: 0.666em; + text-align: center; + color: #fff; + font-weight: bold; + background-color: #f93; + -moz-border-radius: 0.333em; + -webkit-border-radius: 0.333em; + border-radius: 0.333em; + p { + display:none; + } + &:before { content: "?" } + &.admin-hint-show { + font-size: 90%; + text-align: left; + display: block; + float:none; + margin:1em 0; + &:before { content: "" } + background-color: inherit !important; + p { + font-weight: normal; + display: block; + background-color: #ff9; + color: #000; + border-style: solid; + border-width: 1px; + border-left-width: 1em; + border-color: #f93; + padding:1em; + margin: 0; + } + } + } + .no-bullets { + margin-left: 0; + > li { + list-style: none; + } } } - - /* MEDIA QUERIES */ @media only screen and (min-width: 48em) and (max-width: 61em) { .container { diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js new file mode 100644 index 000000000..76c02128c --- /dev/null +++ b/web/js/fixmystreet-admin.js @@ -0,0 +1,59 @@ +$(function(){ + // available for admin pages + + // hide the open311_only section and reveal it only when send_method is relevant + var $open311_only = $('.admin-open311-only'); + + function hide_or_show_open311(hide_fast) { + var send_method = $('#send_method').val(); + var show_open311 = false; + if ($('#endpoint').val()) { + show_open311 = true; // always show the form if there is an endpoint value + } else if (send_method && send_method.toLowerCase() != 'email') { + show_open311 = true; + } + if (show_open311) { + $open311_only.slideDown(); + } else { + if (hide_fast) { + $open311_only.hide(); + } else { + $open311_only.slideUp(); + } + } + } + + if ($open311_only) { + $('#send_method').on('change', hide_or_show_open311); + hide_or_show_open311(true); + } + + // admin hints: maybe better implemented as tooltips? + $(".admin-hint").on('click', function(){ + if ($(this).hasClass('admin-hint-show')) { + $(this).removeClass('admin-hint-show'); + } else { + $(this).addClass('admin-hint-show'); + } + }); + + // on a body's page, hide/show deleted contact categories + var $table_with_deleted_contacts = $('table tr.is-deleted td.contact-category').closest('table'); + if ($table_with_deleted_contacts.length == 1) { + var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Hide deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>"); + $table_with_deleted_contacts.before($toggle_deleted_btn); + $toggle_deleted_btn.on('click', function(e){ + e.preventDefault(); + var $cols = $table_with_deleted_contacts.find('tr.is-deleted'); + if ($cols.first().is(':visible')) { + $cols.hide(); + $(this).prop("value", 'Show deleted contacts'); + } else { + $cols.show(); + $(this).prop("value", 'Hide deleted contacts'); + } + }); + } + +}); + |