aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/web/base/admin/body.html110
-rw-r--r--templates/web/base/admin/category_edit.html73
-rw-r--r--templates/web/base/admin/contact-form.html117
-rw-r--r--templates/web/zurich/admin/body.html5
-rw-r--r--templates/web/zurich/admin/contact-form.html21
-rw-r--r--web/js/fixmystreet-admin.js7
6 files changed, 152 insertions, 181 deletions
diff --git a/templates/web/base/admin/body.html b/templates/web/base/admin/body.html
index 52df20c89..0b8d3b18c 100644
--- a/templates/web/base/admin/body.html
+++ b/templates/web/base/admin/body.html
@@ -120,111 +120,13 @@
<h2>[% loc('Add new category') %]</h2>
[% END %]
-[% IF errors %]
-<div class="fms-admin-warning">
- [% errors.values.join('<br>') %]
-</div>
-[% END %]
+ [% IF errors %]
+ <div class="fms-admin-warning">
+ [% errors.values.join('<br>') %]
+ </div>
+ [% END %]
- <form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
-
- <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" class="form-control" name="category" size="30" value="[% contact.category | html %]">
- </p>
-
- <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 address:') %] </strong><input type="text" class="form-control" name="email" size="30" value="[% contact.email | html %]">
- </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"[% ' checked' IF contact.confirmed OR contact.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"[% ' checked' IF contact.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 class="form-control" 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" [% ' checked' IF contact.non_public %]>
- <label for="non_public" class="inline">[% loc('Private') %]</label>
- </p>
-
- <div class="admin-hint">
- <p>
- [% loc("Check <strong>inspection required</strong> if reports in this category <strong>must be inspected</strong> before being sent.") %]
- </p>
- </div>
- <p>
- <input type="checkbox" name="inspection_required" value="1" id="inspection_required" [% 'checked' IF contact.get_extra_metadata('inspection_required') %]>
- <label for="inspection_required" class="inline">[% loc('Inspection required') %]</label>
- </p>
-
- <p>
- <input type="hidden" name="posted" value="new" >
- <input type="hidden" name="token" value="[% csrf_token %]" >
- <input type="submit" class="btn" name="Create category" value="[% errors ? loc('Save changes') : loc('Create category') %]" >
- </p>
-
- <div>
- <input type="hidden" name=".cgifields" value="confirmed" >
- <input type="hidden" name=".cgifields" value="deleted" >
- </div>
- </form>
+ [% INCLUDE 'admin/contact-form.html' %]
</div>
[% IF NOT errors and c.user.is_superuser %]
diff --git a/templates/web/base/admin/category_edit.html b/templates/web/base/admin/category_edit.html
index ebaa495db..d1a323819 100644
--- a/templates/web/base/admin/category_edit.html
+++ b/templates/web/base/admin/category_edit.html
@@ -19,78 +19,7 @@
[% END %]
</p>
-<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit">
- <p><strong>[% loc('Category:') %] </strong>[% contact.category | html %]
- <input type="hidden" name="category" value="[% contact.category | html %]" >
- <input type="hidden" name="token" value="[% csrf_token %]" >
-
- <p><strong>[% loc('Email:') %] </strong>
- <input type="text" class="form-control" name="email" value="[% contact.email | html %]" size="30">
-
- <p>
- [% IF c.cobrand.moniker != 'zurich' %]
- <input type="checkbox" name="confirmed" value="1" id="confirmed"[% ' checked' IF contact.confirmed %]>
- <label class="inline" for="confirmed">[% loc('Confirmed' ) %]</label>
- [% ELSE %]
- <input type="hidden" name="confirmed" value="1">
- [% END %]
- <input type="checkbox" name="deleted" value="1" id="deleted"[% ' checked' IF contact.deleted %]>
- <label class="inline" for="deleted">[% loc('Deleted') %]</label>
- [% IF c.cobrand.moniker != 'zurich' %]
- <input type="checkbox" name="non_public" value="1" id="non_public"[% ' checked' IF contact.non_public %]>
- <label class="inline" for="non_public">[% loc('Private') %]</label>
- <input type="checkbox" name="inspection_required" value="1" id="inspection_required"[% ' checked' IF contact.get_extra_metadata('inspection_required') %]>
- <label class="inline" for="inspection_required">[% loc('Inspection required') %]</label>
- [% ELSE %]
- <input type="checkbox" name="photo_required" value="1" id="photo_required"[% ' checked' IF contact.get_extra_metadata('photo_required') %]>
- <label class="inline" for="photo_required">[% loc('Photo required') %]</label>
- [% END %]
- </p>
-
- [% IF c.cobrand.moniker != 'zurich' %]
- <p [% 'class=hidden' UNLESS contact.get_extra_metadata('inspection_required') %]>
- <label>
- [% loc('Reputation threshold:') %]
- <input type="text" class="form-control" name="reputation_threshold" id="reputation_threshold"
- value="[% contact.get_extra_metadata('reputation_threshold') | html %]" size="30">
- </label>
- </p>
- [% END %]
-
- <p><strong>[% loc('Note:') %] </strong><textarea class="form-control" name="note" rows="3" cols="40"></textarea>
-
- [% IF body.can_be_devolved %]
- <h2>[% loc('Configure Endpoint') %]</h2>
- <form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
- <p>
- <label for="endpoint">Endpoint</label>
- <input type="text" class="form-control" name="endpoint" id="endpoint" value="[% contact.endpoint | html %]" size="50">
- </p>
-
- <p>
- <label for="jurisdiction">Jurisdiction</label>
- <input type="text" class="form-control" name="jurisdiction" id="jurisdiction" value="[% contact.jurisdiction | html %]" size="50">
- </p>
-
- <p>
- <label for="api_key">Api Key</label>
- <input type="text" class="form-control" name="api_key" id="api_key" value="[% contact.api_key | html %]" size="25">
- </p>
-
- <p>
- <label for="send_method">Send Method</label>
- <select class="form-control" name="send_method">
- <option value=""> -- Select a method -- </option>
- [% FOR method IN send_methods %]
- <option value="[% method %]"[% ' selected' IF contact.send_method == method %]>[% method %]</option>
- [% END %]
- </select>
- </p>
- [% END %]
-
- <input type="hidden" name="posted" value="new">
- <p><input type="submit" class="btn" name="Save changes" value="[% loc('Save changes') %]">
-</form>
+[% INCLUDE 'admin/contact-form.html' %]
[% IF contact.extra %]
<h2>[% loc('Extra data:') %] </h2>
diff --git a/templates/web/base/admin/contact-form.html b/templates/web/base/admin/contact-form.html
new file mode 100644
index 000000000..20f56c2d6
--- /dev/null
+++ b/templates/web/base/admin/contact-form.html
@@ -0,0 +1,117 @@
+<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit">
+
+ [% IF contact.in_storage %]
+ <p>
+ <h1>[% contact.category | html %]</h2>
+ <input type="hidden" name="category" value="[% contact.category | html %]" >
+ </p>
+ [% ELSE %]
+ <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" class="form-control" name="category" size="30" value="[% contact.category | html %]" required>
+ </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 address') %] </strong><input type="text" class="form-control" name="email" size="30" value="[% contact.email | html %]" required>
+ </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"[% ' checked' IF contact.confirmed OR contact.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"[% ' checked' IF contact.deleted %]>
+ <label for="deleted" class="inline">[% loc('Deleted') %]</label>
+ </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" [% ' checked' IF contact.non_public %]>
+ <label for="non_public" class="inline">[% loc('Private') %]</label>
+ </p>
+
+ <div class="admin-hint">
+ <p>
+ [% loc("Check <strong>inspection required</strong> if reports in this category <strong>must be inspected</strong> before being sent.") %]
+ </p>
+ </div>
+ <p>
+ <input type="checkbox" name="inspection_required" value="1" id="inspection_required" [% 'checked' IF contact.get_extra_metadata('inspection_required') %]>
+ <label for="inspection_required" class="inline">[% loc('Inspection required') %]</label>
+ </p>
+
+ <div class="admin-hint">
+ <p>
+ [% loc("Reports will automatically be sent without needing to be inspected if the user's <strong>reputation</strong> is at or above this value. Set to <strong>0</strong> if all reports must be inspected regardless.") %]
+ </p>
+ </div>
+ <p [% 'class=hidden' UNLESS contact.get_extra_metadata('inspection_required') %]>
+ <label>
+ [% loc('Reputation threshold') %]
+ <input type="text" class="form-control" name="reputation_threshold" id="reputation_threshold"
+ value="[% contact.get_extra_metadata('reputation_threshold') | html %]" size="30">
+ </label>
+ </p>
+
+ <div class="admin-hint">
+ <p>
+ [% loc("Use this field to record details that are only displayed in the admin. Input is not shown publicly, and is not sent to the body.") %]
+ </p>
+ </div>
+ <p>
+ <label>
+ [% loc('Summarise your changes') %]
+ <input class="form-control" type="text" name="note" size="30" required>
+ </label>
+ </p>
+
+ <p>
+ <input type="hidden" name="posted" value="new" >
+ <input type="hidden" name="token" value="[% csrf_token %]" >
+ <input type="submit" class="btn" name="Create category" value="[% contact.in_storage ? loc('Save changes') : loc('Create category') %]" >
+ </p>
+</form>
diff --git a/templates/web/zurich/admin/body.html b/templates/web/zurich/admin/body.html
index 435f42885..cf860990d 100644
--- a/templates/web/zurich/admin/body.html
+++ b/templates/web/zurich/admin/body.html
@@ -61,11 +61,6 @@
<input type="hidden" name="token" value="[% csrf_token %]" >
<input type="submit" class="btn" name="Create category" value="[% errors ? loc('Save changes') : loc('Create category') %]">
</p>
-
- <div>
- <input type="hidden" name=".cgifields" value="confirmed" >
- <input type="hidden" name=".cgifields" value="deleted" >
- </div>
</form>
[% END %]
diff --git a/templates/web/zurich/admin/contact-form.html b/templates/web/zurich/admin/contact-form.html
new file mode 100644
index 000000000..dddfc6d01
--- /dev/null
+++ b/templates/web/zurich/admin/contact-form.html
@@ -0,0 +1,21 @@
+<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit">
+ <p><strong>[% loc('Category:') %] </strong>[% contact.category | html %]
+ <input type="hidden" name="category" value="[% contact.category | html %]" >
+ <input type="hidden" name="token" value="[% csrf_token %]" >
+
+ <p><strong>[% loc('Email:') %] </strong>
+ <input type="text" class="form-control" name="email" value="[% contact.email | html %]" size="30">
+
+ <p>
+ <input type="hidden" name="confirmed" value="1">
+ <input type="checkbox" name="deleted" value="1" id="deleted"[% ' checked' IF contact.deleted %]>
+ <label class="inline" for="deleted">[% loc('Deleted') %]</label>
+ <input type="checkbox" name="photo_required" value="1" id="photo_required"[% ' checked' IF contact.get_extra_metadata('photo_required') %]>
+ <label class="inline" for="photo_required">[% loc('Photo required') %]</label>
+ </p>
+
+ <p><strong>[% loc('Note:') %] </strong><textarea class="form-control" name="note" rows="3" cols="40"></textarea>
+
+ <input type="hidden" name="posted" value="new">
+ <p><input type="submit" class="btn" name="Save changes" value="[% loc('Save changes') %]">
+</form>
diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js
index 6f4580feb..e0605b443 100644
--- a/web/js/fixmystreet-admin.js
+++ b/web/js/fixmystreet-admin.js
@@ -83,10 +83,17 @@ $(function(){
// On category edit page, hide the reputation input if inspection isn't required
$("form#category_edit #inspection_required").change(function() {
var $p = $("form#category_edit #reputation_threshold").closest("p");
+ var $hint = $p.prevUntil().first();
if (this.checked) {
$p.removeClass("hidden");
+ if ($hint.length) {
+ $hint.removeClass("hidden");
+ }
} else {
$p.addClass("hidden");
+ if ($hint.length) {
+ $hint.addClass("hidden");
+ }
}
});
});