Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bexley changes #2481

Merged
merged 6 commits into from
May 17, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
104 changes: 90 additions & 14 deletions web/cobrands/bexley/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,70 @@ var defaults = {
strategy_class: OpenLayers.Strategy.FixMyStreet
};

var streetlight_default = {
fillColor: "#FFFF00",
fillOpacity: 0.6,
strokeColor: "#000000",
strokeOpacity: 0.8,
strokeWidth: 2,
pointRadius: 6
};

var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');

var streetlight_select = {
externalGraphic: pin_prefix + "pin-spot.png",
fillColor: "#55BB00",
graphicWidth: 48,
graphicHeight: 64,
graphicXOffset: -24,
graphicYOffset: -56,
backgroundGraphic: pin_prefix + "pin-shadow.png",
backgroundWidth: 60,
backgroundHeight: 30,
backgroundXOffset: -7,
backgroundYOffset: -22,
popupYOffset: -40,
graphicOpacity: 1.0,

label: "${Unit_No}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
};

var streetlight_stylemap = new OpenLayers.StyleMap({
'default': new OpenLayers.Style(streetlight_default),
'select': new OpenLayers.Style(streetlight_select)
});

var labeled_defaults = $.extend(true, {}, defaults, {
select_action: true,
stylemap: streetlight_stylemap,
feature_code: 'Unit_No',
asset_type: 'spot',
asset_id_field: 'Unit_ID',
attributes: {
UnitID: 'Unit_ID'
},
actions: {
asset_found: function(asset) {
var id = asset.attributes[this.fixmystreet.feature_code] || '';
if (id !== '') {
var asset_name = this.fixmystreet.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">' + this.fixmystreet.asset_item + '</b> from the map &raquo;');
}
},
asset_not_found: function() {
$('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map &raquo;');
}
}
});

fixmystreet.assets.add(defaults, {
http_options: {
params: {
Expand All @@ -44,35 +108,47 @@ fixmystreet.assets.add(defaults, {
})
});

fixmystreet.assets.add(defaults, {
fixmystreet.assets.add(labeled_defaults, {
http_options: {
params: {
TYPENAME: "Bollards"
}
},
asset_type: 'spot',
asset_id_field: 'Unit_ID',
attributes: {
UnitID: 'Unit_ID'
},
asset_category: ["Damaged sign, bollard etc."],
asset_category: ["Keep left bollard"],
asset_item: 'bollard'
});

fixmystreet.assets.add(defaults, {
fixmystreet.assets.add(labeled_defaults, {
http_options: {
params: {
TYPENAME: "Lighting"
}
},
asset_type: 'spot',
asset_id_field: 'Unit_ID',
attributes: {
UnitID: 'Unit_ID'
},
asset_category: ["Lamp post", "Light in park or open space", "Zebra crossing light", "Traffic sign light", "Underpass light", "Keep left bollard", "Light in multi-storey car park", "Light in outside car park"],
asset_category: ["Lamp post", "Light in park or open space", "Underpass light", "Light in multi-storey car park", "Light in outside car park"],
asset_item: 'street light'
});

// We need to trigger the below function on subcategory change also
$(function(){
$("#problem_form").on("change.category", "#form_DALocation", function() {
$(fixmystreet).trigger('report_new:category_change', [ $('#form_category') ]);
});
});

fixmystreet.message_controller.register_category({
body: defaults.body,
category: function() {
var cat = $('#form_category').val();
if (cat === 'Dead animal') {
var where = $('#form_DALocation').val();
if (where === 'Garden' || where === 'Other private property') {
return true;
}
dracos marked this conversation as resolved.
Show resolved Hide resolved
}
return false;
},
message: 'Please follow the link above to pay to remove a dead animal from a private property.'
});

})();