From 6101956c6f27deb6c57d7f3545f0eba2d90015da Mon Sep 17 00:00:00 2001 From: Galiant Date: Fri, 20 Apr 2018 22:26:15 +0000 Subject: [PATCH] Added admin login and edit profile functionality --- app/views/items/index.html.erb | 2 +- app/views/layouts/_header.html.erb | 9 ++++++++- app/views/layouts/application.html.erb | 2 +- db/development.sqlite3 | Bin 109568 -> 109568 bytes 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/items/index.html.erb b/app/views/items/index.html.erb index 295f9b1..05244a4 100644 --- a/app/views/items/index.html.erb +++ b/app/views/items/index.html.erb @@ -25,7 +25,7 @@ Add to cart <%= link_to 'Show', item, :class => "button", :role => "button" %> - <% if user_signed_in? %> + <% if session[:login] == 1 %> <%= link_to 'Edit', edit_item_path(item), :class => "button", :role => "button" %> <%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' }, :class => "button", :role => "button" %> <% end %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index ebc6143..66955bc 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -10,12 +10,19 @@
  • <%= link_to "Cart", cart_path %>
  • <% if user_signed_in? %> -
  • Hi <%= current_user.email %>
  • +
  • <%= link_to 'Edit Profile', edit_user_registration_path %>
  • <%= link_to 'Sign Out', destroy_user_session_path, :method =>:delete %>
  • <% else %>
  • <%= link_to 'Register', new_user_registration_path %>
  • <%= link_to 'Sign In', new_user_session_path %>
  • <% end %> + + <% if session[:login] == 1 %> +
  • <%= link_to "Admin Logout", logout_path %>
  • + <% else %> +
  • <%= link_to "Admin Login", login_path %>
  • + <% end %> + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a9012f2..ea3799a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - Gamestore + GameLand <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> diff --git a/db/development.sqlite3 b/db/development.sqlite3 index d4ab2108ff16ce082886271235baa6adca741062..97109f1eb63591a5926f2775081330b2a958a395 100644 GIT binary patch delta 361 zcmZp;!PantZGtr8tcfztjI%Z-6iG8OZ@w&T7{JBM=*qw>%%sKWy0OumvA!{hnV-S9 zk(Gggfz#1ZQ`6BgF|Q;(JuxRU*`YEqBR^j+IX_p$C{e}GP{lLT*sRPVqtqmzBG5EX zzc|z@-PF)OJuNpq$W_nR+ut=R#V4mYDkrVNveeHh!z4c=KdjQoz|cb1z(m)`K*7k! z3WSXHjEs#;EzCeNY1pNV&Gn3oEcA>_jDTuQQF&MmG%~U@G{GukY;101yjd&n7AF@o z^Lhs6^~_J0k8c(fSja3R&TPzx#kb5d%(je^ZSo{0Kdx2;YWl>${D=8F^QX;%HBXpX TS(q6ZnVY}YZ~tD;$f*MWO>JQf delta 99 zcmV-p0G$7T*am>u29O&8n2{Vq0hqC1avK2xv(p11<9i_p0t5E|1N;N`vk{Q!0|Nj60E72`xA%Vm F2`tfN9?<{*