ba_spree 1.0.0 → 1.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/README.md +4 -1
- data/app/controllers/ba_spree/checkout_controller_decorator.rb +23 -0
- data/app/controllers/ba_spree/storefront_api_products_controller_decorator.rb +28 -0
- data/app/controllers/ba_spree/storefront_api_variants_controller_decorator.rb +27 -0
- data/app/finders/ba_spree/products/find_decorator.rb +19 -0
- data/app/helpers/spree/base_helper_decorator.rb +23 -8
- data/app/models/ba_spree/line_item_decorator.rb +14 -0
- data/app/models/ba_spree/order_decorator.rb +6 -0
- data/app/models/ba_spree/product_decorator.rb +14 -0
- data/app/models/spree/promotion_handler/cart_decorator.rb +5 -0
- data/app/overrides/keep_bill_address_form_open_on_error.rb +13 -0
- data/app/views/themes/default/spree/orders/_summary.html.erb +15 -4
- data/config/locales/en.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/lib/ba_spree/version.rb +1 -1
- data/lib/ba_spree.rb +20 -0
- metadata +50 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ff58a21f768530a02800b2fc55181f69d07e8abf91b2e2da5b0a9064e412b7e
|
|
4
|
+
data.tar.gz: d16fd26564e35a8a448420fd8f7dc585111c11f4fbb3e5204a73c299bfb9c9ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc60da4dd93ffcf3d0d15e823f5f6f264a3368c4614b2c2bcde5527cf4bf0146b45cabfe4277d0e57478a5fdeac1ca131f011e6a3bc924627eba02553b6e7ed5
|
|
7
|
+
data.tar.gz: dc7bd940663133de589568351e00d546587163bdebe19eb81a2872df644238e2cae1fe3420153bd2ccf7f3f8c4365947487e7a299027464d70f6d8ae10384f54
|
data/README.md
CHANGED
|
@@ -69,7 +69,7 @@ are specific to your shop, so set them yourself.
|
|
|
69
69
|
|
|
70
70
|
## What you get
|
|
71
71
|
|
|
72
|
-
ba_spree itself is a thin wrapper. The substance is these
|
|
72
|
+
ba_spree itself is a thin wrapper. The substance is these 23 engines, all
|
|
73
73
|
pulled in by a single `gem 'ba_spree'`.
|
|
74
74
|
|
|
75
75
|
### Japanese commerce conventions
|
|
@@ -99,6 +99,9 @@ pulled in by a single `gem 'ba_spree'`.
|
|
|
99
99
|
| `spree_auto_capture_digital` | Auto-capture orders containing only digital products |
|
|
100
100
|
| `spree_digital_payment_notice` | Show payment notices for orders containing digital products |
|
|
101
101
|
| `spree_checkout_signup_promotion` | Prompt sign-up / login at the checkout address step |
|
|
102
|
+
| `spree_order_total_discount` | Percentage discount on the order total |
|
|
103
|
+
| `spree_common_shipping_method_splitter` | Ship items in one package when their shipping categories share a shipping method |
|
|
104
|
+
| `spree_promotion_action_create_line_items` | Stop customers adding, changing or removing the items a promotion adds to the cart |
|
|
102
105
|
|
|
103
106
|
### Analytics
|
|
104
107
|
|
|
@@ -2,6 +2,7 @@ module BaSpree
|
|
|
2
2
|
module CheckoutControllerDecorator
|
|
3
3
|
def self.prepended(base)
|
|
4
4
|
base.before_action :filter_bill_address_when_use_shipping, only: [ :update ], if: -> { params[:state] == 'payment' }
|
|
5
|
+
base.before_action :ensure_line_item_prices_current, only: [ :edit, :update ]
|
|
5
6
|
end
|
|
6
7
|
|
|
7
8
|
protected
|
|
@@ -10,6 +11,9 @@ module BaSpree
|
|
|
10
11
|
# @gem-override spree_storefront-5.3.6/app/controllers/spree/checkout_controller.rb#load_order
|
|
11
12
|
# reason: ゲストチェックアウト対応のため super なしで丸ごと再実装。本家のゲスト処理を
|
|
12
13
|
# handle_guest_checkout / create_guest_order に抽出している (commit d0dbe2b4)
|
|
14
|
+
# #1352: 抽出時に落ちていた本家の `elsif !current_store.prefers_guest_checkout?` →
|
|
15
|
+
# `require_user(redirect_path: spree_signup_path)` の分岐を復元した。
|
|
16
|
+
# これが無いと guest_checkout を OFF にしてもゲストのカートがチェックアウトへ進めてしまう。
|
|
13
17
|
# @see https://github.com/be-agile/giga-repeat/commit/d0dbe2b4524e22c1cf974bbd4829c587ef7cd254
|
|
14
18
|
def load_order
|
|
15
19
|
return @order if @order.present?
|
|
@@ -34,6 +38,11 @@ module BaSpree
|
|
|
34
38
|
elsif try_spree_current_user.nil? && !allow_access_to_complete_order_with_new_user?
|
|
35
39
|
handle_guest_checkout
|
|
36
40
|
end
|
|
41
|
+
elsif !current_store.prefers_guest_checkout?
|
|
42
|
+
# 本家にある分岐。ユーザーが紐付いていない(=純粋なゲストの)カートは、
|
|
43
|
+
# ゲスト購入が無効なストアではログインを要求する。
|
|
44
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1352
|
|
45
|
+
require_user(redirect_path: spree_signup_path)
|
|
37
46
|
end
|
|
38
47
|
|
|
39
48
|
# completed orders shouldn't be updated anymore
|
|
@@ -94,6 +103,20 @@ module BaSpree
|
|
|
94
103
|
end
|
|
95
104
|
end
|
|
96
105
|
|
|
106
|
+
# チェックアウトを放置している間に商品価格が変わっていたら、住所入力からやり直させる。
|
|
107
|
+
# address から次へ進むときに Spree が明細価格を再計算し、続く配送・支払ステップで
|
|
108
|
+
# 送料・税・支払金額が現在価格で作り直される。
|
|
109
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1392
|
|
110
|
+
def ensure_line_item_prices_current
|
|
111
|
+
# 価格の再計算が走るのは address から次へ進むときだけなので、それより後の state だけ判定する
|
|
112
|
+
return unless %w[delivery payment confirm].include?(@order.state)
|
|
113
|
+
return unless @order.line_item_prices_stale?
|
|
114
|
+
|
|
115
|
+
@order.restart_checkout_flow
|
|
116
|
+
flash[:error] = Spree.t(:line_item_prices_changed)
|
|
117
|
+
redirect_to spree.checkout_state_path(@order.token, 'address')
|
|
118
|
+
end
|
|
119
|
+
|
|
97
120
|
def filter_bill_address_when_use_shipping
|
|
98
121
|
return unless params[:order]&.dig(:bill_address_attributes)
|
|
99
122
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module BaSpree
|
|
2
|
+
# storefront API の商品取得を、HTML 側と同じ公開状態の判定に揃える。
|
|
3
|
+
#
|
|
4
|
+
# 本家の scope は for_store + accessible_by(:show) だけで、ゲストに適用される
|
|
5
|
+
# Spree::PermissionSets::DefaultCustomer が `can :read, Spree::Product` を条件なしで
|
|
6
|
+
# 与えるため、公開状態の絞り込みが効いていない。結果、slug か id を指定すれば
|
|
7
|
+
# draft(非公開) / archived(取扱対象外) / 論理削除済みの商品が取得できていた。
|
|
8
|
+
#
|
|
9
|
+
# 一覧も同じ scope を通るので、filter[show_discontinued] / filter[show_deleted] を
|
|
10
|
+
# 渡してフィルタを外す経路もここで塞がる(for_user が付ける status = 'active' は
|
|
11
|
+
# finder の include_discontinued では外れず、not_deleted は生 SQL の where なので
|
|
12
|
+
# with_deleted の unscope でも消えない)。
|
|
13
|
+
#
|
|
14
|
+
# prepend 先は storefront のコントローラに限定する。Spree::Api::V2::ResourceController に
|
|
15
|
+
# 当てると、それを継承する Spree::Api::V2::Platform::ResourceController 経由で
|
|
16
|
+
# Platform API 全体が Spree::Variant 等に for_user を呼んで NoMethodError になる。
|
|
17
|
+
#
|
|
18
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1352
|
|
19
|
+
module StorefrontApiProductsControllerDecorator
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def scope(skip_cancancan: false)
|
|
23
|
+
super.for_user(spree_current_user)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Spree::Api::V2::Storefront::ProductsController.prepend(BaSpree::StorefrontApiProductsControllerDecorator)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module BaSpree
|
|
2
|
+
# storefront API のバリエーション取得も、商品と同じ公開状態の判定に揃える
|
|
3
|
+
# (draft / archived / 論理削除済みの商品の SKU・価格が取得できていた)。
|
|
4
|
+
#
|
|
5
|
+
# scope の返り値は Spree::Variant のリレーションで、for_user は Spree::Product の
|
|
6
|
+
# スコープのため後ろにチェーンできない。商品を引く側に挟む必要があるので、
|
|
7
|
+
# 本家のメソッドを丸ごと再実装している。
|
|
8
|
+
module StorefrontApiVariantsControllerDecorator
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
# @gem-override spree_api-5.3.6/app/controllers/spree/api/v2/storefront/variants_controller.rb#scope
|
|
12
|
+
# reason: 本家の product_scope に for_user を挟むため。for_user は Spree::Product の
|
|
13
|
+
# スコープで、本家の返り値(Spree::Variant のリレーション)にはチェーンできない。
|
|
14
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1352
|
|
15
|
+
def scope(skip_cancancan: false)
|
|
16
|
+
product_scope = Spree::Product.for_store(current_store)
|
|
17
|
+
product_scope = product_scope.accessible_by(current_ability, :show) unless skip_cancancan
|
|
18
|
+
product_scope = product_scope.for_user(spree_current_user)
|
|
19
|
+
product_scope = product_scope.i18n if model_class.include?(Spree::TranslatableResource)
|
|
20
|
+
|
|
21
|
+
product = product_scope.friendly.find(params[:id])
|
|
22
|
+
product.variants_including_master
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Spree::Api::V2::Storefront::VariantsController.prepend(BaSpree::StorefrontApiVariantsControllerDecorator)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module BaSpree
|
|
2
|
+
module Products
|
|
3
|
+
module FindDecorator
|
|
4
|
+
private
|
|
5
|
+
|
|
6
|
+
# @gem-override spree_core-5.3.6/app/finders/spree/products/find.rb#ordered
|
|
7
|
+
# reason: 「関連性」の並び順で、親カテゴリの一覧に子カテゴリの商品が混ざって並ばないよう、
|
|
8
|
+
# カテゴリツリーの縦型探索順に並べる。
|
|
9
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1503
|
|
10
|
+
def ordered(products)
|
|
11
|
+
return super unless %w[default manual].include?(sort_by) && taxons?
|
|
12
|
+
|
|
13
|
+
products.ascend_by_taxons_tree_position(taxons)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Spree::Products::Find.prepend(BaSpree::Products::FindDecorator)
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
module BaseHelperDecorator
|
|
3
|
+
# Issue #1153: ストアフロントのフラグメントキャッシュのキーは、本家では
|
|
4
|
+
# locale / currency / ログイン中か否か / role_users しか持たず、ユーザごとの差が入らない。
|
|
5
|
+
# このままカテゴリ・商品・価格をユーザごとに絞ると、別のユーザ向けに生成された HTML が
|
|
6
|
+
# そのまま出るため、顧客グループID(ソート済み)を署名として足して分離する。
|
|
7
|
+
# spree_storefront_base_cache_key の中身でもあるため、ナビ・一覧・絞り込みサイドバーが
|
|
8
|
+
# これ1箇所で分離される。Issue #1219 で残っていた「一覧の価格が別グループのユーザに
|
|
9
|
+
# 見える」経路の修正も兼ねる。
|
|
10
|
+
# 本家と同じく defined?(try_spree_current_user) のガードを維持する
|
|
11
|
+
# (Spree::BaseHelper は Spree::MailHelper と Spree::VariantPresenter にも include され、
|
|
12
|
+
# そこでは try_spree_current_user が未定義のため)。
|
|
13
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1153
|
|
14
|
+
# メモ化には本家と別の ivar を使う。本家も @spree_base_cache_key に ||= するため、同じ
|
|
15
|
+
# ivar を使うと「||= が左辺を先に読む」という評価順序に依存することになり、本家の実装が
|
|
16
|
+
# 変わったときに顧客グループIDだけが無音で落ちる(別グループ向けの HTML が出る)。
|
|
17
|
+
def spree_base_cache_key
|
|
18
|
+
@ba_spree_base_cache_key ||= [
|
|
19
|
+
*super,
|
|
20
|
+
(defined?(try_spree_current_user) && try_spree_current_user.try(:customer_group_ids)&.sort)
|
|
21
|
+
].compact
|
|
22
|
+
end
|
|
23
|
+
|
|
3
24
|
CHILD_TAXONS_SECTION_DEFAULT_PREFERENCES = {
|
|
4
25
|
heading_size: 'medium',
|
|
5
26
|
heading_alignment: 'center'
|
|
@@ -32,14 +53,8 @@ module Spree
|
|
|
32
53
|
class ChildTaxonsSection < SimpleDelegator
|
|
33
54
|
def cache_key
|
|
34
55
|
child_taxon_ids = links.map(&:linkable_id)
|
|
35
|
-
max_updated_at = links.
|
|
36
|
-
"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# ActiveSupport::Cache は cache_key より先にこちらを見るため、
|
|
40
|
-
# 委譲先の実装が使われないよう合わせて上書きする
|
|
41
|
-
def cache_key_with_version
|
|
42
|
-
cache_key
|
|
56
|
+
max_updated_at = links.map(&:linkable).map(&:updated_at).max.to_i
|
|
57
|
+
"#{child_taxon_ids.join('-')}-#{max_updated_at}"
|
|
43
58
|
end
|
|
44
59
|
end
|
|
45
60
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module BaSpree
|
|
2
|
+
module LineItemDecorator
|
|
3
|
+
# 注文に写し取った price が、現在の販売価格(Spree::LineItem#update_price と同じ計算)とずれているか。
|
|
4
|
+
# 価格の再計算は address から次へ進むときにしか走らないため、チェックアウトを長期間放置した注文で
|
|
5
|
+
# 商品価格(予約割引の終了・価格改定)が変わったことを検知するのに使う。
|
|
6
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1392
|
|
7
|
+
def price_stale?
|
|
8
|
+
context = Spree::Pricing::Context.from_order(variant, order, quantity: quantity)
|
|
9
|
+
variant.price_for(context).price_including_vat_for(tax_zone: tax_zone) != price
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Spree::LineItem.prepend(BaSpree::LineItemDecorator)
|
|
@@ -89,6 +89,12 @@ module BaSpree
|
|
|
89
89
|
# (cancel! 内の after_cancel が 'order.canceled' を publish 済みなので、ここは update のみ)
|
|
90
90
|
publish_event('order.updated')
|
|
91
91
|
end
|
|
92
|
+
|
|
93
|
+
# 現在の販売価格とずれている明細が1つでもあるか
|
|
94
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1392
|
|
95
|
+
def line_item_prices_stale?
|
|
96
|
+
line_items.any?(&:price_stale?)
|
|
97
|
+
end
|
|
92
98
|
end
|
|
93
99
|
end
|
|
94
100
|
|
|
@@ -24,6 +24,20 @@ module BaSpree
|
|
|
24
24
|
|
|
25
25
|
# ProductProperty -> metafields 移行用の読み書きヘルパー(Spree 5.4 の Property 削除対応)
|
|
26
26
|
base.include Spree::ProductPropertyMetafields
|
|
27
|
+
|
|
28
|
+
# 指定カテゴリ群の中で、カテゴリツリーを縦型探索した順(lft) → カテゴリ内の商品の並び順(position) に並べる。
|
|
29
|
+
# 複数のカテゴリに属する商品は、最初に出てくる位置で並ぶ。
|
|
30
|
+
# taxon は、絞り込みに使う spree_products_taxons の行からたどり、指定カテゴリ群の行だけで MIN をとる。
|
|
31
|
+
base.add_search_scope :ascend_by_taxons_tree_position do |taxon_ids|
|
|
32
|
+
# position(INT)の上の桁に lft を置いた1つの整数にする
|
|
33
|
+
tree_position_sql = "MIN(#{Spree::Taxon.table_name}.lft * #{2**32} + #{Spree::Classification.table_name}.position)"
|
|
34
|
+
|
|
35
|
+
joins(classifications: :taxon).
|
|
36
|
+
where(Spree::Classification.table_name => { taxon_id: taxon_ids }).
|
|
37
|
+
select("#{Spree::Product.table_name}.*", "#{tree_position_sql} AS taxon_tree_position").
|
|
38
|
+
group("#{Spree::Product.table_name}.id").
|
|
39
|
+
order(Arel.sql("#{tree_position_sql} ASC"))
|
|
40
|
+
end
|
|
27
41
|
end
|
|
28
42
|
|
|
29
43
|
def set_slug
|
|
@@ -18,7 +18,12 @@ module Spree
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
# 注文に紐づいたプロモーションは、条件を外れたときに取り消す(deactivate)ため除外しない
|
|
21
22
|
def exclude_promotion_ids
|
|
23
|
+
unmatched_product_rule_promotion_ids - order.promotion_ids
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def unmatched_product_rule_promotion_ids
|
|
22
27
|
cart_product_ids = order.line_items.joins(:variant).pluck('spree_variants.product_id').uniq
|
|
23
28
|
# Find all promotions with Product rules
|
|
24
29
|
all_product_rule_promotions = Spree::Promotion
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# payment 画面で請求先住所(bill_address)を新規入力して送信し、バリデーションで差し戻された
|
|
2
|
+
# とき、本家は bill_address が new_record? のため「配送先と同じ(use_shipping)」を再びチェック
|
|
3
|
+
# 済みにし、入力したフォームを hidden に戻してしまう。入力欄の直下に出したエラーも一緒に
|
|
4
|
+
# 隠れて、何が悪かったのか分からなくなる。
|
|
5
|
+
#
|
|
6
|
+
# 請求先住所にエラーがあるときは use_shipping を外し、フォームを開いたままにする。
|
|
7
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1397
|
|
8
|
+
Deface::Override.new(
|
|
9
|
+
virtual_path: 'spree/checkout/_payment',
|
|
10
|
+
name: 'keep_bill_address_form_open_on_error',
|
|
11
|
+
replace: "erb[silent]:contains('use_shipping = ')",
|
|
12
|
+
text: "<% use_shipping = (@order.shipping_eq_billing_address? || @order.bill_address.nil? || @order.bill_address.new_record?) && @order.requires_ship_address? && (@order.bill_address.nil? || @order.bill_address.errors.empty?) %>"
|
|
13
|
+
)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<%# @gem-override spree_storefront-5.3.6/app/views/themes/default/spree/orders/_summary.html.erb %>
|
|
2
|
-
<%# reason: カートサマリの小計・割引・合計表示を adjustments
|
|
2
|
+
<%# reason: カートサマリの小計・割引・合計表示を adjustments ベースに組み替え、買い物を続けるボタンを追加している。空のクイックチェックアウト欄を出さず、スマホでボタンを横幅いっぱいにしている %>
|
|
3
|
+
<%# (「レジに進む」を押したらカートをローディング状態にして連打を防ぐ) %>
|
|
3
4
|
<%# @see https://github.com/be-agile/giga-repeat/issues/698 %>
|
|
5
|
+
<%# @see https://github.com/be-agile/giga-repeat/issues/1390 %>
|
|
4
6
|
<%= turbo_frame_tag :cart_summary do %>
|
|
5
7
|
<% if order.line_items.any? %>
|
|
6
8
|
<div class="cart-summary-container p-4">
|
|
@@ -53,7 +55,9 @@
|
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
<div class="flex <%= !turbo_frame_request? && !turbo_stream_request? ? 'flex-row' : 'flex-col' %> gap-4 mt-4 w-full justify-end items-end">
|
|
56
|
-
|
|
58
|
+
<%# quick_checkout_enabled? は注文の条件しか見ないので、Apple Pay 等のボタンのパーシャルが1つも登録されていないと
|
|
59
|
+
中身が空の w-full の欄だけが出て、隣の「レジに進む」等のボタンの幅を半分奪う。パーシャルがあるときだけ出す %>
|
|
60
|
+
<% if quick_checkout_enabled?(@order) && Spree.storefront.partials.quick_checkout.any? %>
|
|
57
61
|
<div class="min-h-[46px] w-full has-[turbo-frame]:block group no-separator">
|
|
58
62
|
<% if !turbo_frame_request? && !turbo_stream_request? %>
|
|
59
63
|
<%= render partial: 'spree/checkout/quick_checkout', locals: { height: 46, theme: 'black', button_width: 320, container_class: "w-full flex justify-end" } %>
|
|
@@ -62,21 +66,28 @@
|
|
|
62
66
|
<% end %>
|
|
63
67
|
</div>
|
|
64
68
|
<% end %>
|
|
65
|
-
|
|
69
|
+
<%# 幅を指定しないと中身に合わせて縮み、日本語は1文字ごとに改行できるのでボタンが極端に細くなる。
|
|
70
|
+
スマホではボタンを横幅いっぱいに広げ、PC では幅 320px(lg:w-80)でページなら右寄せ・スライドオーバーなら中央にする。
|
|
71
|
+
ba_spree のビューは storefront の Tailwind のビルド対象外なので、クラスは本家のビューで使われていてビルドに含まれるものだけを使う %>
|
|
72
|
+
<div class="<%= turbo_frame_request? || turbo_stream_request? ? 'lg:items-center' : 'lg:items-end' %>" style="display: flex; flex-direction: column; gap: 1rem; width: 100%;">
|
|
73
|
+
<%# レジに進むと確認画面まで自動で進める(spree_checkout_auto_advance)分だけ待ち時間が長いので、数量の変更時と同じく
|
|
74
|
+
カートを操作できなくしてローディングを出す(連打も防ぐ)。ブラウザの戻るで復元されたときは元に戻す (#1390) %>
|
|
66
75
|
<%= link_to Spree.t(:checkout), spree.checkout_path(order.token),
|
|
67
76
|
class: 'btn-primary block w-full lg:w-80 text-center !no-underline !mt-0',
|
|
68
|
-
data: { 'turbo': 'false', 'cart-target': 'checkoutButton' } %>
|
|
77
|
+
data: { 'turbo': 'false', 'cart-target': 'checkoutButton', action: 'click->cart#disableCart pageshow@window->cart#enableCart' } %>
|
|
69
78
|
|
|
70
79
|
<% # Continue Shopping button %>
|
|
71
80
|
<% if turbo_frame_request? || turbo_stream_request? %>
|
|
72
81
|
<%# Modal context: close the slideover %>
|
|
73
82
|
<%= button_tag Spree.t(:continue_shopping),
|
|
74
83
|
type: 'button',
|
|
84
|
+
class: 'lg:w-80',
|
|
75
85
|
style: 'display: inline-block; text-align: center; text-decoration: none; background-color: white; padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.875rem; line-height: 1.25rem; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; border-radius: var(--button-border-radius); border: var(--button-border-width) solid var(--button-background-color, var(--button)); color: var(--button-background-color, var(--button));',
|
|
76
86
|
data: { action: 'slideover#toggle' } %>
|
|
77
87
|
<% else %>
|
|
78
88
|
<%# Full-page cart context: redirect to products %>
|
|
79
89
|
<%= link_to Spree.t(:continue_shopping), spree.products_path,
|
|
90
|
+
class: 'lg:w-80',
|
|
80
91
|
style: 'display: inline-block; text-align: center; text-decoration: none; background-color: white; padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.875rem; line-height: 1.25rem; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; border-radius: var(--button-border-radius); border: var(--button-border-width) solid var(--button-background-color, var(--button)); color: var(--button-background-color, var(--button));',
|
|
81
92
|
data: { 'turbo-frame': '_top' } %>
|
|
82
93
|
<% end %>
|
data/config/locales/en.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/lib/ba_spree/version.rb
CHANGED
data/lib/ba_spree.rb
CHANGED
|
@@ -16,5 +16,25 @@ require 'spree_materials'
|
|
|
16
16
|
# Spree::Calculator::FlatPercentOrderTotal を参照する。
|
|
17
17
|
# @see https://github.com/be-agile/giga-repeat/issues/1307
|
|
18
18
|
require 'spree_order_total_discount'
|
|
19
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1400
|
|
20
|
+
require 'spree_common_shipping_method_splitter'
|
|
19
21
|
require 'ba_spree/engine'
|
|
20
22
|
require 'ba_spree/version'
|
|
23
|
+
|
|
24
|
+
module BaSpree
|
|
25
|
+
# ba_spree が束ねる engine の gem 名(ba_spree.gemspec の記載順)。
|
|
26
|
+
# 依存のうち be-agile org で公開している gem を engine とみなし、spree 本体や deface は除く。
|
|
27
|
+
def self.bundled_engine_names
|
|
28
|
+
Gem.loaded_specs.fetch('ba_spree').runtime_dependencies.map(&:name).select do |name|
|
|
29
|
+
Gem.loaded_specs[name]&.homepage&.start_with?('https://github.com/be-agile/')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# ba_spree.gemspec が依存する engine を、gemspec の記載順ですべて require する(上で require 済みのものは何も起きない)。
|
|
35
|
+
# Bundler.require は Gemfile に書かれた gem しか require しないため、`gem "ba_spree"` だけを書いた利用者の環境では
|
|
36
|
+
# ここで require しないと engine として登録されない。ba_spree より後にロードするので decorator は ba_spree の外側に重なる。
|
|
37
|
+
# giga-repeat でも Gemfile.basic の先頭の ba_spree がここで全て require するため、本番の engine のロード順も
|
|
38
|
+
# gemspec の記載順で決まる。engine の一覧を gemspec だけに持ち、ここや Gemfile との二重管理を避ける。
|
|
39
|
+
# @see https://github.com/be-agile/giga-repeat/issues/1403
|
|
40
|
+
BaSpree.bundled_engine_names.each { |name| require name }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ba_spree
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- be agile Co., Ltd.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: ba_spree_loyalty_points
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - ">="
|
|
@@ -109,7 +109,7 @@ dependencies:
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: spree_materials
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
115
|
- - ">="
|
|
@@ -123,7 +123,7 @@ dependencies:
|
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
126
|
+
name: spree_order_total_discount
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
|
129
129
|
- - ">="
|
|
@@ -137,7 +137,7 @@ dependencies:
|
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
140
|
+
name: ba_spree_google_analytics
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
143
|
- - ">="
|
|
@@ -151,7 +151,7 @@ dependencies:
|
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
152
|
version: '0'
|
|
153
153
|
- !ruby/object:Gem::Dependency
|
|
154
|
-
name:
|
|
154
|
+
name: spree_yahoo_ads
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
156
156
|
requirements:
|
|
157
157
|
- - ">="
|
|
@@ -165,7 +165,7 @@ dependencies:
|
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: '0'
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
168
|
+
name: spree_products_payment_methods
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
171
|
- - ">="
|
|
@@ -179,7 +179,7 @@ dependencies:
|
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: '0'
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
|
-
name:
|
|
182
|
+
name: ba_spree_cash_on_delivery
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
185
|
- - ">="
|
|
@@ -193,7 +193,7 @@ dependencies:
|
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0'
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name:
|
|
196
|
+
name: ba_spree_related_products
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
199
|
- - ">="
|
|
@@ -207,7 +207,7 @@ dependencies:
|
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '0'
|
|
209
209
|
- !ruby/object:Gem::Dependency
|
|
210
|
-
name:
|
|
210
|
+
name: spree_np_atobarai
|
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
|
212
212
|
requirements:
|
|
213
213
|
- - ">="
|
|
@@ -221,7 +221,7 @@ dependencies:
|
|
|
221
221
|
- !ruby/object:Gem::Version
|
|
222
222
|
version: '0'
|
|
223
223
|
- !ruby/object:Gem::Dependency
|
|
224
|
-
name:
|
|
224
|
+
name: spree_direct_debit
|
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
|
226
226
|
requirements:
|
|
227
227
|
- - ">="
|
|
@@ -235,7 +235,7 @@ dependencies:
|
|
|
235
235
|
- !ruby/object:Gem::Version
|
|
236
236
|
version: '0'
|
|
237
237
|
- !ruby/object:Gem::Dependency
|
|
238
|
-
name:
|
|
238
|
+
name: spree_zip_autocomplete
|
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
|
240
240
|
requirements:
|
|
241
241
|
- - ">="
|
|
@@ -249,7 +249,7 @@ dependencies:
|
|
|
249
249
|
- !ruby/object:Gem::Version
|
|
250
250
|
version: '0'
|
|
251
251
|
- !ruby/object:Gem::Dependency
|
|
252
|
-
name:
|
|
252
|
+
name: spree_address_format_i18n
|
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
|
254
254
|
requirements:
|
|
255
255
|
- - ">="
|
|
@@ -263,7 +263,21 @@ dependencies:
|
|
|
263
263
|
- !ruby/object:Gem::Version
|
|
264
264
|
version: '0'
|
|
265
265
|
- !ruby/object:Gem::Dependency
|
|
266
|
-
name:
|
|
266
|
+
name: spree_custom_email
|
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
|
268
|
+
requirements:
|
|
269
|
+
- - ">="
|
|
270
|
+
- !ruby/object:Gem::Version
|
|
271
|
+
version: '0'
|
|
272
|
+
type: :runtime
|
|
273
|
+
prerelease: false
|
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
275
|
+
requirements:
|
|
276
|
+
- - ">="
|
|
277
|
+
- !ruby/object:Gem::Version
|
|
278
|
+
version: '0'
|
|
279
|
+
- !ruby/object:Gem::Dependency
|
|
280
|
+
name: ba_spree_bank_transfer
|
|
267
281
|
requirement: !ruby/object:Gem::Requirement
|
|
268
282
|
requirements:
|
|
269
283
|
- - ">="
|
|
@@ -361,7 +375,7 @@ dependencies:
|
|
|
361
375
|
- !ruby/object:Gem::Version
|
|
362
376
|
version: '0'
|
|
363
377
|
- !ruby/object:Gem::Dependency
|
|
364
|
-
name:
|
|
378
|
+
name: spree_gmo_pg
|
|
365
379
|
requirement: !ruby/object:Gem::Requirement
|
|
366
380
|
requirements:
|
|
367
381
|
- - ">="
|
|
@@ -375,7 +389,21 @@ dependencies:
|
|
|
375
389
|
- !ruby/object:Gem::Version
|
|
376
390
|
version: '0'
|
|
377
391
|
- !ruby/object:Gem::Dependency
|
|
378
|
-
name:
|
|
392
|
+
name: spree_common_shipping_method_splitter
|
|
393
|
+
requirement: !ruby/object:Gem::Requirement
|
|
394
|
+
requirements:
|
|
395
|
+
- - ">="
|
|
396
|
+
- !ruby/object:Gem::Version
|
|
397
|
+
version: '0'
|
|
398
|
+
type: :runtime
|
|
399
|
+
prerelease: false
|
|
400
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
401
|
+
requirements:
|
|
402
|
+
- - ">="
|
|
403
|
+
- !ruby/object:Gem::Version
|
|
404
|
+
version: '0'
|
|
405
|
+
- !ruby/object:Gem::Dependency
|
|
406
|
+
name: spree_promotion_action_create_line_items
|
|
379
407
|
requirement: !ruby/object:Gem::Requirement
|
|
380
408
|
requirements:
|
|
381
409
|
- - ">="
|
|
@@ -417,6 +445,8 @@ files:
|
|
|
417
445
|
- app/assets/stylesheets/spree/admin/custom.scss
|
|
418
446
|
- app/controllers/ba_spree/checkout_controller_decorator.rb
|
|
419
447
|
- app/controllers/ba_spree/store_controller_decorator.rb
|
|
448
|
+
- app/controllers/ba_spree/storefront_api_products_controller_decorator.rb
|
|
449
|
+
- app/controllers/ba_spree/storefront_api_variants_controller_decorator.rb
|
|
420
450
|
- app/controllers/concerns/ba_spree/theme_concern_decorator.rb
|
|
421
451
|
- app/controllers/spree/admin/assets_controller_decorator.rb
|
|
422
452
|
- app/controllers/spree/admin/products_controller_decorator.rb
|
|
@@ -430,6 +460,7 @@ files:
|
|
|
430
460
|
- app/decorators/spree/money_decorator.rb
|
|
431
461
|
- app/decorators/spree/order_email_subscriber_decorator.rb
|
|
432
462
|
- app/decorators/spree/page_sections/featured_posts_decorator.rb
|
|
463
|
+
- app/finders/ba_spree/products/find_decorator.rb
|
|
433
464
|
- app/helpers/currency_rounding_helper.rb
|
|
434
465
|
- app/helpers/spree/admin/filter_params_preservation.rb
|
|
435
466
|
- app/helpers/spree/admin/navigation_helper_decorator.rb
|
|
@@ -443,6 +474,7 @@ files:
|
|
|
443
474
|
- app/javascript/spree/admin/controllers/slug_form_controller.js
|
|
444
475
|
- app/models/ba_spree/address_decorator.rb
|
|
445
476
|
- app/models/ba_spree/adjustment_decorator.rb
|
|
477
|
+
- app/models/ba_spree/line_item_decorator.rb
|
|
446
478
|
- app/models/ba_spree/order_decorator.rb
|
|
447
479
|
- app/models/ba_spree/order_updater_decorator.rb
|
|
448
480
|
- app/models/ba_spree/payment_method_decorator.rb
|
|
@@ -490,6 +522,7 @@ files:
|
|
|
490
522
|
- app/overrides/fix_coupon_apply_button_layout.rb
|
|
491
523
|
- app/overrides/hide_gift_cards_and_store_credits_from_account_nav.rb
|
|
492
524
|
- app/overrides/hide_shipping_message_for_digital_only_orders.rb
|
|
525
|
+
- app/overrides/keep_bill_address_form_open_on_error.rb
|
|
493
526
|
- app/overrides/localize_apply_button_text.rb
|
|
494
527
|
- app/overrides/localize_newsletter_button_text.rb
|
|
495
528
|
- app/overrides/replace_announcement_bar_text.rb
|