Skip to content

Instantly share code, notes, and snippets.

@DemitryT
Created August 29, 2012 14:10
Show Gist options
  • Save DemitryT/3513136 to your computer and use it in GitHub Desktop.
Save DemitryT/3513136 to your computer and use it in GitHub Desktop.
admin.js
function updateMapMarkerOnShowAddressChange() {
// added the if statement below
if($("setting_rentals_details_map_marker_box")) {
var boxRadioButton = $("setting_rentals_details_map_marker_box");
var initialMapMarkerBox = boxRadioButton.checked;
}
var rentAddressCheckbox = $('setting_show_rental_address');
var pinRadioButton = $("setting_rentals_details_map_marker_pin");
// added the if statement below
if(typeof rentAddressCheckbox !== "undefined" && typeof pinRadioButton !== "undefined" && typeof boxRadioButton !== "undefined") {
if(rentAddressCheckbox.checked && !boxRadioButton.disabled){
boxRadioButton.disabled = true;
boxRadioButton.checked = false;
pinRadioButton.checked = true;
}
rentAddressCheckbox.observe('click', function() {
if(rentAddressCheckbox.checked) {
boxRadioButton.disabled = true;
boxRadioButton.checked = false;
pinRadioButton.checked = true;
}
else if(!rentAddressCheckbox.checked) {
boxRadioButton.disabled = false;
if(initialMapMarkerBox) {
boxRadioButton.checked = true;
pinRadioButton.checked = false;
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment