aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--templates/web/base/report/new/category.html10
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6cadc9bee..0f6afb5a6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@
- Stop filter category overriding chosen category.
- Allow things to reset if "Pick a category" picked.
- Stop category_change firing more than it should.
+ - Fix extra question display when only one category.
- Development improvements:
- Make front page cache time configurable.
- Better working of /fakemapit/ under https.
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>