aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base/admin/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates/web/base/admin/templates')
-rw-r--r--templates/web/base/admin/templates/edit.html93
-rw-r--r--templates/web/base/admin/templates/index.html11
-rw-r--r--templates/web/base/admin/templates/view.html39
3 files changed, 143 insertions, 0 deletions
diff --git a/templates/web/base/admin/templates/edit.html b/templates/web/base/admin/templates/edit.html
new file mode 100644
index 000000000..7ce67f96f
--- /dev/null
+++ b/templates/web/base/admin/templates/edit.html
@@ -0,0 +1,93 @@
+[% INCLUDE 'admin/header.html' title=tprintf(loc('Response Template for %s'), body.name) -%]
+[% rt = response_template %]
+
+[% UNLESS rt.id %]<h3>[% loc('New template') %]</h3>[% END %]
+
+<form method="post"
+ action="[% c.uri_for_action('/admin/templates/edit', body.id, rt.id || 'new' ) %]"
+ enctype="application/x-www-form-urlencoded"
+ accept-charset="utf-8"
+ class="validate">
+
+ [% IF errors %]
+ <p class="error">[% loc('Please correct the errors below') %]</p>
+ [% END %]
+
+ [% IF errors.title %]
+ <div class="form-error">[% errors.title %]</div>
+ [% END %]
+ <div class="admin-hint">
+ <p>
+ [% loc('This is a <strong>private</strong> name for this template so you can identify it when updating reports or editing in the admin.') %]
+ </p>
+ </div>
+ <p>
+ <strong>[% loc('Title:') %] </strong>
+ <input type="text" name="title" class="required form-control" size="30" value="[% rt.title | html %]">
+ </p>
+
+ <div class="admin-hint">
+ <p>
+ [% loc('This is the <strong>public</strong> text that will be shown on the site.') %]
+ </p>
+ </div>
+ <p>
+ <strong>[% loc('Text:') %] </strong>
+ <textarea class="form-control" name="text" class="required">[% rt.text | html %]</textarea>
+ </p>
+
+ [% INCLUDE 'admin/category-checkboxes.html' hint=loc('If you only want this template to be an option for specific categories, pick them here. By default they will show for all categories.') %]
+
+ [% IF errors.state %]
+ <div class="form-error">[% errors.state %]</div>
+ [% END %]
+ <div class="admin-hint">
+ <p>
+ [% loc('If you want to use this template to prefill the update field when changing a report&rsquo;s state, select the state here.') %]
+ </p>
+ </div>
+ <p>
+ <label for="state">[% loc('State') %]</label>
+ [% INCLUDE 'report/inspect/state_groups_select.html' current_state=rt.state include_empty=1 %]
+ </p>
+
+ [% IF errors.external_status_code %]
+ <div class="form-error">[% errors.external_status_code %]</div>
+ [% END %]
+ <div class="admin-hint">
+ <p>
+ [% loc('If you want to use this template to prefill the update field when a report&rsquo;s <strong>external</strong> (e.g. Confirm) status code changes, enter the status code here.') %]
+ </p>
+ </div>
+ <p>
+ <label for="external_status_code">[% loc('External status code') %]</label>
+ <input type="text" name="external_status_code" class="form-control" size="30" value="[% rt.external_status_code | html %]">
+ </p>
+
+ [% IF errors.auto_response %]
+ <div class="form-error">[% errors.auto_response %]</div>
+ [% END %]
+ <div class="admin-hint">
+ <p>
+ [% loc('If ticked, this template will be used for Open311 updates that put problems in this state.') %]
+ </p>
+ </div>
+ <p>
+ <label>
+ <strong>[% loc('Auto-response:') %]</strong>
+ <input type="checkbox" name="auto_response" [% 'checked' IF rt.auto_response %] />
+ </label>
+ </p>
+
+ <p>
+ <input type="hidden" name="token" value="[% csrf_token %]" >
+ <input type="submit" class="btn" name="Edit templates" value="[% rt.id ? loc('Save changes') : loc('Create template') %]" >
+ </p>
+ [% IF rt.id %]
+ <p>
+ <input class="delete btn-danger" type="submit" name="delete_template" value="[% loc('Delete template') %]" data-confirm="[% loc('Are you sure?') %]">
+ </p>
+ [% END %]
+</form>
+
+[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/templates/index.html b/templates/web/base/admin/templates/index.html
new file mode 100644
index 000000000..9322c6ef6
--- /dev/null
+++ b/templates/web/base/admin/templates/index.html
@@ -0,0 +1,11 @@
+[% INCLUDE 'admin/header.html' title=loc('Response Templates') -%]
+
+<ul>
+ [% FOR body IN bodies %]
+ <li>
+ <a href="[% c.uri_for_action('/admin/templates/view', body.id) %]">[% body.name %]</a>
+ </li>
+ [% END %]
+</ul>
+
+[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/base/admin/templates/view.html b/templates/web/base/admin/templates/view.html
new file mode 100644
index 000000000..6a1dd9614
--- /dev/null
+++ b/templates/web/base/admin/templates/view.html
@@ -0,0 +1,39 @@
+[% INCLUDE 'admin/header.html' title=tprintf(loc('Response Templates for %s'), body.name) -%]
+
+<table>
+ <thead>
+ <tr>
+ <th> [% loc('Title') %] </th>
+ <th> [% loc('Categories') %] </th>
+ <th> [% loc('State') %] </th>
+ <th> [% loc('Auto Response') %] </th>
+ <th> &nbsp; </th>
+ </tr>
+ </thead>
+ <tbody>
+[% FOR t IN response_templates %]
+ <tr>
+ <td> [% t.title | html %] </td>
+ <td>
+ [% UNLESS t.contacts.size %]
+ <em>[% loc('All categories') %]</em>
+ [% ELSE %]
+ [% FOR contact IN t.contacts %]
+ [% contact.category_display %][% ',' UNLESS loop.last %]
+ [% END %]
+ [% END %]
+ </td>
+ <td>
+ [% IF t.state %][% t.state | html %][% END %]
+ [% IF t.external_status_code %][% t.external_status_code | html %] (external)[% END %]
+ </td>
+ <td> [% IF t.auto_response %]X[% END %] </td>
+ <td> <a href="[% c.uri_for_action('/admin/templates/edit', body.id, t.id) %]" class="btn">[% loc('Edit') %]</a> </td>
+ </tr>
+[% END %]
+ </tbody>
+</table>
+
+<a href="[% c.uri_for_action('/admin/templates/index', body.id, 'new') %]" class="btn">[% loc('New template') %]</a>
+
+[% INCLUDE 'admin/footer.html' %]