Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venshop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huanvl
venshop
Commits
7eca9aae
Commit
7eca9aae
authored
Oct 25, 2013
by
vulehuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-style header link after login
parent
58a82bcb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
venshop_app/app/controllers/products_controller.rb
+8
-0
venshop_app/app/views/layouts/_header.html.erb
+23
-6
venshop_app/config/routes.rb
+1
-0
No files found.
venshop_app/app/controllers/products_controller.rb
View file @
7eca9aae
class
ProductsController
<
ApplicationController
add_breadcrumb
"Products"
,
:products_path
before_action
:signed_in_user
,
only:
[
:new
]
def
index
@products
=
Product
.
get_list
(
limit:
16
,
page:
params
[
:page
])
...
...
@@ -14,4 +15,11 @@ class ProductsController < ApplicationController
end
@other_products
=
Product
.
get_other_products
(
@product
.
id
,
product_category_id:
@product
.
product_category_id
,
limit:
16
)
end
def
new
@product
=
Product
.
new
end
def
user_items
end
end
venshop_app/app/views/layouts/_header.html.erb
View file @
7eca9aae
...
...
@@ -12,14 +12,31 @@
<div
class=
"block-user-action"
>
<div
class=
"btn-group"
>
<%
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>
<%=
link_to
signout_path
,
class:
"btn btn-primary last"
,
method:
"delete"
,
dada:
{
confirm:
"Do you want to logout?"
}
do
%>
<span
class=
"glyphicon glyphicon-log-out"
></span>
Logout
<%
end
%>
<a
data-toggle=
"dropdown"
href=
"#"
class=
"btn btn-default"
><span
class=
"glyphicon glyphicon-list"
></span>
My actions
</a>
<ul
class=
"dropdown-menu"
role=
"menu"
aria-labelledby=
"dLabel"
>
<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
%>
<%=
link_to
signin_path
,
class:
"btn btn-primary"
do
%>
<span
class=
"glyphicon glyphicon-log-in"
></span>
Login
...
...
venshop_app/config/routes.rb
View file @
7eca9aae
...
...
@@ -2,6 +2,7 @@ VenshopApp::Application.routes.draw do
get
"product_categories/show"
get
"products/index"
get
"products/show"
get
"products/user_items"
get
"cards/index"
get
"cards/checkout"
post
"cards/checkout"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment