comable_core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +57 -15
- data/app/helpers/comable/application_helper.rb +25 -0
- data/app/mailers/comable/order_mailer.rb +25 -0
- data/app/models/comable/customer.rb +1 -2
- data/app/models/comable/order.rb +37 -18
- data/app/models/comable/order_delivery.rb +7 -4
- data/app/models/comable/order_detail.rb +23 -5
- data/app/models/comable/payment.rb +0 -2
- data/app/models/comable/product.rb +1 -11
- data/app/models/comable/shipment_method.rb +6 -0
- data/app/models/comable/stock.rb +2 -8
- data/app/models/comable/store.rb +17 -0
- data/app/models/concerns/comable/sku_choice.rb +14 -0
- data/app/models/concerns/comable/sku_item.rb +17 -0
- data/app/views/comable/order_mailer/complete.text.erb +43 -0
- data/config/locales/ja.yml +22 -0
- data/db/migrate/20140120032559_create_comable_customers.rb +1 -0
- data/db/migrate/20140723175431_create_comable_orders.rb +5 -0
- data/db/migrate/20140723175810_create_comable_order_details.rb +7 -1
- data/db/migrate/20140921191416_create_comable_shipment_methods.rb +10 -0
- data/db/migrate/20140926063541_create_comable_stores.rb +11 -0
- data/lib/comable/core/engine.rb +2 -0
- data/lib/comable_core.rb +0 -1
- metadata +10 -3
- data/lib/comable/decoratable.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a04e83098af7da04af0085988beee96d9dfaf150
|
4
|
+
data.tar.gz: 30d646a65f0e590746934f8f1f34707777d54a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b51d3919bf4bd8ffc65b79d3c0142214e56ce4e1b55ed5b137b57e07e542a7231bc9ce32b1e71c24c6c301997f55e50e7dea2306ec990be9d9359391d8a593f
|
7
|
+
data.tar.gz: fe8b54aec6b72c0cd10a76fb86abe592de36b273879d3ffc1642ef9fda419dc25e9aa62c92fef070eb0e1174ef318d3b5edf19df4adfeedfe29dd709c158cead
|
data/Rakefile
CHANGED
@@ -16,27 +16,69 @@ end
|
|
16
16
|
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
17
17
|
load 'rails/tasks/engine.rake'
|
18
18
|
|
19
|
-
|
19
|
+
if File.exist?('comable.gemspec')
|
20
|
+
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
21
|
+
require 'tasks/release'
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
namespace :app do
|
24
|
+
namespace :spec do
|
25
|
+
desc 'Run the code examples'
|
26
|
+
RSpec::Core::RakeTask.new(:all) do |t|
|
27
|
+
FRAMEWORKS.each do |framework|
|
28
|
+
t.pattern << ",#{framework}/spec/**{,/*/**}/*_spec.rb"
|
29
|
+
end
|
30
|
+
end
|
23
31
|
|
24
|
-
|
25
|
-
|
26
|
-
|
32
|
+
FRAMEWORKS.each do |framework|
|
33
|
+
desc "Run the code examples in #{framework}/spec"
|
34
|
+
RSpec::Core::RakeTask.new(framework) do |t|
|
35
|
+
t.pattern = "../#{framework}/spec/**{,/*/**}/*_spec.rb"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
27
40
|
|
28
|
-
namespace :
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
41
|
+
namespace :db do
|
42
|
+
task 'migrate' => 'app:db:migrate'
|
43
|
+
task 'app:db:migrate' => 'migrate:all'
|
44
|
+
|
45
|
+
namespace :migrate do
|
46
|
+
task :all do
|
47
|
+
FRAMEWORKS.each do |framework|
|
48
|
+
command = "cd #{framework} && test -d db && bundle exec rake db:migrate RAILS_ENV=#{Rails.env}"
|
49
|
+
puts command
|
50
|
+
system command
|
51
|
+
end
|
52
|
+
end
|
33
53
|
end
|
34
54
|
|
35
|
-
|
36
|
-
|
37
|
-
|
55
|
+
namespace :migrate do
|
56
|
+
task 'reset' => 'app:db:migrate:reset'
|
57
|
+
task 'app:db:migrate:reset' => 'app:db:migrate'
|
58
|
+
task 'app:db:migrate' => 'reset:all'
|
59
|
+
|
60
|
+
namespace :reset do
|
61
|
+
task :all do
|
62
|
+
FRAMEWORKS.each do |framework|
|
63
|
+
command = "cd #{framework} && test -d db && bundle exec rake db:migrate:reset RAILS_ENV=#{Rails.env}"
|
64
|
+
puts command
|
65
|
+
system command
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
38
69
|
end
|
39
70
|
end
|
71
|
+
|
72
|
+
task default: ['app:spec:all', 'rubocop']
|
40
73
|
end
|
41
74
|
|
42
|
-
task default: ['app:spec
|
75
|
+
task default: ['app:spec', 'rubocop']
|
76
|
+
|
77
|
+
Bundler::GemHelper.install_tasks
|
78
|
+
|
79
|
+
# from https://github.com/rspec/rspec-rails/issues/936
|
80
|
+
task 'test:prepare'
|
81
|
+
|
82
|
+
task :rubocop do
|
83
|
+
exec 'rubocop'
|
84
|
+
end
|
@@ -1,11 +1,36 @@
|
|
1
1
|
module Comable
|
2
2
|
module ApplicationHelper
|
3
|
+
def current_store
|
4
|
+
@current_store || load_store
|
5
|
+
end
|
6
|
+
|
3
7
|
def current_customer
|
4
8
|
@current_customer || load_customer
|
5
9
|
end
|
6
10
|
|
11
|
+
def current_order
|
12
|
+
current_customer.incomplete_order
|
13
|
+
end
|
14
|
+
|
15
|
+
def name_with_honorific(name)
|
16
|
+
I18n.t('comable.honorific', name: name)
|
17
|
+
end
|
18
|
+
|
19
|
+
def name_with_quantity(name, quantity)
|
20
|
+
return name unless quantity
|
21
|
+
return name if quantity <= 1
|
22
|
+
[
|
23
|
+
name,
|
24
|
+
"x#{quantity}"
|
25
|
+
].join(' ')
|
26
|
+
end
|
27
|
+
|
7
28
|
private
|
8
29
|
|
30
|
+
def load_store
|
31
|
+
@current_store = Comable::Store.instance
|
32
|
+
end
|
33
|
+
|
9
34
|
def load_customer
|
10
35
|
@current_customer = logged_in_customer
|
11
36
|
@current_customer ||= Comable::Customer.new(cookies)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Comable
|
2
|
+
class OrderMailer < ActionMailer::Base
|
3
|
+
helper Comable::ApplicationHelper
|
4
|
+
helper_method :subject_for
|
5
|
+
|
6
|
+
def complete(order)
|
7
|
+
@order = order
|
8
|
+
mail(from: current_store.email_sender, to: order.email, subject: subject_for(order))
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def current_store
|
14
|
+
Comable::Store.instance
|
15
|
+
end
|
16
|
+
|
17
|
+
def subject_for(order)
|
18
|
+
[
|
19
|
+
current_store.name,
|
20
|
+
I18n.t('comable.order_mailer.complete.subject'),
|
21
|
+
order.code
|
22
|
+
].join(' ')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Comable
|
2
2
|
class Customer < ActiveRecord::Base
|
3
|
-
include Decoratable
|
4
3
|
include CartOwner
|
5
4
|
|
6
5
|
has_many :comable_orders, class_name: Comable::Order.name, foreign_key: table_name.singularize.foreign_key
|
@@ -62,7 +61,7 @@ module Comable
|
|
62
61
|
def initialize_incomplete_order
|
63
62
|
orders = find_incomplete_orders
|
64
63
|
return orders.first if orders.any?
|
65
|
-
order = orders.create(family_name: family_name, first_name: first_name, order_deliveries_attributes: [{ family_name: family_name, first_name: first_name }])
|
64
|
+
order = orders.create(family_name: family_name, first_name: first_name, email: email, order_deliveries_attributes: [{ family_name: family_name, first_name: first_name }])
|
66
65
|
@cookies.permanent.signed[:guest_token] = order.guest_token if not_logged_in?
|
67
66
|
order
|
68
67
|
end
|
data/app/models/comable/order.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
module Comable
|
2
2
|
class Order < ActiveRecord::Base
|
3
|
-
include Decoratable
|
4
|
-
|
5
3
|
belongs_to :customer, class_name: Comable::Customer.name, foreign_key: Comable::Customer.table_name.singularize.foreign_key, autosave: false
|
6
4
|
belongs_to :payment, class_name: Comable::Payment.name, foreign_key: Comable::Payment.table_name.singularize.foreign_key, autosave: false
|
5
|
+
belongs_to :shipment_method, class_name: Comable::ShipmentMethod.name, autosave: false
|
7
6
|
has_many :order_deliveries, dependent: :destroy, class_name: Comable::OrderDelivery.name, foreign_key: table_name.singularize.foreign_key
|
8
7
|
|
9
8
|
accepts_nested_attributes_for :order_deliveries
|
@@ -12,7 +11,9 @@ module Comable
|
|
12
11
|
complete_order.validates :code, presence: true
|
13
12
|
complete_order.validates :first_name, presence: true
|
14
13
|
complete_order.validates :family_name, presence: true
|
15
|
-
complete_order.validates
|
14
|
+
complete_order.validates :email, presence: true
|
15
|
+
complete_order.validates :shipment_fee, presence: true
|
16
|
+
complete_order.validates :total_price, presence: true
|
16
17
|
end
|
17
18
|
|
18
19
|
with_options if: :incomplete? do |incomplete_order|
|
@@ -20,6 +21,8 @@ module Comable
|
|
20
21
|
incomplete_order.validates :guest_token, uniqueness: { scope: [:guest_token, :completed_at] }, if: :guest_token
|
21
22
|
end
|
22
23
|
|
24
|
+
define_model_callbacks :complete
|
25
|
+
before_complete :precomplete
|
23
26
|
before_create :generate_guest_token
|
24
27
|
|
25
28
|
scope :complete, -> { where.not(completed_at: nil) }
|
@@ -33,11 +36,9 @@ module Comable
|
|
33
36
|
|
34
37
|
def complete
|
35
38
|
# TODO: トランザクションの追加
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
before_complete
|
40
|
-
save!
|
39
|
+
run_callbacks :complete do
|
40
|
+
save_to_complete!
|
41
|
+
end
|
41
42
|
self
|
42
43
|
end
|
43
44
|
|
@@ -49,29 +50,47 @@ module Comable
|
|
49
50
|
completed_at.nil?
|
50
51
|
end
|
51
52
|
|
52
|
-
#
|
53
|
-
def
|
54
|
-
|
53
|
+
# 氏名を取得
|
54
|
+
def full_name
|
55
|
+
[family_name, first_name].join(' ')
|
56
|
+
end
|
57
|
+
|
58
|
+
# 時価商品合計を取得
|
59
|
+
def current_item_total_price
|
60
|
+
order_deliveries.map(&:order_details).flatten.sum(&:current_subtotal_price)
|
55
61
|
end
|
56
62
|
|
57
|
-
#
|
58
|
-
def
|
59
|
-
order_deliveries.map(&:order_details).flatten.
|
63
|
+
# 売価商品合計を取得
|
64
|
+
def item_total_price
|
65
|
+
order_deliveries.map(&:order_details).flatten.sum(&:subtotal_price)
|
66
|
+
end
|
67
|
+
|
68
|
+
# 時価送料を取得
|
69
|
+
def current_shipment_fee
|
70
|
+
shipment_method.try(:fee) || 0
|
71
|
+
end
|
72
|
+
|
73
|
+
# 時価合計を取得
|
74
|
+
def current_total_price
|
75
|
+
current_item_total_price + current_shipment_fee
|
60
76
|
end
|
61
77
|
|
62
78
|
private
|
63
79
|
|
64
|
-
def
|
80
|
+
def save_to_complete!
|
65
81
|
self.completed_at = Time.now
|
82
|
+
self.shipment_fee = current_shipment_fee
|
83
|
+
self.total_price = current_total_price
|
66
84
|
generate_code
|
67
|
-
order_deliveries.each(&:
|
85
|
+
order_deliveries.each(&:save_to_complete)
|
86
|
+
save!
|
68
87
|
end
|
69
88
|
|
70
89
|
def valid_stock
|
71
90
|
order_deliveries.map(&:order_details).flatten.each do |order_detail|
|
72
|
-
return errors.add :base, "「#{order_detail.stock.
|
91
|
+
return errors.add :base, "「#{order_detail.stock.name_with_sku}」の注文数が不正です。" if order_detail.quantity <= 0
|
73
92
|
quantity = order_detail.stock.quantity - order_detail.quantity
|
74
|
-
return errors.add :base, "「#{order_detail.stock.
|
93
|
+
return errors.add :base, "「#{order_detail.stock.name_with_sku}」の在庫が不足しています。" if quantity < 0
|
75
94
|
end
|
76
95
|
end
|
77
96
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Comable
|
2
2
|
class OrderDelivery < ActiveRecord::Base
|
3
|
-
include Decoratable
|
4
|
-
|
5
3
|
belongs_to :order, class_name: Comable::Order.name, foreign_key: Comable::Order.table_name.singularize.foreign_key
|
6
4
|
has_many :order_details, dependent: :destroy, class_name: Comable::OrderDetail.name, foreign_key: table_name.singularize.foreign_key
|
7
5
|
|
@@ -9,8 +7,13 @@ module Comable
|
|
9
7
|
delegate :guest_token, to: :order
|
10
8
|
delegate :complete?, to: :order
|
11
9
|
|
12
|
-
def
|
13
|
-
order_details.each(&:
|
10
|
+
def save_to_complete
|
11
|
+
order_details.each(&:save_to_complete)
|
12
|
+
end
|
13
|
+
|
14
|
+
# 氏名を取得
|
15
|
+
def full_name
|
16
|
+
[family_name, first_name].join(' ')
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Comable
|
2
2
|
class OrderDetail < ActiveRecord::Base
|
3
|
-
include
|
3
|
+
include Comable::SkuItem
|
4
|
+
include Comable::SkuChoice
|
4
5
|
|
5
6
|
belongs_to :stock, class_name: Comable::Stock.name, foreign_key: Comable::Stock.table_name.singularize.foreign_key
|
6
7
|
belongs_to :order_delivery, class_name: Comable::OrderDelivery.name, foreign_key: Comable::OrderDelivery.table_name.singularize.foreign_key
|
@@ -11,11 +12,18 @@ module Comable
|
|
11
12
|
delegate :guest_token, to: :order_delivery
|
12
13
|
delegate :complete?, to: :order_delivery
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
before_save :save_to_add_cart, unless: :complete?
|
16
|
+
|
17
|
+
def save_to_complete
|
18
|
+
self.attributes = current_attributes
|
16
19
|
decrement_stock
|
17
20
|
end
|
18
21
|
|
22
|
+
# TODO: カート投入時との差額表示
|
23
|
+
def save_to_add_cart
|
24
|
+
self.attributes = current_attributes
|
25
|
+
end
|
26
|
+
|
19
27
|
# 時価を取得
|
20
28
|
def current_price
|
21
29
|
stock.price
|
@@ -31,12 +39,22 @@ module Comable
|
|
31
39
|
price * quantity
|
32
40
|
end
|
33
41
|
|
42
|
+
private
|
43
|
+
|
34
44
|
def decrement_stock
|
35
45
|
stock.decrement!(quantity: quantity)
|
36
46
|
end
|
37
47
|
|
38
|
-
def
|
39
|
-
|
48
|
+
def current_attributes
|
49
|
+
{
|
50
|
+
name: product.name,
|
51
|
+
code: stock.code,
|
52
|
+
price: stock.price,
|
53
|
+
sku_h_item_name: product.sku_h_item_name,
|
54
|
+
sku_v_item_name: product.sku_v_item_name,
|
55
|
+
sku_h_choice_name: stock.sku_h_choice_name,
|
56
|
+
sku_v_choice_name: stock.sku_v_choice_name
|
57
|
+
}
|
40
58
|
end
|
41
59
|
end
|
42
60
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Comable
|
2
2
|
class Product < ActiveRecord::Base
|
3
|
-
include
|
3
|
+
include Comable::SkuItem
|
4
4
|
|
5
5
|
has_many :stocks, class_name: Comable::Stock.name, foreign_key: table_name.singularize.foreign_key
|
6
6
|
after_create :create_stock
|
@@ -13,16 +13,6 @@ module Comable
|
|
13
13
|
!unsold?
|
14
14
|
end
|
15
15
|
|
16
|
-
def sku_h?
|
17
|
-
sku_h_item_name.present?
|
18
|
-
end
|
19
|
-
|
20
|
-
def sku_v?
|
21
|
-
sku_v_item_name.present?
|
22
|
-
end
|
23
|
-
|
24
|
-
alias_method :sku?, :sku_h?
|
25
|
-
|
26
16
|
private
|
27
17
|
|
28
18
|
def create_stock
|
data/app/models/comable/stock.rb
CHANGED
@@ -4,7 +4,7 @@ module Comable
|
|
4
4
|
# 商品に複数紐付き、品数やSKU(Stock Keeping Unit)情報を保持する。
|
5
5
|
#
|
6
6
|
class Stock < ActiveRecord::Base
|
7
|
-
include
|
7
|
+
include Comable::SkuChoice
|
8
8
|
|
9
9
|
belongs_to :product, class_name: Comable::Product.name, foreign_key: Comable::Product.table_name.singularize.foreign_key
|
10
10
|
|
@@ -28,16 +28,10 @@ module Comable
|
|
28
28
|
# @!endgroup
|
29
29
|
#
|
30
30
|
|
31
|
+
delegate :name, to: :product
|
31
32
|
delegate :price, to: :product
|
32
33
|
delegate :sku?, to: :product
|
33
34
|
|
34
|
-
def name
|
35
|
-
return product.name unless product.sku?
|
36
|
-
sku_name = sku_h_choice_name
|
37
|
-
sku_name += '/' + sku_v_choice_name if sku_v_choice_name.present?
|
38
|
-
product.name + "(#{sku_name})"
|
39
|
-
end
|
40
|
-
|
41
35
|
# 在庫の有無を取得する
|
42
36
|
#
|
43
37
|
# @example
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Comable
|
2
|
+
class Store < ActiveRecord::Base
|
3
|
+
class << self
|
4
|
+
def instance
|
5
|
+
Comable::Store.first || Comable::Store.new(name: default_store_name)
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_store_name
|
9
|
+
'Comable store'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def email_activate?
|
14
|
+
email_activate_flag && email_sender.present?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Comable
|
2
|
+
#
|
3
|
+
# SKU選択肢
|
4
|
+
# 商品と注文明細にSKU選択肢としての機能を付与するためのモジュール
|
5
|
+
#
|
6
|
+
module SkuChoice
|
7
|
+
def name_with_sku
|
8
|
+
return name unless sku?
|
9
|
+
sku_name = sku_h_choice_name
|
10
|
+
sku_name += '/' + sku_v_choice_name if sku_v_choice_name.present?
|
11
|
+
name + "(#{sku_name})"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= subject_for(@order) %>
|
2
|
+
<%= "#{@order.class.human_attribute_name(:code)}: #{@order.code}" %>
|
3
|
+
----------------------------------------------------------------------
|
4
|
+
|
5
|
+
<%= I18n.t('comable.order_mailer.complete.dear', name: @order.full_name) %>
|
6
|
+
|
7
|
+
<%= I18n.t('comable.order_mailer.complete.introductions', store_name: current_store.name) %>
|
8
|
+
|
9
|
+
<%- shipment_method = @order.shipment_method %>
|
10
|
+
<%- if shipment_method %>
|
11
|
+
<%= shipment_method.class.model_name.human %>:
|
12
|
+
<%= shipment_method.name %>
|
13
|
+
<%- end %>
|
14
|
+
|
15
|
+
<%= Comable::OrderDelivery.model_name.human %>:
|
16
|
+
<%- @order.order_deliveries.each do |order_delivery| %>
|
17
|
+
<%= name_with_honorific order_delivery.full_name %>
|
18
|
+
<%- end %>
|
19
|
+
|
20
|
+
======================================================================
|
21
|
+
|
22
|
+
<%= Comable::Order.model_name.human %>
|
23
|
+
|
24
|
+
<%= "#{@order.class.human_attribute_name(:code)}: #{@order.code}" %>
|
25
|
+
<%= "#{@order.class.human_attribute_name(:completed_at)}: #{I18n.l @order.completed_at.to_date}" %>
|
26
|
+
|
27
|
+
<%- @order.order_deliveries.map(&:order_details).flatten.each do |order_detail| %>
|
28
|
+
<%= name_with_quantity order_detail.name_with_sku, order_detail.quantity %>
|
29
|
+
<%= number_to_currency order_detail.subtotal_price %>
|
30
|
+
|
31
|
+
<%- end %>
|
32
|
+
----------------------------------------------------------------------
|
33
|
+
|
34
|
+
<%= "#{@order.class.human_attribute_name(:item_total_price)}: #{number_to_currency @order.item_total_price}" %>
|
35
|
+
<%= "#{@order.class.human_attribute_name(:shipment_fee)}: #{number_to_currency @order.shipment_fee}" %>
|
36
|
+
|
37
|
+
<%= "#{@order.class.human_attribute_name(:total_price)}: #{number_to_currency @order.total_price}" %>
|
38
|
+
|
39
|
+
<%= "#{@order.class.human_attribute_name(:payment)}: #{@order.payment.name}\n" if @order.payment -%>
|
40
|
+
|
41
|
+
======================================================================
|
42
|
+
|
43
|
+
<%= I18n.t('comable.order_mailer.complete.outroductions', store_name: current_store.name) %>
|
data/config/locales/ja.yml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
ja:
|
2
2
|
comable:
|
3
|
+
honorific: &honorific
|
4
|
+
'%{name} 様'
|
5
|
+
|
3
6
|
carts:
|
4
7
|
add_product: '1つの商品がカートに入りしました'
|
5
8
|
product_not_found: 'ご指定の商品は見つかりませんでした'
|
@@ -9,3 +12,22 @@ ja:
|
|
9
12
|
orders:
|
10
13
|
success: '注文が完了しました'
|
11
14
|
failure: '注文に失敗しました。入力項目を見直してください。'
|
15
|
+
|
16
|
+
order_mailer:
|
17
|
+
complete:
|
18
|
+
subject: '注文完了メール'
|
19
|
+
dear: *honorific
|
20
|
+
introductions: |-
|
21
|
+
%{store_name} をご利用いただきましてありがとうございます。
|
22
|
+
ご注文内容は下記のとおりです。
|
23
|
+
outroductions: |-
|
24
|
+
またのご利用をお待ちしております。
|
25
|
+
%{store_name}
|
26
|
+
order: 'ご注文内容'
|
27
|
+
order_delivery: 'お届け先'
|
28
|
+
|
29
|
+
activerecord:
|
30
|
+
models:
|
31
|
+
comable/order: ご注文
|
32
|
+
comable/order_delivery: お届け先
|
33
|
+
comable/order_details: ご注文明細
|
@@ -7,6 +7,11 @@ class CreateComableOrders < ActiveRecord::Migration
|
|
7
7
|
t.string :code
|
8
8
|
t.string :family_name
|
9
9
|
t.string :first_name
|
10
|
+
t.string :email
|
11
|
+
t.integer :shipment_fee, null: false, default: 0
|
12
|
+
t.string :shipment_tracking_number
|
13
|
+
t.integer :shipment_method_id
|
14
|
+
t.integer :total_price
|
10
15
|
t.datetime :completed_at
|
11
16
|
end
|
12
17
|
|
@@ -3,7 +3,13 @@ class CreateComableOrderDetails < ActiveRecord::Migration
|
|
3
3
|
create_table :comable_order_details do |t|
|
4
4
|
t.integer :comable_order_delivery_id, null: false
|
5
5
|
t.integer :comable_stock_id, null: false
|
6
|
-
t.
|
6
|
+
t.string :name, null: false
|
7
|
+
t.string :code, null: false
|
8
|
+
t.integer :price, null: false
|
9
|
+
t.string :sku_h_item_name
|
10
|
+
t.string :sku_v_item_name
|
11
|
+
t.string :sku_h_choice_name
|
12
|
+
t.string :sku_v_choice_name
|
7
13
|
t.integer :quantity, default: 1, null: false
|
8
14
|
end
|
9
15
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreateComableShipmentMethods < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :comable_shipment_methods do |t|
|
4
|
+
t.boolean :activate_flag, null: false, default: true
|
5
|
+
t.string :name, null: false
|
6
|
+
t.integer :fee, null: false
|
7
|
+
t.string :traking_url
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateComableStores < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :comable_stores do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :meta_keyword
|
6
|
+
t.string :meta_description
|
7
|
+
t.string :email_sender
|
8
|
+
t.boolean :email_activate_flag, null: false, default: true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/comable/core/engine.rb
CHANGED
data/lib/comable_core.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comable_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YOSHIDA Hiroki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,13 +36,19 @@ files:
|
|
36
36
|
- app/assets/stylesheets/comable/application.css
|
37
37
|
- app/helpers/comable/application_helper.rb
|
38
38
|
- app/helpers/comable/products_helper.rb
|
39
|
+
- app/mailers/comable/order_mailer.rb
|
39
40
|
- app/models/comable/customer.rb
|
40
41
|
- app/models/comable/order.rb
|
41
42
|
- app/models/comable/order_delivery.rb
|
42
43
|
- app/models/comable/order_detail.rb
|
43
44
|
- app/models/comable/payment.rb
|
44
45
|
- app/models/comable/product.rb
|
46
|
+
- app/models/comable/shipment_method.rb
|
45
47
|
- app/models/comable/stock.rb
|
48
|
+
- app/models/comable/store.rb
|
49
|
+
- app/models/concerns/comable/sku_choice.rb
|
50
|
+
- app/models/concerns/comable/sku_item.rb
|
51
|
+
- app/views/comable/order_mailer/complete.text.erb
|
46
52
|
- config/locales/ja.yml
|
47
53
|
- db/migrate/20131214194807_create_comable_products.rb
|
48
54
|
- db/migrate/20140120032559_create_comable_customers.rb
|
@@ -51,9 +57,10 @@ files:
|
|
51
57
|
- db/migrate/20140723175624_create_comable_order_deliveries.rb
|
52
58
|
- db/migrate/20140723175810_create_comable_order_details.rb
|
53
59
|
- db/migrate/20140817194104_create_comable_payments.rb
|
60
|
+
- db/migrate/20140921191416_create_comable_shipment_methods.rb
|
61
|
+
- db/migrate/20140926063541_create_comable_stores.rb
|
54
62
|
- lib/comable/cart_owner.rb
|
55
63
|
- lib/comable/core/engine.rb
|
56
|
-
- lib/comable/decoratable.rb
|
57
64
|
- lib/comable/errors.rb
|
58
65
|
- lib/comable/payment_method.rb
|
59
66
|
- lib/comable/payment_method/base.rb
|
data/lib/comable/decoratable.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
module Comable
|
2
|
-
module Decoratable
|
3
|
-
def self.included(base)
|
4
|
-
# refs: http://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers
|
5
|
-
Dir.glob(Rails.root + "app/decorators/comable/#{base.name.demodulize.underscore}_decorator*.rb").each do |c|
|
6
|
-
require_dependency(c)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|