diff options
Diffstat (limited to 'templates/web')
-rw-r--r-- | templates/web/base/admin/category-multiselect.html | 10 | ||||
-rw-r--r-- | templates/web/base/admin/defecttypes/edit.html | 37 | ||||
-rw-r--r-- | templates/web/base/admin/defecttypes/index.html | 13 | ||||
-rw-r--r-- | templates/web/base/admin/defecttypes/list.html | 35 | ||||
-rw-r--r-- | templates/web/base/defect_type/format.html | 9 | ||||
-rw-r--r-- | templates/web/base/report/_inspect.html | 23 | ||||
-rw-r--r-- | templates/web/oxfordshire/admin/defecttypes/extra_fields.html | 8 | ||||
-rw-r--r-- | templates/web/oxfordshire/defect_type/format.html | 4 |
8 files changed, 127 insertions, 12 deletions
diff --git a/templates/web/base/admin/category-multiselect.html b/templates/web/base/admin/category-multiselect.html new file mode 100644 index 000000000..98416204f --- /dev/null +++ b/templates/web/base/admin/category-multiselect.html @@ -0,0 +1,10 @@ +<p> + <strong>[% loc('Categories:') %]</strong> +</p> +<p> + <select class="form-control js-multiple" name="categories" id="categories" multiple data-all="[% loc('All categories') %]"> + [% FOR contact IN contacts %] + <option value="[% contact.id %]" [% 'selected' IF contact.active %]>[% contact.category | html %]</option> + [% END %] + </select> +</p> diff --git a/templates/web/base/admin/defecttypes/edit.html b/templates/web/base/admin/defecttypes/edit.html new file mode 100644 index 000000000..65c8a5ab7 --- /dev/null +++ b/templates/web/base/admin/defecttypes/edit.html @@ -0,0 +1,37 @@ +[% INCLUDE 'admin/header.html' title=tprintf(loc('Defect Type for %s'), body.name) -%] +[% dt = defect_type %] + +[% UNLESS dt.id %]<h3>[% loc('New defect type') %]</h3>[% END %] + +<form method="post" + action="[% c.uri_for('', body.id, dt.id || 'new' ) %]" + enctype="application/x-www-form-urlencoded" + accept-charset="utf-8" + class="validate"> + + <p> + <strong>[% loc('Name:') %] </strong> + <input type="text" name="name" class="required form-control" size="30" value="[% dt.name | html %]"> + </p> + <p> + <strong>[% loc('Description:') %] </strong> + <input type="text" name="description" class="form-control" size="30" value="[% dt.description | html %]"> + </p> + + <div class="admin-hint"> + <p> + [% loc('If you only want this defect type to be an option for specific categories, pick them here. By default they will show for all categories.') %] + </p> + </div> + + [% INCLUDE 'admin/category-multiselect.html' %] + + [% TRY %][% INCLUDE 'admin/defecttypes/extra_fields.html' %][% CATCH file %][% END %] + + <p> + <input type="hidden" name="token" value="[% csrf_token %]" > + <input type="submit" class="btn" name="save" value="[% dt.id ? loc('Save changes') : loc('Create defect type') %]" > + </p> +</form> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/defecttypes/index.html b/templates/web/base/admin/defecttypes/index.html new file mode 100644 index 000000000..2e6ce7e1b --- /dev/null +++ b/templates/web/base/admin/defecttypes/index.html @@ -0,0 +1,13 @@ +[% INCLUDE 'admin/header.html' title=loc('Defect Types') -%] + +<ul> + [% FOR body IN bodies %] + <li> + <a href="[% c.uri_for('', body.id) %]">[% body.name %]</a> + [% defect_types_count = body.defect_types.count %] + [% IF defect_types_count %]([% defect_types_count %])[% END %] + </li> + [% END %] +</ul> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/defecttypes/list.html b/templates/web/base/admin/defecttypes/list.html new file mode 100644 index 000000000..1a9cb4fa7 --- /dev/null +++ b/templates/web/base/admin/defecttypes/list.html @@ -0,0 +1,35 @@ +[% INCLUDE 'admin/header.html' title=tprintf(loc('Defect Types for %s'), body.name) -%] + +<table> + <thead> + <tr> + <th> [% loc('Name') %] </th> + <th> [% loc('Description') %] </th> + <th> [% loc('Categories') %] </th> + <th> </th> + </tr> + </thead> + <tbody> + [% PROCESS 'defect_type/format.html' %] + [% FOR d IN defect_types %] + <tr> + <td> [% defect_type_format(defect_type=d) %] </td> + <td> [% d.description | html %] </td> + <td> + [% UNLESS d.contacts.size %] + <em>[% loc('All categories') %]</em> + [% ELSE %] + [% FOR contact IN d.contacts %] + [% contact.category %][% ',' UNLESS loop.last %] + [% END %] + [% END %] + </td> + <td> <a href="[% c.uri_for('', body.id, d.id) %]" class="btn">[% loc('Edit') %]</a> </td> + </tr> + [% END %] + </tbody> +</table> + +<a href="[% c.uri_for('', body.id, 'new') %]" class="btn">[% loc('New defect type') %]</a> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/defect_type/format.html b/templates/web/base/defect_type/format.html new file mode 100644 index 000000000..3c0781501 --- /dev/null +++ b/templates/web/base/defect_type/format.html @@ -0,0 +1,9 @@ +[% +# This template can be overridden by cobrands if they've added extra fields +# to the DefectType model (e.g Cobrand::Oxfordshire->defect_type_extra_fields) +# which should be used to represent this DefectType +# to the user in the inspect form. +~%] +[% MACRO defect_type_format BLOCK ~%] +[%~ defect_type.name | html ~%] +[%~ END %]
\ No newline at end of file diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index 625887eff..5e97de3f4 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -62,18 +62,17 @@ [% END %] [% IF permissions.report_inspect %] - [% IF c.cobrand.defect_types %] - <p> - <label for="defect_type">[% loc('Defect type') %]</label> - [% defect_type = problem.get_extra_metadata('defect_type') %] - <select id="defect_type" name="defect_type" class="form-control"> - <option value=""[% ' selected' IF NOT defect_type %]>-</option> - [% FOREACH dt IN c.cobrand.defect_types.pairs %] - <option[% ' selected' IF defect_type == dt.key %] value="[% dt.key | html %]">[% dt.value | html %]</option> - [% END %] - </select> - </p> - [% END %] + [% PROCESS 'defect_type/format.html' %] + <p> + <label for="defect_type">[% loc('Defect type') %]</label> + <select id="defect_type" name="defect_type" class="form-control"> + <option value=""[% ' selected' IF NOT problem.defect_type %]>-</option> + [% FOREACH defect_type IN problem.defect_types %] + <option[% ' selected' IF problem.defect_type_id == defect_type.id %] value="[% defect_type.id %]">[% defect_type_format() %]</option> + [% END %] + </select> + </p> + <p> <label for="state">[% loc('State') %]</label> [% INCLUDE 'report/inspect/state_groups_select.html' %] diff --git a/templates/web/oxfordshire/admin/defecttypes/extra_fields.html b/templates/web/oxfordshire/admin/defecttypes/extra_fields.html new file mode 100644 index 000000000..73cc54f0c --- /dev/null +++ b/templates/web/oxfordshire/admin/defecttypes/extra_fields.html @@ -0,0 +1,8 @@ +<p> + <strong>[% loc('Activity Code:') %] </strong> + <input type="text" name="extra[activity_code]" class="form-control" size="30" value="[% dt.get_extra_metadata('activity_code') | html %]"> +</p> +<p> + <strong>[% loc('Defect Code:') %] </strong> + <input type="text" name="extra[defect_code]" class="form-control" size="30" value="[% dt.get_extra_metadata('defect_code') | html %]"> +</p> diff --git a/templates/web/oxfordshire/defect_type/format.html b/templates/web/oxfordshire/defect_type/format.html new file mode 100644 index 000000000..9cbf2d873 --- /dev/null +++ b/templates/web/oxfordshire/defect_type/format.html @@ -0,0 +1,4 @@ +[% MACRO defect_type_format BLOCK ~%] +[%~ defect_type.get_extra_metadata('defect_code') | html %] - [% defect_type.get_extra_metadata('activity_code') | html %] +([% defect_type.name | html %]) +[%~ END %]
\ No newline at end of file |