diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | web/js/fixmystreet.js | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 2311b4aff..63add43ee 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -500,7 +500,7 @@ sub setup_categories_and_councils : Private { unless ( $seen{$contact->category} ) { push @category_options, $contact->category; - $category_extras{ $contact->category } = $contact->extra + $category_extras{ $contact->category } = [ values %{$contact->extra} ] if $contact->extra; } $seen{$contact->category} = 1; diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index 22cd1c64f..ad3ff7c4d 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -61,11 +61,13 @@ $(function(){ if ( category_extras ) { $('#category_meta').empty(); if ( category_extras[this.options[ this.selectedIndex ].text] ) { - extras = category_extras[this.options[ this.selectedIndex ].text]; - for ( i in extras ) { - meta = extras[i]; + fields = category_extras[this.options[ this.selectedIndex ].text]; + $('<p>Additional information</p>').appendTo('#category_meta'); + fields.sort( function(a,b) { return a.order - b.order } ); + for ( i in fields) { + meta = fields[i]; field = '<div class="form-field">'; - field += '<label for="form_' + meta.code + '">' + meta.description + '</label>'; + field += '<label for="form_' + meta.code + '">' + meta.description + ':</label>'; field += '<input type="text" value="" name="' + meta.code + '" id="form_' + meta.code + '">'; field += '</div>'; $('<p>' + field + '</p>').appendTo('#category_meta'); |