Commit 23c96f32 by Vy Quoc Vu

solr

parent 7f6a553a
...@@ -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
......
...@@ -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
......
...@@ -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>
......
...@@ -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>
......
...@@ -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
......
...@@ -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
......
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment