<commit_before><div class="container">
  <div class="jumbotron jumbotron-b">
    <div class="row">
      <div class="menubar"><%= render_navigation( expand_all: true) %></div>
    </div>
    <% provide(:title, 'Propiedades::Registrar') %>
    <% Cities.data_path = Rails.root.join('config', 'extras', 'cities') %>
    <h1>Registrar Propiedad</h1>

    <div class="row">
      <div class="col-md-6 col-md-offset-3">
        <%= form_for @property, url: {action: "create"} do |f| %>
            <%@countries = CountriesWithCitiesGrouper.new('Americas')%>
            <%= f.label :city, "Ciudad" %>
          <%= f.select :city, @countries.cities_for('Colombia'),
                   { include_blank: true },
                   { class: 'chosen-select' } %>

          <%= f.label :neighbor, "Barrio:" %>
          <%= f.text_field :neighbor %>

          <%= f.label :location, "Dirección:" %>
          <%= f.text_field :location %>

          <%= f.label :area, "Área del Inmueble*:" %>
          <%= f.text_field :area %>

          <%= f.label :building_name, "Urbanización:" %>
          <%= f.text_field :building_name %>

          <%= f.label :floors_number, "# Pisos:" %>
          <%= f.number_field :floors_number %>

                <%= f.label :floors, "Piso:" %>
          <%= f.number_field :floor %>

          <%= f.label :op_rental, "Arrendar/Rentar"%>
          <%= f.radio_button :for_sell, "0", required: true %>

          <%= f.label :op_sell, "Vender" %>
          <%= f.radio_button :for_sell, "1", required: true %>

                <%= f.label :value, "Valor:" %>
          <%= f.number_field :value %>

          <%= f.hidden_field :lease_holder_id, value: current_user.id %>

          <%= f.submit "Registrar", class: "btn btn-primary" %>
        <% end %>
      </div>
    </div>
  </div>
</div><commit_msg>agregando mapa a registrar propiedades<commit_after>
<style>
#map { width: 500px; height: 400px; margin: 0 auto }
</style>
<div class="container">
  <div class="jumbotron jumbotron-b">
    <div class="row">
      <div class="menubar"><%= render_navigation( expand_all: true) %></div>
    </div>
    <% provide(:title, 'Propiedades::Registrar') %>
    <% Cities.data_path = Rails.root.join('config', 'extras', 'cities') %>
    <h1>Registrar Propiedad</h1>
    <div class="row">
      <div class="col-md-6 col-md-offset-3">
				<div id="map"></div>
				<br>
        <%= form_for @property, url: {action: "create"} do |f| %>

          <%= f.label :location, "Dirección:" %>
          <%= f.text_field :location %>
				
          <%= f.label :neighbor, "Barrio:" %>
          <%= f.text_field :neighbor %>

          <%= f.label :area, "Área del Inmueble*:" %>
          <%= f.text_field :area %>

          <%= f.label :building_name, "Urbanización:" %>
          <%= f.text_field :building_name %>

          <%= f.label :floors_number, "# Pisos:" %>
          <%= f.number_field :floors_number %>

                <%= f.label :floors, "Piso:" %>
          <%= f.number_field :floor %>

          <%= f.label :op_rental, "Arrendar/Rentar"%>
          <%= f.radio_button :for_sell, "0", required: true %>

          <%= f.label :op_sell, "Vender" %>
          <%= f.radio_button :for_sell, "1", required: true %>

                <%= f.label :value, "Valor:" %>
          <%= f.number_field :value %>

          <%= f.hidden_field :lease_holder_id, value: current_user.id %>

          <%= f.submit "Registrar", class: "btn btn-primary" %>
        <% end %>
      </div>
    </div>
  </div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=<KEY>"></script>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.4.2.min.js"></script>
<script>
	var map;
	$(document).ready(function() {
		//Crear el mapa
		map = mapa(0,0);
		//Asignar el evento de double clik al mapa
		google.maps.event.addListener(map, 'dblclick', function(e) {
			//Creamos un onjeto JSON con los parametros que vamos a enviar {latitud,longitu,sensor}
			params = {
				"latlng": e.latLng.lat()+','+e.latLng.lng(),
				"sensor": true
			}
			//Hacemos una peticion AJAX con JQuery
			$.get('http://maps.googleapis.com/maps/api/geocode/json',params,function(res){
				dir = $('#direccion');
				try{
			          //mostramos la direccion completa en un alert
			          alert('La dirección del inmueble seleccionado es: ' + res.results[0].formatted_address);
								document.getElementById('property_location').value = res.results[0].formatted_address
								//console.log(res.results[0].formatted_address)
			    }
			    catch(e){
			            //Si hay un error, esque la direccion no se puedo obtener
			            alert("No se pudo obtener la dirección, intentalo de nuevo"+e);
			            return;
			    }
			        return;
			    });
		});
	});

	//Funcion carga el mapa sobre el div con id map
	function mapa(lat,lon){
        var mapOptions = {
            center: new google.maps.LatLng(lat, lon),
            zoom: 4,
            disableDoubleClickZoom:true
        };
				
        map = new google.maps.Map(document.getElementById('map'),{center: {lat: 6.24905, lng: -75.5994845}, zoom: 12});
        return map; 
	}
	
		
</script>
{'fraction_non_alphanumeric': 0.18297791317593298, 'fraction_numerical': 0.00913937547600914, 'mean_word_length': 2.3437301082113304, 'pattern_counts': {'":': 2, '<': 98, '<?xml version=': 0, '>': 98, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3846899', 'n_tokens_mistral': 2052, 'n_tokens_neox': 1800, 'n_words': 358}