aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/css/core.scss8
-rw-r--r--web/js/fixmystreet.js26
2 files changed, 34 insertions, 0 deletions
diff --git a/web/css/core.scss b/web/css/core.scss
index 71e290d5c..f8a00a1f4 100644
--- a/web/css/core.scss
+++ b/web/css/core.scss
@@ -220,6 +220,14 @@ $map_width: 500px;
margin-bottom: 1em;
}
+ #category_meta {
+ margin-bottom: 30px;
+ }
+
+ #category_meta label {
+ width: 10em;
+ }
+
// Map
#map_box {
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index b67c4d74b..48d66360b 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -57,6 +57,32 @@ $(function(){
timer = window.setTimeout(email_alert_close, 2000);
});
+ $('#form_category').change(function() {
+ if ( category_extras ) {
+ $('#category_meta').empty();
+ if ( category_extras[this.options[ this.selectedIndex ].text] ) {
+ var fields = category_extras[this.options[ this.selectedIndex ].text];
+ $('<h4>Additional information</h4>').appendTo('#category_meta');
+ for ( var i in fields) {
+ var meta = fields[i];
+ var field = '<div class="form-field">';
+ field += '<label for="form_' + meta.code + '">' + meta.description + ':</label>';
+ if ( meta.values ) {
+ field += '<select name="' + meta.code + '" id="form_' + meta.code + '">';
+ for ( var j in meta.values.value ) {
+ field += '<option value="' + meta.values.value[j].key + '">' + j + '</option>';
+ }
+ field += '</select>';
+ } else {
+ field += '<input type="text" value="" name="' + meta.code + '" id="form_' + meta.code + '">';
+ }
+ field += '</div>';
+ $( field ).appendTo('#category_meta');
+ }
+ }
+ }
+ });
+
// Geolocation
if (geo_position_js.init()) {
$('#postcodeForm').append('<p id="geolocate_para">Or <a href="#" id="geolocate_link">locate me automatically</a>').css({ "padding-bottom": "0.5em" });