{I" class:ETI"BundledAsset;FI"logical_path;TI"maps/addresspicker_form.js;FI" pathname;TI"p/Users/austin/Sites/berlinmagic/magic_addresses/vendor/assets/javascripts/maps/addresspicker_form.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+u3ėTI" length;TiI" digest;TI"%d2e0497ef76e7e83238b4750c6ac701a;FI" source;TI"(function() { this.checkDaLocationFormBox = function(field) { if (field.val() !== "" && ($(field).val() != null)) { return $(field).val() + " "; } else { return ""; } }; this.updateLocationFormDataField = function(el) { if ($(el).addresspicker != null) { return $(el).addresspicker("updatePosition"); } }; this.updateshortLocationFormDataField = function(el) { var form, mdata; mdata = ""; form = $(el).closest(".map_form"); el = form.find(".mgca_short_data"); mdata = mdata + checkDaLocationFormBox(form.find("input.mgca_txt.street")); mdata = mdata + checkDaLocationFormBox(form.find("input.mgca_txt.street_number")); mdata = mdata + checkDaLocationFormBox(form.find("input.mgca_txt.zip")); mdata = mdata + checkDaLocationFormBox(form.find("input.mgca_txt.city")); return el.val("" + mdata); }; this.updateLocationFormGoogleMapField = function(el) { var form, lat, long; form = $(el).closest(".map_form"); lat = form.find(".mgca_latitude").val(); long = form.find(".mgca_longitude").val(); $(el).addresspicker({ mapOptions: { zoom: 15, center: new google.maps.LatLng(lat, long) }, elements: { map: form.find(".address_preview_map").length > 0 ? "#" + (form.find(".address_preview_map").attr("id")) : false, lat: form.find(".mgca_latitude").length > 0 ? "#" + (form.find(".mgca_latitude").attr("id")) : false, lng: form.find(".mgca_longitude").length > 0 ? "#" + (form.find(".mgca_longitude").attr("id")) : false, locality: form.find(".mgca_txt.city").length > 0 ? "#" + (form.find(".mgca_txt.city").attr("id")) : false, sublocality: form.find(".mgca_txt.district").length > 0 ? "#" + (form.find(".mgca_txt.district").attr("id")) : false, country: form.find(".mgca_txt.country").length > 0 ? "#" + (form.find(".mgca_txt.country").attr("id")) : false, country_code: form.find(".mgca_txt.country_code").length > 0 ? "#" + (form.find(".mgca_txt.country_code").attr("id")) : false, streetNumber: form.find(".mgca_txt.street_number").length > 0 ? "#" + (form.find(".mgca_txt.street_number").attr("id")) : false, route: form.find(".mgca_txt.street").length > 0 ? "#" + (form.find(".mgca_txt.street").attr("id")) : false, postal_code: form.find(".mgca_txt.zip").length > 0 ? "#" + (form.find(".mgca_txt.zip").attr("id")) : false, administrative_area_level_1: form.find(".mgca_txt.state").length > 0 ? "#" + (form.find(".mgca_txt.state").attr("id")) : false, administrative_area_level_2: form.find(".mgca_txt.county").length > 0 ? "#" + (form.find(".mgca_txt.county").attr("id")) : false, administrative_area_level_3: form.find(".mgca_txt.subcounty").length > 0 ? "#" + (form.find(".mgca_txt.subcounty").attr("id")) : false, formatted_address: form.find(".mgca_txt.address").length > 0 ? "#" + (form.find(".mgca_txt.address").attr("id")) : false } }); $(el).addresspicker("marker").setVisible(true); $(el).addresspicker("updatePosition"); return window.setTimeout((function() { return $(el).addresspicker("updatePosition"); }), 500); }; this.updateLocationFormGoogleField = function(el) { var form; form = $(el).closest(".map_form"); return $(el).addresspicker({ elements: { lat: form.find(".mgca_latitude").length > 0 ? "#" + (form.find(".mgca_latitude").attr("id")) : false, lng: form.find(".mgca_longitude").length > 0 ? "#" + (form.find(".mgca_longitude").attr("id")) : false, locality: form.find(".mgca_txt.city").length > 0 ? "#" + (form.find(".mgca_txt.city").attr("id")) : false, sublocality: form.find(".mgca_txt.district").length > 0 ? "#" + (form.find(".mgca_txt.district").attr("id")) : false, country: form.find(".mgca_txt.country").length > 0 ? "#" + (form.find(".mgca_txt.country").attr("id")) : false, country_code: form.find(".mgca_txt.country_code").length > 0 ? "#" + (form.find(".mgca_txt.country_code").attr("id")) : false, streetNumber: form.find(".mgca_txt.street_number").length > 0 ? "#" + (form.find(".mgca_txt.street_number").attr("id")) : false, route: form.find(".mgca_txt.street").length > 0 ? "#" + (form.find(".mgca_txt.street").attr("id")) : false, postal_code: form.find(".mgca_txt.zip").length > 0 ? "#" + (form.find(".mgca_txt.zip").attr("id")) : false, administrative_area_level_1: form.find(".mgca_txt.state").length > 0 ? "#" + (form.find(".mgca_txt.state").attr("id")) : false, administrative_area_level_2: form.find(".mgca_txt.county").length > 0 ? "#" + (form.find(".mgca_txt.county").attr("id")) : false, administrative_area_level_3: form.find(".mgca_txt.subcounty").length > 0 ? "#" + (form.find(".mgca_txt.subcounty").attr("id")) : false, formatted_address: form.find(".mgca_txt.address").length > 0 ? "#" + (form.find(".mgca_txt.address").attr("id")) : false } }); }; this.updateLocationFormAllGoogleFields = function() { $("input.mgca_map_data").each(function() { console.log("Find field!"); return updateLocationFormGoogleMapField(this); }); return $("input.mgca_short_data").each(function() { console.log("Find field!"); return updateLocationFormGoogleField(this); }); }; }).call(this); ;TI"required_assets_digest;TI"%9e417e151d1cb89a27379f189c559100;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F