diff options
Diffstat (limited to 'web/cobrands/eastsussex/assets.js')
-rw-r--r-- | web/cobrands/eastsussex/assets.js | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/web/cobrands/eastsussex/assets.js b/web/cobrands/eastsussex/assets.js index 296c8ede4..6f5304cd0 100644 --- a/web/cobrands/eastsussex/assets.js +++ b/web/cobrands/eastsussex/assets.js @@ -72,18 +72,10 @@ fixmystreet.assets.add(defaults, { asset_item: 'street light', asset_category: ["Burning By Day", "Intermittent", "Lamp Dim", "Lamp Flashing", "Lamp Obscured", "Lamp Out", "Missing Number", "Noisy Column", "Vandalism" ], select_action: true, + feature_code: 'Name', actions: { - asset_found: function(asset) { - var id = asset.attributes.Name || ''; - if (id !== '') { - $('.category_meta_message').html('You have selected <b>' + id + '</b>'); - } else { - $('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map »'); - } - }, - asset_not_found: function() { - $('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map »'); - } + asset_found: fixmystreet.assets.named_select_action_found, + asset_not_found: fixmystreet.assets.named_select_action_not_found } }); @@ -106,22 +98,19 @@ fixmystreet.assets.add(defaults, { asset_item: 'drain', asset_category: ["Blocked Drain", "Culvert", "Broken Drain Cover", "Smell", "Sunken Drain", "Missing Drain Cover"], select_action: true, + construct_selected_asset_message: function(asset) { + var last_clean = asset.attributes.Gully_Last_Clean_Date__c || ''; + var next_clean = asset.attributes.Gully_Next_Clean_Date__c || ''; + if (last_clean !== '' || next_clean !== '') { + var message = ''; + if (last_clean) { message += '<b>Last Cleaned</b>: ' + last_clean; } + if (next_clean) { message += ' <b>Next Clean</b>: ' + next_clean; } + return message; + } + }, actions: { - asset_found: function(asset) { - var last_clean = asset.attributes.Gully_Last_Clean_Date__c || ''; - var next_clean = asset.attributes.Gully_Next_Clean_Date__c || ''; - if (last_clean !== '' || next_clean !== '') { - var message = ''; - if (last_clean) { message += '<b>Last Cleaned</b>: ' + last_clean; } - if (next_clean) { message += ' <b>Next Clean</b>: ' + next_clean; } - $('.category_meta_message').html(message); - } else { - $('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map »'); - } - }, - asset_not_found: function() { - $('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map »'); - } + asset_found: fixmystreet.assets.named_select_action_found, + asset_not_found: fixmystreet.assets.named_select_action_not_found } }); |