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
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Nguyen Quoc Kien
venshop
Commits
17b967c5
Commit
17b967c5
authored
Jul 31, 2015
by
Nguyen Quoc Kien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New brach review code
parent
ab64a07d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
app/controllers/admin/carts_controller.rb
+2
-1
app/controllers/admin/products_controller.rb
+1
-0
app/controllers/admin/users_controller.rb
+9
-9
No files found.
app/controllers/admin/carts_controller.rb
View file @
17b967c5
class
Admin
::
CartsController
<
ApplicationController
class
Admin
::
CartsController
<
ApplicationController
before_action
:authenticate_admin!
before_action
:authenticate_admin!
def
index
def
index
@users
=
User
.
all
@users
=
User
.
all
end
end
...
@@ -25,4 +25,5 @@ class Admin::CartsController < ApplicationController
...
@@ -25,4 +25,5 @@ class Admin::CartsController < ApplicationController
@cart
.
update
(
status:
status
)
@cart
.
update
(
status:
status
)
redirect_to
admin_cart_path
(
id:
params
[
:user_id
])
redirect_to
admin_cart_path
(
id:
params
[
:user_id
])
end
end
end
end
app/controllers/admin/products_controller.rb
View file @
17b967c5
...
@@ -58,6 +58,7 @@ class Admin::ProductsController < ApplicationController
...
@@ -58,6 +58,7 @@ class Admin::ProductsController < ApplicationController
end
end
private
private
def
find_product
def
find_product
@product
=
Product
.
find
(
params
[
:id
])
@product
=
Product
.
find
(
params
[
:id
])
end
end
...
...
app/controllers/admin/users_controller.rb
View file @
17b967c5
class
Admin
::
UsersController
<
ApplicationController
class
Admin
::
UsersController
<
ApplicationController
before_action
:authenticate_admin!
before_action
:authenticate_admin!
def
index
@users
=
User
.
paginate
(
page:
params
[
:page
]).
per_page
(
21
)
end
def
destroy
def
index
@user
=
User
.
find
(
params
[
:id
])
@users
=
User
.
paginate
(
page:
params
[
:page
]).
per_page
(
21
)
if
@user
.
destroy
end
def
destroy
@user
=
User
.
find
(
params
[
:id
])
if
@user
.
destroy
flash
[
:success
]
=
"Delete User : Success"
flash
[
:success
]
=
"Delete User : Success"
else
else
flash
[
:danger
]
=
"Delete User : Error"
flash
[
:danger
]
=
"Delete User : Error"
end
end
redirect_to
admin_users_path
redirect_to
admin_users_path
end
end
end
end
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