aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-05-19 12:15:24 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-05-26 13:34:38 +0100
commit9e7c44777e9fbcbef6be463b4a7a1dc9b20d90f1 (patch)
treeab709d5975a9b61c2778559be59e76f8beb015ec /templates
parent36baff2d6ea23dc6648160ce82e40e0e9f6d7bda (diff)
Make sure existing state is included in drop-down.
It is possible the report's state isn't one that the user can access, but in that case we should still show it to avoid confusion.
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/report/_state_select_field.html11
1 files changed, 10 insertions, 1 deletions
diff --git a/templates/web/base/report/_state_select_field.html b/templates/web/base/report/_state_select_field.html
index 9b3ed18df..adec1ff06 100644
--- a/templates/web/base/report/_state_select_field.html
+++ b/templates/web/base/report/_state_select_field.html
@@ -2,10 +2,19 @@
[% IF include_empty %]
<option value="">---</option>
[% END %]
+[% SET found = 0 ~%]
+[% FOREACH group IN state_groups ~%]
+ [% FOREACH state IN group.1 ~%]
+ [% SET found = 1 IF state == current_state ~%]
+ [% END ~%]
+[% END ~%]
+[% IF NOT found ~%]
+ <option selected value="[% current_state %]">[% state_pretty.$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 %]">[% state_pretty.$state %]</option>
[% END %]
</optgroup>
[% END %]