diff --git a/.github/labeler.yml b/.github/labeler.yml index e7f0f9028d2..0b59473b94a 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -18,6 +18,16 @@ - changed-files: - any-glob-to-any-file: - "admin/**/*" +"changelog:solidus_promotions": +- any: + - changed-files: + - any-glob-to-any-file: + - "promotions/**/*" +"changelog:solidus_legacy_promotions": +- any: + - changed-files: + - any-glob-to-any-file: + - "legacy_promotions/**/*" "changelog:solidus_sample": - any: - changed-files: @@ -40,6 +50,8 @@ - "!backend/**/*" - "!api/**/*" - "!admin/**/*" + - "!promotions/**/*" + - "!legacy_promotions/**/*" - "!sample/**/*" - "!lib/**/*" - "!README.md" diff --git a/admin/app/components/solidus_admin/base_component.rb b/admin/app/components/solidus_admin/base_component.rb index 7bfe1b52852..e41e65235cf 100644 --- a/admin/app/components/solidus_admin/base_component.rb +++ b/admin/app/components/solidus_admin/base_component.rb @@ -25,6 +25,10 @@ def missing_translation(key, options) end end + def self.i18n_scope + @i18n_scope ||= name.underscore.tr("/", ".") + end + def self.stimulus_id @stimulus_id ||= name.underscore .sub(/^solidus_admin\/(.*)\/component$/, '\1') diff --git a/legacy_promotions/app/assets/stylesheets/solidus_legacy_promotions/promotions.scss b/legacy_promotions/app/assets/stylesheets/solidus_legacy_promotions/promotions.scss index eee8b872043..4a37ef631b1 100644 --- a/legacy_promotions/app/assets/stylesheets/solidus_legacy_promotions/promotions.scss +++ b/legacy_promotions/app/assets/stylesheets/solidus_legacy_promotions/promotions.scss @@ -1,3 +1,3 @@ -@import "spree/backend/themes/classic"; +@import "spree/backend/globals/variables"; @import "solidus_legacy_promotions/promotions/edit"; diff --git a/legacy_promotions/lib/components/admin/solidus_legacy_promotions/orders/index/component.yml b/legacy_promotions/lib/components/admin/solidus_legacy_promotions/orders/index/component.yml index 454b31bbdb7..3829db2d825 100644 --- a/legacy_promotions/lib/components/admin/solidus_legacy_promotions/orders/index/component.yml +++ b/legacy_promotions/lib/components/admin/solidus_legacy_promotions/orders/index/component.yml @@ -1,20 +1,5 @@ en: - columns: - items: - one: 1 Item - other: '%{count} Items' filters: - status: Status - shipment_state: Shipment State - payment_state: Payment State promotions: Promotions - date: - formats: - short: '%d %b %y' scopes: - all_orders: All - canceled: Canceled - complete: Complete - returned: Returned - in_progress: In Progress promotions: Promotions diff --git a/legacy_promotions/lib/solidus_legacy_promotions/engine.rb b/legacy_promotions/lib/solidus_legacy_promotions/engine.rb index c716ba6693e..4c34fc3252e 100644 --- a/legacy_promotions/lib/solidus_legacy_promotions/engine.rb +++ b/legacy_promotions/lib/solidus_legacy_promotions/engine.rb @@ -87,12 +87,17 @@ class Engine < ::Rails::Engine end initializer "solidus_legacy_promotions", after: "spree.load_config_initializers" do - Spree::Config.order_contents_class = "Spree::OrderContents" - Spree::Config.promotions = SolidusLegacyPromotions::Configuration.new - Spree::Config.adjustment_promotion_source_types << "Spree::PromotionAction" + # Only set these if there is no promotion configuration set. In this case, + # we're running on a store without the new `solidus_promotions` gem and we + # need to set the configuration to the legacy one. + if Spree::Config.promotions.is_a?(Spree::Core::NullPromotionConfiguration) + Spree::Config.order_contents_class = "Spree::OrderContents" + Spree::Config.promotions = SolidusLegacyPromotions::Configuration.new + end Spree::Api::Config.adjustment_attributes << :promotion_code_id Spree::Api::Config.adjustment_attributes << :eligible + Spree::Config.adjustment_promotion_source_types << "Spree::PromotionAction" end end end diff --git a/promotions/lib/components/admin/solidus_promotions/orders/index/component.yml b/promotions/lib/components/admin/solidus_promotions/orders/index/component.yml index 95af3f495d4..3829db2d825 100644 --- a/promotions/lib/components/admin/solidus_promotions/orders/index/component.yml +++ b/promotions/lib/components/admin/solidus_promotions/orders/index/component.yml @@ -1,3 +1,5 @@ en: filters: promotions: Promotions + scopes: + promotions: Promotions