Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fc0d692
admin namespace & route
xdite Jun 9, 2014
15b0176
Add product
xdite Jun 9, 2014
677a5e6
add product new
xdite Jun 9, 2014
540c410
add admin_products_index
xdite Jun 9, 2014
b7a3ed5
install devise
xdite Jun 9, 2014
6539e53
add admin_user
xdite Jun 9, 2014
e63fa02
add signin/signout
xdite Jun 9, 2014
158bb27
install bootstrap
Jun 9, 2014
e13db1a
add welcome page
xdite Jun 12, 2014
e6295f3
* Bootstrap
xdite Jun 12, 2014
4b9d689
Admin Should able to see admin panel link in dropdown menu
xdite Jun 12, 2014
67f1576
Refine with Product List with table
xdite Jun 12, 2014
dc21ff7
SimpleForm with Bootstrap
xdite Jun 12, 2014
631e094
Render Edit
xdite Jun 12, 2014
9d049ff
* install carrierwave
xdite Jun 12, 2014
3bfdfd2
build product index
xdite Jun 12, 2014
fbcdd50
refine show page
xdite Jun 12, 2014
6e16e1f
add notice stickits
xdite Jun 12, 2014
39ac28e
store-v2 spec
xdite Jun 12, 2014
f03f3d2
add alert js
xdite Jun 12, 2014
e65076d
add cart nav
xdite Jun 12, 2014
19694b4
Add cart / cart_item
xdite Jun 12, 2014
27bd831
add product to cart
xdite Jun 12, 2014
6bf634b
cart sumaary
xdite Jun 12, 2014
c8ed57f
身為消費者,我要在前台能夠將多樣商品加到購物車,並生成一張訂單
xdite Jun 13, 2014
8d43f8e
✔ 身為消費者,當系統生成一張訂單後,我可以填寫寄送資訊,並且用信用卡結帳 @done (14-06-13 14:47)
xdite Jun 13, 2014
5fe9f18
install aasm
xdite Jun 13, 2014
d792f50
make payment
xdite Jun 13, 2014
1582426
✔ 身為消費者,當我下單時,我的信箱要能收到一張下單確認信 @done (14-06-13 17:44)
xdite Jun 13, 2014
9463e09
nothing change to admin/products/edit.html.erb
dangjlin Jun 18, 2014
0e34c55
add fucntion - remove all itmes from cart
dangjlin Jun 18, 2014
5f3ee58
add function - remove 1 item from cart
dangjlin Jun 18, 2014
32eb978
complete remove all items from cart,but pending on choose quantity in…
dangjlin Jun 19, 2014
28e92a0
add function - when quantity is 0 cannot add to cart
dangjlin Jun 19, 2014
5bcf932
start to create all orders list page
dangjlin Jun 19, 2014
25ee61e
add function list all orders
dangjlin Jun 21, 2014
ac83b50
add function : notify_credit_card_sucess , check by mail content link
dangjlin Jun 21, 2014
7093692
update readme file
dangjlin Jun 21, 2014
9dc5042
update readme file
dangjlin Jun 21, 2014
a99f038
Update README.rdoc
dangjlin Jun 21, 2014
a179f8a
Update README.rdoc
dangjlin Jun 21, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
.DS_Store
public/uploads
17 changes: 17 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development


gem "devise"


gem "bootstrap-sass"
gem "simple_form", "3.1.0rc1"
gem 'carrierwave'
gem "mini_magick"

gem "aasm"


group :development do
gem "annotate"
gem "letter_opener"
gem 'roadie'
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

Expand Down
51 changes: 51 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
aasm (3.2.0)
actionmailer (4.1.0)
actionpack (= 4.1.0)
actionview (= 4.1.0)
Expand All @@ -27,15 +28,35 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
annotate (2.6.3)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
arel (5.0.1.20140414130214)
bcrypt (3.1.7)
bootstrap-sass (3.0.3.0)
sass (~> 3.2)
builder (3.2.2)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
css_parser (1.3.5)
addressable
devise (3.2.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
erubis (2.7.0)
execjs (2.2.0)
hike (1.2.3)
Expand All @@ -47,12 +68,22 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
launchy (2.4.2)
addressable (~> 2.3)
letter_opener (1.2.0)
launchy (~> 2.2)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_magick (3.7.0)
subexec (~> 0.2.1)
mini_portile (0.6.0)
minitest (5.3.4)
multi_json (1.10.1)
nokogiri (1.6.2.1)
mini_portile (= 0.6.0)
orm_adapter (0.5.0)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.2)
Expand All @@ -75,6 +106,11 @@ GEM
rake (10.3.2)
rdoc (4.1.1)
json (~> 1.4)
roadie (2.4.3)
actionmailer (> 3.0.0, < 5.0.0)
css_parser (~> 1.3.4)
nokogiri (> 1.5.0)
sprockets
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
Expand All @@ -84,6 +120,9 @@ GEM
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
simple_form (3.1.0.rc1)
actionpack (~> 4.0)
activemodel (~> 4.0)
spring (1.1.3)
sprockets (2.11.0)
hike (~> 1.2)
Expand All @@ -95,6 +134,7 @@ GEM
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.9)
subexec (0.2.3)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
Expand All @@ -108,17 +148,28 @@ GEM
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)

PLATFORMS
ruby

DEPENDENCIES
aasm
annotate
bootstrap-sass
carrierwave
coffee-rails (~> 4.0.0)
devise
jbuilder (~> 2.0)
jquery-rails
letter_opener
mini_magick
rails (= 4.1.0)
roadie
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
simple_form (= 3.1.0rc1)
spring
sqlite3
turbolinks
Expand Down
31 changes: 31 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@


作業#1

1. 清空購物車 (Done)
2. 從購物車內刪掉某些物品 (Done)
3. 購物車加入「數量」設計 (pending)
4. 購物車的總價=> 小計x 數量 (pending)
5. 數量為 0 的貨物不能「購買」 (Done)


作業#2
1. 配合作業#1 支援「多重購買數量」 (pending)
2. 並修改訂單畫面 (pending)
3. 訂單畫面美化 (pending)

回家作業#3
1. 建立 account/orders 可以看到該使用者過去所有訂單 (Done)
2. 結賬後跳轉到account/orders#index (Done)

回家作業#4
1. 建立 admin/orders 可以看到系統內所有訂單 (Done)
2. admin 的order 列表應要能顯示訂單狀態 (Done)
3. 單張order 應要可以要「按照狀態圖」改變狀態 (pending)


作業#5
1. 信用卡付款成功也要寄信通知 (Done)
2. 消費者可以透過email 裡的連結檢視原先的order (Done)


== README

This README would normally document whatever steps are necessary to get the
Expand Down
62 changes: 62 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

購物:
✔ 身為消費者,我要在前台能夠找到商品並加到購物車 @done (14-06-13 06:24)
✔ 身為消費者,我要在前台能看到購物車裡面的明細 @done (14-06-13 07:02)
✔ 身為消費者,我要在前台能夠將多樣商品加到購物車,並生成一張訂單 @done (14-06-13 13:22)
✔ 身為消費者,當系統生成一張訂單後,我可以填寫寄送資訊,並且用信用卡結帳 @done (14-06-13 14:47)
✔ 身為消費者,當我下單時,我的信箱要能收到一張下單確認信 @done (14-06-13 17:44)
✔ 訂單狀態應分為未結帳、已結帳、出貨中、已出貨、辦理退貨 @done (14-06-13 17:44)
☐ 身為消費者,當我用信用卡結帳後,我的信箱要能收到一張訂購完成信

Admin 管理訂單:
☐ 身為管理者,可以在後台看訂單,訂單狀態分為未結帳、已結帳、出貨中、已出貨、辦理退貨
☐ 身為管理者,我可以在後台對單張訂單做狀態改變
☐ 身為管理者,當我在將商品設為已出貨時,消費者應該收到一張已出貨的通知信

☐ 身為商家,當消費者確定購物結帳後,該商品的庫存必須按照數量減少


Admin:
✔ Admin Should able to see admin panel link in dropdown menu @done (14-06-13 01:59)
Product:
✔ Refine with Product List with table @done (14-06-13 02:14)
✔ should able update image when create product @done (14-06-13 04:09)
☐ should able to upload image after update

其他:
✔ 套 Bootstrap 版 @done (14-06-12 18:33)
✔ Login / Logout using bootstrap nav @done (14-06-12 18:33)
✔ SimpleForm with Bootstrap @done (14-06-13 02:39)
✔ 安裝 Carrierwave @done (14-06-13 03:21)
☐ Search function ( using Ransack )

有空想做的:
☐ 重新整理登入 / 登出畫面
☐ 加入 Facebook Login


--- ✄ -----------------------

身為商家的管理者,我要能夠在後台上架我的東西,並設定能夠販賣:
✔ 管理者必須要有一個後台 @done (14-06-12 17:56)
✔ 後台必須要可以新增產品 @done (14-06-12 17:56)
✔ 產品內容必須要有標題、文字、數量 @done (14-06-12 18:02)
✔ 產品必須要有價格 @done (14-06-13 03:21)
✔ 產品內容必須要有圖片 @done (14-06-13 03:21)

身為商家的管理者,我要能夠在後台設定權限,權限分成管理者以及消費者:
✔ 身為管理者,才可以進入後台 @done (14-06-13 03:39)
✔ 身為管理者,必須要登入且是 admin @done (14-06-13 03:39)
✔ 管理者身份必須要被分為 admin / user @done (14-06-13 03:39)


任何使用者都要能看到首頁:
✔ 首頁應該要能夠看到所有商品 @done (14-06-13 03:39)
✔ 任何使用者都要能看到首頁 @done (14-06-13 03:39)



任何使用者都要能看到產品頁:
✔ 產品頁應該能要看到標題 @done (14-06-13 04:09)
✔ 產品頁應該要能看到敘述 @done (14-06-13 04:09)
✔ 產品頁應該要能看到圖片 @done (14-06-13 04:09)

3 changes: 3 additions & 0 deletions app/assets/javascripts/accounts/orders.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin/orders.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin/products.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
4 changes: 2 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap/dropdown
//= require bootstrap/alert
3 changes: 3 additions & 0 deletions app/assets/javascripts/carts.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/orders.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/products.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/accounts/orders.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the accounts/orders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/admin/orders.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the admin/orders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/admin/products.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the admin::products controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
16 changes: 15 additions & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*= require bootstrap
*= require products
*/



.group:before, .group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1; /* IE6&7 */
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/carts.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the carts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/orders.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the orders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
8 changes: 8 additions & 0 deletions app/assets/stylesheets/products.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.product-price{
padding-top: 20px;
padding-bottom: 20px;

font-size: 30px;
font-weight: bold;
color: #ff007c;
}
9 changes: 9 additions & 0 deletions app/controllers/accounts/orders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Accounts::OrdersController < ApplicationController

def index
@orders = current_user.orders
end



end
26 changes: 26 additions & 0 deletions app/controllers/admin/orders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Admin::OrdersController < ApplicationController

def index
@orders = Order.all

end

def show
@order = Order.find(params[:id])
#@order = Order.find_by(params[:id]) 使用這樣的查詢 結果只會傳回一筆 item 但實際上有5筆 why ?
end

def update
@order = Order.find(params[:id])
#@order.params[:order => :aasm_state])

# 想法: 想透過傳入前一頁頁面的 aasm_state 的值,然後觸發讓 @order 去執行 aasm 的 event
# ex: 如果前面選 ship , 這樣我就可以執行 @order.ship 這個 event

#flash[:notice] = "aaabbbb state :" + "#{params[:order => :aasm_state]}"
#不知道為什麼無法抓出 parmas :order 這個 hash 裡面的 aasm_state 這個 hash 的值 傳不出來
render :show
end


end
Loading