From ee759fed73ec75086951d229b51fa237a56c455a Mon Sep 17 00:00:00 2001 From: t-tullis Date: Fri, 2 Mar 2018 11:07:13 -0800 Subject: [PATCH 1/4] nothing --- app/assets/stylesheets/users.scss | 2 ++ app/controllers/users_controller.rb | 15 ++++++---- app/views/users/new.html.erb | 43 +++++++++++++++++++++++------ 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss index 1efc835..62efcfc 100755 --- a/app/assets/stylesheets/users.scss +++ b/app/assets/stylesheets/users.scss @@ -1,3 +1,5 @@ // Place all the styles related to the users 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/users_controller.rb b/app/controllers/users_controller.rb index ffeb72d..a95c6bc 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -21,20 +21,25 @@ def show end -<<<<<<< HEAD + def create - @user = User.create(user_params) - redirect_to login_path + @user=User.find_by(email:user_params[:email]) + if(@user && @user.authenticate(user_params[:password])) + login(@user) + redirect_to user_path + else + flash[:error]="Please sign up" + redirect_to sign_up_path + end end -======= ->>>>>>> map2 def edit end def destroy end + def map @user = User.all puts 'this call has been made by AJAX' diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index d447a6a..b68ef63 100755 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,37 +1,62 @@ -

Users#new

+

Sign Up

-<%= form_for :user do |f| %> +<%= form_for :user do |l| %> +
+
+ <%= l.label :email %> +
+ <%= l.text_field :email, placeholder: "Email" %> +
+
+ <%= l.label :password %> +
+ <%= l.password_field :password, placeholder: "Password" %> + +
+ + <%= l.submit "Login" %> +
+ + <% end %> + +
+ +
+
+
+ +<%= form_for :user do |f| %> +
+
<%= f.label :first_name %>
<%= f.text_field :first_name, placeholder: "First Name" %>
-
+
<%= f.label :last_name %>
<%= f.text_field :last_name, placeholder: "Last Name" %>
-
+
<%= f.label :email %>
<%= f.text_field :email, placeholder: "Email" %>
-
+
<%= f.label :password %>
<%= f.password_field :password, placeholder: "Password" %>
- - - +
<%= f.submit "Sign Up" %> - +
<% end %>

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

From a62559a004cd60f0a212a0ce34db821409f6cf98 Mon Sep 17 00:00:00 2001 From: t-tullis Date: Fri, 2 Mar 2018 14:45:05 -0800 Subject: [PATCH 2/4] no changes --- app/controllers/users_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 454f8aa..b2b31c1 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -21,7 +21,7 @@ def show end -<<<<<<< HEAD + def create @user=User.find_by(email:user_params[:email]) @@ -34,7 +34,7 @@ def create end end -======= + def create @user = User.new({first_name:user_params[:first_name],last_name:user_params[:last_name],email:user_params[:email],password:user_params[:password]}) if(@user.save) @@ -42,7 +42,7 @@ def create redirect_to user_path end end ->>>>>>> bb307ee6c5c8d264f7696258b0f463cbb792397e + def edit end From 3e102b8cf7977db29e2a633e4505d0500b81aad3 Mon Sep 17 00:00:00 2001 From: t-tullis Date: Mon, 5 Mar 2018 11:13:50 -0800 Subject: [PATCH 3/4] Styled Sign-up Form --- Gemfile | 1 + Gemfile.lock | 3 ++ app/assets/javascripts/application.js | 1 + app/assets/stylesheets/application.css | 1 + app/assets/stylesheets/session.scss | 11 ++++++ app/assets/stylesheets/users.scss | 31 +++++++++++++++ app/controllers/users_controller.rb | 14 +------ app/views/session/new.html.erb | 23 +++++++++++- app/views/users/new.html.erb | 52 ++++++++++++++++++++++---- app/views/users/show.html.erb | 23 ++++++++++-- config/routes.rb | 2 +- 11 files changed, 137 insertions(+), 25 deletions(-) diff --git a/Gemfile b/Gemfile index 5e53408..d342385 100755 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end +gem 'bootstrap-datepicker-rails' gem 'faker' gem 'jquery-rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' diff --git a/Gemfile.lock b/Gemfile.lock index b6136f9..0b63e73 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,6 +41,8 @@ GEM arel (8.0.0) bcrypt (3.1.11) bindex (0.5.0) + bootstrap-datepicker-rails (1.7.1.1) + railties (>= 3.0) builder (3.2.3) byebug (10.0.0) coffee-rails (4.2.2) @@ -165,6 +167,7 @@ PLATFORMS DEPENDENCIES bcrypt (~> 3.1.7) + bootstrap-datepicker-rails byebug coffee-rails (~> 4.2) faker diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 64d7631..894faf1 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,6 +15,7 @@ //= require jquery //= require jquery_ujs //= require bootstrap.min +//= require bootstrap-datepicker var directionsService = new google.maps.DirectionsService var directionsDisplay = new google.maps.DirectionsRenderer var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png", diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index fe8932b..0efe889 100755 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,6 +14,7 @@ *= require_self *= require bootstrap.min *= require home.scss + *= require bootstrap-datepicker */ p { transition: all 2s; diff --git a/app/assets/stylesheets/session.scss b/app/assets/stylesheets/session.scss index 6fa5e44..fc2c699 100755 --- a/app/assets/stylesheets/session.scss +++ b/app/assets/stylesheets/session.scss @@ -1,3 +1,14 @@ // Place all the styles related to the session controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + +h2, h4, .date, .day{ + text-align: center; +} + +.listandmap{ + display: flex; + justify-content: center; + justify-content: space-around; +} + diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss index 62efcfc..cd899aa 100755 --- a/app/assets/stylesheets/users.scss +++ b/app/assets/stylesheets/users.scss @@ -2,4 +2,35 @@ // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ +.logo{ + text-align: center; +} +.logsession{ + margin-top: 10%; +} + +.login{ + margin-top: 5%; +} + +.line { + border-left: 2px solid black; + height: 600px; +} + +.signup{ + margin-top: 19%; +} + +.everything{ + display: flex; + justify-content: center; + justify-content: space-around; +} + +input{ + height: 40px; + width: 300px; + border-radius: 5px; +} diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2fe8162..3f5d24f 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -22,20 +22,8 @@ def show end - - def create - @user=User.find_by(email:user_params[:email]) - if(@user && @user.authenticate(user_params[:password])) - login(@user) - redirect_to user_path - else - flash[:error]="Please sign up" - redirect_to sign_up_path - end - end - - def create + @user = User.new({first_name:user_params[:first_name],last_name:user_params[:last_name],email:user_params[:email],password:user_params[:password]}) if(@user.save) login(@user,user_params[:lat],user_params[:lng]) diff --git a/app/views/session/new.html.erb b/app/views/session/new.html.erb index 2335977..583812c 100755 --- a/app/views/session/new.html.erb +++ b/app/views/session/new.html.erb @@ -1,10 +1,31 @@ -

Login

<%= form_with mode:@user , id:'login' do |t|%> + +
+
+ +

Login

+ +
<%= t.label :email , 'Email' %> +
<%= t.text_field :email , placeholder:'Email here' %> +
+ +
<%= t.label :password, 'Password' %> +
<%= t.password_field :password , placeholder:'Password' %> +
+ <%= t.hidden_field :lat %> <%= t.hidden_field :lng %> +
<%= t.submit 'Login' %> <% end %> +
+ +
+ + + + diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index d67fe72..cdf5bb9 100755 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,29 +1,65 @@ -

Users#new

+<%= form_with url:user_login_path, id:'login' do |l|%> -
+ + + +
+ + + +
+
+ + +
<% if(flash[:user_error]) %> <% flash[:user_error].each do |e| %>

<%= e %>

<% end %> <% end %> -<%= form_with model:@user , id:'signup' ,class:'form col-lg-12' do |f|%> -
+<%= form_with model:@user , id:'signup' do |f|%> + + -
+
<%= f.label :last_name %>
- <%= f.text_field :last_name, placeholder: "Last Name" , class:'form-control' %> + <%= f.text_field :last_name, placeholder: "Last Name" %>
+
<%= f.label :email %>
<%= f.text_field :email, placeholder: "Email" %>
+
<%= f.label :password %>
@@ -31,9 +67,11 @@
<%= f.hidden_field :lat%> <%= f.hidden_field :lng%> +
<%= f.submit "Sign Up" %> <% end %>

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

+ diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 106b4aa..532595f 100755 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,12 +1,29 @@
-

Users#show

+ +

Hours Of Operation: 7AM - 9PM

+
+ +

Choose Date

+
+ +
+ +
+ +

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

<%= link_to 'Logout' ,logout_path %>
-
+ +
+ +
-
+
+ +
+ diff --git a/config/routes.rb b/config/routes.rb index 594dfca..4ce72e2 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,7 @@ post '/contact_us', to: 'home#create' post '/sign_up', to: 'users#create' , as: 'users' - post '/login', to: 'session#create' + post '/login', to: 'session#create', as:'user_login' get '/logout', to: 'session#destroy' , as:'logout' get '/map' , to: 'users#map' # get '/user/map', to: 'users#map' From b3ffdf49169aaa1becb221c5ebd02ad02a6e9303 Mon Sep 17 00:00:00 2001 From: Abdelhalim Date: Mon, 5 Mar 2018 15:20:02 -0500 Subject: [PATCH 4/4] fixied table issue --- app/controllers/rentals_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/rentals_controller.rb b/app/controllers/rentals_controller.rb index bfc70eb..ff43db2 100644 --- a/app/controllers/rentals_controller.rb +++ b/app/controllers/rentals_controller.rb @@ -30,8 +30,8 @@ def show @rentals=User.find(session[:user_id]).rental.where("drop_date != 'nill' ") @rentals.each do |r| @vehicle=r.vehicle - @local_start=@vehicle.local - @local_end=Local.find(r.local_drop) + @local_start=r.local + @local_end=Local.find_by_id(r.local_drop.to_i) @history.push({rental:r,vehicle:@vehicle,local_start:@local_start,local_end:@local_end}) end