From 6dfcc12d990beab2e0d68461b3024bd817bb67e9 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Mon, 2 Apr 2018 15:45:09 -0700 Subject: [PATCH 01/79] inital diagram drawn --- .DS_Store | Bin 0 -> 6148 bytes Rails RideShare ERD.png | Bin 0 -> 8477 bytes db/.DS_Store | Bin 0 -> 6148 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 .DS_Store create mode 100644 Rails RideShare ERD.png create mode 100644 db/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4c3165de3f24e86be860355ca1911fa590f7460e GIT binary patch literal 6148 zcmeHKJ5EC}5S$GWij*cLrLVvZtSFoy7l7~(LJCR|(Z7mwaWrN>Afl&NP|%=RX+8FO z$Cjsf`xbz0--cUY17JmW#Jdku^L_V;Eh^$@e#YT+I&y+*yiAg30?u7vz+pH)9)I#* z@qlMM;rz8RbAZB9Knh3!DIf);z^@eWQcYW}6E#W!DIf*D74YvvqdWG(F)=9Dw&=hV$s9g4;6jJHUK^+b(Q zKnh$caFxrA*Z({EO#gpL(n<ljq{*zh;mGf ia?FL7TRY6Fxmy`vJq0HKExAW`Yk zL@r%G2!aG5v;YATCis;1d)KU4GvBQ5TQh%T-F5ce<+u0Q=XcJ%H?M9R++sh*e+&cy zv1>!MU?31P00J>7A7KbUIr%d$8JB}j*YvM}K;^NlyY`0|V^KI1rVj%7OMpO6UVuQ` z4AGOHAdr_l2t>LI0;#5gKs*mKaYpKl8wVV8Z)t({!ehG#jM34DP>aVP5O2o*k4f9> zc_Kr|;;F5FgJt^Q0qzSt>YsiZG6I~?*1C4bcXTnU7qKv$98Tf&i_qJUI@tJZnU$9< zB?^H`YZJbIYEs+h+J|mF;b;E0f#&(JXPN@m35WYT1$8cki^}FbzD?E`6j6)8 z$jCS&7k42``c$ZQ^5E*Wbcc6UgCOYpsqA@n5a`PRG}A*iDEkxmRRl zo9`j_&x7i@ln?`n_K49#O4+eF1^xN;qU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C%tQ3^ztBDBo9@PWP&h<6CPq2t!pre0 ck}|LPocq0SObj~XK_}{Gz;%&Hfm Date: Mon, 2 Apr 2018 16:58:22 -0700 Subject: [PATCH 02/79] rails new created --- .gitignore | 19 ++ Gemfile | 54 +++++ Gemfile.lock | 196 ++++++++++++++++++ Rakefile | 6 + app/assets/config/manifest.js | 3 + app/assets/images/.keep | 0 app/assets/javascripts/application.js | 15 ++ app/assets/javascripts/cable.js | 13 ++ app/assets/javascripts/channels/.keep | 0 app/assets/stylesheets/application.css | 15 ++ app/channels/application_cable/channel.rb | 4 + app/channels/application_cable/connection.rb | 4 + app/controllers/application_controller.rb | 3 + app/controllers/concerns/.keep | 0 app/helpers/application_helper.rb | 2 + app/jobs/application_job.rb | 2 + app/mailers/application_mailer.rb | 4 + app/models/application_record.rb | 3 + app/models/concerns/.keep | 0 app/views/layouts/application.html.erb | 14 ++ app/views/layouts/mailer.html.erb | 13 ++ app/views/layouts/mailer.text.erb | 1 + bin/bundle | 3 + bin/rails | 9 + bin/rake | 9 + bin/setup | 38 ++++ bin/spring | 17 ++ bin/update | 29 +++ bin/yarn | 11 + config.ru | 5 + config/application.rb | 18 ++ config/boot.rb | 3 + config/cable.yml | 10 + config/database.yml | 85 ++++++++ config/environment.rb | 5 + config/environments/development.rb | 54 +++++ config/environments/production.rb | 91 ++++++++ config/environments/test.rb | 42 ++++ .../application_controller_renderer.rb | 8 + config/initializers/assets.rb | 14 ++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/cookies_serializer.rb | 5 + .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 ++ config/initializers/mime_types.rb | 4 + config/initializers/wrap_parameters.rb | 14 ++ config/locales/en.yml | 33 +++ config/puma.rb | 56 +++++ config/routes.rb | 3 + config/secrets.yml | 32 +++ config/spring.rb | 6 + .../Rails RideShare ERD.png | Bin lib/assets/.keep | 0 lib/tasks/.keep | 0 log/.keep | 0 package.json | 5 + public/404.html | 67 ++++++ public/422.html | 67 ++++++ public/500.html | 66 ++++++ public/apple-touch-icon-precomposed.png | 0 public/apple-touch-icon.png | 0 public/favicon.ico | 0 public/robots.txt | 1 + test/application_system_test_case.rb | 5 + test/controllers/.keep | 0 test/fixtures/.keep | 0 test/fixtures/files/.keep | 0 test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/system/.keep | 0 test/test_helper.rb | 10 + tmp/.keep | 0 vendor/.keep | 0 75 files changed, 1223 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile create mode 100644 app/assets/config/manifest.js create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/javascripts/cable.js create mode 100644 app/assets/javascripts/channels/.keep create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/channels/application_cable/channel.rb create mode 100644 app/channels/application_cable/connection.rb create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/helpers/application_helper.rb create mode 100644 app/jobs/application_job.rb create mode 100644 app/mailers/application_mailer.rb create mode 100644 app/models/application_record.rb create mode 100644 app/models/concerns/.keep create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/mailer.html.erb create mode 100644 app/views/layouts/mailer.text.erb create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/setup create mode 100755 bin/spring create mode 100755 bin/update create mode 100755 bin/yarn create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/cable.yml create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/puma.rb create mode 100644 config/routes.rb create mode 100644 config/secrets.yml create mode 100644 config/spring.rb rename Rails RideShare ERD.png => images/Rails RideShare ERD.png (100%) create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 log/.keep create mode 100644 package.json create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/apple-touch-icon-precomposed.png create mode 100644 public/apple-touch-icon.png create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 test/application_system_test_case.rb create mode 100644 test/controllers/.keep create mode 100644 test/fixtures/.keep create mode 100644 test/fixtures/files/.keep create mode 100644 test/helpers/.keep create mode 100644 test/integration/.keep create mode 100644 test/mailers/.keep create mode 100644 test/models/.keep create mode 100644 test/system/.keep create mode 100644 test/test_helper.rb create mode 100644 tmp/.keep create mode 100644 vendor/.keep diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..82701fedc --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* +!/log/.keep +!/tmp/.keep + +/node_modules +/yarn-error.log + +.byebug_history diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..502cba1e3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,54 @@ +source 'https://rubygems.org' + +git_source(:github) do |repo_name| + repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") + "https://github.com/#{repo_name}.git" +end + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 5.1.5' +# Use postgresql as the database for Active Record +gem 'pg', '>= 0.18', '< 2.0' +# Use Puma as the app server +gem 'puma', '~> 3.7' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.2' +# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks +gem 'turbolinks', '~> 5' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 4.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] + # Adds support for Capybara system testing and selenium driver + gem 'capybara', '~> 2.13' + gem 'selenium-webdriver' +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. + gem 'web-console', '>= 3.3.0' + gem 'listen', '>= 3.0.5', '< 3.2' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..35ce7e7f3 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,196 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.1.6) + actionpack (= 5.1.6) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.6) + actionpack (= 5.1.6) + actionview (= 5.1.6) + activejob (= 5.1.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.1.6) + actionview (= 5.1.6) + activesupport (= 5.1.6) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.1.6) + activesupport (= 5.1.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.6) + activesupport (= 5.1.6) + globalid (>= 0.3.6) + activemodel (5.1.6) + activesupport (= 5.1.6) + activerecord (5.1.6) + activemodel (= 5.1.6) + activesupport (= 5.1.6) + arel (~> 8.0) + activesupport (5.1.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + arel (8.0.0) + bindex (0.5.0) + builder (3.2.3) + byebug (10.0.2) + capybara (2.18.0) + addressable + mini_mime (>= 0.1.3) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (>= 2.0, < 4.0) + childprocess (0.9.0) + ffi (~> 1.0, >= 1.0.11) + coffee-rails (4.2.2) + coffee-script (>= 2.2.0) + railties (>= 4.0.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.0.5) + crass (1.0.3) + erubi (1.7.1) + execjs (2.7.0) + ffi (1.9.23) + globalid (0.4.1) + activesupport (>= 4.2.0) + i18n (1.0.0) + concurrent-ruby (~> 1.0) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.2.2) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.0) + mini_mime (>= 0.1.1) + method_source (0.9.0) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.11.3) + multi_json (1.13.1) + nio4r (2.3.0) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + pg (1.0.0) + public_suffix (3.0.2) + puma (3.11.3) + rack (2.0.4) + rack-test (1.0.0) + rack (>= 1.0, < 3) + rails (5.1.6) + actioncable (= 5.1.6) + actionmailer (= 5.1.6) + actionpack (= 5.1.6) + actionview (= 5.1.6) + activejob (= 5.1.6) + activemodel (= 5.1.6) + activerecord (= 5.1.6) + activesupport (= 5.1.6) + bundler (>= 1.3.0) + railties (= 5.1.6) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.1.6) + actionpack (= 5.1.6) + activesupport (= 5.1.6) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.1) + rb-fsevent (0.10.3) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + ruby_dep (1.5.0) + rubyzip (1.2.1) + sass (3.5.6) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + selenium-webdriver (3.11.0) + childprocess (~> 0.5) + rubyzip (~> 1.2) + spring (2.0.2) + activesupport (>= 4.2) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + thor (0.20.0) + thread_safe (0.3.6) + tilt (2.0.8) + turbolinks (5.1.0) + turbolinks-source (~> 5.1) + turbolinks-source (5.1.0) + tzinfo (1.2.5) + thread_safe (~> 0.1) + uglifier (4.1.8) + execjs (>= 0.3.0, < 3) + web-console (3.5.1) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + xpath (3.0.0) + nokogiri (~> 1.8) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + capybara (~> 2.13) + coffee-rails (~> 4.2) + jbuilder (~> 2.5) + listen (>= 3.0.5, < 3.2) + pg (>= 0.18, < 2.0) + puma (~> 3.7) + rails (~> 5.1.5) + sass-rails (~> 5.0) + selenium-webdriver + spring + spring-watcher-listen (~> 2.0.0) + turbolinks (~> 5) + tzinfo-data + uglifier (>= 1.3.0) + web-console (>= 3.3.0) + +BUNDLED WITH + 1.16.1 diff --git a/Rakefile b/Rakefile new file mode 100644 index 000000000..e85f91391 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative 'config/application' + +Rails.application.load_tasks diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 000000000..b16e53d6d --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 000000000..46b20359f --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's +// vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require rails-ujs +//= require turbolinks +//= require_tree . diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js new file mode 100644 index 000000000..739aa5f02 --- /dev/null +++ b/app/assets/javascripts/cable.js @@ -0,0 +1,13 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the `rails generate channel` command. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 000000000..d05ea0f51 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's + * vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb new file mode 100644 index 000000000..d67269728 --- /dev/null +++ b/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 000000000..0ff5442f4 --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 000000000..1c07694e9 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery with: :exception +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 000000000..a009ace51 --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 000000000..286b2239d --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 000000000..10a4cba84 --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 000000000..353326840 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + RideshareRails + <%= csrf_meta_tags %> + + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 000000000..cbd34d2e9 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 000000000..37f0bddbd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 000000000..66e9889e8 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 000000000..5badb2fde --- /dev/null +++ b/bin/rails @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 000000000..d87d5f578 --- /dev/null +++ b/bin/rake @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 000000000..78c4e861d --- /dev/null +++ b/bin/setup @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/spring b/bin/spring new file mode 100755 index 000000000..fb2ec2ebb --- /dev/null +++ b/bin/spring @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require 'rubygems' + require 'bundler' + + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + spring = lockfile.specs.detect { |spec| spec.name == "spring" } + if spring + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version + require 'spring/binstub' + end +end diff --git a/bin/update b/bin/update new file mode 100755 index 000000000..a8e4462f2 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 000000000..c2bacef83 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config.ru b/config.ru new file mode 100644 index 000000000..f7ba0b527 --- /dev/null +++ b/config.ru @@ -0,0 +1,5 @@ +# This file is used by Rack-based servers to start the application. + +require_relative 'config/environment' + +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 000000000..03d71e01b --- /dev/null +++ b/config/application.rb @@ -0,0 +1,18 @@ +require_relative 'boot' + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module RideshareRails + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.1 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 000000000..30f5120df --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 000000000..db55d1026 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 + channel_prefix: rideshare-rails_production diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 000000000..bf1c2b58e --- /dev/null +++ b/config/database.yml @@ -0,0 +1,85 @@ +# PostgreSQL. Versions 9.1 and up are supported. +# +# Install the pg driver: +# gem install pg +# On OS X with Homebrew: +# gem install pg -- --with-pg-config=/usr/local/bin/pg_config +# On OS X with MacPorts: +# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config +# On Windows: +# gem install pg +# Choose the win32 build. +# Install PostgreSQL and put its /bin directory on your path. +# +# Configure Using Gemfile +# gem 'pg' +# +default: &default + adapter: postgresql + encoding: unicode + # For details on connection pooling, see Rails configuration guide + # http://guides.rubyonrails.org/configuring.html#database-pooling + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + +development: + <<: *default + database: rideshare-rails_development + + # The specified database role being used to connect to postgres. + # To create additional roles in postgres see `$ createuser --help`. + # When left blank, postgres will use the default role. This is + # the same name as the operating system user that initialized the database. + #username: rideshare-rails + + # The password associated with the postgres role (username). + #password: + + # Connect on a TCP socket. Omitted by default since the client uses a + # domain socket that doesn't need configuration. Windows does not have + # domain sockets, so uncomment these lines. + #host: localhost + + # The TCP port the server listens on. Defaults to 5432. + # If your server runs on a different port number, change accordingly. + #port: 5432 + + # Schema search path. The server defaults to $user,public + #schema_search_path: myapp,sharedapp,public + + # Minimum log levels, in increasing order: + # debug5, debug4, debug3, debug2, debug1, + # log, notice, warning, error, fatal, and panic + # Defaults to warning. + #min_messages: notice + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: rideshare-rails_test + +# As with config/secrets.yml, you never want to store sensitive information, +# like your database password, in your source code. If your source code is +# ever seen by anyone, they now have access to your database. +# +# Instead, provide the password as a unix environment variable when you boot +# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database +# for a full rundown on how to provide these environment variables in a +# production deployment. +# +# On Heroku and other platform providers, you may have a full connection URL +# available as an environment variable. For example: +# +# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" +# +# You can use this database configuration with: +# +# production: +# url: <%= ENV['DATABASE_URL'] %> +# +production: + <<: *default + database: rideshare-rails_production + username: rideshare-rails + password: <%= ENV['RIDESHARE-RAILS_DATABASE_PASSWORD'] %> diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 000000000..426333bb4 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 000000000..5187e2218 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,54 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Suppress logger output for asset requests. + config.assets.quiet = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 000000000..8eb974095 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,91 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "rideshare-rails_#{Rails.env}" + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 000000000..8e5cbde53 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 000000000..4b828e80c --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..59385cdf3 --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..5a6a32d37 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..4a994e1e7 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 000000000..ac033bf9d --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 000000000..dc1899682 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..bbfc3961b --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 000000000..decc5a857 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 000000000..1e19380dc --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,56 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end +# + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 000000000..787824f88 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,3 @@ +Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html +end diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 000000000..3bf8d84e3 --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,32 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + +development: + secret_key_base: 5b7fb48a1b8b39a62f48181c11e3c2a2069856629268d7c1a10415db8d0c4526957fc25d5796f8060d02e44c027f5b59e25ef3c3ae8959a05052ddb2d007109f + +test: + secret_key_base: e44233f0620aaacad87718308d13368e97ad0f43b7e3a173391ed3d2f7d52681c2c3cd9ae6e3c97cf50f960d4654fe8ff3f5b0e6b07c81a7f41f6bc26b3d2939 + +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. + +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 000000000..c9119b40c --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } diff --git a/Rails RideShare ERD.png b/images/Rails RideShare ERD.png similarity index 100% rename from Rails RideShare ERD.png rename to images/Rails RideShare ERD.png diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/log/.keep b/log/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json new file mode 100644 index 000000000..2d821c4e4 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "name": "rideshare-rails", + "private": true, + "dependencies": {} +} diff --git a/public/404.html b/public/404.html new file mode 100644 index 000000000..2be3af26f --- /dev/null +++ b/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

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

+
+

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

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 000000000..c08eac0d1 --- /dev/null +++ b/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

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

+
+

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

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 000000000..78a030af2 --- /dev/null +++ b/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

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

+
+ + diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png new file mode 100644 index 000000000..e69de29bb diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 000000000..e69de29bb diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 000000000..e69de29bb diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 000000000..37b576a4a --- /dev/null +++ b/public/robots.txt @@ -0,0 +1 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb new file mode 100644 index 000000000..d19212abd --- /dev/null +++ b/test/application_system_test_case.rb @@ -0,0 +1,5 @@ +require "test_helper" + +class ApplicationSystemTestCase < ActionDispatch::SystemTestCase + driven_by :selenium, using: :chrome, screen_size: [1400, 1400] +end diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/system/.keep b/test/system/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 000000000..92e39b2d7 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/.keep b/vendor/.keep new file mode 100644 index 000000000..e69de29bb From 72645169543d513ee6121cba254d7adff41ee6fe Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 09:27:23 -0700 Subject: [PATCH 03/79] updated ERB --- images/Rails RideShare ERD.png | Bin 8477 -> 8849 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/images/Rails RideShare ERD.png b/images/Rails RideShare ERD.png index 90340ccc4555bfae8f6750bbc977b242ed246730..2cbe2774699c1c798aa8a2c031149fa6aa8fe69c 100644 GIT binary patch literal 8849 zcmd6NXH-*Nly(q7DT)dbq$7&bdoQ6V3J8QQT|hu0MTCF>0x0dJiAWU$g0uhvB8C#0 zAVsMnp%Z$MKE1mzbC&WFi-<(H=rjn#6RLGb&G^MAF{3kTb~riwm}P@We5CBs@2jDvfu|==9c^_dcMdnEvj!?k=t)D7OJ8nFE#*?-(Mi_Qt%n;` z9S_aI(}o;3_b@|#O!D4+cP`>OuxSk&yR&h&dp%fKgGn}7f%Vw&px&jlQ8VYFkDxoQ zs0dr=!dSBrcqGGWf;TY>I|w<>YB!N8Bzv0Kz6QD#{_fs$+_r2rDOOizRZi=PQjg2& ziyI7)Gb}D5>ksmQIJ<%bi!wt*y{#MNL-GZ91CBF12ih7e6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&}#cuvyi!(iOV6Uo?~p)9ndXTsVaMm zx7Ob0Y-nPI5uLR_3P+O|){)WN{JJ(#k(lUkQwc7E@nra~^p-|J*zSf^@PZL8Kt9&r z_Ha=$TCM+YScoZ7pYMaSSaY#p+s=Zy7;{oM4U_8!478IF7P*GQqQ9M1p&#h@}K#Mx*mE?p>eFBW9QQ$OOJMQq#W2uLfoT7$NLl5V6lHN zR#7r=i};o!FL>SEZYwrYkvf~}aoJq~ z@!JoC!5p(ThVGk^qX<5fuy|a0c9_0wxTZ*Kcm7=AMZx!vt#*tW)5+q3XC>N)TgiR4u3DMeyMi1 zEPM6PK?drFD&lufF}$G;-(*zdD&oI#Ff0XTY*eg_$S=$weK-fES!3p-sQmDf4$5ID z90HDG#2;0nu1#quHnN7<|0!5cSI-ET7`V(M*)TLgVcxtDP`m0b;nM8vdP)Vz z2N=_0n&6}~aZgtE$KEHff2MD?VEW4Xr4`{#W)yhZ7RT~eSWA8Sx!FO8M+$icG^U1> zk~Cf$r}VGvSf(&uWd2LZwg*T%l2m8t^R1)^lb+fa3#1w@DlLcK89uiV?N%i{l-qMy}T?`=XeA5e5+Nw#B}=WZ6Cp) zF~+0fQ>v%xS_mlRYL6s6?lRpsRu#IiU4&A<(L&-uRJ|JoouP(qhs0Mfo;pjC4H?z8^^ D`*k5@ From e59493c4bcbf5802781f1eeb3a0b79ecc4c746fe Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 11:01:13 -0700 Subject: [PATCH 04/79] created models and migrated --- app/models/driver.rb | 2 + app/models/passenger.rb | 2 + app/models/trip.rb | 2 + db/migrate/20180403175618_create_drivers.rb | 10 +++++ db/migrate/20180403175818_create_trips.rb | 13 ++++++ .../20180403175847_create_passengers.rb | 10 +++++ db/schema.rb | 42 +++++++++++++++++++ test/fixtures/drivers.yml | 11 +++++ test/fixtures/passengers.yml | 11 +++++ test/fixtures/trips.yml | 17 ++++++++ test/models/driver_test.rb | 7 ++++ test/models/passenger_test.rb | 7 ++++ test/models/trip_test.rb | 7 ++++ 13 files changed, 141 insertions(+) create mode 100644 app/models/driver.rb create mode 100644 app/models/passenger.rb create mode 100644 app/models/trip.rb create mode 100644 db/migrate/20180403175618_create_drivers.rb create mode 100644 db/migrate/20180403175818_create_trips.rb create mode 100644 db/migrate/20180403175847_create_passengers.rb create mode 100644 db/schema.rb create mode 100644 test/fixtures/drivers.yml create mode 100644 test/fixtures/passengers.yml create mode 100644 test/fixtures/trips.yml create mode 100644 test/models/driver_test.rb create mode 100644 test/models/passenger_test.rb create mode 100644 test/models/trip_test.rb diff --git a/app/models/driver.rb b/app/models/driver.rb new file mode 100644 index 000000000..1ff364562 --- /dev/null +++ b/app/models/driver.rb @@ -0,0 +1,2 @@ +class Driver < ApplicationRecord +end diff --git a/app/models/passenger.rb b/app/models/passenger.rb new file mode 100644 index 000000000..2c5748ac2 --- /dev/null +++ b/app/models/passenger.rb @@ -0,0 +1,2 @@ +class Passenger < ApplicationRecord +end diff --git a/app/models/trip.rb b/app/models/trip.rb new file mode 100644 index 000000000..a8c077a10 --- /dev/null +++ b/app/models/trip.rb @@ -0,0 +1,2 @@ +class Trip < ApplicationRecord +end diff --git a/db/migrate/20180403175618_create_drivers.rb b/db/migrate/20180403175618_create_drivers.rb new file mode 100644 index 000000000..eddae1b05 --- /dev/null +++ b/db/migrate/20180403175618_create_drivers.rb @@ -0,0 +1,10 @@ +class CreateDrivers < ActiveRecord::Migration[5.1] + def change + create_table :drivers do |t| + t.string :name + t.string :vin + + t.timestamps + end + end +end diff --git a/db/migrate/20180403175818_create_trips.rb b/db/migrate/20180403175818_create_trips.rb new file mode 100644 index 000000000..7d27f18be --- /dev/null +++ b/db/migrate/20180403175818_create_trips.rb @@ -0,0 +1,13 @@ +class CreateTrips < ActiveRecord::Migration[5.1] + def change + create_table :trips do |t| + t.integer :driver_id + t.integer :passenger_id + t.date :date + t.integer :rating + t.integer :cost + + t.timestamps + end + end +end diff --git a/db/migrate/20180403175847_create_passengers.rb b/db/migrate/20180403175847_create_passengers.rb new file mode 100644 index 000000000..97f19c7b4 --- /dev/null +++ b/db/migrate/20180403175847_create_passengers.rb @@ -0,0 +1,10 @@ +class CreatePassengers < ActiveRecord::Migration[5.1] + def change + create_table :passengers do |t| + t.string :name + t.string :phone_num + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 000000000..25129dc47 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,42 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20180403175847) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "drivers", force: :cascade do |t| + t.string "name" + t.string "vin" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "passengers", force: :cascade do |t| + t.string "name" + t.string "phone_num" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "trips", force: :cascade do |t| + t.integer "driver_id" + t.integer "passenger_id" + t.date "date" + t.integer "rating" + t.integer "cost" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/test/fixtures/drivers.yml b/test/fixtures/drivers.yml new file mode 100644 index 000000000..74f888f2f --- /dev/null +++ b/test/fixtures/drivers.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + id: 1 + name: MyString + vin: MyString + +two: + id: 1 + name: MyString + vin: MyString diff --git a/test/fixtures/passengers.yml b/test/fixtures/passengers.yml new file mode 100644 index 000000000..9af114990 --- /dev/null +++ b/test/fixtures/passengers.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + id: 1 + name: MyString + phone_num: MyString + +two: + id: 1 + name: MyString + phone_num: MyString diff --git a/test/fixtures/trips.yml b/test/fixtures/trips.yml new file mode 100644 index 000000000..87f45e327 --- /dev/null +++ b/test/fixtures/trips.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + id: 1 + driver_id: 1 + passenger_id: 1 + date: 2018-04-03 + rating: 1 + cost: 1 + +two: + id: 1 + driver_id: 1 + passenger_id: 1 + date: 2018-04-03 + rating: 1 + cost: 1 diff --git a/test/models/driver_test.rb b/test/models/driver_test.rb new file mode 100644 index 000000000..ce2501238 --- /dev/null +++ b/test/models/driver_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DriverTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/passenger_test.rb b/test/models/passenger_test.rb new file mode 100644 index 000000000..8eea85496 --- /dev/null +++ b/test/models/passenger_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PassengerTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/trip_test.rb b/test/models/trip_test.rb new file mode 100644 index 000000000..1ed8ca609 --- /dev/null +++ b/test/models/trip_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TripTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 05859a2aacf90155b82928ebed18c36079ed0a26 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 11:16:59 -0700 Subject: [PATCH 05/79] fixed migration references --- db/migrate/20180403180551_add_references.rb | 6 ++++++ db/migrate/20180403181213_delete_trips_columns.rb | 6 ++++++ db/migrate/20180403181445_redo_references.rb | 6 ++++++ db/schema.rb | 10 +++++++--- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20180403180551_add_references.rb create mode 100644 db/migrate/20180403181213_delete_trips_columns.rb create mode 100644 db/migrate/20180403181445_redo_references.rb diff --git a/db/migrate/20180403180551_add_references.rb b/db/migrate/20180403180551_add_references.rb new file mode 100644 index 000000000..a9810eaf4 --- /dev/null +++ b/db/migrate/20180403180551_add_references.rb @@ -0,0 +1,6 @@ +class AddReferences < ActiveRecord::Migration[5.1] + def change + # add_reference :trips, :driver, foreign_key: true + # add_reference :trips, :passenger, foreign_key: true + end +end diff --git a/db/migrate/20180403181213_delete_trips_columns.rb b/db/migrate/20180403181213_delete_trips_columns.rb new file mode 100644 index 000000000..f421b64f5 --- /dev/null +++ b/db/migrate/20180403181213_delete_trips_columns.rb @@ -0,0 +1,6 @@ +class DeleteTripsColumns < ActiveRecord::Migration[5.1] + def change + remove_column :trips, :driver_id + remove_column :trips, :passenger_id + end +end diff --git a/db/migrate/20180403181445_redo_references.rb b/db/migrate/20180403181445_redo_references.rb new file mode 100644 index 000000000..5420f455f --- /dev/null +++ b/db/migrate/20180403181445_redo_references.rb @@ -0,0 +1,6 @@ +class RedoReferences < ActiveRecord::Migration[5.1] + def change + add_reference :trips, :driver, foreign_key: true + add_reference :trips, :passenger, foreign_key: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 25129dc47..2be3db2eb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180403175847) do +ActiveRecord::Schema.define(version: 20180403181445) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -30,13 +30,17 @@ end create_table "trips", force: :cascade do |t| - t.integer "driver_id" - t.integer "passenger_id" t.date "date" t.integer "rating" t.integer "cost" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.bigint "driver_id" + t.bigint "passenger_id" + t.index ["driver_id"], name: "index_trips_on_driver_id" + t.index ["passenger_id"], name: "index_trips_on_passenger_id" end + add_foreign_key "trips", "drivers" + add_foreign_key "trips", "passengers" end From 89bf9c0b014b78afac60f475950f5775de769250 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 11:19:35 -0700 Subject: [PATCH 06/79] model relationships created --- app/models/driver.rb | 1 + app/models/passenger.rb | 1 + app/models/trip.rb | 2 ++ 3 files changed, 4 insertions(+) diff --git a/app/models/driver.rb b/app/models/driver.rb index 1ff364562..197e65507 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -1,2 +1,3 @@ class Driver < ApplicationRecord + has_many :trips end diff --git a/app/models/passenger.rb b/app/models/passenger.rb index 2c5748ac2..2fef89192 100644 --- a/app/models/passenger.rb +++ b/app/models/passenger.rb @@ -1,2 +1,3 @@ class Passenger < ApplicationRecord + has_many :trips end diff --git a/app/models/trip.rb b/app/models/trip.rb index a8c077a10..8e2566cd8 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -1,2 +1,4 @@ class Trip < ApplicationRecord + belongs_to :driver + belongs_to :passenger end From 3efd85958be6efc882d41044a4c8d7aeb05a1a7f Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 11:23:10 -0700 Subject: [PATCH 07/79] basic routes created with resources --- config/routes.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 787824f88..fb272242e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,9 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + resources :drivers + resources :passengers + resources :trips + + root 'trips#index' + end From 379b025a5245f288556d965dd4c5bdefa363318c Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 11:26:15 -0700 Subject: [PATCH 08/79] controllers created --- app/controllers/drivers_controller.rb | 0 app/controllers/passengers_controller.rb | 0 app/controllers/trips_controller.rb | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/controllers/drivers_controller.rb create mode 100644 app/controllers/passengers_controller.rb create mode 100644 app/controllers/trips_controller.rb diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/passengers_controller.rb b/app/controllers/passengers_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb new file mode 100644 index 000000000..e69de29bb From ee6098800d3c454a0b7636e2ee2416ff215a9221 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 11:37:21 -0700 Subject: [PATCH 09/79] blueprint methods for controllers --- app/controllers/drivers_controller.rb | 47 ++++++++++++++++++++++++ app/controllers/passengers_controller.rb | 46 +++++++++++++++++++++++ app/controllers/trips_controller.rb | 46 +++++++++++++++++++++++ 3 files changed, 139 insertions(+) diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb index e69de29bb..26e653961 100644 --- a/app/controllers/drivers_controller.rb +++ b/app/controllers/drivers_controller.rb @@ -0,0 +1,47 @@ +class DriversController < ActionController + + def index + @drivers = Driver.all + end + + def show + id = params[:id] + @driver = Driver.find(id) + end + + def new + @driver = Driver.new + end + + def create + @driver = Driver.new(driver_params) + if @driver.save + redirect_to drivers_path + else + render :new + end + end + + def edit + @driver = Driver.find_by(id: params[:id]) + end + + def update + @driver = Driver.find_by(id: params[:id]) + if @Driver.update(driver_params) + redirect_to drivers_path + else + render :edit + end + end + + def destroy + id = params[:id] + end + + private + + def driver_params + return params.require(:driver).permit(:name, :description, :due_date, :status) + end +end diff --git a/app/controllers/passengers_controller.rb b/app/controllers/passengers_controller.rb index e69de29bb..2d98c7637 100644 --- a/app/controllers/passengers_controller.rb +++ b/app/controllers/passengers_controller.rb @@ -0,0 +1,46 @@ +class PassengersController < ActionController + def index + @passengers = Passenger.all + end + + def show + id = params[:id] + @passenger = Passenger.find(id) + end + + def new + @passenger = Passenger.new + end + + def create + @passenger = Passenger.new(passenger_params) + if @Passenger.save + redirect_to passengers_path + else + render :new + end + end + + def edit + @passenger = Passenger.find_by(id: params[:id]) + end + + def update + @passenger = Passenger.find_by(id: params[:id]) + if @Passenger.update(passenger_params) + redirect_to passengers_path + else + render :edit + end + end + + def destroy + id = params[:id] + end + + private + + def passenger_params + return params.require(:passenger).permit(:name, :description, :due_date, :status) + end +end diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index e69de29bb..023b6edcc 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -0,0 +1,46 @@ +class TripsController < ActionController + def index + @trips = Trip.all + end + + def show + id = params[:id] + @trip = Trip.find(id) + end + + def new + @trip = Trip.new + end + + def create + @trip = Trip.new(trip_params) + if @Trip.save + redirect_to trips_path + else + render :new + end + end + + def edit + @trip = Trip.find_by(id: params[:id]) + end + + def update + @trip = Trip.find_by(id: params[:id]) + if @Trip.update(trip_params) + redirect_to trips_path + else + render :edit + end + end + + def destroy + id = params[:id] + end + + private + + def trip_params + return params.require(:trip).permit(:name, :description, :due_date, :status) + end +end From 0aec5acd149672f85dafd3dc5b7c41c47327196c Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 13:41:32 -0700 Subject: [PATCH 10/79] params added for controllers --- app/controllers/drivers_controller.rb | 2 +- app/controllers/passengers_controller.rb | 2 +- app/controllers/trips_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb index 26e653961..7a8ec441f 100644 --- a/app/controllers/drivers_controller.rb +++ b/app/controllers/drivers_controller.rb @@ -42,6 +42,6 @@ def destroy private def driver_params - return params.require(:driver).permit(:name, :description, :due_date, :status) + return params.require(:driver).permit(:name, :vin) end end diff --git a/app/controllers/passengers_controller.rb b/app/controllers/passengers_controller.rb index 2d98c7637..b5fd7c40c 100644 --- a/app/controllers/passengers_controller.rb +++ b/app/controllers/passengers_controller.rb @@ -41,6 +41,6 @@ def destroy private def passenger_params - return params.require(:passenger).permit(:name, :description, :due_date, :status) + return params.require(:passenger).permit(:name, :phone_num) end end diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 023b6edcc..28a51b4e3 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -41,6 +41,6 @@ def destroy private def trip_params - return params.require(:trip).permit(:name, :description, :due_date, :status) + return params.require(:trip).permit(:driver_id, :passenger_id, :date, :rating, :cost) end end From 89ce1071dfdcf405767cd8e32cb5b4c7944a0bdc Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 14:04:18 -0700 Subject: [PATCH 11/79] fixed controllers, have html views --- .DS_Store | Bin 6148 -> 6148 bytes app/.DS_Store | Bin 0 -> 6148 bytes app/assets/javascripts/drivers.coffee | 3 ++ app/assets/javascripts/passengers.coffee | 3 ++ app/assets/javascripts/trips.coffee | 3 ++ app/assets/stylesheets/drivers.scss | 3 ++ app/assets/stylesheets/passengers.scss | 3 ++ app/assets/stylesheets/trips.scss | 3 ++ app/controllers/.DS_Store | Bin 0 -> 6148 bytes app/controllers/drivers_controller.rb | 3 +- app/controllers/passengers_controller.rb | 3 +- app/controllers/trips_controller.rb | 2 +- app/helpers/drivers_helper.rb | 2 ++ app/helpers/passengers_helper.rb | 2 ++ app/helpers/trips_helper.rb | 2 ++ app/views/drivers/create.html.erb | 2 ++ app/views/drivers/destory.html.erb | 2 ++ app/views/drivers/edit.html.erb | 2 ++ app/views/drivers/index.html.erb | 2 ++ app/views/drivers/new.html.erb | 2 ++ app/views/drivers/show.html.erb | 2 ++ app/views/passengers/create.html.erb | 2 ++ app/views/passengers/destory.html.erb | 2 ++ app/views/passengers/edit.html.erb | 2 ++ app/views/passengers/index.html.erb | 2 ++ app/views/passengers/new.html.erb | 2 ++ app/views/passengers/show.html.erb | 2 ++ app/views/trips/create.html.erb | 2 ++ app/views/trips/destory.html.erb | 2 ++ app/views/trips/edit.html.erb | 2 ++ app/views/trips/index.html.erb | 2 ++ app/views/trips/new.html.erb | 2 ++ app/views/trips/show.html.erb | 2 ++ config/routes.rb | 24 +++++++++++++ test/controllers/drivers_controller_test.rb | 7 ++++ .../controllers/passengers_controller_test.rb | 34 ++++++++++++++++++ test/controllers/trips_controller_test.rb | 34 ++++++++++++++++++ 37 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 app/.DS_Store create mode 100644 app/assets/javascripts/drivers.coffee create mode 100644 app/assets/javascripts/passengers.coffee create mode 100644 app/assets/javascripts/trips.coffee create mode 100644 app/assets/stylesheets/drivers.scss create mode 100644 app/assets/stylesheets/passengers.scss create mode 100644 app/assets/stylesheets/trips.scss create mode 100644 app/controllers/.DS_Store create mode 100644 app/helpers/drivers_helper.rb create mode 100644 app/helpers/passengers_helper.rb create mode 100644 app/helpers/trips_helper.rb create mode 100644 app/views/drivers/create.html.erb create mode 100644 app/views/drivers/destory.html.erb create mode 100644 app/views/drivers/edit.html.erb create mode 100644 app/views/drivers/index.html.erb create mode 100644 app/views/drivers/new.html.erb create mode 100644 app/views/drivers/show.html.erb create mode 100644 app/views/passengers/create.html.erb create mode 100644 app/views/passengers/destory.html.erb create mode 100644 app/views/passengers/edit.html.erb create mode 100644 app/views/passengers/index.html.erb create mode 100644 app/views/passengers/new.html.erb create mode 100644 app/views/passengers/show.html.erb create mode 100644 app/views/trips/create.html.erb create mode 100644 app/views/trips/destory.html.erb create mode 100644 app/views/trips/edit.html.erb create mode 100644 app/views/trips/index.html.erb create mode 100644 app/views/trips/new.html.erb create mode 100644 app/views/trips/show.html.erb create mode 100644 test/controllers/drivers_controller_test.rb create mode 100644 test/controllers/passengers_controller_test.rb create mode 100644 test/controllers/trips_controller_test.rb diff --git a/.DS_Store b/.DS_Store index 4c3165de3f24e86be860355ca1911fa590f7460e..01fbbc1285f74cb7a4880f290bbf4eccf037f704 100644 GIT binary patch delta 88 zcmZoMXfc=|&e%S&P;8=}q6jks0|O%ig8)NvPEvk;4v@*fH1VJYSe%(5k)eR0Af*^8 jx3MRKeKR|U00(3H#)IFPC-aNwGBRv-6gkX1v4I5uqc;|x delta 75 zcmZoMXfc=|&e%4wP;8=}q6iZM0|O%ig8)NPetr&+!NA6lIq{;#WCIbFjf+y*Cq59~ d%+4Xe!PvI(;&lj?Ax}n z6dDzv0#twsPys6NB?YpuPG?`*kK0fID)2uF*!Q8p4QpZ-=${S@-U0w82)kkKy#%mW z09X^dKtx~~RA5jwTMP|4;wAHHViy>6(QH06PuA>E)KAC$#nVM=AV(@d1^Nn%V>!3_ zzk$E$|NA7ar~noCD+P42-mX`;Qr6bN<*e2g_zrG4Pq-Q8PQl>i80h5~3oFM9Pl~)^ YbG)yKU7*tucRG+i1Evd&3jA7u7nrgZGXMYp literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/drivers.coffee b/app/assets/javascripts/drivers.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/drivers.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/passengers.coffee b/app/assets/javascripts/passengers.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/passengers.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/trips.coffee b/app/assets/javascripts/trips.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/trips.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/drivers.scss b/app/assets/stylesheets/drivers.scss new file mode 100644 index 000000000..186a23a88 --- /dev/null +++ b/app/assets/stylesheets/drivers.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the drivers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/passengers.scss b/app/assets/stylesheets/passengers.scss new file mode 100644 index 000000000..abb89851f --- /dev/null +++ b/app/assets/stylesheets/passengers.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the passengers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/trips.scss b/app/assets/stylesheets/trips.scss new file mode 100644 index 000000000..473cbc303 --- /dev/null +++ b/app/assets/stylesheets/trips.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the trips controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/.DS_Store b/app/controllers/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0Passengers#create +

Find me in app/views/passengers/create.html.erb

diff --git a/app/views/drivers/destory.html.erb b/app/views/drivers/destory.html.erb new file mode 100644 index 000000000..75657c658 --- /dev/null +++ b/app/views/drivers/destory.html.erb @@ -0,0 +1,2 @@ +

Passengers#destory

+

Find me in app/views/passengers/destory.html.erb

diff --git a/app/views/drivers/edit.html.erb b/app/views/drivers/edit.html.erb new file mode 100644 index 000000000..f6c655f9a --- /dev/null +++ b/app/views/drivers/edit.html.erb @@ -0,0 +1,2 @@ +

Passengers#edit

+

Find me in app/views/passengers/edit.html.erb

diff --git a/app/views/drivers/index.html.erb b/app/views/drivers/index.html.erb new file mode 100644 index 000000000..929c1adad --- /dev/null +++ b/app/views/drivers/index.html.erb @@ -0,0 +1,2 @@ +

Passengers#index

+

Find me in app/views/passengers/index.html.erb

diff --git a/app/views/drivers/new.html.erb b/app/views/drivers/new.html.erb new file mode 100644 index 000000000..42e868512 --- /dev/null +++ b/app/views/drivers/new.html.erb @@ -0,0 +1,2 @@ +

Passengers#new

+

Find me in app/views/passengers/new.html.erb

diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb new file mode 100644 index 000000000..59014cd3f --- /dev/null +++ b/app/views/drivers/show.html.erb @@ -0,0 +1,2 @@ +

Passengers#show

+

Find me in app/views/passengers/show.html.erb

diff --git a/app/views/passengers/create.html.erb b/app/views/passengers/create.html.erb new file mode 100644 index 000000000..c57e678b6 --- /dev/null +++ b/app/views/passengers/create.html.erb @@ -0,0 +1,2 @@ +

Passengers#create

+

Find me in app/views/passengers/create.html.erb

diff --git a/app/views/passengers/destory.html.erb b/app/views/passengers/destory.html.erb new file mode 100644 index 000000000..75657c658 --- /dev/null +++ b/app/views/passengers/destory.html.erb @@ -0,0 +1,2 @@ +

Passengers#destory

+

Find me in app/views/passengers/destory.html.erb

diff --git a/app/views/passengers/edit.html.erb b/app/views/passengers/edit.html.erb new file mode 100644 index 000000000..f6c655f9a --- /dev/null +++ b/app/views/passengers/edit.html.erb @@ -0,0 +1,2 @@ +

Passengers#edit

+

Find me in app/views/passengers/edit.html.erb

diff --git a/app/views/passengers/index.html.erb b/app/views/passengers/index.html.erb new file mode 100644 index 000000000..929c1adad --- /dev/null +++ b/app/views/passengers/index.html.erb @@ -0,0 +1,2 @@ +

Passengers#index

+

Find me in app/views/passengers/index.html.erb

diff --git a/app/views/passengers/new.html.erb b/app/views/passengers/new.html.erb new file mode 100644 index 000000000..42e868512 --- /dev/null +++ b/app/views/passengers/new.html.erb @@ -0,0 +1,2 @@ +

Passengers#new

+

Find me in app/views/passengers/new.html.erb

diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb new file mode 100644 index 000000000..59014cd3f --- /dev/null +++ b/app/views/passengers/show.html.erb @@ -0,0 +1,2 @@ +

Passengers#show

+

Find me in app/views/passengers/show.html.erb

diff --git a/app/views/trips/create.html.erb b/app/views/trips/create.html.erb new file mode 100644 index 000000000..d591532b2 --- /dev/null +++ b/app/views/trips/create.html.erb @@ -0,0 +1,2 @@ +

Trips#create

+

Find me in app/views/trips/create.html.erb

diff --git a/app/views/trips/destory.html.erb b/app/views/trips/destory.html.erb new file mode 100644 index 000000000..67fa83b4c --- /dev/null +++ b/app/views/trips/destory.html.erb @@ -0,0 +1,2 @@ +

Trips#destory

+

Find me in app/views/trips/destory.html.erb

diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb new file mode 100644 index 000000000..c5df78150 --- /dev/null +++ b/app/views/trips/edit.html.erb @@ -0,0 +1,2 @@ +

Trips#edit

+

Find me in app/views/trips/edit.html.erb

diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb new file mode 100644 index 000000000..f7a748c70 --- /dev/null +++ b/app/views/trips/index.html.erb @@ -0,0 +1,2 @@ +

Trips#index

+

Find me in app/views/trips/index.html.erb

diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb new file mode 100644 index 000000000..145f5c473 --- /dev/null +++ b/app/views/trips/new.html.erb @@ -0,0 +1,2 @@ +

Trips#new

+

Find me in app/views/trips/new.html.erb

diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb new file mode 100644 index 000000000..fb24fc2fe --- /dev/null +++ b/app/views/trips/show.html.erb @@ -0,0 +1,2 @@ +

Trips#show

+

Find me in app/views/trips/show.html.erb

diff --git a/config/routes.rb b/config/routes.rb index fb272242e..86a22b308 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,28 @@ Rails.application.routes.draw do + get 'trips/index' + + get 'trips/create' + + get 'trips/destory' + + get 'trips/edit' + + get 'trips/new' + + get 'trips/show' + + get 'passengers/index' + + get 'passengers/create' + + get 'passengers/destory' + + get 'passengers/edit' + + get 'passengers/new' + + get 'passengers/show' + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :drivers resources :passengers diff --git a/test/controllers/drivers_controller_test.rb b/test/controllers/drivers_controller_test.rb new file mode 100644 index 000000000..529f118ce --- /dev/null +++ b/test/controllers/drivers_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DriversControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/passengers_controller_test.rb b/test/controllers/passengers_controller_test.rb new file mode 100644 index 000000000..ca157f9d9 --- /dev/null +++ b/test/controllers/passengers_controller_test.rb @@ -0,0 +1,34 @@ +require 'test_helper' + +class PassengersControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get passengers_index_url + assert_response :success + end + + test "should get create" do + get passengers_create_url + assert_response :success + end + + test "should get destory" do + get passengers_destory_url + assert_response :success + end + + test "should get edit" do + get passengers_edit_url + assert_response :success + end + + test "should get new" do + get passengers_new_url + assert_response :success + end + + test "should get show" do + get passengers_show_url + assert_response :success + end + +end diff --git a/test/controllers/trips_controller_test.rb b/test/controllers/trips_controller_test.rb new file mode 100644 index 000000000..1bc5b3cc4 --- /dev/null +++ b/test/controllers/trips_controller_test.rb @@ -0,0 +1,34 @@ +require 'test_helper' + +class TripsControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get trips_index_url + assert_response :success + end + + test "should get create" do + get trips_create_url + assert_response :success + end + + test "should get destory" do + get trips_destory_url + assert_response :success + end + + test "should get edit" do + get trips_edit_url + assert_response :success + end + + test "should get new" do + get trips_new_url + assert_response :success + end + + test "should get show" do + get trips_show_url + assert_response :success + end + +end From 46fde58d6c5a538e190a718d0b559504437caef2 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 14:17:02 -0700 Subject: [PATCH 12/79] routes troubleshooting --- config/routes.rb | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 86a22b308..d0a93e22a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,27 +1,4 @@ Rails.application.routes.draw do - get 'trips/index' - - get 'trips/create' - - get 'trips/destory' - - get 'trips/edit' - - get 'trips/new' - - get 'trips/show' - - get 'passengers/index' - - get 'passengers/create' - - get 'passengers/destory' - - get 'passengers/edit' - - get 'passengers/new' - - get 'passengers/show' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :drivers From da7c79f48297cf9d156b2204a4910551bcd07ed2 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 15:29:43 -0700 Subject: [PATCH 13/79] driver views updated, trip index basic links set up --- app/views/drivers/create.html.erb | 4 ++-- app/views/drivers/destory.html.erb | 4 ++-- app/views/drivers/edit.html.erb | 4 ++-- app/views/drivers/index.html.erb | 4 ++-- app/views/drivers/new.html.erb | 4 ++-- app/views/drivers/show.html.erb | 4 ++-- app/views/trips/index.html.erb | 7 +++++++ 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/views/drivers/create.html.erb b/app/views/drivers/create.html.erb index c57e678b6..db4dbea32 100644 --- a/app/views/drivers/create.html.erb +++ b/app/views/drivers/create.html.erb @@ -1,2 +1,2 @@ -

Passengers#create

-

Find me in app/views/passengers/create.html.erb

+

Driver#create

+

Find me in app/views/drivers/create.html.erb

diff --git a/app/views/drivers/destory.html.erb b/app/views/drivers/destory.html.erb index 75657c658..aa135de6f 100644 --- a/app/views/drivers/destory.html.erb +++ b/app/views/drivers/destory.html.erb @@ -1,2 +1,2 @@ -

Passengers#destory

-

Find me in app/views/passengers/destory.html.erb

+

Driver#destory

+

Find me in app/views/driver/destory.html.erb

diff --git a/app/views/drivers/edit.html.erb b/app/views/drivers/edit.html.erb index f6c655f9a..8e7dbd55b 100644 --- a/app/views/drivers/edit.html.erb +++ b/app/views/drivers/edit.html.erb @@ -1,2 +1,2 @@ -

Passengers#edit

-

Find me in app/views/passengers/edit.html.erb

+

Drivers#edit

+

Find me in app/views/drivers/edit.html.erb

diff --git a/app/views/drivers/index.html.erb b/app/views/drivers/index.html.erb index 929c1adad..8a23225d3 100644 --- a/app/views/drivers/index.html.erb +++ b/app/views/drivers/index.html.erb @@ -1,2 +1,2 @@ -

Passengers#index

-

Find me in app/views/passengers/index.html.erb

+

Driver#index

+

Find me in app/views/drivers/index.html.erb

diff --git a/app/views/drivers/new.html.erb b/app/views/drivers/new.html.erb index 42e868512..727559cf8 100644 --- a/app/views/drivers/new.html.erb +++ b/app/views/drivers/new.html.erb @@ -1,2 +1,2 @@ -

Passengers#new

-

Find me in app/views/passengers/new.html.erb

+

Driver#new

+

Find me in app/views/drivers/new.html.erb

diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 59014cd3f..fa51c786e 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -1,2 +1,2 @@ -

Passengers#show

-

Find me in app/views/passengers/show.html.erb

+

Driver#show

+

Find me in app/views/drivers/show.html.erb

diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb index f7a748c70..5d47a2519 100644 --- a/app/views/trips/index.html.erb +++ b/app/views/trips/index.html.erb @@ -1,2 +1,9 @@

Trips#index

Find me in app/views/trips/index.html.erb

+ +<%= @trips.first.driver.name %> + +<%= link_to "Drivers", drivers_path %> +<%= link_to "New Driver", new_driver_path %> +<%= link_to "Passengers", passengers_path %> +<%= link_to "New Passenger", new_passenger_path %> From 21e5b9fb4a1234c0ae780786b6de07af523d2859 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 15:43:35 -0700 Subject: [PATCH 14/79] trips/index basic html/css done; links work --- app/assets/stylesheets/application.css | 19 +++++++++++++++++ app/views/trips/index.html.erb | 28 +++++++++++++++++--------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index d05ea0f51..dffce84e7 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,22 @@ *= require_tree . *= require_self */ + + /* * { + border: black solid 1px; + } */ + +.home { + display: flex; + flex-direction: row; + justify-content: space-around; + +} + +.grouping { + margin: 2em; +} + +article { + margin: 4em; +} diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb index 5d47a2519..67ece40b2 100644 --- a/app/views/trips/index.html.erb +++ b/app/views/trips/index.html.erb @@ -1,9 +1,19 @@ -

Trips#index

-

Find me in app/views/trips/index.html.erb

- -<%= @trips.first.driver.name %> - -<%= link_to "Drivers", drivers_path %> -<%= link_to "New Driver", new_driver_path %> -<%= link_to "Passengers", passengers_path %> -<%= link_to "New Passenger", new_passenger_path %> +

Welcome to RideShare

+
+
+
+ <%= link_to "All Drivers", drivers_path %> +
+
+ <%= link_to "Add Driver", new_driver_path %> +
+
+
+
+ <%= link_to "All Passengers", passengers_path %> +
+
+ <%= link_to "Add Passenger", new_passenger_path %> +
+
+
From dc3b2c9d73f195444431bd0e92d5c00c0f772856 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 15:44:50 -0700 Subject: [PATCH 15/79] background color --- app/assets/stylesheets/application.css | 4 ++++ app/views/drivers/index.html.erb | 1 + 2 files changed, 5 insertions(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index d05ea0f51..d4040f870 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,3 +1,7 @@ +body { + background-color: lightblue; +} + /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. diff --git a/app/views/drivers/index.html.erb b/app/views/drivers/index.html.erb index 8a23225d3..13825b74b 100644 --- a/app/views/drivers/index.html.erb +++ b/app/views/drivers/index.html.erb @@ -1,2 +1,3 @@

Driver#index

+

Find me in app/views/drivers/index.html.erb

From b0762c8e4a3448c09948fd21b84a988b8044433c Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 15:59:06 -0700 Subject: [PATCH 16/79] driver list page populated --- app/assets/stylesheets/application.css | 7 +++---- app/views/drivers/index.html.erb | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index af38a45b0..4f0a4fb56 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,7 +1,3 @@ -body { - background-color: lightblue; -} - /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. @@ -21,6 +17,9 @@ body { /* * { border: black solid 1px; } */ + body { + background-color: lightblue; + } .home { display: flex; diff --git a/app/views/drivers/index.html.erb b/app/views/drivers/index.html.erb index 13825b74b..49bfaa7f1 100644 --- a/app/views/drivers/index.html.erb +++ b/app/views/drivers/index.html.erb @@ -1,3 +1,22 @@ -

Driver#index

+ -

Find me in app/views/drivers/index.html.erb

+

All Drivers

+ +
+
    + <% @drivers.each do |driver| %> +
  • + <%= link_to driver.name, driver_path(driver.id) %> +
  • + <% end %> +
+
From f9f053fc8a95d75aea2909849a9e5407f4625cb9 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 15:59:10 -0700 Subject: [PATCH 17/79] passenger index page mapped out; applicatiion css reformatted --- app/assets/stylesheets/application.css | 8 ++++---- app/views/passengers/index.html.erb | 27 ++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index af38a45b0..df1c0b7d0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,7 +1,3 @@ -body { - background-color: lightblue; -} - /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. @@ -22,6 +18,10 @@ body { border: black solid 1px; } */ + body { + background-color: lightblue; + } + .home { display: flex; flex-direction: row; diff --git a/app/views/passengers/index.html.erb b/app/views/passengers/index.html.erb index 929c1adad..a4ec6fac6 100644 --- a/app/views/passengers/index.html.erb +++ b/app/views/passengers/index.html.erb @@ -1,2 +1,25 @@ -

Passengers#index

-

Find me in app/views/passengers/index.html.erb

+ +
+

All Passengers

+
+
+
    + <% @passengers.each do |passenger| %> +
  • + <%= link_to passenger.name, passenger_path(passenger.id) %> +
  • + <%end%> +
+ + +
From 4cb920d9bd71ad2937d8fa946b77cf844861bba8 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 16:48:49 -0700 Subject: [PATCH 18/79] table created for passenger show page, passenger controller updated to be able to show all driver data --- app/assets/stylesheets/application.css | 4 +- app/controllers/passengers_controller.rb | 1 + app/views/passengers/index.html.erb | 5 +-- app/views/passengers/show.html.erb | 52 +++++++++++++++++++++++- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 9783456f9..dcec9f3dc 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,9 +14,9 @@ *= require_self */ - /* * { +* { border: black solid 1px; - } */ + } body { background-color: lightblue; } diff --git a/app/controllers/passengers_controller.rb b/app/controllers/passengers_controller.rb index 628e4f65d..447f9afcc 100644 --- a/app/controllers/passengers_controller.rb +++ b/app/controllers/passengers_controller.rb @@ -4,6 +4,7 @@ def index end def show + @drivers = Driver.all id = params[:id] @passenger = Passenger.find(id) end diff --git a/app/views/passengers/index.html.erb b/app/views/passengers/index.html.erb index a4ec6fac6..ab94a9ca2 100644 --- a/app/views/passengers/index.html.erb +++ b/app/views/passengers/index.html.erb @@ -7,11 +7,12 @@ <%= link_to "Add Passenger", new_passenger_path %> - +

All Passengers

+
    <% @passengers.each do |passenger| %> @@ -20,6 +21,4 @@ <%end%>
- -
diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 59014cd3f..aeeecd42c 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -1,2 +1,50 @@ -

Passengers#show

-

Find me in app/views/passengers/show.html.erb

+ + +
+

Passengers Details

+
+ +
+ + + + + + + + + + <% @passenger.trips.all.each do |trip| %> + + + + + + + + + <%end%> +
+ Trip ID + + Pass + + Driver + + Date + + Rating + + Cost +
<%= trip.id %><%= @passenger.name %><%= @drivers.find(trip.driver_id).name %><%= trip.date %><%= trip.rating %><%= trip.cost %>
+ +
From 8a7d2345567335d0b1fc36dadc3740d8f9a9d764 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 16:50:14 -0700 Subject: [PATCH 19/79] driver trips basic display --- app/controllers/drivers_controller.rb | 1 + app/views/drivers/show.html.erb | 52 +++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb index 7af5967cd..7c7a04bb9 100644 --- a/app/controllers/drivers_controller.rb +++ b/app/controllers/drivers_controller.rb @@ -5,6 +5,7 @@ def index def show id = params[:id] + @passengers = Passenger.all @driver = Driver.find(id) end diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index fa51c786e..2e563be30 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -1,2 +1,50 @@ -

Driver#show

-

Find me in app/views/drivers/show.html.erb

+ + +

Driver Details

+ +
+
+ + + + + + + + + + <% @driver.trips.all.each do |trip| %> + + + + + + + + + <%end%> +
+ Trip ID + + Driver + + Passenger + + Date + + Rating + + Cost +
<%= trip.id %><%= @driver.name %><%= @passengers.find(trip.passenger_id).name %><%= trip.date %><%= trip.rating %><%= trip.cost %>
+ +
+
From 12d8370c8a4e5e05ff17f66479a53abca136d75c Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Tue, 3 Apr 2018 17:02:00 -0700 Subject: [PATCH 20/79] driver show has passenger show links --- app/views/drivers/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 2e563be30..608490e55 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -38,10 +38,10 @@ <%= trip.id %> <%= @driver.name %> - <%= @passengers.find(trip.passenger_id).name %> + <%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %> <%= trip.date %> <%= trip.rating %> - <%= trip.cost %> + $<%= trip.cost.to_f/100 %> <%end%> From d994ac36b0297a48317cad9c3c8bc92ef910e251 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Tue, 3 Apr 2018 17:03:02 -0700 Subject: [PATCH 21/79] changed display of trip cost for passenger show --- app/views/passengers/show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index aeeecd42c..bf626cc3e 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -20,7 +20,7 @@ Trip ID - Pass + Passenger Driver @@ -39,10 +39,10 @@ <%= trip.id %> <%= @passenger.name %> - <%= @drivers.find(trip.driver_id).name %> + <%= link_to @drivers.find(trip.driver_id).name, driver_path(trip.driver_id) %> <%= trip.date %> <%= trip.rating %> - <%= trip.cost %> + $<%= trip.cost.to_f/100 %> <%end%> From 069765b1d6dd8f60f014f514f68d19075b183927 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Wed, 4 Apr 2018 13:55:20 -0700 Subject: [PATCH 22/79] nested trip into driver and passenger --- app/controllers/trips_controller.rb | 6 +++--- config/routes.rb | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 18a35b682..7064948a6 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -1,11 +1,11 @@ class TripsController < ApplicationController def index - @trips = Trip.all + @trips = Trip.all end def show - id = params[:id] - @trip = Trip.find(id) + id = params[:id] + @trip = Trip.find(id) end def new diff --git a/config/routes.rb b/config/routes.rb index d0a93e22a..1e1411f17 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,16 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html - resources :drivers - resources :passengers resources :trips + resources :drivers do + resources :trips, only: [:show, :edit] + end + + resources :passengers do + resources :trips, only: [:show, :edit] + end + root 'trips#index' end From 3f0d1d1a1e5d2cd315a0c7b2140315687f57347c Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Wed, 4 Apr 2018 14:01:33 -0700 Subject: [PATCH 23/79] formatted trip show --- app/views/drivers/show.html.erb | 62 ++++++++++++++++----------------- app/views/trips/show.html.erb | 54 ++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 34 deletions(-) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 608490e55..afebf0db2 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -12,39 +12,37 @@

Driver Details

-
- +
+ + + + + + + + + <% @driver.trips.all.each do |trip| %> - - - - - - + + + + + + - <% @driver.trips.all.each do |trip| %> - - - - - - - - - <%end%> -
+ Trip ID + + Driver + + Passenger + + Date + + Rating + + Cost +
- Trip ID - - Driver - - Passenger - - Date - - Rating - - Cost - <%= trip.id %><%= @driver.name %><%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %><%= trip.date %><%= trip.rating %>$<%= trip.cost.to_f/100 %>
<%= trip.id %><%= @driver.name %><%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %><%= trip.date %><%= trip.rating %>$<%= trip.cost.to_f/100 %>
+ <%end%> + -
diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index fb24fc2fe..35b2b6675 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -1,2 +1,52 @@ -

Trips#show

-

Find me in app/views/trips/show.html.erb

+ +
+

Trip Details

+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ Trip ID + + Date + + Driver + + Passenger + + Cost + + Rating + + LINKS +
<%= @trip.id %><%= @trip.date %><%= @trip.driver.name %><%= @trip.passenger.name %>$<%= @trip.cost.to_f/100 %><%= @trip.rating %> + LINKS +
+
From 69cbdba754c832d9c626180e3afc8e1f5b8f7ad9 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Wed, 4 Apr 2018 14:25:43 -0700 Subject: [PATCH 24/79] drivers/id/trips/id and passengers/id/trips/id working, not linked --- app/controllers/drivers_controller.rb | 2 +- app/controllers/passengers_controller.rb | 4 ++-- app/controllers/trips_controller.rb | 9 ++++++--- app/views/passengers/show.html.erb | 2 +- app/views/trips/show.html.erb | 10 +++++----- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb index 7c7a04bb9..11062609a 100644 --- a/app/controllers/drivers_controller.rb +++ b/app/controllers/drivers_controller.rb @@ -28,7 +28,7 @@ def edit def update @driver = Driver.find_by(id: params[:id]) - if @Driver.update(driver_params) + if @driver.update(driver_params) redirect_to drivers_path else render :edit diff --git a/app/controllers/passengers_controller.rb b/app/controllers/passengers_controller.rb index 447f9afcc..5c2ec439d 100644 --- a/app/controllers/passengers_controller.rb +++ b/app/controllers/passengers_controller.rb @@ -15,7 +15,7 @@ def new def create @passenger = Passenger.new(passenger_params) - if @Passenger.save + if @passenger.save redirect_to passengers_path else render :new @@ -28,7 +28,7 @@ def edit def update @passenger = Passenger.find_by(id: params[:id]) - if @Passenger.update(passenger_params) + if @passenger.update(passenger_params) redirect_to passengers_path else render :edit diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 7064948a6..0cc44b90f 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -1,11 +1,14 @@ class TripsController < ApplicationController def index - @trips = Trip.all + @trips = Trip.all end def show - id = params[:id] - @trip = Trip.find(id) + @drivers = Driver.all + @passengers = Passenger.all + + id = params[:id] + @trip = Trip.find(id) end def new diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index bf626cc3e..158fb79d9 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -37,7 +37,7 @@ <% @passenger.trips.all.each do |trip| %> - <%= trip.id %> + <%= link_to trip.id%> <%= @passenger.name %> <%= link_to @drivers.find(trip.driver_id).name, driver_path(trip.driver_id) %> <%= trip.date %> diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 35b2b6675..acd7e8f41 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -3,9 +3,6 @@
  • <%= link_to "Home", trips_path %>
  • -
  • - <%= link_to "Add Driver", new_driver_path %> -
  • @@ -40,8 +37,11 @@ <%= @trip.id %> <%= @trip.date %> - <%= @trip.driver.name %> - <%= @trip.passenger.name %> + + <%= link_to @trip.driver.name, driver_path(@drivers.find_by(id: @trip.id))%> + + <%= link_to @trip.passenger.name, passenger_path(@passengers.find_by(id: @trip.id))%> + $<%= @trip.cost.to_f/100 %> <%= @trip.rating %> From 24abbefb23d0301e4b5143d6c63623a7fbdd2a0b Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Wed, 4 Apr 2018 14:28:45 -0700 Subject: [PATCH 25/79] link for driver trip --- app/views/drivers/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 608490e55..cd0d2d0be 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -36,7 +36,7 @@ <% @driver.trips.all.each do |trip| %> - <%= trip.id %> + <%= link_to trip.id, trip_path(trip.id) %> <%= @driver.name %> <%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %> <%= trip.date %> From dbb0fd728c910f62be69c8ef2e8fbb9749fc4fee Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Wed, 4 Apr 2018 14:50:53 -0700 Subject: [PATCH 26/79] trip id links from driver and passenger work now; yay --- app/controllers/trips_controller.rb | 2 -- app/views/drivers/show.html.erb | 2 +- app/views/passengers/show.html.erb | 2 +- app/views/trips/show.html.erb | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 0cc44b90f..cba22391b 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -4,8 +4,6 @@ def index end def show - @drivers = Driver.all - @passengers = Passenger.all id = params[:id] @trip = Trip.find(id) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 870f68f5f..9868b28fb 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -35,7 +35,7 @@ <% @driver.trips.all.each do |trip| %> - <%= trip.id %> + <%= link_to trip.id, trip_path(trip.id) %> <%= @driver.name %> <%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %> <%= trip.date %> diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 158fb79d9..087d027d4 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -37,7 +37,7 @@ <% @passenger.trips.all.each do |trip| %> - <%= link_to trip.id%> + <%= link_to trip.id, trip_path(trip.id)%> <%= @passenger.name %> <%= link_to @drivers.find(trip.driver_id).name, driver_path(trip.driver_id) %> <%= trip.date %> diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index acd7e8f41..487c814b1 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -38,9 +38,9 @@ <%= @trip.id %> <%= @trip.date %> - <%= link_to @trip.driver.name, driver_path(@drivers.find_by(id: @trip.id))%> + <%= link_to @trip.driver.name, driver_path(@trip.driver_id)%> - <%= link_to @trip.passenger.name, passenger_path(@passengers.find_by(id: @trip.id))%> + <%= link_to @trip.passenger.name, passenger_path(@trip.passenger_id)%> $<%= @trip.cost.to_f/100 %> <%= @trip.rating %> From c2502c21a8d1ffe3dccd4a8a33d62ab98812bacf Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Wed, 4 Apr 2018 15:02:46 -0700 Subject: [PATCH 27/79] passenger form, new and edit pages drafted --- app/views/passengers/edit.html.erb | 14 ++++++++++++-- app/views/passengers/new.html.erb | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/app/views/passengers/edit.html.erb b/app/views/passengers/edit.html.erb index f6c655f9a..e1a631190 100644 --- a/app/views/passengers/edit.html.erb +++ b/app/views/passengers/edit.html.erb @@ -1,2 +1,12 @@ -

    Passengers#edit

    -

    Find me in app/views/passengers/edit.html.erb

    + + +
    +

    Edit Passenger

    +
    +<%= render partial: "form", locals: {page_title: "Please update information for a passenger"} %> diff --git a/app/views/passengers/new.html.erb b/app/views/passengers/new.html.erb index 42e868512..1ac3c5780 100644 --- a/app/views/passengers/new.html.erb +++ b/app/views/passengers/new.html.erb @@ -1,2 +1,12 @@ -

    Passengers#new

    -

    Find me in app/views/passengers/new.html.erb

    + + +
    +

    New Passenger

    +
    +<%= render partial: "form", locals: {page_title: "Please enter new information for a new passenger!"} %> From ea08eab86b2bade3093b2a3f7e09c9aea3a31f16 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Wed, 4 Apr 2018 15:02:58 -0700 Subject: [PATCH 28/79] form and partials for adding and editing driver --- app/views/drivers/edit.html.erb | 3 +-- app/views/drivers/new.html.erb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/drivers/edit.html.erb b/app/views/drivers/edit.html.erb index 8e7dbd55b..c73aa9b02 100644 --- a/app/views/drivers/edit.html.erb +++ b/app/views/drivers/edit.html.erb @@ -1,2 +1 @@ -

    Drivers#edit

    -

    Find me in app/views/drivers/edit.html.erb

    +<%=render partial: "form", locals: { page_title: "Edit Driver"} %> diff --git a/app/views/drivers/new.html.erb b/app/views/drivers/new.html.erb index 727559cf8..2c8e4215d 100644 --- a/app/views/drivers/new.html.erb +++ b/app/views/drivers/new.html.erb @@ -1,2 +1 @@ -

    Driver#new

    -

    Find me in app/views/drivers/new.html.erb

    +<%=render partial: "form", locals: { page_title: "Add Driver"} %> From 8babb90ab76172467ebf0d100a83e7c4aab68368 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Wed, 4 Apr 2018 15:04:14 -0700 Subject: [PATCH 29/79] oops, passenger form --- app/views/passengers/_form.html.erb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/views/passengers/_form.html.erb diff --git a/app/views/passengers/_form.html.erb b/app/views/passengers/_form.html.erb new file mode 100644 index 000000000..75aa41f7f --- /dev/null +++ b/app/views/passengers/_form.html.erb @@ -0,0 +1,11 @@ +

    <%= page_title %>

    + +<%= form_for @passenger do |f| %> +<%= f.label :name %> +<%= f.text_field :name %>

    + +<%= f.label :phone_number %> +<%= f.text_field :phone_num %>

    + +<%= f.submit %> +<% end %> From 6f62a2914c1357a8fcbdea4bdf08469987c01b57 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Wed, 4 Apr 2018 15:05:32 -0700 Subject: [PATCH 30/79] pushing up driver _form --- app/views/drivers/_form.html.erb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/views/drivers/_form.html.erb diff --git a/app/views/drivers/_form.html.erb b/app/views/drivers/_form.html.erb new file mode 100644 index 000000000..7e0b035c8 --- /dev/null +++ b/app/views/drivers/_form.html.erb @@ -0,0 +1,11 @@ +

    <%= page_title %>

    + +<%= form_for @driver do |f| %> + <%= f.label :name %> + <%= f.text_field :name %> + + <%= f.label :vin %> + <%= f.text_field :vin %> + + <%= f.submit %> +<% end %> From 7adfe12822512f182fcfac540b28ce92dd8f89ba Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Wed, 4 Apr 2018 15:17:20 -0700 Subject: [PATCH 31/79] passenger information + edit button linked on show page --- app/views/drivers/show.html.erb | 2 +- app/views/passengers/show.html.erb | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 9868b28fb..80bb9777a 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -41,8 +41,8 @@ <%= trip.date %> <%= trip.rating %> $<%= trip.cost.to_f/100 %> + <%end%> - <%end%> diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 087d027d4..742e2c91c 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -10,9 +10,16 @@
    -

    Passengers Details

    +

    <%=@passenger.name%>

    +
    +

    + Phone Number: <%= @passenger.phone_num %> +

    +

    + <%= link_to "Edit", edit_passenger_path(@passenger.id)%> +

    +
    -
    @@ -47,4 +54,6 @@ <%end%>
    + +
    From 431f18a1bdc73a947e1bd2e23a31a05575ca3304 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 13:12:23 -0700 Subject: [PATCH 32/79] delete and show changes --- app/controllers/drivers_controller.rb | 6 ++++++ app/controllers/passengers_controller.rb | 7 ++++++- app/views/drivers/show.html.erb | 22 ++++++++++++++-------- app/views/passengers/show.html.erb | 1 + config/routes.rb | 4 ++-- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb index 11062609a..619d776c4 100644 --- a/app/controllers/drivers_controller.rb +++ b/app/controllers/drivers_controller.rb @@ -37,6 +37,12 @@ def update def destroy id = params[:id] + @driver = Driver.find(id) + @driver.trips.delete_all + + if @driver.destroy + redirect_to drivers_path + end end private diff --git a/app/controllers/passengers_controller.rb b/app/controllers/passengers_controller.rb index 5c2ec439d..88d7242cd 100644 --- a/app/controllers/passengers_controller.rb +++ b/app/controllers/passengers_controller.rb @@ -36,7 +36,12 @@ def update end def destroy - id = params[:id] + @passenger = Passenger.find_by(id: params[:id]) + @passenger.trips.delete_all + + if @passenger.destroy + redirect_to passengers_path + end end private diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 80bb9777a..35c87ccb7 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -35,14 +35,20 @@ <% @driver.trips.all.each do |trip| %> - <%= link_to trip.id, trip_path(trip.id) %> + <%= link_to trip.id, driver_trip_path(trip.id) %> <%= @driver.name %> - <%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %> - <%= trip.date %> - <%= trip.rating %> - $<%= trip.cost.to_f/100 %> - <%end%> - - + + <%if trip.passenger_id %> + <%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %> + <% else %> + <%= link_to "Deleted passenger", passengers_path %> + <%end%> + + <%= trip.date %> + <%= trip.rating %> + $<%= trip.cost.to_f/100 %> + <%end%> + + diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 742e2c91c..ef111d845 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -17,6 +17,7 @@

    <%= link_to "Edit", edit_passenger_path(@passenger.id)%> + <%= link_to "Delete", passenger_path(@passenger.id), method: :delete, data: { confirm: 'Are you sure you want to delete this passenger?' } %>

    diff --git a/config/routes.rb b/config/routes.rb index 1e1411f17..3f9ab470a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,11 +4,11 @@ resources :trips resources :drivers do - resources :trips, only: [:show, :edit] + resources :trips, only: [:show, :edit, :destroy] end resources :passengers do - resources :trips, only: [:show, :edit] + resources :trips, only: [:show, :edit, :destroy] end root 'trips#index' From 1e93f9e5f1ba1ad9d0bf6d678b0e1330e197a461 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 13:13:29 -0700 Subject: [PATCH 33/79] driver deletes --- Gemfile | 4 ++++ app/assets/stylesheets/application.css | 5 +---- app/controllers/drivers_controller.rb | 9 ++++++++- app/views/drivers/show.html.erb | 18 +++++++++++++----- config/routes.rb | 4 ++-- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 502cba1e3..e5034a7be 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,10 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +# group :development do +# gem "better_errors" +# gem "binding_of_caller" +# end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.5' diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index dcec9f3dc..0cf117e86 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -16,10 +16,7 @@ * { border: black solid 1px; - } - body { - background-color: lightblue; - } + } body { background-color: lightblue; diff --git a/app/controllers/drivers_controller.rb b/app/controllers/drivers_controller.rb index 11062609a..46aacea79 100644 --- a/app/controllers/drivers_controller.rb +++ b/app/controllers/drivers_controller.rb @@ -5,8 +5,8 @@ def index def show id = params[:id] - @passengers = Passenger.all @driver = Driver.find(id) + @passengers = Passenger.all end def new @@ -37,6 +37,13 @@ def update def destroy id = params[:id] + @driver = Driver.find(id) + @driver.trips.delete_all + + if @driver.destroy + redirect_to drivers_path + end + end private diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 9868b28fb..9fbc44b5e 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -9,7 +9,16 @@ -

    Driver Details

    +

    <%= @driver.name %>

    +
    +

    + Rating: +

    +

    + <%= link_to "Edit", edit_driver_path %> + <%= link_to "Delete", driver_path(@driver.id), method: :delete, data: { confirm: 'Are you sure you want to delete this driver?' } %> +

    +
    @@ -35,14 +44,13 @@ <% @driver.trips.all.each do |trip| %> - + - <%end%> -
    <%= link_to trip.id, trip_path(trip.id) %><%= link_to trip.id, driver_trip_path(trip.id) %> <%= @driver.name %> <%= link_to @passengers.find(trip.passenger_id).name, passenger_path(trip.passenger_id) %> <%= trip.date %> <%= trip.rating %> $<%= trip.cost.to_f/100 %>
    - + <%end%> +
    diff --git a/config/routes.rb b/config/routes.rb index 1e1411f17..3f9ab470a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,11 +4,11 @@ resources :trips resources :drivers do - resources :trips, only: [:show, :edit] + resources :trips, only: [:show, :edit, :destroy] end resources :passengers do - resources :trips, only: [:show, :edit] + resources :trips, only: [:show, :edit, :destroy] end root 'trips#index' From d48592114199f018c5990bf8ed7cf312038611e7 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 13:25:05 -0700 Subject: [PATCH 34/79] deleted passenger is displayed as removed --- app/views/drivers/show.html.erb | 5 ++--- app/views/passengers/show.html.erb | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 49795e679..abd860462 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -57,7 +57,6 @@ <%= trip.rating %> $<%= trip.cost.to_f/100 %> <%end%> - - - + + diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index ef111d845..ab24f8dfd 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -47,14 +47,17 @@ <%= link_to trip.id, trip_path(trip.id)%> <%= @passenger.name %> - <%= link_to @drivers.find(trip.driver_id).name, driver_path(trip.driver_id) %> - <%= trip.date %> - <%= trip.rating %> - $<%= trip.cost.to_f/100 %> - + + <%if trip.driver_id %> + <%= link_to @drivers.find(trip.driver_id).name, driver_path(trip.driver_id) %> + <% else %> + <%= link_to "Deleted driver", drivers_path %> + <%end%> + + <%= trip.date %> + <%= trip.rating %> + $<%= trip.cost.to_f/100 %> <%end%> + - - - From 95d7071d8fb4201b12fe82ed1d99a0d8b8391ba9 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 13:45:17 -0700 Subject: [PATCH 35/79] added edit trip form --- app/views/passengers/show.html.erb | 2 +- app/views/trips/edit.html.erb | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index ab24f8dfd..de2cf7053 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -58,6 +58,6 @@ <%= trip.rating %> $<%= trip.cost.to_f/100 %> <%end%> - + diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb index c5df78150..55209ac20 100644 --- a/app/views/trips/edit.html.erb +++ b/app/views/trips/edit.html.erb @@ -1,2 +1,20 @@ -

    Trips#edit

    -

    Find me in app/views/trips/edit.html.erb

    +

    Edit Trip

    + +<%= form_for @trip do |f| %> +<%= f.label :driver %> +<%= f.text_field :driver %>

    + +<%= f.label :passenger %> +<%= f.text_field :passenger %>

    + +<%= f.label :date %> +<%= f.date_field :date %>

    + +<%= f.label :rating %> +<%= f.select :rating, [[1], [2], [3], [4], [5]], {}, {class: "form-control"} %>

    + +<%= f.label :cost %> +<%= f.text_field :cost %>

    + +<%= f.submit %> +<% end %> From 5c4e5abf799d299f8683cea3e3e8c0453b3e116d Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 13:54:54 -0700 Subject: [PATCH 36/79] trip delete works; controller and view updated --- app/controllers/trips_controller.rb | 6 +++++- app/views/trips/show.html.erb | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index cba22391b..b40b6d4d6 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -36,7 +36,11 @@ def update end def destroy - id = params[:id] + @trip = Trip.find_by(id: params[:id]) + + if @trip.destroy + redirect_to trips_path + end end private diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 487c814b1..7befbf5bf 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -45,7 +45,9 @@ $<%= @trip.cost.to_f/100 %> <%= @trip.rating %> - LINKS + <%= link_to "Edit", edit_trip_path(@trip.id) %> + | + <%= link_to "Delete", trip_path(@trip.id), method: :delete, data: { confirm: 'Are you sure you want to delete this trip?' } %> From 0d24d63792588f00bce0ccf22a70d337562a037a Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 14:03:23 -0700 Subject: [PATCH 37/79] driver input validation --- app/models/driver.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/driver.rb b/app/models/driver.rb index 197e65507..56688aad4 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -1,3 +1,7 @@ class Driver < ApplicationRecord has_many :trips + + validates :name, presence: true, uniqueness: true + validates :vin, presence: true, uniqueness: true + end From 465f36608b89acc0039d77c8e3f056ef09d2130f Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 14:03:51 -0700 Subject: [PATCH 38/79] validation of passenger --- app/models/passenger.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/passenger.rb b/app/models/passenger.rb index 2fef89192..5e2ad11bb 100644 --- a/app/models/passenger.rb +++ b/app/models/passenger.rb @@ -1,3 +1,6 @@ class Passenger < ApplicationRecord has_many :trips + + validates :name, presence: true, uniqueness: true + validates :phone_num, presence: true end From ca491815382af78791d0f25a2ab264fd26dca3cd Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 14:14:04 -0700 Subject: [PATCH 39/79] html error messages added for driver, passenger, trip --- app/controllers/trips_controller.rb | 1 - app/models/driver.rb | 1 - app/views/drivers/_form.html.erb | 10 ++++++++++ app/views/passengers/_form.html.erb | 11 +++++++++++ app/views/trips/edit.html.erb | 10 ++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index b40b6d4d6..560da2b0f 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -4,7 +4,6 @@ def index end def show - id = params[:id] @trip = Trip.find(id) end diff --git a/app/models/driver.rb b/app/models/driver.rb index 56688aad4..c61eaee0c 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -3,5 +3,4 @@ class Driver < ApplicationRecord validates :name, presence: true, uniqueness: true validates :vin, presence: true, uniqueness: true - end diff --git a/app/views/drivers/_form.html.erb b/app/views/drivers/_form.html.erb index 7e0b035c8..687ef39ec 100644 --- a/app/views/drivers/_form.html.erb +++ b/app/views/drivers/_form.html.erb @@ -1,5 +1,15 @@

    <%= page_title %>

    +<% if @driver.errors.any? %> +
      + <% @driver.errors.each do |field, message| %> +
    • + <%= field.capitalize %> <%= message %> +
    • + <% end %> +
    +<% end %> + <%= form_for @driver do |f| %> <%= f.label :name %> <%= f.text_field :name %> diff --git a/app/views/passengers/_form.html.erb b/app/views/passengers/_form.html.erb index 75aa41f7f..c82ef8d35 100644 --- a/app/views/passengers/_form.html.erb +++ b/app/views/passengers/_form.html.erb @@ -1,5 +1,16 @@

    <%= page_title %>

    +<% if @passenger.errors.any? %> +
      + <% @passenger.errors.each do |field, message| %> +
    • + <%= field.capitalize %> <%= message %> +
    • + <% end %> +
    +<% end %> + + <%= form_for @passenger do |f| %> <%= f.label :name %> <%= f.text_field :name %>

    diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb index 55209ac20..c73d4e403 100644 --- a/app/views/trips/edit.html.erb +++ b/app/views/trips/edit.html.erb @@ -1,5 +1,15 @@

    Edit Trip

    +<% if @trip.errors.any? %> +
      + <% @trip.errors.each do |field, message| %> +
    • + <%= field.capitalize %> <%= message %> +
    • + <% end %> +
    +<% end %> + <%= form_for @trip do |f| %> <%= f.label :driver %> <%= f.text_field :driver %>

    From bcc2b80878523e5fe22258ba3603bd1c08a82b05 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 14:14:36 -0700 Subject: [PATCH 40/79] resolving merge conflicts --- app/controllers/trips_controller.rb | 1 + app/views/trips/edit.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index b40b6d4d6..06736af54 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -24,6 +24,7 @@ def create def edit @trip = Trip.find_by(id: params[:id]) + @trip.driver = Driver.find(params[:driver_id]).name end def update diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb index 55209ac20..7cc50f6c4 100644 --- a/app/views/trips/edit.html.erb +++ b/app/views/trips/edit.html.erb @@ -2,7 +2,7 @@ <%= form_for @trip do |f| %> <%= f.label :driver %> -<%= f.text_field :driver %>

    +<%= f.text_field @trip.driver.name %>

    <%= f.label :passenger %> <%= f.text_field :passenger %>

    From 26226ca037a8f7e530e5aa23b671964ce456c2a5 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 14:43:10 -0700 Subject: [PATCH 41/79] cost rounded to 2 everywhere but edit form --- app/controllers/trips_controller.rb | 1 - app/views/drivers/show.html.erb | 2 +- app/views/passengers/show.html.erb | 2 +- app/views/trips/edit.html.erb | 7 ++----- app/views/trips/show.html.erb | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 10c147fe0..560da2b0f 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -23,7 +23,6 @@ def create def edit @trip = Trip.find_by(id: params[:id]) - @trip.driver = Driver.find(params[:driver_id]).name end def update diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index abd860462..478f6fdac 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -55,7 +55,7 @@ <%= trip.date %> <%= trip.rating %> - $<%= trip.cost.to_f/100 %> + <%= number_to_currency(trip.cost/100) %> <%end%> diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index de2cf7053..7b99304ab 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -56,7 +56,7 @@ <%= trip.date %> <%= trip.rating %> - $<%= trip.cost.to_f/100 %> + <%= number_to_currency(trip.cost/100) %> <%end%> diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb index 8188f1081..ec4cfb90a 100644 --- a/app/views/trips/edit.html.erb +++ b/app/views/trips/edit.html.erb @@ -1,4 +1,4 @@ -

    Edit Trip

    +

    Edit Trip for <%= @trip.passenger.name %>

    <% if @trip.errors.any? %>
      @@ -12,10 +12,7 @@ <%= form_for @trip do |f| %> <%= f.label :driver %> -<%= f.text_field @trip.driver.name %>

      - -<%= f.label :passenger %> -<%= f.text_field :passenger %>

      +<%= f.select :driver_id, Driver.all.map { |driver| [driver.name, driver.id]} %>

      <%= f.label :date %> <%= f.date_field :date %>

      diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 7befbf5bf..98e49db5f 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -42,7 +42,7 @@ <%= link_to @trip.passenger.name, passenger_path(@trip.passenger_id)%> - $<%= @trip.cost.to_f/100 %> + <%= number_to_currency(@trip.cost/100)%> <%= @trip.rating %> <%= link_to "Edit", edit_trip_path(@trip.id) %> From d79da83faa98b42b9d093c0e8fee74acba06ffe6 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 14:53:42 -0700 Subject: [PATCH 42/79] validates cost numericality --- app/controllers/trips_controller.rb | 2 +- app/models/trip.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 560da2b0f..6c4c48e05 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -27,7 +27,7 @@ def edit def update @trip = Trip.find_by(id: params[:id]) - if @Trip.update(trip_params) + if @trip.update(trip_params) redirect_to trips_path else render :edit diff --git a/app/models/trip.rb b/app/models/trip.rb index 8e2566cd8..12bd6fe6c 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -1,4 +1,6 @@ class Trip < ApplicationRecord belongs_to :driver belongs_to :passenger + + validates :cost, presence: true, numericality: true end From 7a7f99b73503f86025bed670481144869a90acf4 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 15:20:53 -0700 Subject: [PATCH 43/79] rating method for driver done + linked on driver show --- app/models/driver.rb | 11 +++++++++++ app/views/drivers/show.html.erb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index c61eaee0c..0851c334f 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -3,4 +3,15 @@ class Driver < ApplicationRecord validates :name, presence: true, uniqueness: true validates :vin, presence: true, uniqueness: true + + def avg_rating + total_rating = 0 + self.trips.all.each do |trip| + total_rating += trip.rating + end + average_rating = total_rating/self.trips.length.to_f + return average_rating.round(1) + end + + end diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 478f6fdac..83ccca954 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -12,7 +12,7 @@

      <%= @driver.name %>

      - Rating: + Rating: <%= @driver.avg_rating %>

      <%= link_to "Edit", edit_driver_path %> From ccc7a52e576b0780565edd43a9bc3c76e6263850 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 15:37:22 -0700 Subject: [PATCH 44/79] driver method to calculate total earnings --- app/models/driver.rb | 8 ++++++++ app/models/passenger.rb | 1 + app/models/trip.rb | 2 +- app/views/drivers/show.html.erb | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index 0851c334f..95c3ea3d9 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -13,5 +13,13 @@ def avg_rating return average_rating.round(1) end + def total_earnings + total = 0 + self.trips.each do |trip| + trip.cost -= 1.65 + total += trip.cost + end + return total * .8 + end end diff --git a/app/models/passenger.rb b/app/models/passenger.rb index 5e2ad11bb..fc41decde 100644 --- a/app/models/passenger.rb +++ b/app/models/passenger.rb @@ -3,4 +3,5 @@ class Passenger < ApplicationRecord validates :name, presence: true, uniqueness: true validates :phone_num, presence: true + end diff --git a/app/models/trip.rb b/app/models/trip.rb index 12bd6fe6c..b2cd53555 100644 --- a/app/models/trip.rb +++ b/app/models/trip.rb @@ -2,5 +2,5 @@ class Trip < ApplicationRecord belongs_to :driver belongs_to :passenger - validates :cost, presence: true, numericality: true + validates :cost, presence: true, numericality: {only_integer: true, greater_than: 0 } end diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 83ccca954..4f7b40a9e 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -14,6 +14,9 @@

      Rating: <%= @driver.avg_rating %>

      +

      + Total Earnings: <%= @driver.total_earnings %> +

      <%= link_to "Edit", edit_driver_path %> <%= link_to "Delete", driver_path(@driver.id), method: :delete, data: { confirm: 'Are you sure you want to delete this driver?' } %> From ccc2e757b6f780f24fdf4605a4db005aecc4b7f4 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 15:38:18 -0700 Subject: [PATCH 45/79] passenger paid method --- app/models/passenger.rb | 9 +++++++++ app/views/passengers/show.html.erb | 3 +++ 2 files changed, 12 insertions(+) diff --git a/app/models/passenger.rb b/app/models/passenger.rb index 5e2ad11bb..2b0e9f9d6 100644 --- a/app/models/passenger.rb +++ b/app/models/passenger.rb @@ -3,4 +3,13 @@ class Passenger < ApplicationRecord validates :name, presence: true, uniqueness: true validates :phone_num, presence: true + + def total_paid + total = 0 + self.trips.each do |trip| + total += trip.cost + end + + return total.to_f/100.round(2) + end end diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 7b99304ab..98afa08dc 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -15,6 +15,9 @@

      Phone Number: <%= @passenger.phone_num %>

      +

      + Total Paid: $<%= @passenger.total_paid %> +

      <%= link_to "Edit", edit_passenger_path(@passenger.id)%> <%= link_to "Delete", passenger_path(@passenger.id), method: :delete, data: { confirm: 'Are you sure you want to delete this passenger?' } %> From d00825cf9c3ea6513c293326ca631a4ffc3b05d8 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 15:42:31 -0700 Subject: [PATCH 46/79] formatting edits to driver --- app/models/driver.rb | 7 ++++--- app/views/drivers/show.html.erb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index 95c3ea3d9..9618215d9 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -14,12 +14,13 @@ def avg_rating end def total_earnings - total = 0 + subtotal = 0 self.trips.each do |trip| trip.cost -= 1.65 - total += trip.cost + subtotal += trip.cost end - return total * .8 + total = (subtotal * 0.8)/100 + return total.round(2) end end diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 4f7b40a9e..592f4466e 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -15,7 +15,7 @@ Rating: <%= @driver.avg_rating %>

      - Total Earnings: <%= @driver.total_earnings %> + Total Earnings: $<%= @driver.total_earnings %>

      <%= link_to "Edit", edit_driver_path %> From 416f32929254a484bce8ac1ed660fb01f7bfad7c Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 16:04:07 -0700 Subject: [PATCH 47/79] added to passenger nav --- app/views/passengers/show.html.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 98afa08dc..44c3a86d9 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -3,6 +3,12 @@

    • <%= link_to "Home", trips_path %>
    • +
    • + <%= link_to "All Drivers", drivers_path %> +
    • +
    • + <%= link_to "All Passengers", passengers_path %> +
    • <%= link_to "Add Passenger", new_passenger_path %>
    • From c36afbf6c41954c57c34320d6d242dc46314634c Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 16:14:32 -0700 Subject: [PATCH 48/79] new trip added to passenger in routes --- app/views/passengers/new.html.erb | 2 +- app/views/passengers/show.html.erb | 4 ++++ config/routes.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/passengers/new.html.erb b/app/views/passengers/new.html.erb index 1ac3c5780..8fe756259 100644 --- a/app/views/passengers/new.html.erb +++ b/app/views/passengers/new.html.erb @@ -9,4 +9,4 @@

      New Passenger

      -<%= render partial: "form", locals: {page_title: "Please enter new information for a new passenger!"} %> +<%= render partial: "form", locals: {page_title: "Please enter information for a new passenger!"} %> diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 44c3a86d9..7ca5123dd 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -30,7 +30,11 @@

      +
      +
      + <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> +

      + <% end %>
      diff --git a/config/routes.rb b/config/routes.rb index 3f9ab470a..c272c868d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,7 +8,7 @@ end resources :passengers do - resources :trips, only: [:show, :edit, :destroy] + resources :trips, only: [:show, :edit, :destroy, :new] end root 'trips#index' From 2c02ddf5f92e2e971b6f83ea7f92e02dce6cbf51 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 16:44:43 -0700 Subject: [PATCH 49/79] new trip for passenger fields --- app/models/driver.rb | 1 - app/views/trips/new.html.erb | 29 +++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index 9618215d9..4aa68ff64 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -22,5 +22,4 @@ def total_earnings total = (subtotal * 0.8)/100 return total.round(2) end - end diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb index 145f5c473..1a8d91d68 100644 --- a/app/views/trips/new.html.erb +++ b/app/views/trips/new.html.erb @@ -1,2 +1,27 @@ -

      Trips#new

      -

      Find me in app/views/trips/new.html.erb

      +

      New Trip for

      + +<% if @trip.errors.any? %> +
        + <% @trip.errors.each do |field, message| %> +
      • + <%= field.capitalize %> <%= message %> +
      • + <% end %> +
      +<% end %> + +<%= form_for @trip do |f| %> +<%= f.label :driver %> + + +<%= f.label :date %> +<%= f.date_field :date %>

      + +<%= f.label :rating %> +<%= f.select :rating, [[1], [2], [3], [4], [5]], {}, {class: "form-control"} %>

      + +<%= f.label :cost %> +<%= f.text_field :cost %>

      + +<%= f.submit %> +<% end %> From 83841237fec6d20b19a23600a147d900a51cdea3 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 16:54:09 -0700 Subject: [PATCH 50/79] new trip assigns random driver --- app/views/trips/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb index 1a8d91d68..62370c837 100644 --- a/app/views/trips/new.html.erb +++ b/app/views/trips/new.html.erb @@ -12,7 +12,7 @@ <%= form_for @trip do |f| %> <%= f.label :driver %> - +<%= f.text_field :driver, :value => Driver.all.sample.name %>

      <%= f.label :date %> <%= f.date_field :date %>

      From 73dd426052afe6a808ea7c345afea9fc7a2ac9e9 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 16:54:36 -0700 Subject: [PATCH 51/79] junk --- app/views/trips/new.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb index 1a8d91d68..12dac6d91 100644 --- a/app/views/trips/new.html.erb +++ b/app/views/trips/new.html.erb @@ -1,4 +1,4 @@ -

      New Trip for

      +

      New Trip for <%= @passenger.name %>

      <% if @trip.errors.any? %>
        @@ -12,7 +12,7 @@ <%= form_for @trip do |f| %> <%= f.label :driver %> - +<%= f. :driver, Driver.all.sample %>

        <%= f.label :date %> <%= f.date_field :date %>

        From 4ccb0092852e19d9eb21197d7a1bdef62391237e Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 17:41:46 -0700 Subject: [PATCH 52/79] date generated for new trip --- app/controllers/trips_controller.rb | 2 +- app/views/trips/new.html.erb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 6c4c48e05..99c929e7e 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -14,7 +14,7 @@ def new def create @trip = Trip.new(trip_params) - if @Trip.save + if @trip.save redirect_to trips_path else render :new diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb index 62370c837..9b1490383 100644 --- a/app/views/trips/new.html.erb +++ b/app/views/trips/new.html.erb @@ -1,4 +1,4 @@ -

        New Trip for

        +

        New Trip for <%= @trip.passenger_id %>

        <% if @trip.errors.any? %>
          @@ -11,16 +11,16 @@ <% end %> <%= form_for @trip do |f| %> -<%= f.label :driver %> -<%= f.text_field :driver, :value => Driver.all.sample.name %>

          +<%= f.label :driver %>: +<%= Driver.all.sample.name %>

          -<%= f.label :date %> -<%= f.date_field :date %>

          +<%= f.label :date %>: +<%= Date.today %>

          -<%= f.label :rating %> +<%= f.label :rating %>: <%= f.select :rating, [[1], [2], [3], [4], [5]], {}, {class: "form-control"} %>

          -<%= f.label :cost %> +<%= f.label :cost %>: <%= f.text_field :cost %>

          <%= f.submit %> From 385006eac1bf25fa296025ee4fadca77713982ba Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 18:37:31 -0700 Subject: [PATCH 53/79] new trip basics work --- app/controllers/trips_controller.rb | 16 ++++++++++++---- app/views/trips/new.html.erb | 28 ---------------------------- config/routes.rb | 4 +++- 3 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 app/views/trips/new.html.erb diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 6c4c48e05..08e62e67c 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -9,13 +9,21 @@ def show end def new - @trip = Trip.new + passenger = Passenger.find_by(id: params[:passenger_id]) + + driver = Driver.all.sample + cost = 500 + date = Date.today + rating = nil + + @trip = Trip.new(passenger: passenger, driver: driver, date: date, cost: cost, rating: rating) + + self.create end def create - @trip = Trip.new(trip_params) - if @Trip.save - redirect_to trips_path + if @trip.save + redirect_to passenger_path(@trip[:passenger_id]) else render :new end diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb deleted file mode 100644 index 45e8e15cb..000000000 --- a/app/views/trips/new.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -

          New Trip for <%= @passenger.name %>

          - -<% if @trip.errors.any? %> -
            - <% @trip.errors.each do |field, message| %> -
          • - <%= field.capitalize %> <%= message %> -
          • - <% end %> -
          -<% end %> - -<%= form_for @trip do |f| %> -<%= f.label :driver %> -<%= f.text_field :driver, :value => Driver.all.sample.name %>

          - - -<%= f.label :date %> -<%= f.date_field :date %>

          - -<%= f.label :rating %> -<%= f.select :rating, [[1], [2], [3], [4], [5]], {}, {class: "form-control"} %>

          - -<%= f.label :cost %> -<%= f.text_field :cost %>

          - -<%= f.submit %> -<% end %> diff --git a/config/routes.rb b/config/routes.rb index c272c868d..5254ec49d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html - resources :trips + resources :drivers do resources :trips, only: [:show, :edit, :destroy] @@ -11,6 +11,8 @@ resources :trips, only: [:show, :edit, :destroy, :new] end + resources :trips + root 'trips#index' end From 1c40cc7040a207818283d6c8d052432f2cbef36b Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Thu, 5 Apr 2018 18:47:53 -0700 Subject: [PATCH 54/79] trip form hidden_field, trip controller redirect --- app/controllers/trips_controller.rb | 2 +- app/views/trips/new.html.erb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 99c929e7e..b29251e6d 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -15,7 +15,7 @@ def new def create @trip = Trip.new(trip_params) if @trip.save - redirect_to trips_path + redirect_to passenger_trips_path else render :new end diff --git a/app/views/trips/new.html.erb b/app/views/trips/new.html.erb index 9b1490383..72eaaaaee 100644 --- a/app/views/trips/new.html.erb +++ b/app/views/trips/new.html.erb @@ -13,6 +13,7 @@ <%= form_for @trip do |f| %> <%= f.label :driver %>: <%= Driver.all.sample.name %>

          +<%= f.hidden_field :driver %> <%= f.label :date %>: <%= Date.today %>

          From 889479a6e9a9d33519d3594c6d52614b156af4fb Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Thu, 5 Apr 2018 19:04:10 -0700 Subject: [PATCH 55/79] Driver total earnings method accounts for nil now --- app/models/driver.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index 4aa68ff64..9b2e4a918 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -6,15 +6,22 @@ class Driver < ApplicationRecord def avg_rating total_rating = 0 + trip_count = 0 + self.trips.all.each do |trip| - total_rating += trip.rating + if trip.rating + total_rating += trip.rating + trip_count += 1 + end end - average_rating = total_rating/self.trips.length.to_f + + average_rating = total_rating/trip_count return average_rating.round(1) end def total_earnings subtotal = 0 + self.trips.each do |trip| trip.cost -= 1.65 subtotal += trip.cost From 2f103502f42163fb94c00b7849391e769029b43f Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 09:21:04 -0700 Subject: [PATCH 56/79] deals with dividing by zero error, bolds mini-headers for driver and passenger --- app/models/driver.rb | 4 ++-- app/views/drivers/show.html.erb | 8 ++++---- app/views/passengers/show.html.erb | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index 9b2e4a918..7acd04de9 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -6,7 +6,7 @@ class Driver < ApplicationRecord def avg_rating total_rating = 0 - trip_count = 0 + trip_count = 1 self.trips.all.each do |trip| if trip.rating @@ -16,7 +16,7 @@ def avg_rating end average_rating = total_rating/trip_count - return average_rating.round(1) + return average_rating > 0 ? average_rating.round(1) : 0 end def total_earnings diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 592f4466e..5b05df976 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -12,14 +12,14 @@

          <%= @driver.name %>

          - Rating: <%= @driver.avg_rating %> + Average Rating: <%= @driver.avg_rating %>

          - Total Earnings: $<%= @driver.total_earnings %> + Total Earnings: $<%= @driver.total_earnings %>

          - <%= link_to "Edit", edit_driver_path %> - <%= link_to "Delete", driver_path(@driver.id), method: :delete, data: { confirm: 'Are you sure you want to delete this driver?' } %> + <%= link_to "Edit", edit_driver_path %> + <%= link_to "Delete", driver_path(@driver.id), method: :delete, data: { confirm: 'Are you sure you want to delete this driver?' } %>

          diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 7ca5123dd..d024022bc 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -19,21 +19,21 @@

          <%=@passenger.name%>

          - Phone Number: <%= @passenger.phone_num %> + Phone Number: <%= @passenger.phone_num %>

          - Total Paid: $<%= @passenger.total_paid %> + Total Paid: $<%= @passenger.total_paid %>

          - <%= link_to "Edit", edit_passenger_path(@passenger.id)%> - <%= link_to "Delete", passenger_path(@passenger.id), method: :delete, data: { confirm: 'Are you sure you want to delete this passenger?' } %> + <%= link_to "Edit", edit_passenger_path(@passenger.id)%> + <%= link_to "Delete", passenger_path(@passenger.id), method: :delete, data: { confirm: 'Are you sure you want to delete this passenger?' } %>

          - <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> + <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %>

          From fde29685fb67ee3cc4fbbd9b9c47f6a90e9cd605 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 11:39:37 -0700 Subject: [PATCH 57/79] adjusted average rating; driver show route for trip --- app/models/driver.rb | 23 ++++++++++++++--------- app/views/drivers/show.html.erb | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/models/driver.rb b/app/models/driver.rb index 7acd04de9..648acbbb3 100644 --- a/app/models/driver.rb +++ b/app/models/driver.rb @@ -5,18 +5,23 @@ class Driver < ApplicationRecord validates :vin, presence: true, uniqueness: true def avg_rating - total_rating = 0 - trip_count = 1 + if self.trips.count == 0 + return "No trips yet" + else + total_rating = 0 + trip_count = 0 - self.trips.all.each do |trip| - if trip.rating - total_rating += trip.rating - trip_count += 1 + self.trips.all.each do |trip| + if trip.rating + total_rating += trip.rating + trip_count += 1 + end end - end - average_rating = total_rating/trip_count - return average_rating > 0 ? average_rating.round(1) : 0 + average_rating = total_rating.to_f/trip_count + + return average_rating.round(1) + end end def total_earnings diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 5b05df976..8a7e07abf 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -47,7 +47,7 @@ <% @driver.trips.all.each do |trip| %> - + @@ -43,7 +43,8 @@ - + - + <%end%>
          <%= link_to trip.id, driver_trip_path(trip.id) %><%= link_to trip.id, trip_path(trip.id) %> <%= @driver.name %> <%if trip.passenger_id %> From 48d90346e1ee6b3d0166dcaf36356506cc152a72 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 13:30:36 -0700 Subject: [PATCH 58/79] can't request trip while in progress --- app/views/passengers/show.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index d024022bc..f4d4d99dd 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -33,7 +33,9 @@
          - <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> + <% if @passenger.trips.last.rating != nil %> + <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> + <%end%>

          From e769e8a960aaf7dc0f9b447dffbeb953f1801f29 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 13:53:07 -0700 Subject: [PATCH 59/79] trip rating by driver linked --- app/controllers/trips_controller.rb | 2 +- app/views/passengers/show.html.erb | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 08e62e67c..5ceb60673 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -36,7 +36,7 @@ def edit def update @trip = Trip.find_by(id: params[:id]) if @trip.update(trip_params) - redirect_to trips_path + redirect_to passenger_trip_path(@trip.passenger) else render :edit end diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index f4d4d99dd..906b03df8 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -70,9 +70,15 @@ <%end%> - + - <%end%> + <% end %>
          <%= trip.date %><%= trip.rating %> + <% if trip.rating != nil %> + <%= trip.rating %> + <% else %> + <%= link_to "Edit", edit_trip_path(trip.id) %> + <% end %> + <%= number_to_currency(trip.cost/100) %>
          From 87fd182395fe42328887e8fea08a3bf7f4daf42f Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 14:01:08 -0700 Subject: [PATCH 60/79] random cost and fixed zero trips bug --- app/controllers/trips_controller.rb | 2 +- app/views/passengers/show.html.erb | 2 +- app/views/trips/show.html.erb | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 5ceb60673..9eec2d53c 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -12,7 +12,7 @@ def new passenger = Passenger.find_by(id: params[:passenger_id]) driver = Driver.all.sample - cost = 500 + cost = rand(500...20000) date = Date.today rating = nil diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 906b03df8..9346972d4 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -33,7 +33,7 @@
          - <% if @passenger.trips.last.rating != nil %> + <% if @passenger.trips.count < 1 || @passenger.trips.last.rating != nil %> <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> <%end%>

          diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 98e49db5f..71bcec259 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -31,7 +31,7 @@ Rating
          - LINKS + Actions
          <%= link_to @trip.passenger.name, passenger_path(@trip.passenger_id)%> <%= number_to_currency(@trip.cost/100)%><%= @trip.rating %> + <%= @trip.rating %> <%= link_to "Edit", edit_trip_path(@trip.id) %> | From 6c2dd36ce98514915ac7c6237c9ecdaabb350706 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 14:01:32 -0700 Subject: [PATCH 61/79] stashing commits --- app/views/passengers/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 906b03df8..9346972d4 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -33,7 +33,7 @@
          - <% if @passenger.trips.last.rating != nil %> + <% if @passenger.trips.count < 1 || @passenger.trips.last.rating != nil %> <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> <%end%>

          From 3c87ecda7005c24913dc1659d452292ef3b84980 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 14:03:49 -0700 Subject: [PATCH 62/79] removed space --- app/controllers/trips_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 9eec2d53c..fa8df1b0e 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -44,7 +44,6 @@ def update def destroy @trip = Trip.find_by(id: params[:id]) - if @trip.destroy redirect_to trips_path end From 983c82295b622b36e886bc830e341593d0bb3401 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 14:15:33 -0700 Subject: [PATCH 63/79] cost formatting --- app/views/drivers/show.html.erb | 2 +- app/views/passengers/show.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 8a7e07abf..6188f63de 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -58,7 +58,7 @@
          <%= trip.date %> <%= trip.rating %><%= number_to_currency(trip.cost/100) %>$<%= trip.cost.to_f/100.round(2) %>
          diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 9346972d4..78c2aebf1 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -77,7 +77,7 @@ <%= link_to "Edit", edit_trip_path(trip.id) %> <% end %> -
      <%= number_to_currency(trip.cost/100) %>$<%= trip.cost.to_f/100.round(2) %>
      From 6d8badf5e588782dc66234afb897f3eeea3385ac Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 14:23:49 -0700 Subject: [PATCH 64/79] duplicate changes --- app/controllers/trips_controller.rb | 2 +- app/views/passengers/show.html.erb | 2 +- app/views/trips/edit.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index fa8df1b0e..1c2f0a75b 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -12,7 +12,7 @@ def new passenger = Passenger.find_by(id: params[:passenger_id]) driver = Driver.all.sample - cost = rand(500...20000) + cost = rand(500...2000) date = Date.today rating = nil diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 9346972d4..74ba27c2e 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -77,7 +77,7 @@ <%= link_to "Edit", edit_trip_path(trip.id) %> <% end %> - <%= number_to_currency(trip.cost/100) %> + $<%= trip.cost.to_f/100 %> <% end %> diff --git a/app/views/trips/edit.html.erb b/app/views/trips/edit.html.erb index ec4cfb90a..beb6aa8bf 100644 --- a/app/views/trips/edit.html.erb +++ b/app/views/trips/edit.html.erb @@ -21,7 +21,7 @@ <%= f.select :rating, [[1], [2], [3], [4], [5]], {}, {class: "form-control"} %>

      <%= f.label :cost %> -<%= f.text_field :cost %>

      +$<%= @trip.cost.to_f/100 %>

      <%= f.submit %> <% end %> From c436ed4ecb5ec1b45365b052dce2d5394911c49f Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 14:28:11 -0700 Subject: [PATCH 65/79] rate trip to finish --- app/views/passengers/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 78c2aebf1..7ad3e3c73 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -74,7 +74,7 @@ <% if trip.rating != nil %> <%= trip.rating %> <% else %> - <%= link_to "Edit", edit_trip_path(trip.id) %> + <%= link_to "Rate Trip to Finish", edit_trip_path(trip.id) %> <% end %> $<%= trip.cost.to_f/100.round(2) %> From 2e2472968805764a4cf38aa89942ad3ff33b6b06 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 14:29:44 -0700 Subject: [PATCH 66/79] RATE TRIP --- app/views/passengers/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 7ad3e3c73..c14fe5648 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -74,7 +74,7 @@ <% if trip.rating != nil %> <%= trip.rating %> <% else %> - <%= link_to "Rate Trip to Finish", edit_trip_path(trip.id) %> + <%= link_to "RATE TRIP", edit_trip_path(trip.id) %> <% end %> $<%= trip.cost.to_f/100.round(2) %> From 1454d30faaa968ec955d3512253e5388e498d3b7 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 14:32:43 -0700 Subject: [PATCH 67/79] cost formatting for trip#show --- app/views/trips/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 71bcec259..9dc527a57 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -42,7 +42,7 @@ <%= link_to @trip.passenger.name, passenger_path(@trip.passenger_id)%> - <%= number_to_currency(@trip.cost/100)%> + $<%= @trip.cost.to_f/100%> <%= @trip.rating %> From aea75d94a9f68d4c02929609389ebd7d73b736b5 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 14:59:55 -0700 Subject: [PATCH 68/79] stylistic changes to nav and font, deleted unused html sheets --- app/assets/stylesheets/application.css | 17 +++++++++++++-- app/views/drivers/create.html.erb | 2 -- app/views/drivers/destory.html.erb | 2 -- app/views/layouts/application.html.erb | 1 + app/views/passengers/create.html.erb | 2 -- app/views/passengers/destory.html.erb | 2 -- app/views/trips/create.html.erb | 2 -- app/views/trips/destory.html.erb | 2 -- app/views/trips/show.html.erb | 30 +++++++++++++------------- config/routes.rb | 3 +-- 10 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 app/views/drivers/create.html.erb delete mode 100644 app/views/drivers/destory.html.erb delete mode 100644 app/views/passengers/create.html.erb delete mode 100644 app/views/passengers/destory.html.erb delete mode 100644 app/views/trips/create.html.erb delete mode 100644 app/views/trips/destory.html.erb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 0cf117e86..5d05c0f02 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,12 +14,25 @@ *= require_self */ -* { +/* * { border: black solid 1px; - } + } */ body { background-color: lightblue; + font-family: 'Song Myung', serif; + } + + nav ul { + display: flex; + flex-direction: row; + justify-content: flex-start; + list-style: none; + padding-left: 5px; + } + + nav ul a { + margin-right: 10px; } .home { diff --git a/app/views/drivers/create.html.erb b/app/views/drivers/create.html.erb deleted file mode 100644 index db4dbea32..000000000 --- a/app/views/drivers/create.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

      Driver#create

      -

      Find me in app/views/drivers/create.html.erb

      diff --git a/app/views/drivers/destory.html.erb b/app/views/drivers/destory.html.erb deleted file mode 100644 index aa135de6f..000000000 --- a/app/views/drivers/destory.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

      Driver#destory

      -

      Find me in app/views/driver/destory.html.erb

      diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 353326840..6ba1ca3fb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,6 +1,7 @@ + RideshareRails <%= csrf_meta_tags %> diff --git a/app/views/passengers/create.html.erb b/app/views/passengers/create.html.erb deleted file mode 100644 index c57e678b6..000000000 --- a/app/views/passengers/create.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

      Passengers#create

      -

      Find me in app/views/passengers/create.html.erb

      diff --git a/app/views/passengers/destory.html.erb b/app/views/passengers/destory.html.erb deleted file mode 100644 index 75657c658..000000000 --- a/app/views/passengers/destory.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

      Passengers#destory

      -

      Find me in app/views/passengers/destory.html.erb

      diff --git a/app/views/trips/create.html.erb b/app/views/trips/create.html.erb deleted file mode 100644 index d591532b2..000000000 --- a/app/views/trips/create.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

      Trips#create

      -

      Find me in app/views/trips/create.html.erb

      diff --git a/app/views/trips/destory.html.erb b/app/views/trips/destory.html.erb deleted file mode 100644 index 67fa83b4c..000000000 --- a/app/views/trips/destory.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

      Trips#destory

      -

      Find me in app/views/trips/destory.html.erb

      diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 9dc527a57..7f6f21296 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -34,22 +34,22 @@ Actions - - <%= @trip.id %> - <%= @trip.date %> + + <%= @trip.id %> + <%= @trip.date %> - <%= link_to @trip.driver.name, driver_path(@trip.driver_id)%> + <%= link_to @trip.driver.name, driver_path(@trip.driver_id)%> - <%= link_to @trip.passenger.name, passenger_path(@trip.passenger_id)%> + <%= link_to @trip.passenger.name, passenger_path(@trip.passenger_id)%> - $<%= @trip.cost.to_f/100%> - - <%= @trip.rating %> - - <%= link_to "Edit", edit_trip_path(@trip.id) %> - | - <%= link_to "Delete", trip_path(@trip.id), method: :delete, data: { confirm: 'Are you sure you want to delete this trip?' } %> - - + $<%= @trip.cost.to_f/100%> + + <%= @trip.rating %> + + <%= link_to "Edit", edit_trip_path(@trip.id) %> + | + <%= link_to "Delete", trip_path(@trip.id), method: :delete, data: { confirm: 'Are you sure you want to delete this trip?' } %> + + -
      + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 5254ec49d..68e6c4e67 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,6 @@ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html - resources :drivers do resources :trips, only: [:show, :edit, :destroy] end @@ -12,7 +11,7 @@ end resources :trips - + root 'trips#index' end From 66dbba358ed34ec8b87faa768910a974233d8551 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 15:00:27 -0700 Subject: [PATCH 69/79] home edits --- app/assets/stylesheets/application.css | 11 +++++++++-- app/views/trips/index.html.erb | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 0cf117e86..9b2d1eee9 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,9 +14,9 @@ *= require_self */ -* { +/* * { border: black solid 1px; - } + } */ body { background-color: lightblue; @@ -31,8 +31,15 @@ .grouping { margin: 2em; + background-color: #F9D9D9; + border: double lightblue 1em; + border-radius: 50px; + width: 15em; + text-align: center; + text-decoration: none; } + article { margin: 4em; } diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb index 67ece40b2..11fd2b4ac 100644 --- a/app/views/trips/index.html.erb +++ b/app/views/trips/index.html.erb @@ -4,7 +4,7 @@
      <%= link_to "All Drivers", drivers_path %>
      -
      +
      <%= link_to "Add Driver", new_driver_path %>
      @@ -12,7 +12,7 @@
      <%= link_to "All Passengers", passengers_path %>
      -
      +
      <%= link_to "Add Passenger", new_passenger_path %>
      From 9d0998e460a1afd385ba7d54b0d78f9f306e57f0 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 15:12:07 -0700 Subject: [PATCH 70/79] style changes --- app/assets/stylesheets/application.css | 5 +++-- app/views/layouts/application.html.erb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 851298fac..2db3f4d3d 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -19,8 +19,9 @@ } */ body { - background-color: lightblue; - font-family: 'Song Myung', serif; + background-color: #A9BBCE; + font-family: 'VT323', monospace; + font-size: 1.5em; } nav ul { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6ba1ca3fb..af86dffcd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - + RideshareRails <%= csrf_meta_tags %> From 4307bd67dfb0fa2d941da6d7ddd6866e31c2f8fe Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 15:12:32 -0700 Subject: [PATCH 71/79] table formatting --- app/assets/stylesheets/application.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 851298fac..15b371f08 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -56,3 +56,13 @@ article { margin: 4em; } + +table, th, td { + text-align: center; + padding-bottom: .75em; +} + +th, td { + + padding-right: 1em; +} From c4e1d1a410873876438bb64d70e30a27cb1eae61 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 15:21:35 -0700 Subject: [PATCH 72/79] border color --- app/assets/stylesheets/application.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5eee41f9a..4d143ecee 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -46,7 +46,7 @@ .grouping { margin: 2em; background-color: #F9D9D9; - border: double lightblue 1em; + border: double #A9BBCE 1em; border-radius: 50px; width: 15em; text-align: center; From 1b5a5c8bc1c66feeb6675e34ff74c70f2c65cf7f Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 15:22:19 -0700 Subject: [PATCH 73/79] style changes --- app/assets/stylesheets/application.css | 2 +- app/controllers/trips_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5eee41f9a..dcb03cff9 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -33,7 +33,7 @@ } nav ul a { - margin-right: 10px; + margin-right: 20px; } .home { diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 1c2f0a75b..7a4e4eb71 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -36,7 +36,7 @@ def edit def update @trip = Trip.find_by(id: params[:id]) if @trip.update(trip_params) - redirect_to passenger_trip_path(@trip.passenger) + redirect_to passenger_path(@trip.passenger) else render :edit end From a481d69f01f7887af561c016e5f904ecfdda986c Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 15:32:21 -0700 Subject: [PATCH 74/79] styling --- app/assets/stylesheets/application.css | 6 ++++++ app/views/trips/index.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 100285615..73ac8b634 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -24,6 +24,12 @@ font-size: 1.5em; } + .home_title { + display: flex; + flex-direction: row; + justify-content: space-around; + } + nav ul { display: flex; flex-direction: row; diff --git a/app/views/trips/index.html.erb b/app/views/trips/index.html.erb index 11fd2b4ac..27ef9dbd8 100644 --- a/app/views/trips/index.html.erb +++ b/app/views/trips/index.html.erb @@ -1,4 +1,4 @@ -

      Welcome to RideShare

      +

      Welcome to RideShare

      From b00457abde3081533634e2a24e179f8496f0d566 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 15:36:23 -0700 Subject: [PATCH 75/79] emoji magic --- app/views/drivers/index.html.erb | 2 +- app/views/drivers/show.html.erb | 2 +- app/views/passengers/index.html.erb | 2 +- app/views/passengers/show.html.erb | 2 +- app/views/trips/show.html.erb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/drivers/index.html.erb b/app/views/drivers/index.html.erb index 49bfaa7f1..dfab26865 100644 --- a/app/views/drivers/index.html.erb +++ b/app/views/drivers/index.html.erb @@ -9,7 +9,7 @@
    -

    All Drivers

    +

    🚕 All Drivers 🚕

      diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index 6188f63de..f2d586088 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -21,7 +21,7 @@ <%= link_to "Edit", edit_driver_path %> <%= link_to "Delete", driver_path(@driver.id), method: :delete, data: { confirm: 'Are you sure you want to delete this driver?' } %>

      - +

      diff --git a/app/views/passengers/index.html.erb b/app/views/passengers/index.html.erb index ab94a9ca2..b21ca68d8 100644 --- a/app/views/passengers/index.html.erb +++ b/app/views/passengers/index.html.erb @@ -10,7 +10,7 @@
      -

      All Passengers

      +

      🙋‍ All Passengers 🙋

      diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index c14fe5648..2b4dfb0df 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -36,7 +36,7 @@ <% if @passenger.trips.count < 1 || @passenger.trips.last.rating != nil %> <%= link_to "New Trip", new_passenger_trip_path(@passenger.id) %> <%end%> -
      +


      diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 7f6f21296..953e0911e 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -52,4 +52,4 @@
      -
      \ No newline at end of file +
    From f060c8a5e93a5c09a4a2f2d1786850e21430d783 Mon Sep 17 00:00:00 2001 From: Alexandria Brown Date: Fri, 6 Apr 2018 15:51:45 -0700 Subject: [PATCH 76/79] cleaned nested routes --- config/routes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 68e6c4e67..e08a9d9a3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,15 +3,15 @@ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :drivers do - resources :trips, only: [:show, :edit, :destroy] + resources :trips, only: [:show, :destroy] end resources :passengers do - resources :trips, only: [:show, :edit, :destroy, :new] + resources :trips, only: [:show, :destroy, :new] end resources :trips - + root 'trips#index' end From 0144b8b377e503271b5b727e53beb29184a045d1 Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 15:51:45 -0700 Subject: [PATCH 77/79] more emoji magic --- app/views/drivers/_form.html.erb | 2 +- app/views/drivers/index.html.erb | 9 +++++++++ app/views/drivers/new.html.erb | 8 ++++++++ app/views/drivers/show.html.erb | 9 +++++++++ app/views/passengers/_form.html.erb | 2 +- app/views/passengers/index.html.erb | 9 +++++++++ app/views/passengers/new.html.erb | 5 +---- app/views/passengers/show.html.erb | 3 +++ app/views/trips/show.html.erb | 13 ++++++++++++- 9 files changed, 53 insertions(+), 7 deletions(-) diff --git a/app/views/drivers/_form.html.erb b/app/views/drivers/_form.html.erb index 687ef39ec..b9c4fb379 100644 --- a/app/views/drivers/_form.html.erb +++ b/app/views/drivers/_form.html.erb @@ -1,4 +1,4 @@ -

    <%= page_title %>

    +

    🚕 <%= page_title %> 🚕

    <% if @driver.errors.any? %>
      diff --git a/app/views/drivers/index.html.erb b/app/views/drivers/index.html.erb index dfab26865..ba903df0f 100644 --- a/app/views/drivers/index.html.erb +++ b/app/views/drivers/index.html.erb @@ -3,9 +3,18 @@
    • <%= link_to "Home", trips_path %>
    • +
    • + <%= link_to "All Drivers", drivers_path %> +
    • <%= link_to "Add Driver", new_driver_path %>
    • +
    • + <%= link_to "All Passengers", passengers_path %> +
    • +
    • + <%= link_to "Add Passenger", new_passenger_path %> +
    diff --git a/app/views/drivers/new.html.erb b/app/views/drivers/new.html.erb index 2c8e4215d..13dfbcc22 100644 --- a/app/views/drivers/new.html.erb +++ b/app/views/drivers/new.html.erb @@ -1 +1,9 @@ + + <%=render partial: "form", locals: { page_title: "Add Driver"} %> diff --git a/app/views/drivers/show.html.erb b/app/views/drivers/show.html.erb index f2d586088..f7b799d9c 100644 --- a/app/views/drivers/show.html.erb +++ b/app/views/drivers/show.html.erb @@ -3,9 +3,18 @@
  • <%= link_to "Home", trips_path %>
  • +
  • + <%= link_to "All Drivers", drivers_path %> +
  • <%= link_to "Add Driver", new_driver_path %>
  • +
  • + <%= link_to "All Passengers", passengers_path %> +
  • +
  • + <%= link_to "Add Passenger", new_passenger_path %> +
  • diff --git a/app/views/passengers/_form.html.erb b/app/views/passengers/_form.html.erb index c82ef8d35..f61e5625b 100644 --- a/app/views/passengers/_form.html.erb +++ b/app/views/passengers/_form.html.erb @@ -1,4 +1,4 @@ -

    <%= page_title %>

    +

    🙋 <%= page_title %> 🙋

    <% if @passenger.errors.any? %>
      diff --git a/app/views/passengers/index.html.erb b/app/views/passengers/index.html.erb index b21ca68d8..15b8b6bf9 100644 --- a/app/views/passengers/index.html.erb +++ b/app/views/passengers/index.html.erb @@ -3,6 +3,15 @@
    • <%= link_to "Home", trips_path %>
    • +
    • + <%= link_to "All Drivers", drivers_path %> +
    • +
    • + <%= link_to "Add Driver", new_driver_path %> +
    • +
    • + <%= link_to "All Passengers", passengers_path %> +
    • <%= link_to "Add Passenger", new_passenger_path %>
    • diff --git a/app/views/passengers/new.html.erb b/app/views/passengers/new.html.erb index 8fe756259..82d163d28 100644 --- a/app/views/passengers/new.html.erb +++ b/app/views/passengers/new.html.erb @@ -6,7 +6,4 @@
    -
    -

    New Passenger

    -
    -<%= render partial: "form", locals: {page_title: "Please enter information for a new passenger!"} %> +<%= render partial: "form", locals: {page_title: "New Passenger"} %> diff --git a/app/views/passengers/show.html.erb b/app/views/passengers/show.html.erb index 2b4dfb0df..429cdafca 100644 --- a/app/views/passengers/show.html.erb +++ b/app/views/passengers/show.html.erb @@ -6,6 +6,9 @@
  • <%= link_to "All Drivers", drivers_path %>
  • +
  • + <%= link_to "Add Driver", new_driver_path %> +
  • <%= link_to "All Passengers", passengers_path %>
  • diff --git a/app/views/trips/show.html.erb b/app/views/trips/show.html.erb index 953e0911e..53ffae032 100644 --- a/app/views/trips/show.html.erb +++ b/app/views/trips/show.html.erb @@ -3,6 +3,18 @@
  • <%= link_to "Home", trips_path %>
  • +
  • + <%= link_to "All Drivers", drivers_path %> +
  • +
  • + <%= link_to "Add Driver", new_driver_path %> +
  • +
  • + <%= link_to "All Passengers", passengers_path %> +
  • +
  • + <%= link_to "Add Passenger", new_passenger_path %> +
  • @@ -47,7 +59,6 @@ <%= @trip.rating %> <%= link_to "Edit", edit_trip_path(@trip.id) %> - | <%= link_to "Delete", trip_path(@trip.id), method: :delete, data: { confirm: 'Are you sure you want to delete this trip?' } %> From 959538b4eeb09a40726f84e83b9b1476a1bd47af Mon Sep 17 00:00:00 2001 From: Lily Sky Date: Fri, 6 Apr 2018 15:54:47 -0700 Subject: [PATCH 78/79] new passengers and drivers consistent --- app/views/drivers/_form.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/drivers/_form.html.erb b/app/views/drivers/_form.html.erb index b9c4fb379..e85a6b98a 100644 --- a/app/views/drivers/_form.html.erb +++ b/app/views/drivers/_form.html.erb @@ -12,10 +12,10 @@ <%= form_for @driver do |f| %> <%= f.label :name %> - <%= f.text_field :name %> + <%= f.text_field :name %>

    <%= f.label :vin %> - <%= f.text_field :vin %> + <%= f.text_field :vin %>

    <%= f.submit %> <% end %> From ed7cbc1c0ee2f183b41d81ce942aea1c06e2a4f0 Mon Sep 17 00:00:00 2001 From: Alexandria Brown <30912601+brownav@users.noreply.github.com> Date: Mon, 14 Jan 2019 12:12:15 -0800 Subject: [PATCH 79/79] Set theme jekyll-theme-cayman --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 000000000..c4192631f --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file