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
Dao Minh Nhut
VenShop
Commits
193525ad
Commit
193525ad
authored
Jul 23, 2015
by
Dao Minh Nhut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code convention
parent
2cbd592f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
9 additions
and
13 deletions
+9
-13
app/controllers/home_controller.rb
+0
-0
app/controllers/products_controller.rb
+2
-3
app/views/categories/show.html.erb
+0
-1
app/views/layouts/_sidebar.html.erb
+1
-2
app/views/products/show.html.erb
+2
-3
db/schema.rb
+2
-2
lib/import_amazon.rb
+0
-0
lib/tasks/import_product.rake
+2
-2
test/controllers/home_controller_test.rb
+0
-0
No files found.
app/controllers/home_controller.rb
View file @
193525ad
app/controllers/products_controller.rb
View file @
193525ad
...
@@ -8,7 +8,7 @@ class ProductsController < ApplicationController
...
@@ -8,7 +8,7 @@ class ProductsController < ApplicationController
def
index
def
index
@item
=
Product
.
find
(
:all
)
@item
=
Product
.
find
(
:all
)
#@items = Product.all.select do |i|
#@items = Product.all.select do |i|
#
i.category==params[:id]
#
i.category==params[:id]
#end
#end
end
end
def
new
def
new
...
@@ -24,13 +24,12 @@ class ProductsController < ApplicationController
...
@@ -24,13 +24,12 @@ class ProductsController < ApplicationController
render
'new'
,
layout:
"another_layout"
render
'new'
,
layout:
"another_layout"
end
end
end
end
def
destroy
def
destroy
@item
.
destroy
@item
.
destroy
redirect_to
current_user
redirect_to
current_user
end
end
private
def
correct_user
def
correct_user
@item
=
current_user
.
items
.
find_by_id
(
params
[
:id
])
@item
=
current_user
.
items
.
find_by_id
(
params
[
:id
])
redirect_to
root_url
if
@item
.
nil?
redirect_to
root_url
if
@item
.
nil?
...
...
app/views/categories/show.html.erb
View file @
193525ad
<div
class=
"span9 categories"
>
<div
class=
"span9 categories"
>
<%
@items_of_category
.
each
do
|
i
|
%>
<%
@items_of_category
.
each
do
|
i
|
%>
<div
class=
"span5 center"
>
<div
class=
"span5 center"
>
<h4>
<%=
i
.
name
%>
</h4>
<h4>
<%=
i
.
name
%>
</h4>
...
...
app/views/layouts/_sidebar.html.erb
View file @
193525ad
...
@@ -2,11 +2,10 @@
...
@@ -2,11 +2,10 @@
<div
class=
"sidebar-nav-fixed"
>
<div
class=
"sidebar-nav-fixed"
>
<div
class=
"well"
>
<div
class=
"well"
>
<ul
class=
"nav nav-list"
>
<ul
class=
"nav nav-list"
>
<li
class=
"nav-header"
>
Category
</li>
<li
class=
"nav-header"
>
Category
</li>
<!--% category_list.each do |cat| %-->
<!--% category_list.each do |cat| %-->
<li><a
href=
'/categories/
<%=
cat
.
id
%>
'
>
<%=
cat
.
name
%>
</a></li>
<li><a
href=
'/categories/
<%=
cat
.
id
%>
'
>
<%=
cat
.
name
%>
</a></li>
<%
end
%
>
<!--%end%--
>
</ul>
</ul>
</div>
<!--/.well -->
</div>
<!--/.well -->
</div>
<!--/sidebar-nav-fixed -->
</div>
<!--/sidebar-nav-fixed -->
...
...
app/views/products/show.html.erb
View file @
193525ad
<div
class=
"span8 center"
>
<div
class=
"span8 center"
>
<h3>
Name:
</h3>
<%=
@product
.
name
%>
<br><br>
<h3>
Name:
</h3>
<%=
@item
.
name
%>
<br><br>
</div>
<!--/span-->
</div>
<!--/span-->
\ No newline at end of file
db/schema.rb
View file @
193525ad
...
@@ -15,7 +15,7 @@ ActiveRecord::Schema.define(version: 20150721071537) do
...
@@ -15,7 +15,7 @@ ActiveRecord::Schema.define(version: 20150721071537) do
create_table
"categories"
,
force: :cascade
do
|
t
|
create_table
"categories"
,
force: :cascade
do
|
t
|
t
.
string
"name"
,
limit:
255
t
.
string
"name"
,
limit:
255
t
.
string
"description"
,
limit:
25
5
t
.
string
"description"
,
limit:
6553
5
t
.
string
"image"
,
limit:
255
t
.
string
"image"
,
limit:
255
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
...
@@ -25,7 +25,7 @@ ActiveRecord::Schema.define(version: 20150721071537) do
...
@@ -25,7 +25,7 @@ ActiveRecord::Schema.define(version: 20150721071537) do
t
.
string
"name"
,
limit:
255
t
.
string
"name"
,
limit:
255
t
.
string
"image"
,
limit:
255
t
.
string
"image"
,
limit:
255
t
.
integer
"price"
,
limit:
4
t
.
integer
"price"
,
limit:
4
t
.
string
"description"
,
limit:
25
5
t
.
string
"description"
,
limit:
6553
5
t
.
integer
"category_id"
,
limit:
4
t
.
integer
"category_id"
,
limit:
4
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
...
...
lib/import_amazon.rb
View file @
193525ad
lib/tasks/import_product.rake
View file @
193525ad
namespace
:products
do
namespace
:products
do
desc
'Get products'
desc
'Get products'
task
import: :environment
do
task
import: :environment
do
ImportAmazon
.
new
.
import_product
ImportAmazon
.
new
.
import_product
end
end
end
end
test/controllers/home_controller_test.rb
View file @
193525ad
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