solidus_volume_pricing 2.0.0 → 2.1.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/.github/workflows/lint.yml +2 -2
- data/.github/workflows/test.yml +1 -40
- data/.rubocop.yml +7 -2
- data/.standard.yml +6 -0
- data/Gemfile +6 -2
- data/app/controllers/spree/admin/volume_price_models_controller.rb +17 -1
- data/app/patches/controllers/solidus_volume_pricing/admin_variants_controller_patch.rb +26 -0
- data/lib/generators/solidus_volume_pricing/install/install_generator.rb +1 -1
- data/lib/solidus_volume_pricing/version.rb +1 -1
- data/lib/solidus_volume_pricing.rb +0 -1
- data/solidus_volume_pricing.gemspec +1 -2
- metadata +5 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3901a1a37e8e0828f118d41ffe3c1d82aa863162e4728a92186ba5d544d513c
|
|
4
|
+
data.tar.gz: 5a6b71d009d66682a3fac517dcbd41dd3749204374c255805806f301c81171f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b55f2102c833cb71aa11b09b24b80fde5b0b8a8620949036c2937e472d1db024f5e28db8e5c22ce68be67ffeddbf9ae24abdafdbf30f1a9ccf559d1d264f47c
|
|
7
|
+
data.tar.gz: 3a01103631e77e967f37eecaca7a93c6981f7bc840b71b554e5537483eec935e66151213a387524374aecdf4dbdf880b48e3913e6af31e5e8910e194816e89da
|
data/.github/workflows/lint.yml
CHANGED
|
@@ -15,11 +15,11 @@ jobs:
|
|
|
15
15
|
runs-on: ubuntu-24.04
|
|
16
16
|
steps:
|
|
17
17
|
- name: Checkout code
|
|
18
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@v7
|
|
19
19
|
- name: Install Ruby and gems
|
|
20
20
|
uses: ruby/setup-ruby@v1
|
|
21
21
|
with:
|
|
22
22
|
ruby-version: "3.2"
|
|
23
23
|
bundler-cache: true
|
|
24
24
|
- name: Lint Ruby files
|
|
25
|
-
run: bundle exec
|
|
25
|
+
run: bundle exec standardrb --no-fix
|
data/.github/workflows/test.yml
CHANGED
|
@@ -17,43 +17,4 @@ permissions:
|
|
|
17
17
|
|
|
18
18
|
jobs:
|
|
19
19
|
rspec:
|
|
20
|
-
|
|
21
|
-
runs-on: ubuntu-24.04
|
|
22
|
-
strategy:
|
|
23
|
-
fail-fast: false
|
|
24
|
-
matrix:
|
|
25
|
-
rails-version:
|
|
26
|
-
- "7.2"
|
|
27
|
-
- "8.0"
|
|
28
|
-
ruby-version:
|
|
29
|
-
- "3.1"
|
|
30
|
-
- "3.4"
|
|
31
|
-
solidus-branch:
|
|
32
|
-
- "v4.4"
|
|
33
|
-
- "v4.5"
|
|
34
|
-
- "v4.6"
|
|
35
|
-
database:
|
|
36
|
-
- "postgresql"
|
|
37
|
-
- "mysql"
|
|
38
|
-
- "sqlite"
|
|
39
|
-
exclude:
|
|
40
|
-
- rails-version: "8.0"
|
|
41
|
-
solidus-branch: "v4.4"
|
|
42
|
-
- rails-version: "8.0"
|
|
43
|
-
ruby-version: "3.1"
|
|
44
|
-
|
|
45
|
-
steps:
|
|
46
|
-
- uses: actions/checkout@v4
|
|
47
|
-
- name: Run extension tests
|
|
48
|
-
uses: solidusio/test-solidus-extension@main
|
|
49
|
-
with:
|
|
50
|
-
database: ${{ matrix.database }}
|
|
51
|
-
rails-version: ${{ matrix.rails-version }}
|
|
52
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
53
|
-
solidus-branch: ${{ matrix.solidus-branch }}
|
|
54
|
-
- name: Upload coverage reports to Codecov
|
|
55
|
-
uses: codecov/codecov-action@v5
|
|
56
|
-
continue-on-error: true
|
|
57
|
-
with:
|
|
58
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
59
|
-
files: ./coverage/coverage.xml
|
|
20
|
+
uses: solidusio/test-solidus-extension/.github/workflows/test.yml@main
|
data/.rubocop.yml
CHANGED
data/.standard.yml
ADDED
data/Gemfile
CHANGED
|
@@ -12,23 +12,27 @@ gem "solidus", github: "solidusio/solidus", branch: branch
|
|
|
12
12
|
gem "solidus_frontend"
|
|
13
13
|
|
|
14
14
|
rails_requirement_string = ENV.fetch("RAILS_VERSION", "~> 8.0")
|
|
15
|
+
# CI passes bare versions such as "8.1", which Bundler reads as "= 8.1.0".
|
|
16
|
+
rails_requirement_string = "~> #{rails_requirement_string}.0" if rails_requirement_string.match?(/\A\d+\.\d+\z/)
|
|
15
17
|
gem "rails", rails_requirement_string
|
|
16
18
|
|
|
17
19
|
# Provides basic authentication functionality for testing parts of your engine
|
|
18
20
|
gem "solidus_auth_devise"
|
|
19
21
|
|
|
22
|
+
rails_version = Gem::Requirement.new(rails_requirement_string).requirements[0][1]
|
|
20
23
|
case ENV.fetch("DB", nil)
|
|
21
24
|
when "mysql"
|
|
22
25
|
gem "mysql2"
|
|
23
26
|
when "postgresql"
|
|
24
27
|
gem "pg"
|
|
25
28
|
else
|
|
26
|
-
rails_version = Gem::Requirement.new(rails_requirement_string).requirements[0][1]
|
|
27
29
|
sqlite_version = (rails_version < Gem::Version.new(7.2)) ? "~> 1.4" : "~> 2.0"
|
|
28
|
-
|
|
29
30
|
gem "sqlite3", sqlite_version
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
json_version = (rails_version < Gem::Version.new(8.1)) ? "~> 2.0" : "~> 3.0"
|
|
34
|
+
gem "json", json_version
|
|
35
|
+
|
|
32
36
|
# Use a local Gemfile to include development dependencies that might not be
|
|
33
37
|
# relevant for the project or for other contributors, e.g. pry-byebug.
|
|
34
38
|
#
|
|
@@ -3,10 +3,26 @@
|
|
|
3
3
|
module Spree
|
|
4
4
|
module Admin
|
|
5
5
|
class VolumePriceModelsController < ResourceController
|
|
6
|
-
before_action :load_volume_prices, only: [:new, :edit]
|
|
6
|
+
before_action :load_volume_prices, only: [:new, :edit]
|
|
7
7
|
|
|
8
8
|
private
|
|
9
9
|
|
|
10
|
+
def permitted_resource_params
|
|
11
|
+
params.require(:volume_price_model).permit(
|
|
12
|
+
:name,
|
|
13
|
+
volume_prices_attributes: [
|
|
14
|
+
:id,
|
|
15
|
+
:name,
|
|
16
|
+
:discount_type,
|
|
17
|
+
:range,
|
|
18
|
+
:amount,
|
|
19
|
+
:position,
|
|
20
|
+
:role_id,
|
|
21
|
+
:_destroy
|
|
22
|
+
]
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
10
26
|
def location_after_save
|
|
11
27
|
if @volume_price_model.created_at == @volume_price_model.updated_at
|
|
12
28
|
edit_admin_volume_price_model_url(@volume_price_model)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module SolidusVolumePricing
|
|
2
|
+
module AdminVariantsControllerPatch
|
|
3
|
+
private
|
|
4
|
+
|
|
5
|
+
def permitted_resource_params
|
|
6
|
+
super.merge(params.require(:variant).permit(
|
|
7
|
+
:volume_price_model_ids,
|
|
8
|
+
{
|
|
9
|
+
volume_price_model_ids: [],
|
|
10
|
+
volume_prices_attributes: [
|
|
11
|
+
:id,
|
|
12
|
+
:name,
|
|
13
|
+
:discount_type,
|
|
14
|
+
:range,
|
|
15
|
+
:amount,
|
|
16
|
+
:position,
|
|
17
|
+
:role_id,
|
|
18
|
+
:_destroy
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
::Spree::Admin::VariantsController.prepend self
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -18,7 +18,7 @@ module SolidusVolumePricing
|
|
|
18
18
|
if run_migrations
|
|
19
19
|
run "bin/rails db:migrate"
|
|
20
20
|
else
|
|
21
|
-
puts "Skipping bin/rails db:migrate, don't forget to run it!"
|
|
21
|
+
puts "Skipping bin/rails db:migrate, don't forget to run it!"
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/solidusio-contrib/solidus_volume_pricing"
|
|
18
18
|
spec.metadata["changelog_uri"] = "https://github.com/solidusio-contrib/solidus_volume_pricing/releases"
|
|
19
19
|
|
|
20
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.0", "<
|
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0", "< 5")
|
|
21
21
|
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "solidus_backend", [">= 4.0", "< 5"]
|
|
32
32
|
spec.add_dependency "solidus_core", [">= 4.0", "< 5"]
|
|
33
33
|
spec.add_dependency "solidus_support", [">= 0.15.0", "< 1"]
|
|
34
|
-
spec.add_dependency "coffee-rails"
|
|
35
34
|
spec.add_dependency "deface"
|
|
36
35
|
spec.add_dependency "sassc-rails"
|
|
37
36
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_volume_pricing
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
@@ -69,20 +69,6 @@ dependencies:
|
|
|
69
69
|
- - "<"
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
71
|
version: '1'
|
|
72
|
-
- !ruby/object:Gem::Dependency
|
|
73
|
-
name: coffee-rails
|
|
74
|
-
requirement: !ruby/object:Gem::Requirement
|
|
75
|
-
requirements:
|
|
76
|
-
- - ">="
|
|
77
|
-
- !ruby/object:Gem::Version
|
|
78
|
-
version: '0'
|
|
79
|
-
type: :runtime
|
|
80
|
-
prerelease: false
|
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
-
requirements:
|
|
83
|
-
- - ">="
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: '0'
|
|
86
72
|
- !ruby/object:Gem::Dependency
|
|
87
73
|
name: deface
|
|
88
74
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -155,6 +141,7 @@ files:
|
|
|
155
141
|
- ".gitignore"
|
|
156
142
|
- ".rspec"
|
|
157
143
|
- ".rubocop.yml"
|
|
144
|
+
- ".standard.yml"
|
|
158
145
|
- CHANGELOG.md
|
|
159
146
|
- Gemfile
|
|
160
147
|
- Guardfile
|
|
@@ -173,6 +160,7 @@ files:
|
|
|
173
160
|
- app/overrides/spree/admin/shared/_product_tabs/add_volume_pricing_admin_tab.html.erb.deface
|
|
174
161
|
- app/overrides/spree/admin/shared/_settings_sub_menu/add_volume_price_model_admin_menu_links.html.erb.deface
|
|
175
162
|
- app/overrides/spree/admin/variants/edit/add_volume_pricing_field_to_variant.html.erb.deface
|
|
163
|
+
- app/patches/controllers/solidus_volume_pricing/admin_variants_controller_patch.rb
|
|
176
164
|
- app/patches/helpers/solidus_volume_pricing/spree_base_helper_patch.rb
|
|
177
165
|
- app/patches/models/solidus_volume_pricing/spree_line_item_patch.rb
|
|
178
166
|
- app/patches/models/solidus_volume_pricing/spree_variant_patch.rb
|
|
@@ -233,14 +221,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
233
221
|
version: '3.0'
|
|
234
222
|
- - "<"
|
|
235
223
|
- !ruby/object:Gem::Version
|
|
236
|
-
version: '
|
|
224
|
+
version: '5'
|
|
237
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
226
|
requirements:
|
|
239
227
|
- - ">="
|
|
240
228
|
- !ruby/object:Gem::Version
|
|
241
229
|
version: '0'
|
|
242
230
|
requirements: []
|
|
243
|
-
rubygems_version:
|
|
231
|
+
rubygems_version: 4.0.24
|
|
244
232
|
specification_version: 4
|
|
245
233
|
summary: Allow prices to be configured in quantity ranges for each variant
|
|
246
234
|
test_files: []
|