{I"
class:ETI"ProcessedAsset; FI"logical_path; TI"'subdivision_select/subdivisions.js; FI"
pathname; TI"a/Users/sean/dev/subdivision_select/app/assets/javascripts/subdivision_select/subdivisions.js; FI"content_type; TI"application/javascript; TI"
mtime; Tl+0iUI"length; TiçI"digest; TI"%7e0999d2b4ac1307654bb6ecadeea1f2; FI"source; TI"ç$(document).ready(function() {
function updateSubdivisionsSelect(newSubdivisions) {
var subdivisionSelect = $("select[id$=_subdivision]");
var isEmpty = $.isEmptyObject(newSubdivisions);
clearSelect(subdivisionSelect);
$.each(newSubdivisions, function(alpha2, name) {
subdivisionSelect.append($("").attr("value", alpha2).text(name));
});
// Disable the select if there are no newSubdivisions (and un-do that once there are some)
subdivisionSelect.prop("disabled", isEmpty);
// If there are none, make it say "none"
if (isEmpty) {
subdivisionSelect.append($("").text("none"));
}
}
// Not only empty the select, but:
// if the first element is blank, add a blank element before all others
function clearSelect(selectToClear) {
var includeBlank = selectToClear.children().first().text() === "";
selectToClear.empty();
if (includeBlank) {
selectToClear.append($(""));
}
}
function populateSelectViaAjax() {
$.ajax( {
url: "/subdivisions",
data: { country_code: $(this).val() },
success: updateSubdivisionsSelect
} );
}
$("select[id$=_country]").change(populateSelectViaAjax);
});
; TI"dependency_digest; TI"%964f3aaeff83ef28aad398a059729534; FI"required_paths; T[I"a/Users/sean/dev/subdivision_select/app/assets/javascripts/subdivision_select/subdivisions.js; FI"dependency_paths; T[{I" path; TI"a/Users/sean/dev/subdivision_select/app/assets/javascripts/subdivision_select/subdivisions.js; FI"
mtime; TI"2015-03-31T23:42:40-04:00; TI"digest; TI"%7e0999d2b4ac1307654bb6ecadeea1f2; FI"
_version; TI"%64e62ddc273c2f5847f30d698ca14b67; F