aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-03-25 15:03:49 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-03-27 09:57:01 +0000
commita5afe37792f89e2525c3e446fa5207513cd374cd (patch)
tree84eddd77478c3110220aa14a2368ad8dd7af2909 /templates
parent26f8e67e8f08e77587dfc736a3e0634708a2bfd7 (diff)
Fix extra question display when only one category.
If the site only has the one category, it was being preselected but the extra attribute questions were not being shown.
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/report/new/category.html10
1 files changed, 9 insertions, 1 deletions
diff --git a/templates/web/base/report/new/category.html b/templates/web/base/report/new/category.html
index e537c8f1f..ec53263ca 100644
--- a/templates/web/base/report/new/category.html
+++ b/templates/web/base/report/new/category.html
@@ -1,7 +1,15 @@
+[%
+# If only one option, pre-select that as if it were already selected. This
+# carries through to the category_extras template because this template is
+# included with PROCESS.
+IF category_options.size == 2;
+ category = category_options.1.category;
+END
+~%]
[% IF category_options.size OR category_groups.size ~%]
[%~ BLOCK category_option ~%]
[% cat_op_lc = cat_op.category | lower =%]
- <option value='[% cat_op.category | html %]'[% ' selected' IF report.category == cat_op.category || category_lc == cat_op_lc || (category_options.size == 2 AND loop.last) ~%]
+ <option value='[% cat_op.category | html %]'[% ' selected' IF report.category == cat_op.category || category_lc == cat_op_lc ~%]
>[% IF loop.first %][% cat_op.category_display %][% ELSE %][% cat_op.category_display | html %][% END %]
[%~ IF cat_op.get_extra_metadata('help_text') %] ([% cat_op.get_extra_metadata('help_text') %])[% END ~%]
</option>