aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/cobrands/buckinghamshire/assets.js50
-rw-r--r--web/cobrands/fixmystreet/assets.js4
2 files changed, 38 insertions, 16 deletions
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index cf08f6b1f..318555494 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -77,32 +77,54 @@ var streetlight_stylemap = new OpenLayers.StyleMap({
})
});
-fixmystreet.assets.add($.extend(true, {}, defaults, {
+var streetlight_code_to_type = {
+ 'LC': 'street light',
+ 'S': 'sign',
+ 'BB': 'belisha beacon',
+ 'B': 'bollard',
+ 'BS': 'traffic signal',
+ 'VMS': 'sign',
+ 'RB': 'bollard',
+ 'CPS': 'sign',
+ 'SF': 'sign'
+};
+
+var labeled_defaults = $.extend(true, {}, defaults, {
select_action: true,
stylemap: streetlight_stylemap,
+ attributes: {
+ central_asset_id: 'central_as',
+ site_code: 'site_code'
+ },
+ actions: {
+ asset_found: function(asset, config) {
+ var id = asset.attributes.feature_id || '';
+ if (id !== '') {
+ var code = id.replace(/[0-9]/g, '');
+ var asset_name = streetlight_code_to_type[code] || config.asset_item;
+ $('.category_meta_message').html('You have selected ' + asset_name + ' <b>' + id + '</b>');
+ } else {
+ $('.category_meta_message').html('You can pick a <b class="asset-spot">' + config.asset_item + '</b> from the map &raquo;');
+ }
+ },
+ asset_not_found: function(config) {
+ $('.category_meta_message').html('You can pick a <b class="asset-spot">' + config.asset_item + '</b> from the map &raquo;');
+ }
+ }
+});
+
+fixmystreet.assets.add($.extend(true, {}, labeled_defaults, {
http_options: {
params: {
TYPENAME: "StreetLights_Merged"
}
},
- attributes: {
- central_asset_id: 'central_as',
- site_code: 'Site_code'
- },
asset_category: [
'Light on during the day',
'Street light dim',
'Street light intermittent',
'Street light not working' ],
- asset_item: 'street light',
- actions: {
- asset_found: function(asset) {
- $('.category_meta_message').html('You have selected street light <b>' + asset.attributes.Feature_id + '</b>');
- },
- asset_not_found: function() {
- $('.category_meta_message').html('You can pick a <b class="asset-spot">street light</b> from the map &raquo;');
- }
- }
+ asset_item: 'street light'
}));
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 65b507467..fbf40c690 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -112,13 +112,13 @@ OpenLayers.Layer.VectorAsset = OpenLayers.Class(OpenLayers.Layer.Vector, {
asset_found: function() {
if (this.fixmystreet.actions) {
- this.fixmystreet.actions.asset_found(fixmystreet.assets.selectedFeature());
+ this.fixmystreet.actions.asset_found(fixmystreet.assets.selectedFeature(), this.fixmystreet);
}
},
asset_not_found: function() {
if (this.fixmystreet.actions) {
- this.fixmystreet.actions.asset_not_found();
+ this.fixmystreet.actions.asset_not_found(this.fixmystreet);
}
},