diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-31 16:15:46 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-31 16:15:46 +0100 |
commit | cec5c77a4207b341947affed8e6e8e57ec29965d (patch) | |
tree | 246900550b394f956a8ac4bd76ffbe943cc8fb1e /templates | |
parent | c590981f0c198fa0491801a312a65eed054a0778 (diff) | |
parent | 51a5bcc74982aefea4f7b364e2f4bc49596bd9bf (diff) |
Merge branch 'move-report-states-to-database'
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/base/admin/problem_row.html | 4 | ||||
-rw-r--r-- | templates/web/base/admin/report_blocks.html | 8 | ||||
-rw-r--r-- | templates/web/base/admin/states/index.html | 118 | ||||
-rw-r--r-- | templates/web/base/dashboard/index.html | 11 | ||||
-rw-r--r-- | templates/web/base/front/stats.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/_item.html | 4 | ||||
-rw-r--r-- | templates/web/base/report/banner.html | 6 | ||||
-rw-r--r-- | templates/web/base/report/inspect/state_groups_select.html | 7 | ||||
-rw-r--r-- | templates/web/base/report/state-list.html | 21 | ||||
-rw-r--r-- | templates/web/base/report/update.html | 6 | ||||
-rw-r--r-- | templates/web/base/report/update/form_update.html | 4 | ||||
-rw-r--r-- | templates/web/base/reports/_list-filters.html | 27 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/inspect/state_groups_select.html | 12 |
13 files changed, 156 insertions, 74 deletions
diff --git a/templates/web/base/admin/problem_row.html b/templates/web/base/admin/problem_row.html index 79461367e..446e94d66 100644 --- a/templates/web/base/admin/problem_row.html +++ b/templates/web/base/admin/problem_row.html @@ -34,8 +34,8 @@ [% loc('Created') %]: [% PROCESS format_time time=problem.created %] <br>[% loc('When sent') %]: [% PROCESS format_time time=problem.whensent %] [%- IF problem.is_visible %]<br>[% loc('Confirmed:' ) %] [% PROCESS format_time time=problem.confirmed %][% END -%] - [%- IF problem.is_fixed %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%] - [%- IF problem.is_closed %]<br>[% loc('Closed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%] + [%- IF problem.is_fixed %]<br>[% prettify_state('fixed') %]: [% PROCESS format_time time=problem.lastupdate %][% END -%] + [%- IF problem.is_closed %]<br>[% prettify_state('closed') %]: [% PROCESS format_time time=problem.lastupdate %][% END -%] [%- IF problem.is_open %]<br>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%] </small></td> <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html index 933521b94..f5896b88f 100644 --- a/templates/web/base/admin/report_blocks.html +++ b/templates/web/base/admin/report_blocks.html @@ -1,13 +1,7 @@ [% SET report_blocks_included = 1; - -SET state_groups = [ - [ loc('Open'), [ 'confirmed', 'investigating', 'planned', 'in progress', 'action scheduled' ] ], - [ loc('Fixed'), [ 'fixed', 'fixed - user', 'fixed - council' ] ], - [ loc('Closed'), [ 'unable to fix', 'not responsible', 'duplicate', 'closed', 'internal referral' ] ], - [ loc('Hidden'), [ 'hidden', 'partial', 'unconfirmed' ] ] -]; +SET state_groups = c.cobrand.state_groups_admin; %] diff --git a/templates/web/base/admin/states/index.html b/templates/web/base/admin/states/index.html new file mode 100644 index 000000000..bd87f5013 --- /dev/null +++ b/templates/web/base/admin/states/index.html @@ -0,0 +1,118 @@ +[% INCLUDE 'admin/header.html' title=loc('States') ~%] + +[% SET rows = languages.size + 1 IF languages.size > 1 ~%] + +<form method="post" accept-charset="utf-8"> + +<table> + <tr> + <th>Label</th> + <th>Type</th> + <th colspan="2">Name</th> + <th> </th> + </tr> + [% FOREACH state IN open_states.merge(closed_states).merge(fixed_states) %] + <tr> + <td rowspan="[% rows %]"> + [% IF state.label == 'confirmed' %] + open + [% ELSE %] + [% state.label %] + [% END %] + </td> + <td rowspan="[% rows %]"> + [% IF state.label == 'confirmed' %] + [% loc('Open') %]<input type="hidden" name="type:confirmed" value="open"> + [% ELSIF state.label == 'closed' %] + [% loc('Closed') %]<input type="hidden" name="type:closed" value="closed"> + [% ELSIF state.label == 'fixed' %] + [% loc('Fixed') %]<input type="hidden" name="type:fixed" value="fixed"> + [% ELSE %] + <select name="type:[% state.label %]"> + <option value="open"[% ' selected' IF state.type == 'open' %]>[% loc('Open') %]</option> + <option value="closed"[% ' selected' IF state.type == 'closed' %]>[% loc('Closed') %]</option> + </select> + [% END %] + </td> + <td colspan="2"> + [% IF state.label != 'confirmed' AND state.label != 'closed' %] + <input type="text" name="name:[% state.label %]" value="[% state.name %]"> + [% ELSIF languages.size == 1 %] + <input type="text" name="name:[% state.label %]" value="[% state.msgstr %]"> + [% ELSE %] + [% state.name %] + [% END %] + </td> + <td style="text-align:center;vertical-align:middle" rowspan="[% rows %]"> + [% IF state.label != 'confirmed' AND state.label != 'closed' %] + <input class="btn btn--small" type="submit" name="delete:[% state.label %]" value="Delete"> + [% END %] + </td> + </tr> + [% IF languages.size > 1 %] + [% FOREACH language IN languages.keys.sort %] + <tr> + <td style="vertical-align:middle; text-align:right;"> + <label style="margin:0" for="translation:[% state.label %]:[% language %]"> + [% languages.$language.name %] ([% language %]) + </label> + </td> + <td> + <input type="hidden" name="translation_id:[% state.label %]:[% language %]" + value="[% state.translated.name.$language.id %]"> + <input type="text" name="translation:[% state.label %]:[% language %]" + id="translation:[% state.label %]:[% language %]" value="[% state.translated.name.$language.msgstr %]"> + </td> + </tr> + [% END %] + [% END %] + </td> + </tr> + [% END %] +</table> + + <p> + <input type="hidden" name="token" value="[% csrf_token %]"> + <input type="submit" class="btn" value="[% loc('Update') %]"> + </p> + +</form> + +[% IF fixed_states.size == 0 %] +<form method="post" accept-charset="utf-8"> + <p> + <input type="hidden" name="token" value="[% csrf_token %]"> + <input type="submit" class="btn" name="new_fixed" value="[% loc('Add fixed state') %]"> + </p> +</form> + +[% END %] + +<h2>[% loc('New state') %]</h2> + +<form method="post" accept-charset="utf-8"> + <p> + <label for="label">[% loc('Label') %] <small>[% loc('(a-z and space only)') %]</small></label> + <input type="text" class="form-control" name="label" id="label" value="" size="20" pattern="[a-z ]+"> + </p> + + <p> + <label for="type">[% loc('Label') %]</label> + <select name="type" id="type"> + <option value="open">[% loc('Open') %]</option> + <option value="closed">[% loc('Closed') %]</option> + </select> + </p> + + <p> + <label for="name">[% loc('Name') %]</label> + <input type="text" class="form-control" name="name" id="name" value="" size="20"> + </p> + + <p> + <input type="hidden" name="token" value="[% csrf_token %]"> + <input type="submit" class="btn" name="new" value="[% loc('Create') %]"> + </p> +</form> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/dashboard/index.html b/templates/web/base/dashboard/index.html index 6033ef36b..e47798573 100644 --- a/templates/web/base/dashboard/index.html +++ b/templates/web/base/dashboard/index.html @@ -136,11 +136,12 @@ </select> <p>[% loc('Report state:') %] <select class="form-control" name="state"> <option value=''>[% loc('All') %]</option> - [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', - loc('Investigating')], ['action scheduled', loc('Planned')], ['in progress', - loc('In Progress')], ['closed', loc('Closed')], ['fixed', loc('Fixed')] ] %] - <option [% 'selected ' IF state.0 == q_state %] value="[% state.0 %]">[% state.1 %]</option> - [% END %] + [% FOR group IN filter_states %] + [% FOR state IN group.1 %] + [% NEXT IF state == 'hidden' %] + <option [% 'selected ' IF state == q_state %] value="[% state %]">[% prettify_state(state, 1) %]</option> + [% END %] + [% END %] </select> <input type="submit" class="btn" value="[% loc('Look up') %]"> <a class="export_as_csv" href="[% c.req.uri_with({ export => 1 }) %]">[% loc('Export as CSV') %]</a> diff --git a/templates/web/base/front/stats.html b/templates/web/base/front/stats.html index eb671137b..41358c869 100644 --- a/templates/web/base/front/stats.html +++ b/templates/web/base/front/stats.html @@ -35,7 +35,9 @@ <div id="front_stats"> <div>[% tprintf( new_text, decode(new_n) ) %]</div> + [% IF has_fixed_state %] <div>[% tprintf( fixed_text, decode(fixed_n) ) %]</div> + [% END %] [% IF c.cobrand.moniker != 'zurich' %] <div>[% tprintf( updates_text, decode(updates_n) ) %]</div> [% END %] diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 3f5c5464b..9449ca55d 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -40,9 +40,9 @@ [% END %] <small> [% IF NOT no_fixed AND problem.is_fixed %] - <span class="item-list__item__state">[% loc('Fixed') %]</span> + <span class="item-list__item__state">[% prettify_state('fixed') %]</span> [% ELSIF NOT no_fixed AND problem.is_closed %] - <span class="item-list__item__state">[% loc('Closed') %]</span> + <span class="item-list__item__state">[% prettify_state('closed') %]</span> [% ELSIF (c.user.has_permission_to('report_edit_priority', problem.bodies_str_ids) OR c.user.has_permission_to('report_inspect', problem.bodies_str_ids)) AND problem.response_priority %] <span class="item-list__item__state">[% problem.response_priority.name %]</span> [% END %] diff --git a/templates/web/base/report/banner.html b/templates/web/base/report/banner.html index c80d129eb..ee73d287a 100644 --- a/templates/web/base/report/banner.html +++ b/templates/web/base/report/banner.html @@ -9,11 +9,11 @@ [% INCLUDE banner, id = 'unknown', text = loc('Unknown') %] [% END %] [% IF problem.is_fixed %] - [% INCLUDE banner, id = 'fixed', text = loc('Fixed') %] + [% INCLUDE banner, id = 'fixed', text = prettify_state('fixed') %] [% END %] [% IF problem.is_closed %] - [% INCLUDE banner, id = 'closed', text = loc('Closed') %] + [% INCLUDE banner, id = 'closed', text = prettify_state('closed') %] [% END %] [% IF problem.is_in_progress %] - [% INCLUDE banner, id = 'progress', text = loc('In progress') %] + [% INCLUDE banner, id = 'progress', text = prettify_state(problem.state) %] [% END %] diff --git a/templates/web/base/report/inspect/state_groups_select.html b/templates/web/base/report/inspect/state_groups_select.html index 2cf1a4de5..998b99739 100644 --- a/templates/web/base/report/inspect/state_groups_select.html +++ b/templates/web/base/report/inspect/state_groups_select.html @@ -1,11 +1,6 @@ [% -SET state_groups = [ - [ loc('Open'), [ 'confirmed', 'investigating', 'in progress', 'action scheduled' ] ], - [ loc('Fixed'), [ 'fixed - council' ] ], - [ loc('Closed'), [ 'unable to fix', 'not responsible', 'duplicate', 'internal referral' ] ], - [ loc('Hidden'), [ 'hidden' ] ] -]; +SET state_groups = c.cobrand.state_groups_inspect; %] [% DEFAULT current_state = problem.state %] diff --git a/templates/web/base/report/state-list.html b/templates/web/base/report/state-list.html deleted file mode 100644 index e137c81e2..000000000 --- a/templates/web/base/report/state-list.html +++ /dev/null @@ -1,21 +0,0 @@ -[% -SET state_pretty = { - 'confirmed' = loc('Open') - 'investigating' = loc('Investigating') - 'planned' = loc('Planned') - 'in progress' = loc('In progress') - 'action scheduled' = loc('Action Scheduled') - 'fixed' = loc('Fixed') - 'fixed - user' = loc('Fixed - User') - 'fixed - council' = loc('Fixed - Council') - 'unable to fix' = loc('No further action') - 'not responsible' = loc('Not Responsible') - 'duplicate' = loc('Duplicate') - 'closed' = loc('Closed') - 'internal referral' = loc('Internal referral') - 'hidden' = loc('Hidden') - 'partial' = loc('Partial') - 'unconfirmed' = loc('Unconfirmed') -}; -state_pretty.$state -~%] diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index 1f1438bfc..85624669a 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -43,6 +43,12 @@ </div> [% END %] + [% SET update_state = update.problem_state_display(c) %] + [% IF update_state AND update_state != global.last_state AND NOT (global.last_state == "" AND update.problem_state == 'confirmed') %] + <p class="meta-2">[% loc('State changed to:') %] [% update_state %]</p> + [%- global.last_state = update_state %] + [% END %] + <p class="meta-2"> [% INCLUDE meta_line %] [% IF c.user_exists AND c.user.id == update.user_id AND !update.anonymous %] diff --git a/templates/web/base/report/update/form_update.html b/templates/web/base/report/update/form_update.html index 34abf53c5..5a1b3b602 100644 --- a/templates/web/base/report/update/form_update.html +++ b/templates/web/base/report/update/form_update.html @@ -39,7 +39,7 @@ <label for="state">[% loc( 'State' ) %]</label> [% INCLUDE 'report/inspect/state_groups_select.html' %] [% ELSE %] - [% IF (problem.is_fixed OR problem.state == 'closed') AND ((c.user_exists AND c.user.id == problem.user_id) OR alert_to_reporter) %] + [% IF (problem.is_fixed OR problem.is_closed) AND ((c.user_exists AND c.user.id == problem.user_id) OR alert_to_reporter) %] <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF (update.mark_open || c.req.params.reopen) %]> [% IF problem.is_closed %] @@ -48,7 +48,7 @@ <label class="inline" for="form_reopen">[% loc('This problem has not been fixed') %]</label> [% END %] - [% ELSIF !problem.is_fixed %] + [% ELSIF !problem.is_fixed AND has_fixed_state %] <div class="checkbox-group"> <input type="checkbox" name="fixed" id="form_fixed" value="1"[% ' checked' IF update.mark_fixed %]> diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index ef7c7ad78..50e88857d 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -1,6 +1,6 @@ [% select_status = BLOCK %] <select class="form-control js-multiple" name="status" id="statuses" multiple - data-all="[% loc('All reports') %]" data-all-options='["open","closed","fixed"]' + data-all="[% loc('All') %]" data-all-options='["open","closed","fixed"]' [%~ IF c.cobrand.on_map_default_status == 'open' %] data-none="[% loc('Unfixed reports') %]" [%~ END ~%] @@ -10,19 +10,18 @@ <option value="unshortlisted"[% ' selected' IF filter_status.unshortlisted %]>[% loc('Unshortlisted') %]</option> [% END %] [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %] - <option value="confirmed"[% ' selected' IF filter_status.confirmed %]>[% loc('Open') %]</option> - <option value="investigating"[% ' selected' IF filter_status.investigating %]>[% loc('Investigating') %]</option> - <option value="in progress"[% ' selected' IF filter_status.in_progress %]>[% loc('In progress') %]</option> - <option value="action scheduled"[% ' selected' IF filter_status.action_scheduled %]>[% loc('Action scheduled') %]</option> - <option value="fixed"[% ' selected' IF filter_status.fixed %]>[% loc('Fixed reports') %]</option> - <option value="unable to fix"[% ' selected' IF filter_status.unable_to_fix %]>[% loc('No further action') %]</option> - <option value="not responsible"[% ' selected' IF filter_status.not_responsible %]>[% loc('Not responsible') %]</option> - <option value="internal referral"[% ' selected' IF filter_status.internal_referral %]>[% loc('Internal referral') %]</option> - <option value="duplicate"[% ' selected' IF filter_status.duplicate %]>[% loc('Duplicate') %]</option> + [% FOR group IN filter_states %] + [% FOR state IN group.1 %] + [% NEXT IF state == 'hidden' %] + <option value="[% state %]"[% ' selected' IF filter_status.$state %]>[% prettify_state(state, 1) %]</option> + [% END %] + [% END %] [% ELSE %] - <option value="open"[% ' selected' IF filter_status.open %]>[% loc('Unfixed reports') %]</option> - <option value="closed"[% ' selected' IF filter_status.closed %]>[% loc('Closed reports') %]</option> - <option value="fixed"[% ' selected' IF filter_status.fixed %]>[% loc('Fixed reports') %]</option> + <option value="open"[% ' selected' IF filter_status.open %]>[% prettify_state('confirmed') %]</option> + <option value="closed"[% ' selected' IF filter_status.closed %]>[% prettify_state('closed') %]</option> + [% IF has_fixed_state %] + <option value="fixed"[% ' selected' IF filter_status.fixed %]>[% prettify_state('fixed') %]</option> + [% END %] [% END %] </select> [% END %] @@ -46,7 +45,7 @@ [% END %] <p class="report-list-filters"> - [% tprintf(loc('<label for="statuses">Show</label> %s <label for="filter_categories">about</label> %s', "The first %s is a dropdown of all/fixed/etc, the second is a dropdown of categories"), select_status, select_category) %] + [% tprintf(loc('<label for="statuses">Show</label> %s reports <label for="filter_categories">about</label> %s', "The first %s is a dropdown of all/fixed/etc, the second is a dropdown of categories"), select_status, select_category) %] <input type="submit" name="filter_update" value="[% loc('Go') %]"> </p> diff --git a/templates/web/oxfordshire/report/inspect/state_groups_select.html b/templates/web/oxfordshire/report/inspect/state_groups_select.html deleted file mode 100644 index d36fb0191..000000000 --- a/templates/web/oxfordshire/report/inspect/state_groups_select.html +++ /dev/null @@ -1,12 +0,0 @@ -[% - -SET state_groups = [ - [ loc('New'), [ 'confirmed', 'investigating' ] ], - [ loc('Scheduled'), [ 'action scheduled' ] ], - [ loc('Fixed'), [ 'fixed - council' ] ], - [ loc('Closed'), [ 'not responsible', 'duplicate', 'unable to fix' ] ] -]; - -%] -[% DEFAULT current_state = problem.state %] -[% INCLUDE 'report/_state_select_field.html' single_fixed=1 %] |