diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/zurich/admin/body-form.html | 1 | ||||
-rw-r--r-- | templates/web/zurich/admin/header.html | 1 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 2 | ||||
-rw-r--r-- | templates/web/zurich/admin/response_templates_select.html | 25 | ||||
-rw-r--r-- | templates/web/zurich/admin/template_edit.html | 38 | ||||
-rw-r--r-- | templates/web/zurich/admin/templates.html | 28 | ||||
-rw-r--r-- | templates/web/zurich/header.html | 5 |
7 files changed, 99 insertions, 1 deletions
diff --git a/templates/web/zurich/admin/body-form.html b/templates/web/zurich/admin/body-form.html index a31dffe7c..ac2887159 100644 --- a/templates/web/zurich/admin/body-form.html +++ b/templates/web/zurich/admin/body-form.html @@ -48,6 +48,7 @@ <p> <input type="hidden" name="posted" value="body"> <input type="hidden" name="token" value="[% token %]"> + <p> <input type="submit" value="[% body ? loc('Update body') : loc('Add body') %]"> </p> </form> diff --git a/templates/web/zurich/admin/header.html b/templates/web/zurich/admin/header.html index 281b1de23..a7ae7fb56 100644 --- a/templates/web/zurich/admin/header.html +++ b/templates/web/zurich/admin/header.html @@ -19,6 +19,7 @@ .error { color: red; } .overdue { background-color: #ffcccc; } select { width: auto; } + .admin-report-edit select { max-width: 100%; } #fms_pan_zoom { top: 13em !important; } </style> <script> diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index 02c396e1f..d2c1760ff 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -194,7 +194,7 @@ $(function(){ [% END %] <li><label for="status_update">[% loc('Public response:') %]</label> - + [% INCLUDE 'admin/response_templates_select.html' for='status_update' %] <textarea name='status_update' id='status_update' cols=60 rows=5> [%- IF problem.extra.public_response -%] [%- problem.extra.public_response | html -%] diff --git a/templates/web/zurich/admin/response_templates_select.html b/templates/web/zurich/admin/response_templates_select.html new file mode 100644 index 000000000..a16032790 --- /dev/null +++ b/templates/web/zurich/admin/response_templates_select.html @@ -0,0 +1,25 @@ +[% template_name="templates_for_${for}" %] + +[% response_templates = problem.response_templates %] +<div class="response_templates_select"> +<select id="[% template_name %]"> + <option value="">Choose a template</option> +[% FOR t IN response_templates %] + <option value="[% t.id %]"> [% t.title | html %] </option> +[% END %] +</select> +</p> +<script> + $(function () { + var response_template_texts = { + [% FOR t IN response_templates %] + [% t.id %]: '[% t.text | escape_js %]' [% loop.last ? '' : ',' %] + [% END %] + }; + $('#[% template_name %]').change(function () { + var val = $(this).val(); + var text = response_template_texts[val]; + $('#[% for %]').val( text ); + }); + }); +</script> diff --git a/templates/web/zurich/admin/template_edit.html b/templates/web/zurich/admin/template_edit.html new file mode 100644 index 000000000..e3e4fe190 --- /dev/null +++ b/templates/web/zurich/admin/template_edit.html @@ -0,0 +1,38 @@ +[% INCLUDE 'admin/header.html' title=tprintf(loc('Response Templates for %s'), body.name) -%] +[% rt = response_template %] + +<h2> [% tprintf(loc('Response Templates for %s'), body.name) %] </h2> + +<h3> [% IF rt.id %] + Template «[% rt.title %]» + [% ELSE %] + New template + [% END %] +</h3> + +<form method="post" + action="[% c.uri_for('templates', body.id, rt.id || 'new' ) %]" + enctype="application/x-www-form-urlencoded" + accept-charset="utf-8" + class="validate"> + + <p> + <strong>[% loc('Title:') %] </strong> + <input type="text" name="title" class="required" size="30" value="[% rt.title| html %]"> + </p> + <p> + <strong>[% loc('Text:') %] </strong> + <textarea name="text" class="required">[% rt.text |html %]</textarea> + </p> + <p> + <input type="hidden" name="token" value="[% token %]" > + <input type="submit" name="Edit templates" value="[% rt.id ? loc('Save changes') : loc('Create template') %]" > + </p> + [% IF rt.id %] + <p> + <input class="delete" type="submit" name="delete_template" value="[% loc('Delete template') %]"> + </p> + [% END %] +</form> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/zurich/admin/templates.html b/templates/web/zurich/admin/templates.html new file mode 100644 index 000000000..d3b334022 --- /dev/null +++ b/templates/web/zurich/admin/templates.html @@ -0,0 +1,28 @@ +[% INCLUDE 'admin/header.html' title=tprintf(loc('Response Templates for %s'), body.name) -%] + +<h2> [% tprintf(loc('Response Templates for %s'), body.name) %] </h2> + +<table> + <thead> + <tr> + <th> [% loc('Title') %] </th> + <th> [% loc('Text') %] </th> + <th> [% loc('Created') %] </th> + <th> </th> + </tr> + </thead> + <tbody> +[% FOR t IN response_templates %] + <tr> + <td> [% t.title %] </td> + <td> [% t.text %] </td> + <td> [% t.created %] </td> + <td> <a href="/admin/templates/[% body.id %]/[% t.id %]" class="btn">[% loc('Edit') %]</a> </td> + </tr> +[% END %] + </tbody> +</table> + +<a href="[% c.uri_for('templates', body.id, 'new') %]" class="btn">[% loc('New template') %]</a> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/zurich/header.html b/templates/web/zurich/header.html index 78ed678f6..7e88f3f0f 100644 --- a/templates/web/zurich/header.html +++ b/templates/web/zurich/header.html @@ -72,6 +72,11 @@ <li [% IF pagename == 'stats' %]class="current"[% END %]> <a href="/admin/stats">[% loc('Stats') %]</a> </li> + [% IF admin_type == 'dm' %] + <li [% IF pagename == 'templates' OR pagename == 'template' %]class="current"[% END %]> + <a href="/admin/templates">[% loc('Templates') %]</a> + </li> + [% END %] <li class="search-box"> <form method="get" action="[% c.uri_for('reports') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="text" name="search" size="20" id="search" placeholder="[% loc('Search reports') %]"> |