Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store v3 #32

Open
wants to merge 41 commits into
base: store-v3-solution
Choose a base branch
from
Open
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
9fb01d7
first commit
xdite Jul 7, 2014
8703ff4
rails g controller admin::products (w1r2p10)
edcckao Jul 8, 2014
20aaea8
Add namespace admin with resources products in routes (w1r2p11)
edcckao Jul 8, 2014
900b387
rails g model product title:string description:text quantity:integer …
edcckao Jul 8, 2014
c773d83
Add new and create in products controller (w1r2p14)
edcckao Jul 8, 2014
fa644a0
Add products#new view (w1r2p15)
edcckao Jul 8, 2014
18069a5
Add products index and rake db:migrate (w1r2p17)
edcckao Jul 8, 2014
8ce2581
Add gem devise
edcckao Jul 8, 2014
36bf8fa
Install devise (w1r2p22)
edcckao Jul 8, 2014
8b4d7ae
Add check if user is admin and signin (w1r2p31)
edcckao Jul 8, 2014
0e260ff
Add signout (w1r2p34)
edcckao Jul 8, 2014
b5b5a7a
add gem bootstrap-sass (w1r2p40)
edcckao Jul 8, 2014
e35bb66
Add bootstrap Asset pipeline mount (w1r2p41) [end_of_w1_class]
edcckao Jul 8, 2014
9f7fe36
Apply sdlong's Gemfile
edcckao Jul 8, 2014
7daf839
Install navbar integrated with devise
edcckao Jul 9, 2014
8dd590e
Replaced form with simple_form
edcckao Jul 9, 2014
aca7ee0
Add CRUD for Products except show
edcckao Jul 9, 2014
a35c34c
Install carrierwave and add photo column in product db
edcckao Jul 9, 2014
6edc77c
Add photo thumbnail and bugfixes in product index
edcckao Jul 9, 2014
00c695b
Add user stories, store-v1 prototype completed
edcckao Jul 9, 2014
d0b2b06
Sync with XDite's answer for week2 class
edcckao Jul 14, 2014
44143f8
Add shopping cart icon (w2r1p07)
edcckao Jul 14, 2014
a2920f3
Add cart session w2r1p24)
edcckao Jul 14, 2014
5023249
Add order and checkout
edcckao Jul 14, 2014
54aa671
Add credit card payment (w2r2p11)
edcckao Jul 14, 2014
f131dc5
Add AASM to manage order states
edcckao Jul 14, 2014
237c298
Add order mailer, install roadie (with nokogiri)
edcckao Jul 15, 2014
b5ab10d
Downgrade roadie version to 2.4.3 from 3.0
edcckao Jul 17, 2014
3ed2f00
Week 2 class done
edcckao Jul 17, 2014
eedc90e
Add: Cart items can be deleted
edcckao Jul 17, 2014
4bb72c8
Add: cart item quantity and update method
edcckao Jul 17, 2014
057ad62
Add: item quantity check, and use item quantity to calculate payment
edcckao Jul 17, 2014
08dc334
Add: Item amount in cart, and clear cart after checkout
edcckao Jul 20, 2014
ffacb6f
Add account history, and back to history after checkout
edcckao Jul 20, 2014
870ee50
Add: admin can change order state at admin panel
edcckao Jul 20, 2014
a4343c1
Week 3 class end, with SettingsLogic installed and configured (mailgu…
edcckao Jul 21, 2014
09d3d55
Add extract Stripe_Charge service object, and convert tabs to spaces …
edcckao Jul 21, 2014
551809d
Add: Search with ransack
edcckao Jul 21, 2014
87ed85a
Add homework as user stories
edcckao Jul 21, 2014
2d69434
Add notify mail when an order is successfully paid with credit card
edcckao Jul 27, 2014
24b7407
Add mail to notify status 'order shipped'
edcckao Jul 27, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
.DS_Store
public/uploads
config/config.yml
23 changes: 23 additions & 0 deletions Gemfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ 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 "stripe"


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

gem "aasm"

gem 'settingslogic'
gem 'will_paginate'
gem 'ransack'

gem 'sidekiq'

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

Expand Down
87 changes: 87 additions & 0 deletions Gemfile.lock
100644 → 100755
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,38 @@ 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)
celluloid (0.15.2)
timers (~> 1.1.0)
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)
connection_pool (2.0.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 +71,25 @@ 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)
netrc (0.7.7)
nokogiri (1.6.2.1)
mini_portile (= 0.6.0)
orm_adapter (0.5.0)
polyamorous (1.0.0)
activerecord (>= 3.0)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.2)
Expand All @@ -73,8 +110,25 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
ransack (1.2.3)
actionpack (>= 3.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
i18n
polyamorous (~> 1.0.0)
rdoc (4.1.1)
json (~> 1.4)
redis (3.1.0)
redis-namespace (1.5.0)
redis (~> 3.0, >= 3.0.4)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
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 +138,16 @@ GEM
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
settingslogic (2.0.9)
sidekiq (3.2.1)
celluloid (>= 0.15.2)
connection_pool (>= 2.0.0)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
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,9 +159,15 @@ GEM
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.9)
stripe (1.14.0)
json (~> 1.8.1)
mime-types (~> 1.25)
rest-client (~> 1.4)
subexec (0.2.3)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
Expand All @@ -108,18 +178,35 @@ GEM
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)
will_paginate (3.0.7)

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)
ransack
roadie
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
settingslogic
sidekiq
simple_form (= 3.1.0rc1)
spring
sqlite3
stripe
turbolinks
uglifier (>= 1.3.0)
will_paginate
Empty file modified README.rdoc
100644 → 100755
Empty file.
Empty file modified Rakefile
100644 → 100755
Empty file.
81 changes: 81 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

購物:
✔ 身為消費者,我要在前台能夠找到商品並加到購物車 @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)
☐ use sidekiq to send mail
✔ 訂單狀態應分為未結帳、已結帳、出貨中、已出貨、辦理退貨 @done (14-06-13 17:44)
✔ 身為消費者,當我用信用卡結帳後,我的信箱要能收到一張訂購完成信 @done (14-07-28 01:16)
✔ 身為消費者,可以從信中連結查看原始訂單 @done (14-07-28 00:59)
☐ use sidekiq to send mail
✔ 身為消費者,當我在結賬後,購物⾞應自動清空 @done (14-07-21 03:03)
✔ 身為消費者,我可以從購物車內刪掉某些物品 @done (14-07-18 02:38)
✔ 身為消費者,我可以從購物車內更新購買數量 @done (14-07-18 03:30)
✔ 購物車的總價 => 小計 x 數量 @done (14-07-18 04:54)
✔ 數量為 0 的貨物不能「購買」 @done (14-07-18 04:54)
✔ 訂單支援「多重購買數量」 @done (14-07-21 03:04)
✔ 建立 account/orders 可以看到該使用者過去所有訂單 @done (14-07-21 03:15)
✔ 結賬後跳轉到 account/orders#index @done (14-07-21 03:16)

Admin 管理訂單:
✔ 身為管理者,可以在後台看訂單,訂單狀態分為未結帳、已結帳、出貨中、已出貨、辦理退貨 @done (14-07-21 03:20)
✔ 身為管理者,我可以在後台對單張訂單做狀態改變 @done (14-07-21 05:04)
✔ admin 的 order 列表應要能顯示訂單狀態 @done (14-07-21 05:04)
✔ 身為管理者,當我在將商品設為已出貨時,消費者應該收到一張已出貨的通知信 @done (14-07-28 02:21)
☐ use sidekiq to send mail
☐ 身為商家,當消費者確定購物結帳後,該商品的庫存必須按照數量減少


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 be able to update image when create product @done (14-06-13 04:09)
☐ should be 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 ) @done (14-07-22 07:26)
✔ Refactor: Service Objects @done (14-07-22 07:36)
✔ stripe charge @done (14-07-22 07:42)
✔ Install SettingsLogic and move credentials to config.yml @done (14-07-22 07:41)
✔ stripe @done (14-07-22 07:42)
✔ mailgun @done (14-07-22 07:42)
☐ Use rake to generate 10 fake accounts

有空想做的:
☐ 重新整理登入 / 登出畫面
☐ 加入 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)

Empty file modified app/assets/images/.keep
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions app/assets/javascripts/account/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/
5 changes: 3 additions & 2 deletions app/assets/javascripts/application.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap/dropdown
//= require bootstrap/alert
//= require orders
3 changes: 3 additions & 0 deletions app/assets/javascripts/card_charges.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/cart_items.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/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/
35 changes: 35 additions & 0 deletions app/assets/javascripts/orders.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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/

jQuery ($) ->
$("#payment-form").submit (event) ->
$form = $(this)

# Disable the submit button to prevent repeated clicks
$form.find("button").prop "disabled", true
Stripe.createToken $form, stripeResponseHandler

# Prevent the form from submitting with the default action
false

return

stripeResponseHandler = (status, response) ->
$form = $("#payment-form")
if response.error

# Show the errors on the form
$form.find(".payment-errors").text response.error.message
$form.find("button").prop "disabled", false
else

# token contains id, last4, and card type
token = response.id

# Insert the token into the form so it gets submitted to the server
$form.append $("<input type=\"hidden\" name=\"stripeToken\" />").val(token)

# and submit
$form.get(0).submit()
return
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/account/orders.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the account::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
100644 → 100755
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 */
}
Loading