Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Venshop.v2
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
Vy Quoc Vu
Venshop.v2
Commits
23c96f32
Commit
23c96f32
authored
Aug 05, 2015
by
Vy Quoc Vu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solr
parent
7f6a553a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
14 deletions
+17
-14
app/controllers/cart_products_controller.rb
+0
-1
app/controllers/carts_controller.rb
+1
-0
app/views/admins/products/show.html.erb
+1
-1
app/views/layouts/_header.html.erb
+1
-0
db/migrate/20150724033606_devise_create_users.rb
+1
-2
db/migrate/20150730041232_devise_create_admins.rb
+1
-0
db/schema.rb
+12
-10
No files found.
app/controllers/cart_products_controller.rb
View file @
23c96f32
...
@@ -31,7 +31,6 @@ class CartProductsController < ApplicationController
...
@@ -31,7 +31,6 @@ class CartProductsController < ApplicationController
end
end
def
update
def
update
byebug
if
params
[
:id
].
nil?
if
params
[
:id
].
nil?
flash
[
:danger
]
=
"Product not found!"
flash
[
:danger
]
=
"Product not found!"
elsif
params
[
:new_quantity
].
nil?
||
params
[
:new_quantity
].
to_i
<=
0
elsif
params
[
:new_quantity
].
nil?
||
params
[
:new_quantity
].
to_i
<=
0
...
...
app/controllers/carts_controller.rb
View file @
23c96f32
...
@@ -30,6 +30,7 @@ class CartsController < ApplicationController
...
@@ -30,6 +30,7 @@ class CartsController < ApplicationController
Emailer
.
send_email_to
(
cart_params
[
:mail
].
to_s
,
session
[
:cart
]).
deliver
Emailer
.
send_email_to
(
cart_params
[
:mail
].
to_s
,
session
[
:cart
]).
deliver
flash
[
:success
]
=
"Success!"
flash
[
:success
]
=
"Success!"
session
[
:cart
]
=
nil
session
[
:cart
]
=
nil
redirect_to
:action
=>
"show"
else
else
flash
[
:danger
]
=
"Your mail, your address, your name"
flash
[
:danger
]
=
"Your mail, your address, your name"
redirect_to
:back
redirect_to
:back
...
...
app/views/admins/products/show.html.erb
View file @
23c96f32
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<%=
f
.
label
:price
%>
<%=
f
.
label
:price
%>
<%=
f
.
number_field
:price
,
value:
@product
.
price
/
100
,
class:
'form-control'
%>
<%=
f
.
number_field
:price
,
value:
@product
.
price
/
100
,
class:
'form-control'
%>
<br>
<br>
<%=
f
.
label
:Category
%>
<%=
f
.
label
:Category
%>
<p>
</p>
<%=
collection_select
:category
,
:id
,
Category
.
all
,
:id
,
:name
,
:selected
=>
@product
.
category_id
%>
<%=
collection_select
:category
,
:id
,
Category
.
all
,
:id
,
:name
,
:selected
=>
@product
.
category_id
%>
</br>
</br>
...
...
app/views/layouts/_header.html.erb
View file @
23c96f32
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<div
class=
"navbar-header"
>
<div
class=
"navbar-header"
>
<table>
<table>
<td><a
class=
"navbar-brand"
href=
"/"
>
Venshop
</a></td>
<td><a
class=
"navbar-brand"
href=
"/"
>
Venshop
</a></td>
<td></td>
<form
action=
"/search"
style=
"padding-left : 100px ; resize: vertical;"
method=
"get"
class=
"navbar-brand"
>
<form
action=
"/search"
style=
"padding-left : 100px ; resize: vertical;"
method=
"get"
class=
"navbar-brand"
>
<td
><input
type=
"text"
name=
"search"
value=
""
,
class=
"form-control"
/></td>
<td
><input
type=
"text"
name=
"search"
value=
""
,
class=
"form-control"
/></td>
<td
style=
"padding-left : 20px"
><input
type=
"submit"
value=
"Search"
style=
"font-size: 1em;"
,
class=
"btn btn-primary"
/></td>
<td
style=
"padding-left : 20px"
><input
type=
"submit"
value=
"Search"
style=
"font-size: 1em;"
,
class=
"btn btn-primary"
/></td>
...
...
db/migrate/20150724033606_devise_create_users.rb
View file @
23c96f32
...
@@ -4,8 +4,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
...
@@ -4,8 +4,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
## Database authenticatable
## Database authenticatable
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:encrypted_password
,
null:
false
,
default:
""
t
.
string
:encrypted_password
,
null:
false
,
default:
""
t
.
string
:name
t
.
string
:name
,
default:
"Username"
t
.
string
:address
## Recoverable
## Recoverable
t
.
string
:reset_password_token
t
.
string
:reset_password_token
...
...
db/migrate/20150730041232_devise_create_admins.rb
View file @
23c96f32
...
@@ -4,6 +4,7 @@ class DeviseCreateAdmins < ActiveRecord::Migration
...
@@ -4,6 +4,7 @@ class DeviseCreateAdmins < ActiveRecord::Migration
## Database authenticatable
## Database authenticatable
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:encrypted_password
,
null:
false
,
default:
""
t
.
string
:encrypted_password
,
null:
false
,
default:
""
t
.
string
:name
,
default:
"adminname"
## Recoverable
## Recoverable
t
.
string
:reset_password_token
t
.
string
:reset_password_token
...
...
db/schema.rb
View file @
23c96f32
...
@@ -14,18 +14,19 @@
...
@@ -14,18 +14,19 @@
ActiveRecord
::
Schema
.
define
(
version:
20150730041232
)
do
ActiveRecord
::
Schema
.
define
(
version:
20150730041232
)
do
create_table
"admins"
,
force: :cascade
do
|
t
|
create_table
"admins"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"email"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"name"
,
limit:
255
,
default:
"adminname"
t
.
string
"reset_password_token"
,
limit:
255
t
.
string
"reset_password_token"
,
limit:
255
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"remember_created_at"
t
.
datetime
"remember_created_at"
t
.
integer
"sign_in_count"
,
limit:
4
,
default:
0
,
null:
false
t
.
integer
"sign_in_count"
,
limit:
4
,
default:
0
,
null:
false
t
.
datetime
"current_sign_in_at"
t
.
datetime
"current_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
string
"current_sign_in_ip"
,
limit:
255
t
.
string
"current_sign_in_ip"
,
limit:
255
t
.
string
"last_sign_in_ip"
,
limit:
255
t
.
string
"last_sign_in_ip"
,
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
end
end
add_index
"admins"
,
[
"email"
],
name:
"index_admins_on_email"
,
unique:
true
,
using: :btree
add_index
"admins"
,
[
"email"
],
name:
"index_admins_on_email"
,
unique:
true
,
using: :btree
...
@@ -70,18 +71,19 @@ ActiveRecord::Schema.define(version: 20150730041232) do
...
@@ -70,18 +71,19 @@ ActiveRecord::Schema.define(version: 20150730041232) do
end
end
create_table
"users"
,
force: :cascade
do
|
t
|
create_table
"users"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"email"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
limit:
255
,
default:
""
,
null:
false
t
.
string
"name"
,
limit:
255
,
default:
"Username"
t
.
string
"reset_password_token"
,
limit:
255
t
.
string
"reset_password_token"
,
limit:
255
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"remember_created_at"
t
.
datetime
"remember_created_at"
t
.
integer
"sign_in_count"
,
limit:
4
,
default:
0
,
null:
false
t
.
integer
"sign_in_count"
,
limit:
4
,
default:
0
,
null:
false
t
.
datetime
"current_sign_in_at"
t
.
datetime
"current_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
string
"current_sign_in_ip"
,
limit:
255
t
.
string
"current_sign_in_ip"
,
limit:
255
t
.
string
"last_sign_in_ip"
,
limit:
255
t
.
string
"last_sign_in_ip"
,
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
end
end
add_index
"users"
,
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
,
using: :btree
add_index
"users"
,
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
,
using: :btree
...
...
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