From 4ca6a49179d5228c7562dbb851c619d27bdd0f44 Mon Sep 17 00:00:00 2001 From: Abdelhalim Date: Tue, 6 Mar 2018 02:28:03 -0500 Subject: [PATCH] css fix --- app/assets/javascripts/application.js | 6 +++- app/controllers/rentals_controller.rb | 11 ++++-- app/views/layouts/application.html.erb | 49 +++++++++++++++++++++++++- app/views/rentals/current.html.erb | 5 +++ app/views/session/new.html.erb | 2 +- 5 files changed, 68 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 6f44d52..e7b9d15 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,4 +1,4 @@ - + // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // @@ -247,12 +247,16 @@ $(document).on('turbolinks:load', function () { } if (map_id) { map(); + $('#user_nav').addClass('active') + } if (user_map) { reservation_map(); + $('#user_nav').addClass('active') } if (show_history) { history(); + $('#history_nav').addClass('active') } var slideIndex = 0; diff --git a/app/controllers/rentals_controller.rb b/app/controllers/rentals_controller.rb index ff43db2..cb0b66f 100644 --- a/app/controllers/rentals_controller.rb +++ b/app/controllers/rentals_controller.rb @@ -19,9 +19,10 @@ def create end end def current + @user=User.find(session[:user_id]) @rental=Rental.new @locals=Local.all - @current_rental=User.find(session[:user_id]).rental.where("drop_date = 'nill'") + @current_rental=@user.rental.where("drop_date = 'nill'") @vehicle=@current_rental[0].vehicle @local=@current_rental[0].local end @@ -45,10 +46,13 @@ def drop @rental.update(local_drop:params_drop[:local_id]) redirect_to user_path else + flash[:error_current]='error try again' redirect_to current_path end else -flash[:error]='pick another location this one is full' +flash[:error_current]='pick another location this one is full' +redirect_to current_path + end end @@ -67,6 +71,9 @@ def reserved? @rental end end +def history +@user=User.find(session[:user_id]) +end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1b801ed..1c86893 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,6 +34,9 @@ + <% s=controller.controller_name+'#'+controller.action_name %> + <% if ["users#show","rentals#history","rentals#current"].include? s %> +
@@ -53,7 +56,49 @@ - + + + + + + + + + + + + + +
+ <% else %> +
+ + +
+ <% end %>
+ <%= yield %>
diff --git a/app/views/rentals/current.html.erb b/app/views/rentals/current.html.erb index c54827a..fc29bef 100644 --- a/app/views/rentals/current.html.erb +++ b/app/views/rentals/current.html.erb @@ -1,5 +1,10 @@
+ <% if flash[:error_current] %> +
+

<%=flash[:error_current] %>

+
+ <% end %>


<%= @vehicle.description %> @ <%= @local.street %> , <%= @local.city %> , <%= @local.state %> | <%= @local.zip_code %> Show this acces code

diff --git a/app/views/session/new.html.erb b/app/views/session/new.html.erb index a71a285..c6d1cf8 100755 --- a/app/views/session/new.html.erb +++ b/app/views/session/new.html.erb @@ -30,5 +30,5 @@ <% end %>
-