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
841bca67
Commit
841bca67
authored
Oct 29, 2013
by
vulehuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display error messages in some case raise exception
parent
e9292941
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
4 deletions
+23
-4
venshop_app/app/assets/stylesheets/custom.css.scss
+4
-0
venshop_app/app/controllers/cards_controller.rb
+2
-0
venshop_app/app/controllers/product_categories_controller.rb
+4
-4
venshop_app/app/controllers/products_controller.rb
+5
-0
venshop_app/app/controllers/users_controller.rb
+5
-0
venshop_app/app/views/default_pages/home.html.erb
+1
-0
venshop_app/app/views/products/index.html.erb
+1
-0
venshop_app/app/views/products/show.html.erb
+1
-0
No files found.
venshop_app/app/assets/stylesheets/custom.css.scss
View file @
841bca67
...
...
@@ -469,3 +469,7 @@ footer {
.block-search-result
{
padding-top
:
10px
;
}
#block-message-visible
{
margin-top
:
10px
;
}
venshop_app/app/controllers/cards_controller.rb
View file @
841bca67
...
...
@@ -51,12 +51,14 @@ class CardsController < ApplicationController
# if add a product to card
# first time add to card
if
@card_infos
.
empty?
if
Product
.
exists?
(
params
[
:product_id
])
product
=
Product
.
find
(
params
[
:product_id
])
card_items
=
Array
.
new
card_items
.
push
({
product_id:
params
[
:product_id
],
quantity:
1
})
customer_info
=
Hash
.
new
@card_infos
=
{
card_items:
card_items
,
customer_info:
customer_info
}
session
[
:SHOPPING_CARD_SESSION_NAME
]
=
@card_infos
end
redirect_to
cards_path
else
card_items
=
@card_infos
[
:card_items
]
...
...
venshop_app/app/controllers/product_categories_controller.rb
View file @
841bca67
...
...
@@ -2,14 +2,14 @@ class ProductCategoriesController < ApplicationController
add_breadcrumb
"Products"
,
:products_path
def
show
if
ProductCategory
.
exists?
(
params
[
:id
])
term
=
ProductCategory
.
find
(
params
[
:id
])
if
term
.
nil?
@items
=
Array
.
new
@title
=
''
else
@items
=
Product
.
get_products_by_category
(
product_category_id:
params
[
:id
],
page:
params
[
:page
],
limit:
24
)
@title
=
term
.
name
add_breadcrumb
term
.
name
,
product_category_path
(
term
)
else
flash
[
:error
]
=
"Invalid product category!"
redirect_to
products_path
end
end
end
venshop_app/app/controllers/products_controller.rb
View file @
841bca67
...
...
@@ -7,6 +7,7 @@ class ProductsController < ApplicationController
end
def
show
begin
@product
=
Product
.
find
(
params
[
:id
])
if
!
@product
.
status
user
=
current_user
...
...
@@ -20,6 +21,10 @@ class ProductsController < ApplicationController
add_breadcrumb
@product
.
name
,
product_path
(
@product
)
end
@other_products
=
Product
.
get_other_products
(
@product
.
id
,
product_category_id:
@product
.
product_category_id
,
limit:
20
)
rescue
flash
[
:error
]
=
"Invalid product!"
redirect_to
products_path
end
end
def
new
...
...
venshop_app/app/controllers/users_controller.rb
View file @
841bca67
...
...
@@ -13,7 +13,12 @@ class UsersController < ApplicationController
end
def
show
if
User
.
exists?
(
params
[
:id
])
@user
=
User
.
find
(
params
[
:id
])
else
flash
[
:error
]
=
"Invalid user!"
redirect_to
root_path
end
end
def
create
...
...
venshop_app/app/views/default_pages/home.html.erb
View file @
841bca67
...
...
@@ -3,6 +3,7 @@
<h2
class=
"sprite-2"
>
Recommended Items
<span
class=
"sprite-2"
></span>
</h2>
<div
id=
"block-message-visible"
class=
"hidden"
></div>
<%=
render
'shared/grid'
,
items:
@recommed_items
%>
<div
class=
"clearfix"
></div>
</div>
...
...
venshop_app/app/views/products/index.html.erb
View file @
841bca67
...
...
@@ -3,6 +3,7 @@
<h2
class=
"sprite-2"
>
Products
<span
class=
"sprite-2"
></span>
</h2>
<div
id=
"block-message-visible"
class=
"hidden"
></div>
<%=
render
'shared/grid'
,
items:
@products
%>
<%=
will_paginate
@products
,
renderer:
BootstrapPagination
::
Rails
%>
...
...
venshop_app/app/views/products/show.html.erb
View file @
841bca67
...
...
@@ -2,6 +2,7 @@
<div
class=
"body-box"
>
<h2
class=
"sprite-2"
>
<%=
@product
.
name
%>
<span
class=
"sprite-2"
></span></h2>
<div
class=
"text-justify product-detail"
>
<div
id=
"block-message-visible"
class=
"hidden"
></div>
<%
if
!
@product
.
status
%>
<div
class=
"alert alert-danger"
>
<p
class=
"text-center"
>
This product is only visible to you.
</p>
...
...
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