diff --git a/Gemfile b/Gemfile index 44c2dc6..f8fe4d6 100644 --- a/Gemfile +++ b/Gemfile @@ -56,3 +56,6 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] + +gem 'geocoder' +gem 'bootstrap', '~> 5.1.3' diff --git a/Gemfile.lock b/Gemfile.lock index d149368..585744d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -62,9 +62,15 @@ GEM zeitwerk (~> 2.3) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) + autoprefixer-rails (10.4.2.0) + execjs (~> 2) bindex (0.8.1) bootsnap (1.7.5) msgpack (~> 1.0) + bootstrap (5.1.3) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 2.9.3, < 3) + sassc-rails (>= 2.0.0) builder (3.2.4) byebug (11.1.3) capybara (3.35.3) @@ -79,7 +85,9 @@ GEM concurrent-ruby (1.1.9) crass (1.0.6) erubi (1.10.0) + execjs (2.8.1) ffi (1.15.1) + geocoder (1.7.3) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.10) @@ -107,6 +115,7 @@ GEM nokogiri (1.11.7-x86_64-linux) racc (~> 1.4) pg (1.2.3) + popper_js (2.9.3) public_suffix (4.0.6) puma (5.3.2) nio4r (~> 2.0) @@ -207,8 +216,10 @@ PLATFORMS DEPENDENCIES bootsnap (>= 1.4.4) + bootstrap (~> 5.1.3) byebug capybara (>= 3.26) + geocoder jbuilder (~> 2.7) listen (~> 3.3) pg (~> 1.2.3) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index d05ea0f..a2504d3 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,7 @@ *= require_tree . *= require_self */ + + .navbar { + margin-bottom: 20px; + } \ No newline at end of file diff --git a/app/assets/stylesheets/forecasts.scss b/app/assets/stylesheets/forecasts.scss new file mode 100644 index 0000000..4386ab8 --- /dev/null +++ b/app/assets/stylesheets/forecasts.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Forecasts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/forecasts_controller.rb b/app/controllers/forecasts_controller.rb new file mode 100644 index 0000000..3c7f51f --- /dev/null +++ b/app/controllers/forecasts_controller.rb @@ -0,0 +1,12 @@ +class ForecastsController < ApplicationController + def index + @address = params[:address] + geocoder_results = Geocoder.search(@address) + if geocoder_results + @latitude, @longitude = geocoder_results.first.coordinates + end + end + + def new + end +end diff --git a/app/helpers/forecasts_helper.rb b/app/helpers/forecasts_helper.rb new file mode 100644 index 0000000..186e7d4 --- /dev/null +++ b/app/helpers/forecasts_helper.rb @@ -0,0 +1,2 @@ +module ForecastsHelper +end diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index f710851..95e2d33 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -11,3 +11,6 @@ import "channels" Rails.start() Turbolinks.start() ActiveStorage.start() + +import "bootstrap" +import "../stylesheets/application" \ No newline at end of file diff --git a/app/javascript/stylesheets/application.scss b/app/javascript/stylesheets/application.scss new file mode 100644 index 0000000..7697a21 --- /dev/null +++ b/app/javascript/stylesheets/application.scss @@ -0,0 +1 @@ +@import "bootstrap" \ No newline at end of file diff --git a/app/views/forecasts/_form.html.erb b/app/views/forecasts/_form.html.erb new file mode 100644 index 0000000..8484ffd --- /dev/null +++ b/app/views/forecasts/_form.html.erb @@ -0,0 +1,6 @@ +<%= form_with url: "/forecasts/index", class: 'form-inline', method: :get do |form| %> +