aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-06-01 07:50:28 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-06-10 09:54:28 +0100
commiteb8d1b6f0aed5773c08d76041bc5aec57cbc4a31 (patch)
tree48dd2ec13475a668d98f50395e22354235caa001 /templates
parent831943b1320841f3b9383c1e493840f9f657744c (diff)
Refactor pretty state display.
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/admin/list_updates.html2
-rw-r--r--templates/web/base/admin/problem_row.html2
-rw-r--r--templates/web/base/admin/report_blocks.html19
-rw-r--r--templates/web/base/admin/stats_by_state.html2
-rw-r--r--templates/web/base/report/_item.html2
-rw-r--r--templates/web/base/report/_state_select_field.html4
-rw-r--r--templates/web/base/report/inspect/state_groups_select.html13
-rw-r--r--templates/web/base/report/state-list.html21
-rw-r--r--templates/web/oxfordshire/report/inspect/state_groups_select.html9
9 files changed, 27 insertions, 47 deletions
diff --git a/templates/web/base/admin/list_updates.html b/templates/web/base/admin/list_updates.html
index 35f7adf66..d759a2354 100644
--- a/templates/web/base/admin/list_updates.html
+++ b/templates/web/base/admin/list_updates.html
@@ -34,7 +34,7 @@
<td>[% IF update.user.id == update.problem.user_id %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
<td>[% IF update.user.belongs_to_body( update.problem.bodies_str ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
<td>[% update.cobrand %]<br>[% update.cobrand_data | html %]</td>
- <td>[% state_pretty.${update.state} %]<br><small>
+ <td>[% prettify_state(update.state) %]<br><small>
[% loc('Created:') %] [% PROCESS format_time time=update.created %]
<br>[% loc('Confirmed:') %] [% PROCESS format_time time=update.confirmed %]
</small></td>
diff --git a/templates/web/base/admin/problem_row.html b/templates/web/base/admin/problem_row.html
index 577e36992..e7e18dee9 100644
--- a/templates/web/base/admin/problem_row.html
+++ b/templates/web/base/admin/problem_row.html
@@ -30,7 +30,7 @@
[%- END -%]
<br>[% problem.cobrand %]<br>[% problem.cobrand_data | html %]
</td>
- <td>[% state_pretty.${problem.state} %]<br><small>
+ <td>[% prettify_state(problem.state) %]<br><small>
[% loc('Created') %]:&nbsp;[% PROCESS format_time time=problem.created %]
<br>[% loc('When sent') %]:&nbsp;[% PROCESS format_time time=problem.whensent %]
[%- IF problem.is_visible %]<br>[% loc('Confirmed:' ) %]&nbsp;[% PROCESS format_time time=problem.confirmed %][% END -%]
diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html
index 9231dd1c2..933521b94 100644
--- a/templates/web/base/admin/report_blocks.html
+++ b/templates/web/base/admin/report_blocks.html
@@ -2,25 +2,6 @@
SET report_blocks_included = 1;
-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')
-};
-
SET state_groups = [
[ loc('Open'), [ 'confirmed', 'investigating', 'planned', 'in progress', 'action scheduled' ] ],
[ loc('Fixed'), [ 'fixed', 'fixed - user', 'fixed - council' ] ],
diff --git a/templates/web/base/admin/stats_by_state.html b/templates/web/base/admin/stats_by_state.html
index b003d934e..6bcd35f88 100644
--- a/templates/web/base/admin/stats_by_state.html
+++ b/templates/web/base/admin/stats_by_state.html
@@ -4,7 +4,7 @@
[%- BLOCK states -%]
[%- FOREACH state IN list %]
[%- '<ul>' IF loop.first %]
- <li>[% object.$state %] [% state_pretty.$state %]</li>
+ <li>[% object.$state %] [% prettify_state(state) %]</li>
[%- "\n</ul>" IF loop.last %]
[%- END %]
[% END -%]
diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html
index 6896aa86e..dc53e81aa 100644
--- a/templates/web/base/report/_item.html
+++ b/templates/web/base/report/_item.html
@@ -92,7 +92,7 @@
</div>
<div>
<h4>[% loc('State') %]</h4>
- <p>[% state_pretty.${problem.state} %]</p>
+ <p>[% prettify_state(problem.state) %]</p>
</div>
<div>
<h4>[% loc('Priority') %]</h4>
diff --git a/templates/web/base/report/_state_select_field.html b/templates/web/base/report/_state_select_field.html
index adec1ff06..c580c897d 100644
--- a/templates/web/base/report/_state_select_field.html
+++ b/templates/web/base/report/_state_select_field.html
@@ -9,12 +9,12 @@
[% END ~%]
[% END ~%]
[% IF NOT found ~%]
- <option selected value="[% current_state %]">[% state_pretty.$current_state %]</option>
+ <option selected value="[% current_state %]">[% prettify_state(current_state) %]</option>
[% END ~%]
[% FOREACH group IN state_groups %]
<optgroup label="[% group.0 %]">
[% FOREACH state IN group.1 %]
- <option [% 'selected ' IF state == current_state %]value="[% state %]">[% state_pretty.$state %]</option>
+ <option [% 'selected ' IF state == current_state %]value="[% state %]">[% prettify_state(state) %]</option>
[% END %]
</optgroup>
[% END %]
diff --git a/templates/web/base/report/inspect/state_groups_select.html b/templates/web/base/report/inspect/state_groups_select.html
index c344bf6d0..af41c6770 100644
--- a/templates/web/base/report/inspect/state_groups_select.html
+++ b/templates/web/base/report/inspect/state_groups_select.html
@@ -1,17 +1,4 @@
[%
-SET state_pretty = {
- 'confirmed' = loc('Open')
- 'investigating' = loc('Investigating')
- 'in progress' = loc('In progress')
- 'action scheduled' = loc('Action Scheduled')
- 'fixed - council' = loc('Fixed - Council')
- 'fixed - user' = loc('Fixed - User')
- 'unable to fix' = loc('No further action')
- 'not responsible' = loc('Not Responsible')
- 'duplicate' = loc('Duplicate')
- 'internal referral' = loc('Internal referral')
- 'hidden' = loc('Hidden')
-};
SET state_groups = [
[ loc('Open'), [ 'confirmed', 'investigating', 'in progress', 'action scheduled' ] ],
diff --git a/templates/web/base/report/state-list.html b/templates/web/base/report/state-list.html
new file mode 100644
index 000000000..e137c81e2
--- /dev/null
+++ b/templates/web/base/report/state-list.html
@@ -0,0 +1,21 @@
+[%
+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/oxfordshire/report/inspect/state_groups_select.html b/templates/web/oxfordshire/report/inspect/state_groups_select.html
index 529e6f403..dcb24c982 100644
--- a/templates/web/oxfordshire/report/inspect/state_groups_select.html
+++ b/templates/web/oxfordshire/report/inspect/state_groups_select.html
@@ -1,13 +1,4 @@
[%
-SET state_pretty = {
- 'confirmed' = loc('Open')
- 'investigating' = loc('Investigating')
- 'action scheduled' = loc('Action Scheduled')
- 'fixed - council' = loc('Fixed')
- 'not responsible' = loc('Not Responsible')
- 'duplicate' = loc('Duplicate')
- 'unable to fix' = loc('No further action')
-};
SET state_groups = [
[ loc('New'), [ 'confirmed', 'investigating' ] ],