diff --git a/app/views/maps/_google_map.js.erb b/app/views/maps/_google_map.js.erb index de678ad..78fd623 100644 --- a/app/views/maps/_google_map.js.erb +++ b/app/views/maps/_google_map.js.erb @@ -25,6 +25,8 @@ function codeAddress() { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); marker.setPosition(results[0].geometry.location); + getAddress(marker.getPosition()); + $('profile_data_lat').value = results[0].geometry.location.lat(); $('profile_data_lng').value = results[0].geometry.location.lng(); $('location-fields').removeClassName("loading"); @@ -93,6 +95,10 @@ function updateFields(place) { $('profile_data_lng').value = position.lng(); $('location-fields').removeClassName("loading"); + form = jQuery('#location-form')[0]; + form.lat = marker.getPosition().lat(); + form.lng = marker.getPosition().lng(); + var components_len = place.address_components.size(); if(components_len < 2) diff --git a/app/views/maps/edit_location.rhtml b/app/views/maps/edit_location.rhtml index dee99fb..9ed01a4 100644 --- a/app/views/maps/edit_location.rhtml +++ b/app/views/maps/edit_location.rhtml @@ -2,7 +2,8 @@
<%= flash[:error] %>
-<% form_for :profile_data, :url => {:action => 'edit_location'} do |f| %> + +<% form_for :profile_data, :url => {:action => 'edit_location'}, :html => {:id => 'location-form'} do |f| %>
<%= select_country _('Country'), 'profile_data', 'country', {:class => 'type-select'} %> @@ -23,8 +24,8 @@

- <%= f.hidden_field(:lat) %> - <%= f.hidden_field(:lng) %> + <%= f.hidden_field :lat %> + <%= f.hidden_field :lng %> <% end %> -- libgit2 0.21.2