├── .gitignore ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Procfile ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ ├── cable.js │ │ ├── channels │ │ │ └── .keep │ │ └── google_maps_autocomplete.js │ └── stylesheets │ │ ├── README.md │ │ ├── application.scss │ │ ├── components │ │ ├── _alert.scss │ │ ├── _avatars.scss │ │ ├── _badges.scss │ │ └── _index.scss │ │ ├── config │ │ ├── _bootstrap_variables.scss │ │ └── _variables.scss │ │ ├── flats.scss │ │ ├── layout │ │ ├── _footer.scss │ │ ├── _index.scss │ │ ├── _navbar.scss │ │ └── _utilities.scss │ │ ├── pages │ │ ├── _home.scss │ │ └── _index.scss │ │ └── vendor │ │ ├── _animation_cheat_sheet.scss │ │ └── _index.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── flats_controller.rb │ └── pages_controller.rb ├── helpers │ ├── application_helper.rb │ └── flats_helper.rb ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ └── flat.rb └── views │ ├── flats │ ├── destroy.js.erb │ ├── index.html.erb │ └── new.html.erb │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ ├── pages │ └── home.html.erb │ └── shared │ └── _flashes.html.erb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring └── update ├── browser_key.png ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── geocoder.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── session_store.rb │ ├── simple_form.rb │ ├── simple_form_bootstrap.rb │ └── wrap_parameters.rb ├── locales │ ├── en.yml │ └── simple_form.en.yml ├── puma.rb ├── routes.rb ├── secrets.yml └── spring.rb ├── dashboard.png ├── db ├── migrate │ ├── 20160808145400_create_flats.rb │ └── 20160808161318_add_coordinates_to_flats.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep ├── tasks │ └── .keep └── templates │ └── erb │ └── scaffold │ └── _form.html.erb ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | log/*.log 3 | tmp/**/* 4 | tmp/* 5 | *.swp 6 | .DS_Store 7 | public/assets 8 | 9 | # Ignore application configuration 10 | /config/application.yml 11 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.6.5 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '2.6.5' 3 | 4 | gem 'rails', '5.2.0' 5 | gem 'puma' 6 | gem 'pg' 7 | gem 'figaro' 8 | gem 'jbuilder', '~> 2.0' 9 | gem 'redis' 10 | 11 | gem 'sass-rails' 12 | gem 'jquery-rails' 13 | gem 'uglifier' 14 | gem 'bootstrap-sass' 15 | gem 'font-awesome-sass' 16 | gem 'simple_form' 17 | gem 'geocoder' 18 | gem 'country_select' 19 | gem 'autoprefixer-rails' 20 | 21 | group :development, :test do 22 | gem 'pry-byebug' 23 | gem 'pry-rails' 24 | gem 'spring' 25 | gem 'listen', '~> 3.0.5' 26 | gem 'spring-watcher-listen', '~> 2.0.0' 27 | end 28 | 29 | group :production do 30 | gem 'rails_12factor' 31 | end 32 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (5.2.0) 5 | actionpack (= 5.2.0) 6 | nio4r (~> 2.0) 7 | websocket-driver (>= 0.6.1) 8 | actionmailer (5.2.0) 9 | actionpack (= 5.2.0) 10 | actionview (= 5.2.0) 11 | activejob (= 5.2.0) 12 | mail (~> 2.5, >= 2.5.4) 13 | rails-dom-testing (~> 2.0) 14 | actionpack (5.2.0) 15 | actionview (= 5.2.0) 16 | activesupport (= 5.2.0) 17 | rack (~> 2.0) 18 | rack-test (>= 0.6.3) 19 | rails-dom-testing (~> 2.0) 20 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 21 | actionview (5.2.0) 22 | activesupport (= 5.2.0) 23 | builder (~> 3.1) 24 | erubi (~> 1.4) 25 | rails-dom-testing (~> 2.0) 26 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 27 | activejob (5.2.0) 28 | activesupport (= 5.2.0) 29 | globalid (>= 0.3.6) 30 | activemodel (5.2.0) 31 | activesupport (= 5.2.0) 32 | activerecord (5.2.0) 33 | activemodel (= 5.2.0) 34 | activesupport (= 5.2.0) 35 | arel (>= 9.0) 36 | activestorage (5.2.0) 37 | actionpack (= 5.2.0) 38 | activerecord (= 5.2.0) 39 | marcel (~> 0.3.1) 40 | activesupport (5.2.0) 41 | concurrent-ruby (~> 1.0, >= 1.0.2) 42 | i18n (>= 0.7, < 2) 43 | minitest (~> 5.1) 44 | tzinfo (~> 1.1) 45 | arel (9.0.0) 46 | autoprefixer-rails (6.4.0.1) 47 | execjs 48 | bootstrap-sass (3.4.1) 49 | autoprefixer-rails (>= 5.2.1) 50 | sassc (>= 2.0.0) 51 | builder (3.2.3) 52 | byebug (9.0.5) 53 | coderay (1.1.1) 54 | concurrent-ruby (1.1.5) 55 | countries (2.1.4) 56 | i18n_data (~> 0.8.0) 57 | money (~> 6.9) 58 | sixarm_ruby_unaccent (~> 1.1) 59 | unicode_utils (~> 1.4) 60 | country_select (3.1.1) 61 | countries (~> 2.0) 62 | sort_alphabetical (~> 1.0) 63 | crass (1.0.5) 64 | erubi (1.9.0) 65 | execjs (2.7.0) 66 | ffi (1.9.25) 67 | figaro (1.1.1) 68 | thor (~> 0.14) 69 | font-awesome-sass (4.6.2) 70 | sass (>= 3.2) 71 | geocoder (1.6.1) 72 | globalid (0.4.1) 73 | activesupport (>= 4.2.0) 74 | i18n (1.0.1) 75 | concurrent-ruby (~> 1.0) 76 | i18n_data (0.8.0) 77 | jbuilder (2.7.0) 78 | activesupport (>= 4.2.0) 79 | multi_json (>= 1.2) 80 | jquery-rails (4.1.1) 81 | rails-dom-testing (>= 1, < 3) 82 | railties (>= 4.2.0) 83 | thor (>= 0.14, < 2.0) 84 | listen (3.0.8) 85 | rb-fsevent (~> 0.9, >= 0.9.4) 86 | rb-inotify (~> 0.9, >= 0.9.7) 87 | loofah (2.3.1) 88 | crass (~> 1.0.2) 89 | nokogiri (>= 1.5.9) 90 | mail (2.7.0) 91 | mini_mime (>= 0.1.1) 92 | marcel (0.3.2) 93 | mimemagic (~> 0.3.2) 94 | method_source (0.8.2) 95 | mimemagic (0.3.2) 96 | mini_mime (1.0.0) 97 | mini_portile2 (2.4.0) 98 | minitest (5.12.2) 99 | money (6.11.3) 100 | i18n (>= 0.6.4, < 1.1) 101 | multi_json (1.13.1) 102 | nio4r (2.5.2) 103 | nokogiri (1.10.5) 104 | mini_portile2 (~> 2.4.0) 105 | pg (0.18.4) 106 | pry (0.10.4) 107 | coderay (~> 1.1.0) 108 | method_source (~> 0.8.1) 109 | slop (~> 3.4) 110 | pry-byebug (3.4.0) 111 | byebug (~> 9.0) 112 | pry (~> 0.10) 113 | pry-rails (0.3.4) 114 | pry (>= 0.9.10) 115 | puma (4.3.3) 116 | nio4r (~> 2.0) 117 | rack (2.0.7) 118 | rack-test (1.1.0) 119 | rack (>= 1.0, < 3) 120 | rails (5.2.0) 121 | actioncable (= 5.2.0) 122 | actionmailer (= 5.2.0) 123 | actionpack (= 5.2.0) 124 | actionview (= 5.2.0) 125 | activejob (= 5.2.0) 126 | activemodel (= 5.2.0) 127 | activerecord (= 5.2.0) 128 | activestorage (= 5.2.0) 129 | activesupport (= 5.2.0) 130 | bundler (>= 1.3.0) 131 | railties (= 5.2.0) 132 | sprockets-rails (>= 2.0.0) 133 | rails-dom-testing (2.0.3) 134 | activesupport (>= 4.2.0) 135 | nokogiri (>= 1.6) 136 | rails-html-sanitizer (1.3.0) 137 | loofah (~> 2.3) 138 | rails_12factor (0.0.3) 139 | rails_serve_static_assets 140 | rails_stdout_logging 141 | rails_serve_static_assets (0.0.5) 142 | rails_stdout_logging (0.0.5) 143 | railties (5.2.0) 144 | actionpack (= 5.2.0) 145 | activesupport (= 5.2.0) 146 | method_source 147 | rake (>= 0.8.7) 148 | thor (>= 0.18.1, < 2.0) 149 | rake (13.0.1) 150 | rb-fsevent (0.9.7) 151 | rb-inotify (0.9.7) 152 | ffi (>= 0.5.0) 153 | redis (3.3.1) 154 | sass (3.7.4) 155 | sass-listen (~> 4.0.0) 156 | sass-listen (4.0.0) 157 | rb-fsevent (~> 0.9, >= 0.9.4) 158 | rb-inotify (~> 0.9, >= 0.9.7) 159 | sass-rails (5.0.6) 160 | railties (>= 4.0.0, < 6) 161 | sass (~> 3.1) 162 | sprockets (>= 2.8, < 4.0) 163 | sprockets-rails (>= 2.0, < 4.0) 164 | tilt (>= 1.1, < 3) 165 | sassc (2.2.1) 166 | ffi (~> 1.9) 167 | simple_form (5.0.0) 168 | actionpack (>= 5.0) 169 | activemodel (>= 5.0) 170 | sixarm_ruby_unaccent (1.2.0) 171 | slop (3.6.0) 172 | sort_alphabetical (1.1.0) 173 | unicode_utils (>= 1.2.2) 174 | spring (1.7.2) 175 | spring-watcher-listen (2.0.0) 176 | listen (>= 2.7, < 4.0) 177 | spring (~> 1.2) 178 | sprockets (3.7.2) 179 | concurrent-ruby (~> 1.0) 180 | rack (> 1, < 3) 181 | sprockets-rails (3.2.1) 182 | actionpack (>= 4.0) 183 | activesupport (>= 4.0) 184 | sprockets (>= 3.0.0) 185 | thor (0.20.0) 186 | thread_safe (0.3.6) 187 | tilt (2.0.5) 188 | tzinfo (1.2.5) 189 | thread_safe (~> 0.1) 190 | uglifier (3.0.1) 191 | execjs (>= 0.3.0, < 3) 192 | unicode_utils (1.4.0) 193 | websocket-driver (0.7.0) 194 | websocket-extensions (>= 0.1.0) 195 | websocket-extensions (0.1.3) 196 | 197 | PLATFORMS 198 | ruby 199 | 200 | DEPENDENCIES 201 | autoprefixer-rails 202 | bootstrap-sass 203 | country_select 204 | figaro 205 | font-awesome-sass 206 | geocoder 207 | jbuilder (~> 2.0) 208 | jquery-rails 209 | listen (~> 3.0.5) 210 | pg 211 | pry-byebug 212 | pry-rails 213 | puma 214 | rails (= 5.2.0) 215 | rails_12factor 216 | redis 217 | sass-rails 218 | simple_form 219 | spring 220 | spring-watcher-listen (~> 2.0.0) 221 | uglifier 222 | 223 | RUBY VERSION 224 | ruby 2.6.5p114 225 | 226 | BUNDLED WITH 227 | 1.17.2 228 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | © 2023 La Loco SAS, head of Le Wagon Group - All rights reserved 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | There are two important files: 2 | 3 | - The [`flats/new` view](https://github.com/lewagon/google-maps-autocomplete/blob/master/app/views/flats/new.html.erb) using the `simple_form` gem and the requirement of the Google Place API javascript file. 4 | - The [`google_maps_autocomplete.js`](https://github.com/lewagon/google-maps-autocomplete/blob/master/app/assets/javascripts/google_maps_autocomplete.js) files initializing the form to autocomplete. 5 | 6 | The key set in the second file can be used in the following referrer: 7 | 8 | ![](browser_key.png) 9 | 10 | Two APIs have been used for this Rails project (turned on in the Google Developer Console): 11 | 12 | 1. Google Places API Web Service 13 | 2. Google Maps Geocoding API 14 | 15 | ![](dashboard.png) 16 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | //= require jquery 2 | //= require jquery_ujs 3 | //= require bootstrap-sprockets 4 | //= require_tree . 5 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the rails generate channel command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/app/assets/javascripts/channels/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/google_maps_autocomplete.js: -------------------------------------------------------------------------------- 1 | function onPlaceChanged() { 2 | var place = this.getPlace(); 3 | var components = getAddressComponents(place); 4 | 5 | var flatAddress = document.getElementById('flat_address'); 6 | flatAddress.blur(); 7 | flatAddress.value = components.address; 8 | 9 | document.getElementById('flat_zip_code').value = components.zip_code; 10 | document.getElementById('flat_city').value = components.city; 11 | 12 | if (components.country_code) { 13 | var selector = '#flat_country option[value="' + components.country_code + '"]'; 14 | document.querySelector(selector).selected = true; 15 | } 16 | } 17 | 18 | function getAddressComponents(place) { 19 | // If you want lat/lng, you can look at: 20 | // - place.geometry.location.lat() 21 | // - place.geometry.location.lng() 22 | 23 | if (window.console && typeof console.log === "function") { 24 | console.log(place); 25 | } 26 | 27 | var street_number = null; 28 | var route = null; 29 | var zip_code = null; 30 | var city = null; 31 | var country_code = null; 32 | for (var i in place.address_components) { 33 | var component = place.address_components[i]; 34 | for (var j in component.types) { 35 | var type = component.types[j]; 36 | if (type === 'street_number') { 37 | street_number = component.long_name; 38 | } else if (type === 'route') { 39 | route = component.long_name; 40 | } else if (type === 'postal_code') { 41 | zip_code = component.long_name; 42 | } else if (type === 'locality') { 43 | city = component.long_name; 44 | } else if (type === 'postal_town' && city === null) { 45 | city = component.long_name; 46 | } else if (type === 'country') { 47 | country_code = component.short_name; 48 | } 49 | } 50 | } 51 | 52 | return { 53 | address: street_number === null ? route : (street_number + ' ' + route), 54 | zip_code: zip_code, 55 | city: city, 56 | country_code: country_code 57 | }; 58 | } 59 | 60 | document.addEventListener("DOMContentLoaded", function() { 61 | var flatAddress = document.getElementById('flat_address'); 62 | 63 | if (flatAddress) { 64 | var autocomplete = new google.maps.places.Autocomplete(flatAddress, { types: ['geocode'] }); 65 | google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged); 66 | google.maps.event.addDomListener(flatAddress, 'keydown', function(e) { 67 | if (e.key === "Enter") { 68 | e.preventDefault(); // Do not submit the form on Enter. 69 | } 70 | }); 71 | } 72 | }); 73 | -------------------------------------------------------------------------------- /app/assets/stylesheets/README.md: -------------------------------------------------------------------------------- 1 | ## Setup 2 | 3 | Ensure you have the following gems in your Rails `Gemfile` 4 | 5 | ```ruby 6 | # Gemfile 7 | gem 'bootstrap-sass' 8 | gem 'font-awesome-sass' 9 | gem 'simple_form' 10 | gem 'autoprefixer-rails' 11 | ``` 12 | 13 | In your terminal, generate SimpleForm Bootstrap config. 14 | 15 | ```bash 16 | $ bundle install 17 | $ rails generate simple_form:install --bootstrap 18 | ``` 19 | 20 | Then replace Rails' stylesheets by Le Wagon's stylesheets: 21 | 22 | ``` 23 | $ rm -rf app/assets/stylesheets 24 | $ curl -L https://github.com/lewagon/stylesheets/archive/master.zip > stylesheets.zip 25 | $ unzip stylesheets.zip -d app/assets && rm stylesheets.zip && mv app/assets/rails-stylesheets-master app/assets/stylesheets 26 | ``` 27 | 28 | Don't forget the sprockets directives in `assets/application.js` 29 | 30 | ```javascript 31 | // app/assets/javascripts/application.js 32 | 33 | //= require jquery 34 | //= require jquery_ujs 35 | //= require bootstrap-sprockets 36 | //= require_tree . 37 | ``` 38 | 39 | And the viewport in the layout 40 | 41 | ```html 42 | 43 | 44 | 45 | 46 | 47 | 48 | ``` 49 | 50 | ## Adding new `.scss` files 51 | 52 | Look at your main `application.scss` file to see how SCSS files are imported. 53 | 54 | ```scss 55 | // Graphical variables 56 | @import "config/variables"; 57 | @import "config/bootstrap_variables"; 58 | 59 | // External libraries 60 | @import "bootstrap"; 61 | @import "font-awesome-sprockets"; 62 | @import "font-awesome"; 63 | 64 | // Your CSS 65 | @import "layout/index"; 66 | @import "components/index"; 67 | @import "pages/index"; 68 | @import "vendor/index"; 69 | ``` 70 | 71 | For every folder (**`components`**, **`layout`**, **`pages`**, **`vendor`**), there is one `_index.scss` partial which is responsible for importing all the other partials of its folder. 72 | 73 | **Example 1**: Let's say you add a new `_contact.scss` file in **`pages`** then modify `pages/_index.scss` as: 74 | 75 | ```scss 76 | // pages/_index.scss 77 | @import "home"; 78 | @import "contact"; 79 | ``` 80 | 81 | **Example 2**: Let's say you add a new `_sidebar.scss` file in **`layout`** then modify `layout/_index.scss` as: 82 | 83 | ```scss 84 | // layout/_index.scss 85 | @import "base"; 86 | @import "utilities"; 87 | @import "footer"; 88 | @import "navbar"; 89 | @import "sidebar"; 90 | ``` 91 | 92 | ## Navbar template 93 | 94 | Our `layout/_navbar.scss` code works well with our home-made ERB template which you can find 95 | 96 | - [version without login](https://github.com/lewagon/awesome-navbars/blob/master/templates/_navbar_wagon_without_login.html.erb). 97 | - [version with login](https://github.com/lewagon/awesome-navbars/blob/master/templates/_navbar_wagon.html.erb). 98 | 99 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | // Graphical variables 2 | @import "config/variables"; 3 | @import "config/bootstrap_variables"; 4 | 5 | // External libraries 6 | @import "bootstrap-sprockets"; 7 | @import "bootstrap"; 8 | @import "font-awesome-sprockets"; 9 | @import "font-awesome"; 10 | 11 | // Your CSS 12 | @import "layout/index"; 13 | @import "components/index"; 14 | @import "pages/index"; 15 | @import "vendor/index"; 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_alert.scss: -------------------------------------------------------------------------------- 1 | /* ------------------------------------- 2 | * Your CSS code for flash notices and alerts 3 | * ------------------------------------- */ 4 | 5 | .alert { 6 | margin: 0; 7 | text-align: center; 8 | color: white; 9 | } 10 | .alert-info { 11 | background: $green; 12 | } 13 | .alert-warning { 14 | background: $red; 15 | } 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_avatars.scss: -------------------------------------------------------------------------------- 1 | .avatar { 2 | width: 30px; 3 | border-radius: 50%; 4 | } 5 | .avatar-large { 6 | width: 50px; 7 | border-radius: 50%; 8 | } 9 | .avatar-bordered { 10 | width: 30px; 11 | border-radius: 50%; 12 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 13 | border: white 1px solid; 14 | } 15 | .avatar-square { 16 | width: 30px; 17 | border-radius: 0px; 18 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 19 | border: white 1px solid; 20 | } 21 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_badges.scss: -------------------------------------------------------------------------------- 1 | .badge-container { 2 | position: relative; 3 | font-size: 25px; 4 | line-height: 30px; 5 | width: 30px; 6 | color: grey; 7 | } 8 | .badge { 9 | position: absolute; 10 | top: -5px; 11 | right: -5px; 12 | font-size: 10px; 13 | color: white; 14 | display: flex; 15 | align-items: center; 16 | justify-content: center; 17 | height: 18px; 18 | width: 18px; 19 | text-align: center; 20 | box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1); 21 | border-radius: 50%; 22 | } 23 | .badge-red { 24 | background: #EE5F5B; 25 | } 26 | .badge-green { 27 | background: #32B796; 28 | } 29 | .badge-blue { 30 | background: #469AE0; 31 | } 32 | .badge-black { 33 | background: black; 34 | } 35 | .badge-bordered { 36 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 37 | border: white 1px solid; 38 | } 39 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_index.scss: -------------------------------------------------------------------------------- 1 | @import "alert"; 2 | @import "avatars"; 3 | @import "badges"; -------------------------------------------------------------------------------- /app/assets/stylesheets/config/_bootstrap_variables.scss: -------------------------------------------------------------------------------- 1 | /* ------------------------------------- 2 | * Bootstrap sass variable 3 | * (see http://getbootstrap.com/customize/#less-variables) 4 | * ------------------------------------- */ 5 | 6 | // General style 7 | $font-family-sans-serif: $base-font; 8 | $body-bg: white; 9 | $font-size-base: $base-size; 10 | $line-height-base: $base-height; 11 | $headings-font-family: $header-font; 12 | 13 | // Semantic color scheme 14 | $brand-primary: $blue; 15 | $brand-success: $green; 16 | $brand-info: $yellow; 17 | $brand-danger: $red; 18 | $brand-warning: $orange; 19 | 20 | // Buttons / inputs radius 21 | $border-radius-base: 2px; 22 | $border-radius-large: 2px; 23 | $border-radius-small: 2px; -------------------------------------------------------------------------------- /app/assets/stylesheets/config/_variables.scss: -------------------------------------------------------------------------------- 1 | /* ------------------------------------- 2 | * Fonts 3 | * ------------------------------------- */ 4 | // Google fonts 5 | @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Raleway:400,100,300,700,500"); 6 | $base-font: "Open Sans", "Helvetica", "sans-serif"; 7 | $header-font: "Raleway", "Helvetica", "sans-serif"; 8 | 9 | // Local fonts (uncomment following lines) 10 | // @font-face { 11 | // font-family: "Font Name"; 12 | // src: font-url('FontFile.eot'); 13 | // src: font-url('FontFile.eot?#iefix') format('embedded-opentype'), 14 | // font-url('FontFile.woff') format('woff'), 15 | // font-url('FontFile.ttf') format('truetype') 16 | // } 17 | // $my-font: "Font Name"; 18 | 19 | // Font-size and line-height 20 | $base-size: 16px; 21 | $base-height: 1.4; 22 | 23 | /* ------------------------------------- 24 | * Colors 25 | * ------------------------------------- */ 26 | // Scheme 27 | $brand-color: #D23333; 28 | 29 | $red: #EE5F5B; 30 | $blue: #469AE0; 31 | $yellow: #FDB631; 32 | $orange: #E67E22; 33 | $green: #32B796; 34 | 35 | // Gray scale 36 | $gray-darker: lighten(#000, 13.5%); // #222 37 | $gray-dark: lighten(#000, 20%); // #333 38 | $gray: lighten(#000, 33.5%); // #555 39 | $gray-light: lighten(#000, 46.7%); // #777 40 | $gray-lighter: lighten(#000, 93.5%); // #eee 41 | -------------------------------------------------------------------------------- /app/assets/stylesheets/flats.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the flats controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/layout/_footer.scss: -------------------------------------------------------------------------------- 1 | // Your footer style 2 | -------------------------------------------------------------------------------- /app/assets/stylesheets/layout/_index.scss: -------------------------------------------------------------------------------- 1 | @import "utilities"; 2 | @import "footer"; 3 | @import "navbar"; 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/layout/_navbar.scss: -------------------------------------------------------------------------------- 1 | /* Main class */ 2 | .navbar-wagon { 3 | box-shadow: 0 1px 5px 0 rgba(0,0,0,0.07),0 1px 0 0 rgba(0,0,0,0.03); 4 | background: white; 5 | transition: all 0.3s ease; 6 | display: flex; 7 | height: 70px; 8 | padding: 0px 30px; 9 | align-items: center; 10 | justify-content: space-between; 11 | } 12 | 13 | /* Optional class to fix the navbar on top */ 14 | .navbar-wagon-fixed { 15 | position: fixed; 16 | left: 0px; 17 | top: 0px; 18 | z-index: 1; 19 | width: 100%; 20 | } 21 | 22 | /* Navbar logo */ 23 | .navbar-wagon-brand img { 24 | width: 50px; 25 | } 26 | 27 | /* Navbar right section (with form, links, button) */ 28 | .navbar-wagon-right { 29 | display: flex; 30 | align-items: center; 31 | justify-content: space-between; 32 | } 33 | 34 | /* Navbar item */ 35 | .navbar-wagon-item { 36 | flex: 0 1 auto; 37 | cursor: pointer; 38 | padding: 0 20px; 39 | } 40 | 41 | /* Navbar standard link */ 42 | .navbar-wagon-link { 43 | color: #616668; 44 | font-size: 14px; 45 | } 46 | .navbar-wagon-link:hover { 47 | color: #da552f; 48 | text-decoration: none; 49 | } 50 | 51 | /* Navbar right button */ 52 | .navbar-wagon-button { 53 | margin-left: 10px; 54 | padding: 0 20px; 55 | border-radius: 20em; 56 | line-height: 40px; 57 | background-color: #D23333; 58 | color: white; 59 | font-size: 14px; 60 | border: 2px solid #D23333; 61 | } 62 | .navbar-wagon-button:hover { 63 | color: white; 64 | background: #D23333; 65 | border-color: #ac2626; 66 | } 67 | 68 | /* Navbar search form */ 69 | .navbar-wagon-search { 70 | flex: 0 1 300px; 71 | display: flex; 72 | justify-content: flex-end; 73 | padding: 0 10px; 74 | position: relative; 75 | } 76 | .navbar-wagon-search-btn { 77 | line-height: 40px; 78 | color: #E6E6E6; 79 | border: none; 80 | background: transparent; 81 | position: absolute; 82 | right: 14px; 83 | top: -2px; 84 | z-index: 1; 85 | } 86 | .navbar-wagon-search-input { 87 | flex: 0 1 300px; 88 | transition: all 0.15s ease; 89 | line-height: 40px; 90 | font-weight: lighter; 91 | color: #666666; 92 | border: 1px solid #E6E6E6; 93 | border-radius: 5px; 94 | padding: 0 10px; 95 | font-size: 14px; 96 | outline: none; 97 | } 98 | .navbar-wagon-search-input:focus { 99 | border: 1px solid #CCCCCC; 100 | } 101 | 102 | /* Navbar dropdown menu */ 103 | .navbar-wagon-dropdown-menu { 104 | margin-top: 15px; 105 | box-shadow: 1px 1px 4px #E6E6E6; 106 | border-color: #E6E6E6; 107 | } 108 | .navbar-wagon-dropdown-menu li > a { 109 | transition: color 0.3s ease; 110 | font-weight: lighter !important; 111 | color: #999999 !important; 112 | font-size: 15px !important; 113 | line-height: 22px !important; 114 | padding: 10px 20px; 115 | } 116 | .navbar-wagon-dropdown-menu li > a:hover { 117 | background: transparent !important; 118 | color: black !important; 119 | } 120 | .navbar-wagon-dropdown-menu:before { 121 | content: ' '; 122 | height: 10px; 123 | width: 10px; 124 | position: absolute; 125 | right: 10px; 126 | top: -6px; 127 | background-color: white; 128 | transform: rotate(45deg); 129 | border-left: 1px solid #E6E6E6; 130 | border-top: 1px solid #E6E6E6; 131 | } 132 | -------------------------------------------------------------------------------- /app/assets/stylesheets/layout/_utilities.scss: -------------------------------------------------------------------------------- 1 | /* ------------------------------------- 2 | * Utilities classes 3 | * These are examples of utilities classes 4 | * Feel free to change them and create your own 5 | * ------------------------------------- */ 6 | 7 | // Paddings 8 | .padded { 9 | padding-top: 5em; 10 | padding-bottom: 5em; 11 | } 12 | 13 | // Backgrounds 14 | .bg-black { 15 | background: #4a4a4a; 16 | } 17 | .bg-grey { 18 | background: #aeaeae; 19 | } 20 | .bg-blue { 21 | background: #00a3e1; 22 | } 23 | .bg-dark-blue { 24 | background: #3b5998; 25 | } 26 | 27 | .padded-top { 28 | margin-top: 2em; 29 | } 30 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_home.scss: -------------------------------------------------------------------------------- 1 | /* ------------------------------------- 2 | * CSS code specific to home page 3 | * (margin/padding adjustments) 4 | * ------------------------------------- */ 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_index.scss: -------------------------------------------------------------------------------- 1 | @import "home"; -------------------------------------------------------------------------------- /app/assets/stylesheets/vendor/_animation_cheat_sheet.scss: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================== 3 | CSS3 ANIMATION CHEAT SHEET 4 | ============================================== 5 | 6 | Made by Justin Aguilar 7 | 8 | www.justinaguilar.com/animations/ 9 | 10 | Questions, comments, concerns, love letters: 11 | justin@justinaguilar.com 12 | ============================================== 13 | */ 14 | 15 | /* 16 | ============================================== 17 | slideDown 18 | ============================================== 19 | */ 20 | 21 | 22 | .slideDown{ 23 | animation-name: slideDown; 24 | -webkit-animation-name: slideDown; 25 | 26 | animation-duration: 1s; 27 | -webkit-animation-duration: 1s; 28 | 29 | animation-timing-function: ease; 30 | -webkit-animation-timing-function: ease; 31 | 32 | visibility: visible !important; 33 | } 34 | 35 | @keyframes slideDown { 36 | 0% { 37 | transform: translateY(-100%); 38 | } 39 | 50%{ 40 | transform: translateY(8%); 41 | } 42 | 65%{ 43 | transform: translateY(-4%); 44 | } 45 | 80%{ 46 | transform: translateY(4%); 47 | } 48 | 95%{ 49 | transform: translateY(-2%); 50 | } 51 | 100% { 52 | transform: translateY(0%); 53 | } 54 | } 55 | 56 | @-webkit-keyframes slideDown { 57 | 0% { 58 | -webkit-transform: translateY(-100%); 59 | } 60 | 50%{ 61 | -webkit-transform: translateY(8%); 62 | } 63 | 65%{ 64 | -webkit-transform: translateY(-4%); 65 | } 66 | 80%{ 67 | -webkit-transform: translateY(4%); 68 | } 69 | 95%{ 70 | -webkit-transform: translateY(-2%); 71 | } 72 | 100% { 73 | -webkit-transform: translateY(0%); 74 | } 75 | } 76 | 77 | /* 78 | ============================================== 79 | slideUp 80 | ============================================== 81 | */ 82 | 83 | 84 | .slideUp{ 85 | animation-name: slideUp; 86 | -webkit-animation-name: slideUp; 87 | 88 | animation-duration: 1s; 89 | -webkit-animation-duration: 1s; 90 | 91 | animation-timing-function: ease; 92 | -webkit-animation-timing-function: ease; 93 | 94 | visibility: visible !important; 95 | } 96 | 97 | @keyframes slideUp { 98 | 0% { 99 | transform: translateY(100%); 100 | } 101 | 50%{ 102 | transform: translateY(-8%); 103 | } 104 | 65%{ 105 | transform: translateY(4%); 106 | } 107 | 80%{ 108 | transform: translateY(-4%); 109 | } 110 | 95%{ 111 | transform: translateY(2%); 112 | } 113 | 100% { 114 | transform: translateY(0%); 115 | } 116 | } 117 | 118 | @-webkit-keyframes slideUp { 119 | 0% { 120 | -webkit-transform: translateY(100%); 121 | } 122 | 50%{ 123 | -webkit-transform: translateY(-8%); 124 | } 125 | 65%{ 126 | -webkit-transform: translateY(4%); 127 | } 128 | 80%{ 129 | -webkit-transform: translateY(-4%); 130 | } 131 | 95%{ 132 | -webkit-transform: translateY(2%); 133 | } 134 | 100% { 135 | -webkit-transform: translateY(0%); 136 | } 137 | } 138 | 139 | /* 140 | ============================================== 141 | slideLeft 142 | ============================================== 143 | */ 144 | 145 | 146 | .slideLeft{ 147 | animation-name: slideLeft; 148 | -webkit-animation-name: slideLeft; 149 | 150 | animation-duration: 1s; 151 | -webkit-animation-duration: 1s; 152 | 153 | animation-timing-function: ease-in-out; 154 | -webkit-animation-timing-function: ease-in-out; 155 | 156 | visibility: visible !important; 157 | } 158 | 159 | @keyframes slideLeft { 160 | 0% { 161 | transform: translateX(150%); 162 | } 163 | 50%{ 164 | transform: translateX(-8%); 165 | } 166 | 65%{ 167 | transform: translateX(4%); 168 | } 169 | 80%{ 170 | transform: translateX(-4%); 171 | } 172 | 95%{ 173 | transform: translateX(2%); 174 | } 175 | 100% { 176 | transform: translateX(0%); 177 | } 178 | } 179 | 180 | @-webkit-keyframes slideLeft { 181 | 0% { 182 | -webkit-transform: translateX(150%); 183 | } 184 | 50%{ 185 | -webkit-transform: translateX(-8%); 186 | } 187 | 65%{ 188 | -webkit-transform: translateX(4%); 189 | } 190 | 80%{ 191 | -webkit-transform: translateX(-4%); 192 | } 193 | 95%{ 194 | -webkit-transform: translateX(2%); 195 | } 196 | 100% { 197 | -webkit-transform: translateX(0%); 198 | } 199 | } 200 | 201 | /* 202 | ============================================== 203 | slideRight 204 | ============================================== 205 | */ 206 | 207 | 208 | .slideRight{ 209 | animation-name: slideRight; 210 | -webkit-animation-name: slideRight; 211 | 212 | animation-duration: 1s; 213 | -webkit-animation-duration: 1s; 214 | 215 | animation-timing-function: ease-in-out; 216 | -webkit-animation-timing-function: ease-in-out; 217 | 218 | visibility: visible !important; 219 | } 220 | 221 | @keyframes slideRight { 222 | 0% { 223 | transform: translateX(-150%); 224 | } 225 | 50%{ 226 | transform: translateX(8%); 227 | } 228 | 65%{ 229 | transform: translateX(-4%); 230 | } 231 | 80%{ 232 | transform: translateX(4%); 233 | } 234 | 95%{ 235 | transform: translateX(-2%); 236 | } 237 | 100% { 238 | transform: translateX(0%); 239 | } 240 | } 241 | 242 | @-webkit-keyframes slideRight { 243 | 0% { 244 | -webkit-transform: translateX(-150%); 245 | } 246 | 50%{ 247 | -webkit-transform: translateX(8%); 248 | } 249 | 65%{ 250 | -webkit-transform: translateX(-4%); 251 | } 252 | 80%{ 253 | -webkit-transform: translateX(4%); 254 | } 255 | 95%{ 256 | -webkit-transform: translateX(-2%); 257 | } 258 | 100% { 259 | -webkit-transform: translateX(0%); 260 | } 261 | } 262 | 263 | /* 264 | ============================================== 265 | slideExpandUp 266 | ============================================== 267 | */ 268 | 269 | 270 | .slideExpandUp{ 271 | animation-name: slideExpandUp; 272 | -webkit-animation-name: slideExpandUp; 273 | 274 | animation-duration: 1.6s; 275 | -webkit-animation-duration: 1.6s; 276 | 277 | animation-timing-function: ease-out; 278 | -webkit-animation-timing-function: ease -out; 279 | 280 | visibility: visible !important; 281 | } 282 | 283 | @keyframes slideExpandUp { 284 | 0% { 285 | transform: translateY(100%) scaleX(0.5); 286 | } 287 | 30%{ 288 | transform: translateY(-8%) scaleX(0.5); 289 | } 290 | 40%{ 291 | transform: translateY(2%) scaleX(0.5); 292 | } 293 | 50%{ 294 | transform: translateY(0%) scaleX(1.1); 295 | } 296 | 60%{ 297 | transform: translateY(0%) scaleX(0.9); 298 | } 299 | 70% { 300 | transform: translateY(0%) scaleX(1.05); 301 | } 302 | 80%{ 303 | transform: translateY(0%) scaleX(0.95); 304 | } 305 | 90% { 306 | transform: translateY(0%) scaleX(1.02); 307 | } 308 | 100%{ 309 | transform: translateY(0%) scaleX(1); 310 | } 311 | } 312 | 313 | @-webkit-keyframes slideExpandUp { 314 | 0% { 315 | -webkit-transform: translateY(100%) scaleX(0.5); 316 | } 317 | 30%{ 318 | -webkit-transform: translateY(-8%) scaleX(0.5); 319 | } 320 | 40%{ 321 | -webkit-transform: translateY(2%) scaleX(0.5); 322 | } 323 | 50%{ 324 | -webkit-transform: translateY(0%) scaleX(1.1); 325 | } 326 | 60%{ 327 | -webkit-transform: translateY(0%) scaleX(0.9); 328 | } 329 | 70% { 330 | -webkit-transform: translateY(0%) scaleX(1.05); 331 | } 332 | 80%{ 333 | -webkit-transform: translateY(0%) scaleX(0.95); 334 | } 335 | 90% { 336 | -webkit-transform: translateY(0%) scaleX(1.02); 337 | } 338 | 100%{ 339 | -webkit-transform: translateY(0%) scaleX(1); 340 | } 341 | } 342 | 343 | /* 344 | ============================================== 345 | expandUp 346 | ============================================== 347 | */ 348 | 349 | 350 | .expandUp{ 351 | animation-name: expandUp; 352 | -webkit-animation-name: expandUp; 353 | 354 | animation-duration: 0.7s; 355 | -webkit-animation-duration: 0.7s; 356 | 357 | animation-timing-function: ease; 358 | -webkit-animation-timing-function: ease; 359 | 360 | visibility: visible !important; 361 | } 362 | 363 | @keyframes expandUp { 364 | 0% { 365 | transform: translateY(100%) scale(0.6) scaleY(0.5); 366 | } 367 | 60%{ 368 | transform: translateY(-7%) scaleY(1.12); 369 | } 370 | 75%{ 371 | transform: translateY(3%); 372 | } 373 | 100% { 374 | transform: translateY(0%) scale(1) scaleY(1); 375 | } 376 | } 377 | 378 | @-webkit-keyframes expandUp { 379 | 0% { 380 | -webkit-transform: translateY(100%) scale(0.6) scaleY(0.5); 381 | } 382 | 60%{ 383 | -webkit-transform: translateY(-7%) scaleY(1.12); 384 | } 385 | 75%{ 386 | -webkit-transform: translateY(3%); 387 | } 388 | 100% { 389 | -webkit-transform: translateY(0%) scale(1) scaleY(1); 390 | } 391 | } 392 | 393 | /* 394 | ============================================== 395 | fadeIn 396 | ============================================== 397 | */ 398 | 399 | .fadeIn{ 400 | animation-name: fadeIn; 401 | -webkit-animation-name: fadeIn; 402 | 403 | animation-duration: 1.5s; 404 | -webkit-animation-duration: 1.5s; 405 | 406 | animation-timing-function: ease-in-out; 407 | -webkit-animation-timing-function: ease-in-out; 408 | 409 | visibility: visible !important; 410 | } 411 | 412 | @keyframes fadeIn { 413 | 0% { 414 | transform: scale(0); 415 | opacity: 0.0; 416 | } 417 | 60% { 418 | transform: scale(1.1); 419 | } 420 | 80% { 421 | transform: scale(0.9); 422 | opacity: 1; 423 | } 424 | 100% { 425 | transform: scale(1); 426 | opacity: 1; 427 | } 428 | } 429 | 430 | @-webkit-keyframes fadeIn { 431 | 0% { 432 | -webkit-transform: scale(0); 433 | opacity: 0.0; 434 | } 435 | 60% { 436 | -webkit-transform: scale(1.1); 437 | } 438 | 80% { 439 | -webkit-transform: scale(0.9); 440 | opacity: 1; 441 | } 442 | 100% { 443 | -webkit-transform: scale(1); 444 | opacity: 1; 445 | } 446 | } 447 | 448 | /* 449 | ============================================== 450 | expandOpen 451 | ============================================== 452 | */ 453 | 454 | 455 | .expandOpen{ 456 | animation-name: expandOpen; 457 | -webkit-animation-name: expandOpen; 458 | 459 | animation-duration: 1.2s; 460 | -webkit-animation-duration: 1.2s; 461 | 462 | animation-timing-function: ease-out; 463 | -webkit-animation-timing-function: ease-out; 464 | 465 | visibility: visible !important; 466 | } 467 | 468 | @keyframes expandOpen { 469 | 0% { 470 | transform: scale(1.8); 471 | } 472 | 50% { 473 | transform: scale(0.95); 474 | } 475 | 80% { 476 | transform: scale(1.05); 477 | } 478 | 90% { 479 | transform: scale(0.98); 480 | } 481 | 100% { 482 | transform: scale(1); 483 | } 484 | } 485 | 486 | @-webkit-keyframes expandOpen { 487 | 0% { 488 | -webkit-transform: scale(1.8); 489 | } 490 | 50% { 491 | -webkit-transform: scale(0.95); 492 | } 493 | 80% { 494 | -webkit-transform: scale(1.05); 495 | } 496 | 90% { 497 | -webkit-transform: scale(0.98); 498 | } 499 | 100% { 500 | -webkit-transform: scale(1); 501 | } 502 | } 503 | 504 | /* 505 | ============================================== 506 | bigEntrance 507 | ============================================== 508 | */ 509 | 510 | 511 | .bigEntrance{ 512 | animation-name: bigEntrance; 513 | -webkit-animation-name: bigEntrance; 514 | 515 | animation-duration: 1.6s; 516 | -webkit-animation-duration: 1.6s; 517 | 518 | animation-timing-function: ease-out; 519 | -webkit-animation-timing-function: ease-out; 520 | 521 | visibility: visible !important; 522 | } 523 | 524 | @keyframes bigEntrance { 525 | 0% { 526 | transform: scale(0.3) rotate(6deg) translateX(-30%) translateY(30%); 527 | opacity: 0.2; 528 | } 529 | 30% { 530 | transform: scale(1.03) rotate(-2deg) translateX(2%) translateY(-2%); 531 | opacity: 1; 532 | } 533 | 45% { 534 | transform: scale(0.98) rotate(1deg) translateX(0%) translateY(0%); 535 | opacity: 1; 536 | } 537 | 60% { 538 | transform: scale(1.01) rotate(-1deg) translateX(0%) translateY(0%); 539 | opacity: 1; 540 | } 541 | 75% { 542 | transform: scale(0.99) rotate(1deg) translateX(0%) translateY(0%); 543 | opacity: 1; 544 | } 545 | 90% { 546 | transform: scale(1.01) rotate(0deg) translateX(0%) translateY(0%); 547 | opacity: 1; 548 | } 549 | 100% { 550 | transform: scale(1) rotate(0deg) translateX(0%) translateY(0%); 551 | opacity: 1; 552 | } 553 | } 554 | 555 | @-webkit-keyframes bigEntrance { 556 | 0% { 557 | -webkit-transform: scale(0.3) rotate(6deg) translateX(-30%) translateY(30%); 558 | opacity: 0.2; 559 | } 560 | 30% { 561 | -webkit-transform: scale(1.03) rotate(-2deg) translateX(2%) translateY(-2%); 562 | opacity: 1; 563 | } 564 | 45% { 565 | -webkit-transform: scale(0.98) rotate(1deg) translateX(0%) translateY(0%); 566 | opacity: 1; 567 | } 568 | 60% { 569 | -webkit-transform: scale(1.01) rotate(-1deg) translateX(0%) translateY(0%); 570 | opacity: 1; 571 | } 572 | 75% { 573 | -webkit-transform: scale(0.99) rotate(1deg) translateX(0%) translateY(0%); 574 | opacity: 1; 575 | } 576 | 90% { 577 | -webkit-transform: scale(1.01) rotate(0deg) translateX(0%) translateY(0%); 578 | opacity: 1; 579 | } 580 | 100% { 581 | -webkit-transform: scale(1) rotate(0deg) translateX(0%) translateY(0%); 582 | opacity: 1; 583 | } 584 | } 585 | 586 | /* 587 | ============================================== 588 | hatch 589 | ============================================== 590 | */ 591 | 592 | .hatch{ 593 | animation-name: hatch; 594 | -webkit-animation-name: hatch; 595 | 596 | animation-duration: 2s; 597 | -webkit-animation-duration: 2s; 598 | 599 | animation-timing-function: ease-in-out; 600 | -webkit-animation-timing-function: ease-in-out; 601 | 602 | transform-origin: 50% 100%; 603 | -ms-transform-origin: 50% 100%; 604 | -webkit-transform-origin: 50% 100%; 605 | 606 | visibility: visible !important; 607 | } 608 | 609 | @keyframes hatch { 610 | 0% { 611 | transform: rotate(0deg) scaleY(0.6); 612 | } 613 | 20% { 614 | transform: rotate(-2deg) scaleY(1.05); 615 | } 616 | 35% { 617 | transform: rotate(2deg) scaleY(1); 618 | } 619 | 50% { 620 | transform: rotate(-2deg); 621 | } 622 | 65% { 623 | transform: rotate(1deg); 624 | } 625 | 80% { 626 | transform: rotate(-1deg); 627 | } 628 | 100% { 629 | transform: rotate(0deg); 630 | } 631 | } 632 | 633 | @-webkit-keyframes hatch { 634 | 0% { 635 | -webkit-transform: rotate(0deg) scaleY(0.6); 636 | } 637 | 20% { 638 | -webkit-transform: rotate(-2deg) scaleY(1.05); 639 | } 640 | 35% { 641 | -webkit-transform: rotate(2deg) scaleY(1); 642 | } 643 | 50% { 644 | -webkit-transform: rotate(-2deg); 645 | } 646 | 65% { 647 | -webkit-transform: rotate(1deg); 648 | } 649 | 80% { 650 | -webkit-transform: rotate(-1deg); 651 | } 652 | 100% { 653 | -webkit-transform: rotate(0deg); 654 | } 655 | } 656 | 657 | 658 | /* 659 | ============================================== 660 | bounce 661 | ============================================== 662 | */ 663 | 664 | 665 | .bounce{ 666 | animation-name: bounce; 667 | -webkit-animation-name: bounce; 668 | 669 | animation-duration: 1.6s; 670 | -webkit-animation-duration: 1.6s; 671 | 672 | animation-timing-function: ease; 673 | -webkit-animation-timing-function: ease; 674 | 675 | transform-origin: 50% 100%; 676 | -ms-transform-origin: 50% 100%; 677 | -webkit-transform-origin: 50% 100%; 678 | } 679 | 680 | @keyframes bounce { 681 | 0% { 682 | transform: translateY(0%) scaleY(0.6); 683 | } 684 | 60%{ 685 | transform: translateY(-100%) scaleY(1.1); 686 | } 687 | 70%{ 688 | transform: translateY(0%) scaleY(0.95) scaleX(1.05); 689 | } 690 | 80%{ 691 | transform: translateY(0%) scaleY(1.05) scaleX(1); 692 | } 693 | 90%{ 694 | transform: translateY(0%) scaleY(0.95) scaleX(1); 695 | } 696 | 100%{ 697 | transform: translateY(0%) scaleY(1) scaleX(1); 698 | } 699 | } 700 | 701 | @-webkit-keyframes bounce { 702 | 0% { 703 | -webkit-transform: translateY(0%) scaleY(0.6); 704 | } 705 | 60%{ 706 | -webkit-transform: translateY(-100%) scaleY(1.1); 707 | } 708 | 70%{ 709 | -webkit-transform: translateY(0%) scaleY(0.95) scaleX(1.05); 710 | } 711 | 80%{ 712 | -webkit-transform: translateY(0%) scaleY(1.05) scaleX(1); 713 | } 714 | 90%{ 715 | -webkit-transform: translateY(0%) scaleY(0.95) scaleX(1); 716 | } 717 | 100%{ 718 | -webkit-transform: translateY(0%) scaleY(1) scaleX(1); 719 | } 720 | } 721 | 722 | 723 | /* 724 | ============================================== 725 | pulse 726 | ============================================== 727 | */ 728 | 729 | .pulse{ 730 | animation-name: pulse; 731 | -webkit-animation-name: pulse; 732 | 733 | animation-duration: 1.5s; 734 | -webkit-animation-duration: 1.5s; 735 | 736 | animation-iteration-count: infinite; 737 | -webkit-animation-iteration-count: infinite; 738 | } 739 | 740 | @keyframes pulse { 741 | 0% { 742 | transform: scale(0.9); 743 | opacity: 0.4; 744 | } 745 | 50% { 746 | transform: scale(1.1); 747 | opacity: 1; 748 | } 749 | 100% { 750 | transform: scale(0.9); 751 | opacity: 0.4; 752 | } 753 | } 754 | 755 | @-webkit-keyframes pulse { 756 | 0% { 757 | -webkit-transform: scale(0.95); 758 | opacity: 0.4; 759 | } 760 | 50% { 761 | -webkit-transform: scale(1.1); 762 | opacity: 1; 763 | } 764 | 100% { 765 | -webkit-transform: scale(0.95); 766 | opacity: 0.4; 767 | } 768 | } 769 | 770 | /* 771 | ============================================== 772 | floating 773 | ============================================== 774 | */ 775 | 776 | .floating{ 777 | animation-name: floating; 778 | -webkit-animation-name: floating; 779 | 780 | animation-duration: 1s; 781 | -webkit-animation-duration: 1s; 782 | 783 | animation-iteration-count: infinite; 784 | -webkit-animation-iteration-count: infinite; 785 | } 786 | 787 | @keyframes floating { 788 | 0% { 789 | transform: translateY(0%); 790 | } 791 | 50% { 792 | transform: translateY(8%); 793 | } 794 | 100% { 795 | transform: translateY(0%); 796 | } 797 | } 798 | 799 | @-webkit-keyframes floating { 800 | 0% { 801 | -webkit-transform: translateY(0%); 802 | } 803 | 50% { 804 | -webkit-transform: translateY(8%); 805 | } 806 | 100% { 807 | -webkit-transform: translateY(0%); 808 | } 809 | } 810 | 811 | /* 812 | ============================================== 813 | tossing 814 | ============================================== 815 | */ 816 | 817 | .tossing{ 818 | animation-name: tossing; 819 | -webkit-animation-name: tossing; 820 | 821 | animation-duration: 2.5s; 822 | -webkit-animation-duration: 2.5s; 823 | 824 | animation-iteration-count: infinite; 825 | -webkit-animation-iteration-count: infinite; 826 | } 827 | 828 | @keyframes tossing { 829 | 0% { 830 | transform: rotate(-4deg); 831 | } 832 | 50% { 833 | transform: rotate(4deg); 834 | } 835 | 100% { 836 | transform: rotate(-4deg); 837 | } 838 | } 839 | 840 | @-webkit-keyframes tossing { 841 | 0% { 842 | -webkit-transform: rotate(-4deg); 843 | } 844 | 50% { 845 | -webkit-transform: rotate(4deg); 846 | } 847 | 100% { 848 | -webkit-transform: rotate(-4deg); 849 | } 850 | } 851 | 852 | /* 853 | ============================================== 854 | pullUp 855 | ============================================== 856 | */ 857 | 858 | .pullUp{ 859 | animation-name: pullUp; 860 | -webkit-animation-name: pullUp; 861 | 862 | animation-duration: 1.1s; 863 | -webkit-animation-duration: 1.1s; 864 | 865 | animation-timing-function: ease-out; 866 | -webkit-animation-timing-function: ease-out; 867 | 868 | transform-origin: 50% 100%; 869 | -ms-transform-origin: 50% 100%; 870 | -webkit-transform-origin: 50% 100%; 871 | } 872 | 873 | @keyframes pullUp { 874 | 0% { 875 | transform: scaleY(0.1); 876 | } 877 | 40% { 878 | transform: scaleY(1.02); 879 | } 880 | 60% { 881 | transform: scaleY(0.98); 882 | } 883 | 80% { 884 | transform: scaleY(1.01); 885 | } 886 | 100% { 887 | transform: scaleY(0.98); 888 | } 889 | 80% { 890 | transform: scaleY(1.01); 891 | } 892 | 100% { 893 | transform: scaleY(1); 894 | } 895 | } 896 | 897 | @-webkit-keyframes pullUp { 898 | 0% { 899 | -webkit-transform: scaleY(0.1); 900 | } 901 | 40% { 902 | -webkit-transform: scaleY(1.02); 903 | } 904 | 60% { 905 | -webkit-transform: scaleY(0.98); 906 | } 907 | 80% { 908 | -webkit-transform: scaleY(1.01); 909 | } 910 | 100% { 911 | -webkit-transform: scaleY(0.98); 912 | } 913 | 80% { 914 | -webkit-transform: scaleY(1.01); 915 | } 916 | 100% { 917 | -webkit-transform: scaleY(1); 918 | } 919 | } 920 | 921 | /* 922 | ============================================== 923 | pullDown 924 | ============================================== 925 | */ 926 | 927 | .pullDown{ 928 | animation-name: pullDown; 929 | -webkit-animation-name: pullDown; 930 | 931 | animation-duration: 1.1s; 932 | -webkit-animation-duration: 1.1s; 933 | 934 | animation-timing-function: ease-out; 935 | -webkit-animation-timing-function: ease-out; 936 | 937 | transform-origin: 50% 0%; 938 | -ms-transform-origin: 50% 0%; 939 | -webkit-transform-origin: 50% 0%; 940 | } 941 | 942 | @keyframes pullDown { 943 | 0% { 944 | transform: scaleY(0.1); 945 | } 946 | 40% { 947 | transform: scaleY(1.02); 948 | } 949 | 60% { 950 | transform: scaleY(0.98); 951 | } 952 | 80% { 953 | transform: scaleY(1.01); 954 | } 955 | 100% { 956 | transform: scaleY(0.98); 957 | } 958 | 80% { 959 | transform: scaleY(1.01); 960 | } 961 | 100% { 962 | transform: scaleY(1); 963 | } 964 | } 965 | 966 | @-webkit-keyframes pullDown { 967 | 0% { 968 | -webkit-transform: scaleY(0.1); 969 | } 970 | 40% { 971 | -webkit-transform: scaleY(1.02); 972 | } 973 | 60% { 974 | -webkit-transform: scaleY(0.98); 975 | } 976 | 80% { 977 | -webkit-transform: scaleY(1.01); 978 | } 979 | 100% { 980 | -webkit-transform: scaleY(0.98); 981 | } 982 | 80% { 983 | -webkit-transform: scaleY(1.01); 984 | } 985 | 100% { 986 | -webkit-transform: scaleY(1); 987 | } 988 | } 989 | 990 | /* 991 | ============================================== 992 | stretchLeft 993 | ============================================== 994 | */ 995 | 996 | .stretchLeft{ 997 | animation-name: stretchLeft; 998 | -webkit-animation-name: stretchLeft; 999 | 1000 | animation-duration: 1.5s; 1001 | -webkit-animation-duration: 1.5s; 1002 | 1003 | animation-timing-function: ease-out; 1004 | -webkit-animation-timing-function: ease-out; 1005 | 1006 | transform-origin: 100% 0%; 1007 | -ms-transform-origin: 100% 0%; 1008 | -webkit-transform-origin: 100% 0%; 1009 | } 1010 | 1011 | @keyframes stretchLeft { 1012 | 0% { 1013 | transform: scaleX(0.3); 1014 | } 1015 | 40% { 1016 | transform: scaleX(1.02); 1017 | } 1018 | 60% { 1019 | transform: scaleX(0.98); 1020 | } 1021 | 80% { 1022 | transform: scaleX(1.01); 1023 | } 1024 | 100% { 1025 | transform: scaleX(0.98); 1026 | } 1027 | 80% { 1028 | transform: scaleX(1.01); 1029 | } 1030 | 100% { 1031 | transform: scaleX(1); 1032 | } 1033 | } 1034 | 1035 | @-webkit-keyframes stretchLeft { 1036 | 0% { 1037 | -webkit-transform: scaleX(0.3); 1038 | } 1039 | 40% { 1040 | -webkit-transform: scaleX(1.02); 1041 | } 1042 | 60% { 1043 | -webkit-transform: scaleX(0.98); 1044 | } 1045 | 80% { 1046 | -webkit-transform: scaleX(1.01); 1047 | } 1048 | 100% { 1049 | -webkit-transform: scaleX(0.98); 1050 | } 1051 | 80% { 1052 | -webkit-transform: scaleX(1.01); 1053 | } 1054 | 100% { 1055 | -webkit-transform: scaleX(1); 1056 | } 1057 | } 1058 | 1059 | /* 1060 | ============================================== 1061 | stretchRight 1062 | ============================================== 1063 | */ 1064 | 1065 | .stretchRight{ 1066 | animation-name: stretchRight; 1067 | -webkit-animation-name: stretchRight; 1068 | 1069 | animation-duration: 1.5s; 1070 | -webkit-animation-duration: 1.5s; 1071 | 1072 | animation-timing-function: ease-out; 1073 | -webkit-animation-timing-function: ease-out; 1074 | 1075 | transform-origin: 0% 0%; 1076 | -ms-transform-origin: 0% 0%; 1077 | -webkit-transform-origin: 0% 0%; 1078 | } 1079 | 1080 | @keyframes stretchRight { 1081 | 0% { 1082 | transform: scaleX(0.3); 1083 | } 1084 | 40% { 1085 | transform: scaleX(1.02); 1086 | } 1087 | 60% { 1088 | transform: scaleX(0.98); 1089 | } 1090 | 80% { 1091 | transform: scaleX(1.01); 1092 | } 1093 | 100% { 1094 | transform: scaleX(0.98); 1095 | } 1096 | 80% { 1097 | transform: scaleX(1.01); 1098 | } 1099 | 100% { 1100 | transform: scaleX(1); 1101 | } 1102 | } 1103 | 1104 | @-webkit-keyframes stretchRight { 1105 | 0% { 1106 | -webkit-transform: scaleX(0.3); 1107 | } 1108 | 40% { 1109 | -webkit-transform: scaleX(1.02); 1110 | } 1111 | 60% { 1112 | -webkit-transform: scaleX(0.98); 1113 | } 1114 | 80% { 1115 | -webkit-transform: scaleX(1.01); 1116 | } 1117 | 100% { 1118 | -webkit-transform: scaleX(0.98); 1119 | } 1120 | 80% { 1121 | -webkit-transform: scaleX(1.01); 1122 | } 1123 | 100% { 1124 | -webkit-transform: scaleX(1); 1125 | } 1126 | } 1127 | -------------------------------------------------------------------------------- /app/assets/stylesheets/vendor/_index.scss: -------------------------------------------------------------------------------- 1 | @import "animation_cheat_sheet"; 2 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | end 4 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/flats_controller.rb: -------------------------------------------------------------------------------- 1 | class FlatsController < ApplicationController 2 | def index 3 | @flats = Flat.all.order(created_at: :desc) 4 | end 5 | 6 | def new 7 | @flat = Flat.new 8 | end 9 | 10 | def create 11 | @flat = Flat.new(flat_params) 12 | if @flat.save 13 | redirect_to root_path, notice: 'Your flat has been created' 14 | else 15 | render :new 16 | end 17 | end 18 | 19 | def destroy 20 | @flat = Flat.find(params[:id]) 21 | @flat.destroy 22 | end 23 | 24 | private 25 | 26 | def flat_params 27 | params.require(:flat).permit(:address, :zip_code, :city, :country) 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def home 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/flats_helper.rb: -------------------------------------------------------------------------------- 1 | module FlatsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/flat.rb: -------------------------------------------------------------------------------- 1 | class Flat < ApplicationRecord 2 | validates :address, presence: true 3 | validates :zip_code, presence: true 4 | validates :city, presence: true 5 | validates :country, presence: true 6 | 7 | geocoded_by :full_address 8 | after_validation :geocode, if: :full_address_changed? 9 | 10 | def full_address 11 | "#{address}, #{zip_code} #{city} #{ISO3166::Country[country].name}" 12 | end 13 | 14 | def full_address_changed? 15 | address_changed? || zip_code_changed? || city_changed? || country_changed? 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/views/flats/destroy.js.erb: -------------------------------------------------------------------------------- 1 | <% if @flat %> 2 | $("[data-flat-id='<%= @flat.id %>']").remove(); 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/flats/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 | <%= link_to new_flat_path do %> 6 | Add a flat 7 | <% end %> 8 | | 9 | <%= link_to "https://github.com/lewagon/google-maps-autocomplete#readme", target: :blank do %> 10 | Source code 11 | <% end %> 12 |

13 | 14 | <% if @flats.any? %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | <% @flats.each do |flat| %> 25 | 26 | 27 | 28 | 29 | 34 | 35 | <% end %> 36 | 37 |
AddressLatitudeLongitude
<%= flat.full_address %><%= flat.latitude %><%= flat.longitude %> 30 | <%= link_to flat_path(flat), method: :delete, remote: true, data: { confirm: 'Delete flat?' } do %> 31 | 32 | <% end %> 33 |
38 | <% end %> 39 |
40 |
41 |
42 | -------------------------------------------------------------------------------- /app/views/flats/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | <%= simple_form_for(@flat) do |f| %> 5 | <%= f.input :address %> 6 | <%= f.input :zip_code %> 7 | <%= f.input :city %> 8 | <%= f.input :country, priority: [ 'FR' ] %> 9 | <%= f.submit class: 'btn btn-primary' %> 10 | <% end %> 11 |
12 |
13 |
14 | 15 | <%= content_for(:after_js) do %> 16 | 17 | <% end %> 18 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Google Maps Autocomplete Demo - Le Wagon 8 | <%= csrf_meta_tags %> 9 | <%= action_cable_meta_tag %> 10 | <%= stylesheet_link_tag 'application', media: 'all' %> 11 | 12 | 13 | <%= render 'shared/flashes' %> 14 | <%= yield %> 15 | <%= javascript_include_tag 'application' %> 16 | <%= yield(:after_js) %> 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/pages/home.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_for(:after_js) do %> 2 | 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/shared/_flashes.html.erb: -------------------------------------------------------------------------------- 1 | <% if notice %> 2 | 6 | <% end %> 7 | <% if alert %> 8 | 12 | <% end %> 13 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) 11 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } 12 | gem 'spring', match[1] 13 | require 'spring/binstub' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /browser_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/browser_key.png -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "active_job/railtie" 7 | require "active_record/railtie" 8 | require "action_controller/railtie" 9 | require "action_mailer/railtie" 10 | require "action_view/railtie" 11 | require "action_cable/engine" 12 | require "sprockets/railtie" 13 | # require "rails/test_unit/railtie" 14 | 15 | # Require the gems listed in Gemfile, including any gems 16 | # you've limited to :test, :development, or :production. 17 | Bundler.require(*Rails.groups) 18 | 19 | module GoogleMapsAutocomplete 20 | class Application < Rails::Application 21 | # Settings in config/environments/* take precedence over those specified here. 22 | # Application configuration should go into files in config/initializers 23 | # -- all .rb files in that directory are automatically loaded. 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see rails configuration guide 21 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: google-maps-autocomplete_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: google-maps-autocomplete 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: google-maps-autocomplete_test 61 | 62 | # As with config/secrets.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: google-maps-autocomplete_production 84 | username: google-maps-autocomplete 85 | password: <%= ENV['GOOGLE-MAPS-AUTOCOMPLETE_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | if Rails.root.join('tmp/caching-dev.txt').exist? 17 | config.action_controller.perform_caching = true 18 | 19 | config.cache_store = :memory_store 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => 'public, max-age=172800' 22 | } 23 | else 24 | config.action_controller.perform_caching = false 25 | 26 | config.cache_store = :null_store 27 | end 28 | 29 | # Don't care if the mailer can't send. 30 | config.action_mailer.raise_delivery_errors = false 31 | 32 | config.action_mailer.perform_caching = false 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations. 38 | config.active_record.migration_error = :page_load 39 | 40 | # Debug mode disables concatenation and preprocessing of assets. 41 | # This option may cause significant delays in view rendering with a large 42 | # number of complex assets. 43 | config.assets.debug = false 44 | 45 | # Suppress logger output for asset requests. 46 | config.assets.quiet = true 47 | 48 | # Raises error for missing translations 49 | # config.action_view.raise_on_missing_translations = true 50 | 51 | # Use an evented file watcher to asynchronously detect changes in source code, 52 | # routes, locales, etc. This feature depends on the listen gem. 53 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 54 | end 55 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | # Compress JavaScripts and CSS. 22 | config.assets.js_compressor = :uglifier 23 | # config.assets.css_compressor = :sass 24 | 25 | # Do not fallback to assets pipeline if a precompiled asset is missed. 26 | config.assets.compile = false 27 | 28 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 29 | 30 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 31 | # config.action_controller.asset_host = 'http://assets.example.com' 32 | 33 | # Specifies the header that your server uses for sending files. 34 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 35 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 36 | 37 | # Mount Action Cable outside main process or domain 38 | # config.action_cable.mount_path = nil 39 | # config.action_cable.url = 'wss://example.com/cable' 40 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Use the lowest log level to ensure availability of diagnostic information 46 | # when problems arise. 47 | config.log_level = :debug 48 | 49 | # Prepend all log lines with the following tags. 50 | config.log_tags = [ :request_id ] 51 | 52 | # Use a different cache store in production. 53 | # config.cache_store = :mem_cache_store 54 | 55 | # Use a real queuing backend for Active Job (and separate queues per environment) 56 | # config.active_job.queue_adapter = :resque 57 | # config.active_job.queue_name_prefix = "google-maps-autocomplete_#{Rails.env}" 58 | config.action_mailer.perform_caching = false 59 | 60 | # Ignore bad email addresses and do not raise email delivery errors. 61 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 62 | # config.action_mailer.raise_delivery_errors = false 63 | 64 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 65 | # the I18n.default_locale when a translation cannot be found). 66 | config.i18n.fallbacks = true 67 | 68 | # Send deprecation notices to registered listeners. 69 | config.active_support.deprecation = :notify 70 | 71 | # Use default logging formatter so that PID and timestamp are not suppressed. 72 | config.log_formatter = ::Logger::Formatter.new 73 | 74 | # Use a different logger for distributed setups. 75 | # require 'syslog/logger' 76 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 77 | 78 | if ENV["RAILS_LOG_TO_STDOUT"].present? 79 | logger = ActiveSupport::Logger.new(STDOUT) 80 | logger.formatter = config.log_formatter 81 | config.logger = ActiveSupport::TaggedLogging.new(logger) 82 | end 83 | 84 | # Do not dump schema after migrations. 85 | config.active_record.dump_schema_after_migration = false 86 | end 87 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/geocoder.rb: -------------------------------------------------------------------------------- 1 | Geocoder.configure( 2 | # Geocoding options 3 | # timeout: 3, # geocoding service timeout (secs) 4 | # language: :en, # ISO-639 language code 5 | :lookup => :google, 6 | :api_key => ENV['GOOGLE_API_SERVER_KEY'], 7 | :use_https => true, 8 | # http_proxy: nil, # HTTP proxy server (user:pass@host:port) 9 | # https_proxy: nil, # HTTPS proxy server (user:pass@host:port) 10 | # cache: nil, # cache object (must respond to #[], #[]=, and #keys) 11 | # cache_prefix: 'geocoder:', # prefix (string) to use for all cache keys 12 | 13 | # Exceptions that should not be rescued by default 14 | # (if you want to implement custom error handling); 15 | # supports SocketError and Timeout::Error 16 | # always_raise: [], 17 | 18 | # Calculation options 19 | units: :km, 20 | # distances: :linear # :spherical or :linear 21 | ) 22 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_google-maps-autocomplete_session' 4 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | # Wrappers are used by the form builder to generate a 4 | # complete input. You can remove any component from the 5 | # wrapper, change the order or even add your own to the 6 | # stack. The options given below are used to wrap the 7 | # whole input. 8 | config.wrappers :default, class: :input, 9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b| 10 | ## Extensions enabled by default 11 | # Any of these extensions can be disabled for a 12 | # given input by passing: `f.input EXTENSION_NAME => false`. 13 | # You can make any of these extensions optional by 14 | # renaming `b.use` to `b.optional`. 15 | 16 | # Determines whether to use HTML5 (:email, :url, ...) 17 | # and required attributes 18 | b.use :html5 19 | 20 | # Calculates placeholders automatically from I18n 21 | # You can also pass a string as f.input placeholder: "Placeholder" 22 | b.use :placeholder 23 | 24 | ## Optional extensions 25 | # They are disabled unless you pass `f.input EXTENSION_NAME => true` 26 | # to the input. If so, they will retrieve the values from the model 27 | # if any exists. If you want to enable any of those 28 | # extensions by default, you can change `b.optional` to `b.use`. 29 | 30 | # Calculates maxlength from length validations for string inputs 31 | b.optional :maxlength 32 | 33 | # Calculates pattern from format validations for string inputs 34 | b.optional :pattern 35 | 36 | # Calculates min and max from length validations for numeric inputs 37 | b.optional :min_max 38 | 39 | # Calculates readonly automatically from readonly attributes 40 | b.optional :readonly 41 | 42 | ## Inputs 43 | b.use :label_input 44 | b.use :hint, wrap_with: { tag: :span, class: :hint } 45 | b.use :error, wrap_with: { tag: :span, class: :error } 46 | 47 | ## full_messages_for 48 | # If you want to display the full error message for the attribute, you can 49 | # use the component :full_error, like: 50 | # 51 | # b.use :full_error, wrap_with: { tag: :span, class: :error } 52 | end 53 | 54 | # The default wrapper to be used by the FormBuilder. 55 | config.default_wrapper = :default 56 | 57 | # Define the way to render check boxes / radio buttons with labels. 58 | # Defaults to :nested for bootstrap config. 59 | # inline: input + label 60 | # nested: label > input 61 | config.boolean_style = :nested 62 | 63 | # Default class for buttons 64 | config.button_class = 'btn' 65 | 66 | # Method used to tidy up errors. Specify any Rails Array method. 67 | # :first lists the first message for each field. 68 | # Use :to_sentence to list all errors for each field. 69 | # config.error_method = :first 70 | 71 | # Default tag used for error notification helper. 72 | config.error_notification_tag = :div 73 | 74 | # CSS class to add for error notification helper. 75 | config.error_notification_class = 'error_notification' 76 | 77 | # ID to add for error notification helper. 78 | # config.error_notification_id = nil 79 | 80 | # Series of attempts to detect a default label method for collection. 81 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 82 | 83 | # Series of attempts to detect a default value method for collection. 84 | # config.collection_value_methods = [ :id, :to_s ] 85 | 86 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 87 | # config.collection_wrapper_tag = nil 88 | 89 | # You can define the class to use on all collection wrappers. Defaulting to none. 90 | # config.collection_wrapper_class = nil 91 | 92 | # You can wrap each item in a collection of radio/check boxes with a tag, 93 | # defaulting to :span. 94 | # config.item_wrapper_tag = :span 95 | 96 | # You can define a class to use in all item wrappers. Defaulting to none. 97 | # config.item_wrapper_class = nil 98 | 99 | # How the label text should be generated altogether with the required text. 100 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } 101 | 102 | # You can define the class to use on all labels. Default is nil. 103 | # config.label_class = nil 104 | 105 | # You can define the default class to be used on forms. Can be overriden 106 | # with `html: { :class }`. Defaulting to none. 107 | # config.default_form_class = nil 108 | 109 | # You can define which elements should obtain additional classes 110 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 111 | 112 | # Whether attributes are required by default (or not). Default is true. 113 | # config.required_by_default = true 114 | 115 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 116 | # These validations are enabled in SimpleForm's internal config but disabled by default 117 | # in this configuration, which is recommended due to some quirks from different browsers. 118 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 119 | # change this configuration to true. 120 | config.browser_validations = false 121 | 122 | # Collection of methods to detect if a file type was given. 123 | # config.file_methods = [ :mounted_as, :file?, :public_filename ] 124 | 125 | # Custom mappings for input types. This should be a hash containing a regexp 126 | # to match as key, and the input type that will be used when the field name 127 | # matches the regexp as value. 128 | # config.input_mappings = { /count/ => :integer } 129 | 130 | # Custom wrappers for input types. This should be a hash containing an input 131 | # type as key and the wrapper that will be used for all inputs with specified type. 132 | # config.wrapper_mappings = { string: :prepend } 133 | 134 | # Namespaces where SimpleForm should look for custom input classes that 135 | # override default inputs. 136 | # config.custom_inputs_namespaces << "CustomInputs" 137 | 138 | # Default priority for time_zone inputs. 139 | # config.time_zone_priority = nil 140 | 141 | # Default priority for country inputs. 142 | # config.country_priority = nil 143 | 144 | # When false, do not use translations for labels. 145 | # config.translate_labels = true 146 | 147 | # Automatically discover new inputs in Rails' autoload path. 148 | # config.inputs_discovery = true 149 | 150 | # Cache SimpleForm inputs discovery 151 | # config.cache_discovery = !Rails.env.development? 152 | 153 | # Default class for inputs 154 | # config.input_class = nil 155 | 156 | # Define the default class of the input wrapper of the boolean input. 157 | config.boolean_label_class = 'checkbox' 158 | 159 | # Defines if the default input wrapper class should be included in radio 160 | # collection wrappers. 161 | # config.include_default_input_wrapper_class = true 162 | 163 | # Defines which i18n scope will be used in Simple Form. 164 | # config.i18n_scope = 'simple_form' 165 | end 166 | -------------------------------------------------------------------------------- /config/initializers/simple_form_bootstrap.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | config.error_notification_class = 'alert alert-danger' 4 | config.button_class = 'btn btn-default' 5 | config.boolean_label_class = nil 6 | 7 | config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 8 | b.use :html5 9 | b.use :placeholder 10 | b.optional :maxlength 11 | b.optional :pattern 12 | b.optional :min_max 13 | b.optional :readonly 14 | b.use :label, class: 'control-label' 15 | 16 | b.use :input, class: 'form-control' 17 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 18 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 19 | end 20 | 21 | config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 22 | b.use :html5 23 | b.use :placeholder 24 | b.optional :maxlength 25 | b.optional :readonly 26 | b.use :label, class: 'control-label' 27 | 28 | b.use :input 29 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 30 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 31 | end 32 | 33 | config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 34 | b.use :html5 35 | b.optional :readonly 36 | 37 | b.wrapper tag: 'div', class: 'checkbox' do |ba| 38 | ba.use :label_input 39 | end 40 | 41 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 42 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 43 | end 44 | 45 | config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 46 | b.use :html5 47 | b.optional :readonly 48 | b.use :label, class: 'control-label' 49 | b.use :input 50 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 51 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 52 | end 53 | 54 | config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 55 | b.use :html5 56 | b.use :placeholder 57 | b.optional :maxlength 58 | b.optional :pattern 59 | b.optional :min_max 60 | b.optional :readonly 61 | b.use :label, class: 'col-sm-3 control-label' 62 | 63 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 64 | ba.use :input, class: 'form-control' 65 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 66 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 67 | end 68 | end 69 | 70 | config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 71 | b.use :html5 72 | b.use :placeholder 73 | b.optional :maxlength 74 | b.optional :readonly 75 | b.use :label, class: 'col-sm-3 control-label' 76 | 77 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 78 | ba.use :input 79 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 80 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 81 | end 82 | end 83 | 84 | config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 85 | b.use :html5 86 | b.optional :readonly 87 | 88 | b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr| 89 | wr.wrapper tag: 'div', class: 'checkbox' do |ba| 90 | ba.use :label_input 91 | end 92 | 93 | wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } 94 | wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 95 | end 96 | end 97 | 98 | config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 99 | b.use :html5 100 | b.optional :readonly 101 | 102 | b.use :label, class: 'col-sm-3 control-label' 103 | 104 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 105 | ba.use :input 106 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 107 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 108 | end 109 | end 110 | 111 | config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 112 | b.use :html5 113 | b.use :placeholder 114 | b.optional :maxlength 115 | b.optional :pattern 116 | b.optional :min_max 117 | b.optional :readonly 118 | b.use :label, class: 'sr-only' 119 | 120 | b.use :input, class: 'form-control' 121 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 122 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 123 | end 124 | 125 | config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 126 | b.use :html5 127 | b.optional :readonly 128 | b.use :label, class: 'control-label' 129 | b.wrapper tag: 'div', class: 'form-inline' do |ba| 130 | ba.use :input, class: 'form-control' 131 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 132 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 133 | end 134 | end 135 | # Wrappers for forms and inputs using the Bootstrap toolkit. 136 | # Check the Bootstrap docs (http://getbootstrap.com) 137 | # to learn about the different styles for forms and inputs, 138 | # buttons and other elements. 139 | config.default_wrapper = :vertical_form 140 | config.wrapper_mappings = { 141 | check_boxes: :vertical_radio_and_checkboxes, 142 | radio_buttons: :vertical_radio_and_checkboxes, 143 | file: :vertical_file_input, 144 | boolean: :vertical_boolean, 145 | datetime: :multi_select, 146 | date: :multi_select, 147 | time: :multi_select 148 | } 149 | end 150 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # The code in the `on_worker_boot` will be called if you are using 36 | # clustered mode by specifying a number of `workers`. After each worker 37 | # process is booted this block will be run, if you are using `preload_app!` 38 | # option you will want to use this block to reconnect to any threads 39 | # or connections that may have been created at application boot, Ruby 40 | # cannot share connections between processes. 41 | # 42 | # on_worker_boot do 43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 44 | # end 45 | 46 | # Allow puma to be restarted by `rails restart` command. 47 | plugin :tmp_restart 48 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | resources :flats, only: %i(new create destroy) 3 | root to: 'flats#index' 4 | end 5 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 9ec37746a593d8683f303dfec0cc10d9275488dcf8ec96314aef3bc7d123c027812f5d7f0e0cf4f0a06848edc7ae7403ca1db51ed2bb7b0d8f6f263600767ff6 15 | 16 | test: 17 | secret_key_base: ad1eba710e45c6229cacca823400f1e098f80eba02e39269b9a3fc52bba215ec4fff52378f508359a509cfaeae9f7abb137a1be458814fa660ef685fb3d73275 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/dashboard.png -------------------------------------------------------------------------------- /db/migrate/20160808145400_create_flats.rb: -------------------------------------------------------------------------------- 1 | class CreateFlats < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :flats do |t| 4 | t.string :address 5 | t.string :zip_code 6 | t.string :city 7 | t.string :country 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20160808161318_add_coordinates_to_flats.rb: -------------------------------------------------------------------------------- 1 | class AddCoordinatesToFlats < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :flats, :latitude, :float 4 | add_column :flats, :longitude, :float 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 20160808161318) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | create_table "flats", force: :cascade do |t| 19 | t.string "address" 20 | t.string "zip_code" 21 | t.string "city" 22 | t.string "country" 23 | t.datetime "created_at", null: false 24 | t.datetime "updated_at", null: false 25 | t.float "latitude" 26 | t.float "longitude" 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | puts "Destroying all flats first..." 2 | Flat.destroy_all 3 | 4 | puts "Creating a flat for Paris" 5 | Flat.create address: '16 villa gaudelet', zip_code: 75011, city: 'Paris', country: 'FR' 6 | 7 | puts "Creating a flat for London" 8 | Flat.create address: '14-22 Elder St', zip_code: 'E1 6BT', city: 'London', country: 'GB' 9 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> 2 | <%%= f.error_notification %> 3 | 4 |
5 | <%- attributes.each do |attribute| -%> 6 | <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> 7 | <%- end -%> 8 |
9 | 10 |
11 | <%%= f.button :submit %> 12 |
13 | <%% end %> 14 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lewagon/google-maps-autocomplete/16e145091ee15f2dcbe3cbc8c561c131c06f1b3c/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------