Commit a6d1568718c69ab239005df04cb4d3a9c66fc9a1
1 parent
bbb8594c
Exists in
master
and in
22 other branches
Update lat and lng at profile
Showing
2 changed files
with
10 additions
and
3 deletions
Show diff stats
app/views/maps/_google_map.js.erb
| ... | ... | @@ -25,6 +25,8 @@ function codeAddress() { |
| 25 | 25 | if (status == google.maps.GeocoderStatus.OK) { |
| 26 | 26 | map.setCenter(results[0].geometry.location); |
| 27 | 27 | marker.setPosition(results[0].geometry.location); |
| 28 | + getAddress(marker.getPosition()); | |
| 29 | + | |
| 28 | 30 | $('profile_data_lat').value = results[0].geometry.location.lat(); |
| 29 | 31 | $('profile_data_lng').value = results[0].geometry.location.lng(); |
| 30 | 32 | $('location-fields').removeClassName("loading"); |
| ... | ... | @@ -93,6 +95,10 @@ function updateFields(place) { |
| 93 | 95 | $('profile_data_lng').value = position.lng(); |
| 94 | 96 | $('location-fields').removeClassName("loading"); |
| 95 | 97 | |
| 98 | + form = jQuery('#location-form')[0]; | |
| 99 | + form.lat = marker.getPosition().lat(); | |
| 100 | + form.lng = marker.getPosition().lng(); | |
| 101 | + | |
| 96 | 102 | var components_len = place.address_components.size(); |
| 97 | 103 | |
| 98 | 104 | if(components_len < 2) | ... | ... |
app/views/maps/edit_location.rhtml
| ... | ... | @@ -2,7 +2,8 @@ |
| 2 | 2 | <div class="error"> |
| 3 | 3 | <%= flash[:error] %> |
| 4 | 4 | </div> |
| 5 | -<% form_for :profile_data, :url => {:action => 'edit_location'} do |f| %> | |
| 5 | + | |
| 6 | +<% form_for :profile_data, :url => {:action => 'edit_location'}, :html => {:id => 'location-form'} do |f| %> | |
| 6 | 7 | |
| 7 | 8 | <div id='location-fields'> |
| 8 | 9 | <%= select_country _('Country'), 'profile_data', 'country', {:class => 'type-select'} %> |
| ... | ... | @@ -23,8 +24,8 @@ |
| 23 | 24 | <p><div id="location-map"></div></p> |
| 24 | 25 | </div> |
| 25 | 26 | |
| 26 | - <%= f.hidden_field(:lat) %> | |
| 27 | - <%= f.hidden_field(:lng) %> | |
| 27 | + <%= f.hidden_field :lat %> | |
| 28 | + <%= f.hidden_field :lng %> | |
| 28 | 29 | |
| 29 | 30 | <% end %> |
| 30 | 31 | ... | ... |