diff --git a/Gemfile b/Gemfile index 2a0d017..36e38e8 100644 --- a/Gemfile +++ b/Gemfile @@ -53,7 +53,7 @@ end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] group :development, :test do - + gem 'pry-byebug' gem 'rspec-rails' gem 'rails-controller-testing' diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index f5dbde3..0b1243b 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -15,13 +15,13 @@ @import "bootstrap"; .Page-Title { - font-size:30px; - font-weight:bold; - text-align:center; + font-size:30px; + font-weight:bold; + text-align:center; } .panel-footer { - background-color: white; + background-color: white; } .contact-header { @@ -31,3 +31,12 @@ .questions { margin-left: 10%; } + +#map_wrapper { + height: 400px; +} + +#map_canvas { + width: 100%; + height: 100%; +} diff --git a/app/controllers/listings_controller.rb b/app/controllers/listings_controller.rb index 972a80e..bcc7db7 100644 --- a/app/controllers/listings_controller.rb +++ b/app/controllers/listings_controller.rb @@ -3,6 +3,33 @@ class ListingsController < ApplicationController skip_before_action :verify_authenticity_token + def get_map_points + map_points = [{lat:42.3601, long:-71.0589}] + + @listings = Listing.all + + @listings.each do |point| + array = [] + + if point.latitude.to_f > 41.6821 && + point.latitude.to_f < 42.9337 && + point.longitude.to_f < -69.9598 && + point.longitude.to_f > -72.2781 + + array << point.address + array << point.latitude + array << point.longitude + end + + map_points << array + end + + respond_to do |format| + format.html + format.json { render json: { data: map_points } } + end + end + def index @listings = Listing.paginate(:page => params[:page], :per_page => 50) respond_to do |format| @@ -44,7 +71,6 @@ def create def discriminatory @listings = Listing.discriminatory - binding.pry render_listings_formats end @@ -74,5 +100,4 @@ def render_listings_formats format.json {render json: @listings.to_json} end end - end diff --git a/app/views/listings/index.html.erb b/app/views/listings/index.html.erb index 92e34ac..8f806a4 100644 --- a/app/views/listings/index.html.erb +++ b/app/views/listings/index.html.erb @@ -36,64 +36,68 @@ -
-
-
- <%= button_to "Run Scraper", scrapers_path, class: 'btn btn-primary btn-block' %> -
+
+
+
+ +
+
+
+ <%= button_to "Run Scraper", scrapers_path, class: 'btn btn-primary btn-block' %>
-
-
- - - - - - - - - - + +
+
+
headinglisted ataddresslatitudelongitudedescriptiondiscriminatory
+ + + + + + + + + + + + + <% @listings.each do |listing| %> + + + + + + + + - - - <% @listings.each do |listing| %> - - - - - - - - - - <% end %> - -
headinglisted ataddresslatitudelongitudedescriptiondiscriminatory
<%= link_to listing.heading, listing_path(listing) %><%= listing.listed_at %><%= listing.address %><%= listing.latitude %><%= listing.longitude %><%= listing.description %><%= listing.discriminatory %>
<%= link_to listing.heading, listing_path(listing) %><%= listing.listed_at %><%= listing.address %><%= listing.latitude %><%= listing.longitude %><%= listing.description %><%= listing.discriminatory %>
-
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 01ef3e6..f01726a 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,3 +9,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) +Rails.application.config.assets.precompile += %w( google.js ) diff --git a/config/routes.rb b/config/routes.rb index ad5dafb..39015de 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,4 +10,5 @@ post '/tools/trackchanges', to: 'trackchanges#get_changes' get '/tools/trackform', to: 'trackchanges#trackform' get '/Contact', to: 'contacts#index' + post '/mappoints', to: 'listings#get_map_points' end