Skip to content

Commit

Permalink
mapa arreglado, falta checar bugs en los markers, inicia forma de #9
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjcsr committed Mar 27, 2014
1 parent f495c34 commit dfbc3f9
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/assets/javascripts/preguntas.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
16 changes: 15 additions & 1 deletion app/assets/javascripts/static_pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function getCentros(lat, lng, busqueda) {
} else {
API_ENDPOINT = "/hospitales.json"
}
console.log(API_ENDPOINT);
var prom = $.ajax({
url: API + API_ENDPOINT,
cache: false,
Expand Down Expand Up @@ -93,6 +94,9 @@ function getCentros(lat, lng, busqueda) {
//*********/
$(document).ready(function() {
getCentros();
submit_ajax_form();


$('.vendor-heading').click(function() {
toggleVendor($(this));
});
Expand Down Expand Up @@ -123,12 +127,22 @@ $(document).ready(function() {

});

function submit_ajax_form() {
$('#preguntas').bind('ajax:success', function(e,data,status,xhr) {
console.log(xhr.responseText)
}).bind("ajax:error", function(e,xhr, status, error) {
console.log(error)
});
}



mapa.on('dragend', function(e) {
console.log(e.distance);
console.log(mapa.getBounds().getCenter().lat)
console.log(mapa.getBounds().getCenter().lng)
if (mapa.getZoom() == 14){
console.log(mapa.getZoom())
if (mapa.getZoom() >= 14){
getCentros(mapa.getBounds().getCenter().lat,mapa.getBounds().getCenter().lng)
showDataAtZoom(markers.getGeoJSON());
} else {
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/preguntas.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Preguntas controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
10 changes: 10 additions & 0 deletions app/controllers/preguntas_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class PreguntasController < ApplicationController

def preguntar
pregunta = params[:pregunta]
respond_to do |format|
format.json { render json: {response: "wololo", forma: {valor: pregunta}}}
end
end

end
2 changes: 2 additions & 0 deletions app/helpers/preguntas_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module PreguntasHelper
end
8 changes: 8 additions & 0 deletions app/views/static_pages/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
%p
De la Secretaría de Salud, SEDESA
.vendor-data
#vendor-head-later.vendor-heading
¿Qué necesitas?
#vendor-info-now.vendor-entries
= form_tag '/preguntas.json', id: "preguntas", method: 'post', remote: true do
= field_set_tag do
= label_tag :pregunta, "Pregunta"
= text_field_tag :pregunta
= submit_tag 'OK'
#vendor-head-now.vendor-heading
Cerca de aquí
#vendor-info-now.vendor-entries{style: "display: none"}
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

get 'mapa' => 'static_pages#index', as: :mapa

post '/preguntas' => 'preguntas#preguntar', as: :preguntar


resources :places

Expand Down
5 changes: 5 additions & 0 deletions spec/controllers/preguntas_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe PreguntasController do

end
15 changes: 15 additions & 0 deletions spec/helpers/preguntas_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the PreguntasHelper. For example:
#
# describe PreguntasHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe PreguntasHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit dfbc3f9

Please sign in to comment.