solidus_legacy_promotions 4.4.0 → 4.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9d7efd633c012b29dd74c0586dac9c26b1a39c90e2ba9fb956843913cf00cf5
4
- data.tar.gz: 5ebe9bde3952c34717157d2229f34c12e79e95a43114bb459966457fa433a97f
3
+ metadata.gz: f7e25a87b32de8febdd67d28fa5a558d26c5128875d06b637b8ed52bfa0a2dc9
4
+ data.tar.gz: 98d7ff2153ecc29358483226092aa7001aa4f1e4e3a64ed0db8d97c662ad9786
5
5
  SHA512:
6
- metadata.gz: f8235d2a505e5c77ed0d1c1867e7fc2296ad1c130b225181225b096deb5f027bfba955fc3ef02824383bb9733956a25badbfd385b6466c478d8fd1947520e487
7
- data.tar.gz: 9cd8c70170387dd5c8c2875bcb6a570704410eded75113d7833e816f05948d48acc592de1272661db249add575ae8ac4e0d1b758238e6f1fbae141e8a480c8c2
6
+ metadata.gz: f71034d931089916518921d45a125ec90a345d1db2fe1579eabfb0fe39afa3e0ec55c6d548929a7b25ac48359a3b8330b5cb87e90293e98d63c567b3ec5ed649
7
+ data.tar.gz: 690f0d2397d6fbe4d1bc144aef2b4f8f49fc7a7ea061be32b249452f30b7ca72c6382c91f8a882960887d16f9b0da2bbe82160855210b9f0cc2035fe3b2e83fc
@@ -1,3 +1,3 @@
1
- @import "spree/backend/themes/classic";
1
+ @import "spree/backend/globals/variables";
2
2
 
3
3
  @import "solidus_legacy_promotions/promotions/edit";
@@ -2,6 +2,11 @@
2
2
 
3
3
  module SolidusLegacyPromotions
4
4
  module SpreeLineItemDecorator
5
+ def self.prepended(base)
6
+ base.has_many :line_item_actions, dependent: :destroy
7
+ base.has_many :actions, through: :line_item_actions
8
+ end
9
+
5
10
  def total_before_tax
6
11
  amount + adjustments.select { |value| !value.tax? && value.eligible? }.sum(&:amount)
7
12
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ class LineItemAction < Spree::Base
5
+ belongs_to :line_item, optional: true
6
+ belongs_to :action, class_name: "Spree::PromotionAction", optional: true
7
+ end
8
+ end
@@ -1,4 +1,8 @@
1
1
  en:
2
+ solidus_admin:
3
+ menu_item:
4
+ legacy_promotions: Promotions
5
+ legacy_promotion_categories: Promotion Categories
2
6
  spree:
3
7
  admin:
4
8
  promotion_status:
@@ -23,8 +27,8 @@ en:
23
27
  general: General
24
28
  starts_at_placeholder: Immediately
25
29
  tab:
26
- promotion_categories: Promotion Categories
27
- promotions: Promotions
30
+ legacy_promotions: Promotions
31
+ legacy_promotion_categories: Promotion Categories
28
32
  back_to_promotion_categories_list: Back To Promotions Categories List
29
33
  back_to_promotions_list: Back To Promotions List
30
34
  base_amount: Base Amount
@@ -122,5 +122,17 @@ class SolidusOneFourPromotions < ActiveRecord::Migration[5.0]
122
122
  t.index ["starts_at"], name: "index_spree_promotions_on_starts_at"
123
123
  end
124
124
  end
125
+
126
+ unless table_exists?(:spree_line_item_actions)
127
+ create_table "spree_line_item_actions", force: :cascade do |t|
128
+ t.integer "line_item_id", null: false
129
+ t.integer "action_id", null: false
130
+ t.integer "quantity", default: 0
131
+ t.datetime "created_at", precision: 6
132
+ t.datetime "updated_at", precision: 6
133
+ t.index ["action_id"], name: "index_spree_line_item_actions_on_action_id"
134
+ t.index ["line_item_id"], name: "index_spree_line_item_actions_on_line_item_id"
135
+ end
136
+ end
125
137
  end
126
138
  end
@@ -1,20 +1,5 @@
1
1
  en:
2
- columns:
3
- items:
4
- one: 1 Item
5
- other: '%{count} Items'
6
2
  filters:
7
- status: Status
8
- shipment_state: Shipment State
9
- payment_state: Payment State
10
3
  promotions: Promotions
11
- date:
12
- formats:
13
- short: '%d %b %y'
14
4
  scopes:
15
- all_orders: All
16
- canceled: Canceled
17
- complete: Complete
18
- returned: Returned
19
- in_progress: In Progress
20
5
  promotions: Promotions
@@ -9,7 +9,7 @@ module SolidusLegacyPromotions
9
9
  initializer "solidus_legacy_promotions.add_backend_menu_item" do
10
10
  if SolidusSupport.backend_available?
11
11
  promotions_menu_item = Spree::BackendConfiguration::MenuItem.new(
12
- label: :promotions,
12
+ label: :legacy_promotions,
13
13
  icon: Spree::Backend::Config.admin_updated_navbar ? "ri-megaphone-line" : "bullhorn",
14
14
  partial: "spree/admin/shared/promotion_sub_menu",
15
15
  condition: -> { can?(:admin, Spree::Promotion) },
@@ -17,12 +17,14 @@ module SolidusLegacyPromotions
17
17
  data_hook: :admin_promotion_sub_tabs,
18
18
  children: [
19
19
  Spree::BackendConfiguration::MenuItem.new(
20
- label: :promotions,
21
- condition: -> { can?(:admin, Spree::Promotion) }
20
+ label: :legacy_promotions,
21
+ condition: -> { can?(:admin, Spree::Promotion) },
22
+ url: :admin_promotions_path
22
23
  ),
23
24
  Spree::BackendConfiguration::MenuItem.new(
24
- label: :promotion_categories,
25
- condition: -> { can?(:admin, Spree::PromotionCategory) }
25
+ label: :legacy_promotion_categories,
26
+ condition: -> { can?(:admin, Spree::PromotionCategory) },
27
+ url: -> { Spree::Core::Engine.routes.url_helpers.admin_promotion_categories_path },
26
28
  )
27
29
  ]
28
30
  )
@@ -41,10 +43,22 @@ module SolidusLegacyPromotions
41
43
  if SolidusSupport.admin_available?
42
44
  SolidusAdmin::Config.configure do |config|
43
45
  config.menu_items << {
44
- key: "promotions",
46
+ key: "legacy_promotions",
45
47
  route: -> { spree.admin_promotions_path },
46
48
  icon: "megaphone-line",
47
- position: 30
49
+ position: 1.5,
50
+ children: [
51
+ {
52
+ key: "legacy_promotions",
53
+ route: -> { spree.admin_promotions_path },
54
+ position: 1
55
+ },
56
+ {
57
+ key: "legacy_promotion_categories",
58
+ route: -> { spree.admin_promotion_categories_path },
59
+ position: 2
60
+ }
61
+ ]
48
62
  }
49
63
  end
50
64
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.metadata['rubygems_mfa_required'] = 'true'
18
18
 
19
19
  s.files = `git ls-files -z`.split("\x0").reject do |f|
20
- f.match(%r{^(spec|script)/})
20
+ f.match(%r{^(spec|bin)/})
21
21
  end
22
22
 
23
23
  s.required_ruby_version = '>= 3.1.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_legacy_promotions
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-12 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.4.0
19
+ version: 4.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.4.0
26
+ version: 4.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.4.0
33
+ version: 4.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.4.0
40
+ version: 4.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: solidus_support
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,7 @@ files:
94
94
  - app/models/spree/calculator/percent_on_line_item.rb
95
95
  - app/models/spree/calculator/tiered_flat_rate.rb
96
96
  - app/models/spree/calculator/tiered_percent.rb
97
+ - app/models/spree/line_item_action.rb
97
98
  - app/models/spree/order_contents.rb
98
99
  - app/models/spree/order_promotion.rb
99
100
  - app/models/spree/permission_sets/promotion_display.rb
@@ -140,7 +141,6 @@ files:
140
141
  - app/views/spree/order_mailer/confirm_email.text.erb
141
142
  - app/views/spree/promotion_code_batch_mailer/promotion_code_batch_errored.text.erb
142
143
  - app/views/spree/promotion_code_batch_mailer/promotion_code_batch_finished.text.erb
143
- - bin/rails
144
144
  - config/locales/en.yml
145
145
  - config/locales/promotion_categories.en.yml
146
146
  - config/locales/promotions.en.yml
data/bin/rails DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails gems
3
- # installed from the root of your application.
4
-
5
- ENGINE_ROOT = File.expand_path('..', __dir__)
6
- ENGINE_PATH = File.expand_path('../lib/solidus_legacy_promotions/engine', __dir__)
7
-
8
- # Set up gems listed in the Gemfile.
9
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__)
10
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
-
12
- require "rails/all"
13
- require "rails/engine/commands"