Commit 7eca9aae by vulehuan

re-style header link after login

parent 58a82bcb
class ProductsController < ApplicationController class ProductsController < ApplicationController
add_breadcrumb "Products", :products_path add_breadcrumb "Products", :products_path
before_action :signed_in_user, only: [:new]
def index def index
@products = Product.get_list(limit: 16, page: params[:page]) @products = Product.get_list(limit: 16, page: params[:page])
...@@ -14,4 +15,11 @@ class ProductsController < ApplicationController ...@@ -14,4 +15,11 @@ class ProductsController < ApplicationController
end end
@other_products = Product.get_other_products(@product.id, product_category_id: @product.product_category_id, limit: 16) @other_products = Product.get_other_products(@product.id, product_category_id: @product.product_category_id, limit: 16)
end end
def new
@product = Product.new
end
def user_items
end
end end
...@@ -12,14 +12,31 @@ ...@@ -12,14 +12,31 @@
<div class="block-user-action"> <div class="block-user-action">
<div class="btn-group"> <div class="btn-group">
<% if signed_in? %> <% if signed_in? %>
<%= link_to edit_user_path(current_user), class: "btn btn-default" do %>
<span class="glyphicon glyphicon-edit"></span> Settings
<% end %>
<a href="<%= cards_path %>" class="btn btn-danger"> <span class="glyphicon glyphicon-shopping-cart"></span> Your cart <a href="<%= cards_path %>" class="btn btn-danger"> <span class="glyphicon glyphicon-shopping-cart"></span> Your cart
</a> </a>
<%= link_to signout_path, class: "btn btn-primary last", method: "delete", dada: { confirm: "Do you want to logout?" } do %> <a data-toggle="dropdown" href="#" class="btn btn-default"><span class="glyphicon glyphicon-list"></span> My actions</a>
<span class="glyphicon glyphicon-log-out"></span> Logout <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<% end %> <li>
<%= link_to edit_user_path(current_user) do %>
<span class="glyphicon glyphicon-edit"></span> Update my profile
<% end %>
</li>
<li>
<%= link_to url_for(controller: 'products', action:'user_items') do %>
<span class="glyphicon glyphicon-home"></span> My products
<% end %>
</li>
<li>
<%= link_to new_product_path do %>
<span class="glyphicon glyphicon-plus"></span> Add new product
<% end %>
</li>
<li>
<%= link_to signout_path, method: "delete", dada: { confirm: "Do you want to logout?" } do %>
<span class="glyphicon glyphicon-log-out"></span> Logout
<% end %>
</li>
</ul>
<% else %> <% else %>
<%= link_to signin_path, class: "btn btn-primary" do %> <%= link_to signin_path, class: "btn btn-primary" do %>
<span class="glyphicon glyphicon-log-in"></span> Login <span class="glyphicon glyphicon-log-in"></span> Login
......
...@@ -2,6 +2,7 @@ VenshopApp::Application.routes.draw do ...@@ -2,6 +2,7 @@ VenshopApp::Application.routes.draw do
get "product_categories/show" get "product_categories/show"
get "products/index" get "products/index"
get "products/show" get "products/show"
get "products/user_items"
get "cards/index" get "cards/index"
get "cards/checkout" get "cards/checkout"
post "cards/checkout" post "cards/checkout"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment