solidus_volume_pricing 0.2.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +35 -0
- data/.gem_release.yml +5 -0
- data/.github/dependabot.yml +7 -0
- data/.github/stale.yml +17 -0
- data/.gitignore +14 -9
- data/.rspec +2 -2
- data/.rubocop.yml +3 -7
- data/.rubocop_todo.yml +126 -0
- data/CHANGELOG.md +86 -0
- data/Gemfile +25 -2
- data/Guardfile +3 -1
- data/{LICENSE.md → LICENSE} +2 -2
- data/README.md +55 -50
- data/Rakefile +4 -19
- data/app/assets/javascripts/spree/backend/solidus_volume_pricing.js +1 -15
- data/app/controllers/spree/admin/volume_price_models_controller.rb +2 -1
- data/app/controllers/spree/admin/volume_prices_controller.rb +3 -1
- data/app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb +42 -0
- data/app/decorators/helpers/solidus_volume_pricing/spree/base_helper_decorator.rb +31 -0
- data/app/decorators/models/solidus_volume_pricing/spree/line_item_decorator.rb +18 -0
- data/app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb +21 -0
- data/app/models/solidus_volume_pricing/price_display.rb +47 -0
- data/app/models/solidus_volume_pricing/pricer.rb +95 -0
- data/app/models/solidus_volume_pricing/pricing_options.rb +20 -0
- data/app/models/spree/volume_price.rb +43 -26
- data/app/models/spree/volume_price_model.rb +6 -4
- data/app/overrides/spree/admin/shared/_settings_sub_menu/add_volume_price_model_admin_menu_links.html.erb.deface +5 -0
- data/app/overrides/views_decorator.rb +2 -0
- data/app/views/spree/admin/shared/_vp_product_tab.html.erb +2 -2
- data/app/views/spree/admin/variants/_edit_fields.html.erb +5 -32
- data/app/views/spree/admin/variants/volume_prices.html.erb +9 -36
- data/app/views/spree/admin/volume_price_models/_form.html.erb +6 -2
- data/app/views/spree/admin/volume_price_models/_list.html.erb +8 -4
- data/app/views/spree/admin/volume_price_models/_select.html.erb +17 -0
- data/app/views/spree/admin/volume_price_models/edit.html.erb +7 -6
- data/app/views/spree/admin/volume_price_models/index.html.erb +7 -5
- data/app/views/spree/admin/volume_price_models/new.html.erb +5 -5
- data/app/views/spree/admin/volume_prices/_table.html.erb +26 -0
- data/app/views/spree/admin/volume_prices/_volume_price_fields.html.erb +10 -8
- data/app/views/spree/products/_volume_pricing.html.erb +8 -8
- data/bin/console +17 -0
- data/bin/rails +12 -4
- data/bin/setup +8 -0
- data/config/locales/de.yml +17 -3
- data/config/locales/en.yml +21 -2
- data/config/locales/pt.yml +6 -2
- data/config/locales/ru.yml +6 -2
- data/config/locales/sv.yml +6 -2
- data/config/locales/tr.yml +6 -2
- data/config/routes.rb +3 -1
- data/db/migrate/20081119145604_create_volume_prices.rb +3 -1
- data/db/migrate/20110203174010_change_display_name_for_volume_prices.rb +3 -1
- data/db/migrate/20111206173307_prefix_volume_pricing_table_names.rb +3 -1
- data/db/migrate/20121115043422_add_discount_type_column.rb +3 -1
- data/db/migrate/20150513200904_add_role_to_volume_price.rb +3 -1
- data/db/migrate/20150603143015_create_spree_volume_price_models.rb +3 -1
- data/lib/generators/solidus_volume_pricing/install/install_generator.rb +5 -5
- data/lib/solidus_volume_pricing/engine.rb +16 -24
- data/lib/solidus_volume_pricing/range_from_string.rb +36 -0
- data/lib/solidus_volume_pricing/testing_support/factories.rb +14 -0
- data/lib/solidus_volume_pricing/version.rb +3 -16
- data/lib/solidus_volume_pricing.rb +6 -1
- data/solidus_volume_pricing.gemspec +26 -23
- data/spec/controllers/spree/admin/variants_controller_spec.rb +18 -15
- data/spec/features/manage_volume_price_models_feature_spec.rb +5 -7
- data/spec/features/manage_volume_prices_feature_spec.rb +9 -8
- data/spec/helpers/base_helper_spec.rb +3 -1
- data/spec/lib/solidus_volume_pricing/range_from_string_spec.rb +61 -0
- data/spec/models/solidus_volume_pricing/pricer_spec.rb +669 -0
- data/spec/models/solidus_volume_pricing/pricing_options_spec.rb +57 -0
- data/spec/models/spree/line_item_spec.rb +23 -21
- data/spec/models/spree/order_spec.rb +4 -2
- data/spec/models/spree/variant_spec.rb +3 -303
- data/spec/models/spree/volume_price_spec.rb +145 -50
- data/spec/spec_helper.rb +15 -35
- data/spec/support/shoulda.rb +11 -0
- metadata +83 -161
- data/.hound.yml +0 -40
- data/.travis.yml +0 -12
- data/CONTRIBUTING.md +0 -81
- data/app/controllers/spree/admin/variants_controller_decorator.rb +0 -32
- data/app/helpers/spree/base_helper_decorator.rb +0 -19
- data/app/models/spree/line_item_decorator.rb +0 -13
- data/app/models/spree/user_decorator.rb +0 -10
- data/app/models/spree/variant_decorator.rb +0 -104
- data/app/overrides/spree/admin/shared/sub_menu/_configuration/add_volume_price_model_admin_menu_links.html.erb.deface +0 -3
- data/app/views/spree/admin/volume_prices/_edit_fields.html.erb +0 -31
- data/spec/factories/volume_price_factory.rb +0 -12
- data/spec/support/capybara.rb +0 -12
- data/spec/support/database_cleaner.rb +0 -21
- data/spec/support/factory_girl.rb +0 -7
- data/spec/support/spree.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 98bbc2761ea5f9a04ec275d189fc8ef633a9a23a174b0fb0fe7183db0e51ac90
|
4
|
+
data.tar.gz: 966b8ca6e650a96310cd69d8c216fed8dff2705f2e35f4722bdf29ef9fe4b747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea5dec857a30471edb436aadd74bdfd21f553e1320fc29fd787619b73eb74cfeddfea8699fc8c3c960e9a7630d4032591ba4c2fd2fba2527edc0ca0e6e1fb7a4
|
7
|
+
data.tar.gz: cf4b9beecf2f6cb70d05b4e1018ec910eff96a24c09535b350beb2de2bfa2b802a9e333a19f5242a9888a12347bfda8ad7236731f27bd3e8b9b8c1f63865a1a3
|
@@ -0,0 +1,35 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
orbs:
|
4
|
+
# Always take the latest version of the orb, this allows us to
|
5
|
+
# run specs against Solidus supported versions only without the need
|
6
|
+
# to change this configuration every time a Solidus version is released
|
7
|
+
# or goes EOL.
|
8
|
+
solidusio_extensions: solidusio/extensions@volatile
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
run-specs-with-postgres:
|
12
|
+
executor: solidusio_extensions/postgres
|
13
|
+
steps:
|
14
|
+
- solidusio_extensions/run-tests
|
15
|
+
run-specs-with-mysql:
|
16
|
+
executor: solidusio_extensions/mysql
|
17
|
+
steps:
|
18
|
+
- solidusio_extensions/run-tests
|
19
|
+
|
20
|
+
workflows:
|
21
|
+
"Run specs on supported Solidus versions":
|
22
|
+
jobs:
|
23
|
+
- run-specs-with-postgres
|
24
|
+
- run-specs-with-mysql
|
25
|
+
"Weekly run specs against master":
|
26
|
+
triggers:
|
27
|
+
- schedule:
|
28
|
+
cron: "0 0 * * 4" # every Thursday
|
29
|
+
filters:
|
30
|
+
branches:
|
31
|
+
only:
|
32
|
+
- master
|
33
|
+
jobs:
|
34
|
+
- run-specs-with-postgres
|
35
|
+
- run-specs-with-mysql
|
data/.gem_release.yml
ADDED
data/.github/stale.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
2
|
+
daysUntilStale: 60
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
4
|
+
daysUntilClose: 7
|
5
|
+
# Issues with these labels will never be considered stale
|
6
|
+
exemptLabels:
|
7
|
+
- pinned
|
8
|
+
- security
|
9
|
+
# Label to use when marking an issue as stale
|
10
|
+
staleLabel: wontfix
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
12
|
+
markComment: >
|
13
|
+
This issue has been automatically marked as stale because it has not had
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
15
|
+
for your contributions.
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
17
|
+
closeComment: false
|
data/.gitignore
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
*.gem
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
\#*
|
3
|
+
*~
|
4
|
+
.#*
|
5
5
|
.DS_Store
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
.idea
|
7
|
+
.project
|
8
|
+
.sass-cache
|
9
9
|
coverage
|
10
|
-
.
|
11
|
-
.ruby-version
|
12
|
-
.ruby-gemset
|
10
|
+
Gemfile.lock
|
13
11
|
tmp
|
12
|
+
nbproject
|
13
|
+
pkg
|
14
|
+
*.swp
|
15
|
+
spec/dummy
|
16
|
+
spec/examples.txt
|
17
|
+
.byebug*
|
18
|
+
Gemfile-local
|
data/.rspec
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
--color
|
2
|
-
|
3
|
-
|
2
|
+
--format documentation
|
3
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-11-23 17:04:33 +0100 using RuboCop version 0.76.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec,
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'solidus_volume_pricing.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 2
|
17
|
+
Lint/InterpolationCheck:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
20
|
+
|
21
|
+
# Offense count: 21
|
22
|
+
# Cop supports --auto-correct.
|
23
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
24
|
+
# URISchemes: http, https
|
25
|
+
Metrics/LineLength:
|
26
|
+
Max: 160
|
27
|
+
|
28
|
+
# Offense count: 43
|
29
|
+
# Configuration parameters: Prefixes.
|
30
|
+
# Prefixes: when, with, without
|
31
|
+
RSpec/ContextWording:
|
32
|
+
Exclude:
|
33
|
+
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
|
34
|
+
- 'spec/helpers/base_helper_spec.rb'
|
35
|
+
- 'spec/models/solidus_volume_pricing/pricer_spec.rb'
|
36
|
+
- 'spec/models/spree/order_spec.rb'
|
37
|
+
- 'spec/models/spree/volume_price_spec.rb'
|
38
|
+
|
39
|
+
# Offense count: 2
|
40
|
+
RSpec/DescribeClass:
|
41
|
+
Exclude:
|
42
|
+
- 'spec/features/manage_volume_price_models_feature_spec.rb'
|
43
|
+
- 'spec/features/manage_volume_prices_feature_spec.rb'
|
44
|
+
|
45
|
+
# Offense count: 1
|
46
|
+
# Configuration parameters: CustomTransform, IgnoreMethods.
|
47
|
+
RSpec/FilePath:
|
48
|
+
Exclude:
|
49
|
+
- 'spec/helpers/base_helper_spec.rb'
|
50
|
+
|
51
|
+
# Offense count: 29
|
52
|
+
# Configuration parameters: AssignmentOnly.
|
53
|
+
RSpec/InstanceVariable:
|
54
|
+
Exclude:
|
55
|
+
- 'spec/helpers/base_helper_spec.rb'
|
56
|
+
- 'spec/models/spree/order_spec.rb'
|
57
|
+
|
58
|
+
# Offense count: 5
|
59
|
+
# Configuration parameters: AggregateFailuresByDefault.
|
60
|
+
RSpec/MultipleExpectations:
|
61
|
+
Max: 3
|
62
|
+
|
63
|
+
# Offense count: 58
|
64
|
+
# Configuration parameters: IgnoreSharedExamples.
|
65
|
+
RSpec/NamedSubject:
|
66
|
+
Exclude:
|
67
|
+
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
68
|
+
- 'spec/models/solidus_volume_pricing/pricer_spec.rb'
|
69
|
+
- 'spec/models/solidus_volume_pricing/pricing_options_spec.rb'
|
70
|
+
- 'spec/models/spree/volume_price_spec.rb'
|
71
|
+
|
72
|
+
# Offense count: 74
|
73
|
+
RSpec/NestedGroups:
|
74
|
+
Max: 7
|
75
|
+
|
76
|
+
# Offense count: 1
|
77
|
+
# Configuration parameters: Include.
|
78
|
+
# Include: db/migrate/*.rb
|
79
|
+
Rails/CreateTableWithTimestamps:
|
80
|
+
Exclude:
|
81
|
+
- 'db/migrate/20150603143015_create_spree_volume_price_models.rb'
|
82
|
+
|
83
|
+
# Offense count: 1
|
84
|
+
# Configuration parameters: Include.
|
85
|
+
# Include: app/models/**/*.rb
|
86
|
+
Rails/HasManyOrHasOneDependent:
|
87
|
+
Exclude:
|
88
|
+
- 'app/models/spree/volume_price_model.rb'
|
89
|
+
|
90
|
+
# Offense count: 2
|
91
|
+
# Configuration parameters: Include.
|
92
|
+
# Include: app/models/**/*.rb
|
93
|
+
Rails/InverseOf:
|
94
|
+
Exclude:
|
95
|
+
- 'app/models/spree/volume_price.rb'
|
96
|
+
- 'app/models/spree/volume_price_model.rb'
|
97
|
+
|
98
|
+
# Offense count: 1
|
99
|
+
# Configuration parameters: Include.
|
100
|
+
# Include: app/controllers/**/*.rb
|
101
|
+
Rails/LexicallyScopedActionFilter:
|
102
|
+
Exclude:
|
103
|
+
- 'app/controllers/spree/admin/volume_price_models_controller.rb'
|
104
|
+
|
105
|
+
# Offense count: 1
|
106
|
+
# Configuration parameters: Include.
|
107
|
+
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
|
108
|
+
Rails/Output:
|
109
|
+
Exclude:
|
110
|
+
- 'lib/generators/solidus_volume_pricing/install/install_generator.rb'
|
111
|
+
|
112
|
+
# Offense count: 2
|
113
|
+
# Configuration parameters: Blacklist, Whitelist.
|
114
|
+
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
115
|
+
Rails/SkipsModelValidations:
|
116
|
+
Exclude:
|
117
|
+
- 'spec/models/spree/volume_price_spec.rb'
|
118
|
+
|
119
|
+
# Offense count: 2
|
120
|
+
# Cop supports --auto-correct.
|
121
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
122
|
+
# SupportedStyles: nested, compact
|
123
|
+
Style/ClassAndModuleChildren:
|
124
|
+
Exclude:
|
125
|
+
- 'app/models/spree/volume_price.rb'
|
126
|
+
- 'app/models/spree/volume_price_model.rb'
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v1.1.0](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v1.1.0) (2023-02-09)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v1.0.0...v1.1.0)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Dependabot can't resolve your Ruby dependency files [\#57](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/57)
|
10
|
+
- Prepare Solidus Volume Pricing for Solidus 3.0 [\#53](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/53)
|
11
|
+
- Dependabot can't resolve your Ruby dependency files [\#52](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/52)
|
12
|
+
- Dependabot can't resolve your Ruby dependency files [\#51](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/51)
|
13
|
+
- Role base volume pricing not working [\#47](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/47)
|
14
|
+
- Dependabot couldn't find a Gemfile-local for this project [\#44](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/44)
|
15
|
+
- Dependabot can't resolve your Ruby dependency files [\#42](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/42)
|
16
|
+
- Dependabot can't resolve your Ruby dependency files [\#41](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/41)
|
17
|
+
- Dependabot can't resolve your Ruby dependency files [\#40](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/40)
|
18
|
+
- Dependabot can't resolve your Ruby dependency files [\#39](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/39)
|
19
|
+
- Dependabot can't resolve your Ruby dependency files [\#38](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/38)
|
20
|
+
- Dependabot can't resolve your Ruby dependency files [\#37](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/37)
|
21
|
+
- Dependabot can't resolve your Ruby dependency files [\#36](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/36)
|
22
|
+
- Dependabot can't resolve your Ruby dependency files [\#35](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/35)
|
23
|
+
- Can we get a new release? [\#29](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/29)
|
24
|
+
|
25
|
+
**Merged pull requests:**
|
26
|
+
|
27
|
+
- Update supported ruby version [\#66](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/66) ([mcrisologo](https://github.com/mcrisologo))
|
28
|
+
- Bump version to 1.1.0 [\#65](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/65) ([mcrisologo](https://github.com/mcrisologo))
|
29
|
+
- Update to use forked solidus\_frontend when needed [\#64](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/64) ([waiting-for-dev](https://github.com/waiting-for-dev))
|
30
|
+
- Configure autoloader to ignore decorators [\#61](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/61) ([pelargir](https://github.com/pelargir))
|
31
|
+
- Updating gemspec for Ruby 3 support [\#60](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/60) ([embold-given](https://github.com/embold-given))
|
32
|
+
- Solidus 3 preparation [\#59](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/59) ([cpfergus1](https://github.com/cpfergus1))
|
33
|
+
- Upgrade to GitHub-native Dependabot [\#58](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/58) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
34
|
+
- Relax solidus\_support dependency [\#50](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/50) ([kennyadsl](https://github.com/kennyadsl))
|
35
|
+
- Fix Dependabot looking for Gemfile-local [\#48](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/48) ([aldesantis](https://github.com/aldesantis))
|
36
|
+
- Fix role discounts [\#46](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/46) ([hrdchz](https://github.com/hrdchz))
|
37
|
+
- Rerun dev tools extension update command to improve the structure [\#45](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/45) ([blocknotes](https://github.com/blocknotes))
|
38
|
+
- Upgrade the extension using solidus\_dev\_support [\#43](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/43) ([blocknotes](https://github.com/blocknotes))
|
39
|
+
|
40
|
+
## [v1.0.0](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v1.0.0) (2019-11-23)
|
41
|
+
|
42
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v0.2.1...v1.0.0)
|
43
|
+
|
44
|
+
**Implemented enhancements:**
|
45
|
+
|
46
|
+
- Replace `I18n.t` with `t` in views [\#22](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/22)
|
47
|
+
|
48
|
+
**Closed issues:**
|
49
|
+
|
50
|
+
- can we create packs of product by this ? [\#13](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/13)
|
51
|
+
- Rails v 5.0.1 [\#8](https://github.com/solidusio-contrib/solidus_volume_pricing/issues/8)
|
52
|
+
|
53
|
+
**Merged pull requests:**
|
54
|
+
|
55
|
+
- Replace I18n.t with t in views [\#34](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/34) ([aldesantis](https://github.com/aldesantis))
|
56
|
+
- Reformat readme [\#33](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/33) ([aldesantis](https://github.com/aldesantis))
|
57
|
+
- Adopt solidus\_extension\_dev\_tools [\#32](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/32) ([aldesantis](https://github.com/aldesantis))
|
58
|
+
- Switch to sassc/rails [\#30](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/30) ([pelargir](https://github.com/pelargir))
|
59
|
+
- Update pg requirement from ~\> 0.21 to ~\> 1.1 [\#27](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/27) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
60
|
+
- Update coffee-rails requirement from ~\> 4.0 to ~\> 5.0 [\#26](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/26) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
61
|
+
- Adopt CircleCI instead of Travis [\#23](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/23) ([aldesantis](https://github.com/aldesantis))
|
62
|
+
- Solidus 2.4 UI updates [\#21](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/21) ([tvdeyen](https://github.com/tvdeyen))
|
63
|
+
- Test suite maintenance [\#20](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/20) ([aitbw](https://github.com/aitbw))
|
64
|
+
- Remove 2.2 from CI \(EOL\) [\#19](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/19) ([jacobherrington](https://github.com/jacobherrington))
|
65
|
+
- Remove versions past EOL from .travis.yml [\#17](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/17) ([jacobherrington](https://github.com/jacobherrington))
|
66
|
+
- Add Solidus 2.1-2.7 to .travis.yml [\#16](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/16) ([jacobherrington](https://github.com/jacobherrington))
|
67
|
+
- Remove deprecated icon option from button [\#12](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/12) ([pelargir](https://github.com/pelargir))
|
68
|
+
- V2.1 [\#11](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/11) ([seand7565](https://github.com/seand7565))
|
69
|
+
- Role fix [\#9](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/9) ([Senjai](https://github.com/Senjai))
|
70
|
+
- 1.0 fixes [\#7](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/7) ([tvdeyen](https://github.com/tvdeyen))
|
71
|
+
- Add pricers to calculate volume prices [\#4](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/4) ([tvdeyen](https://github.com/tvdeyen))
|
72
|
+
- Remove String monkey patch [\#3](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/3) ([tvdeyen](https://github.com/tvdeyen))
|
73
|
+
- Solidus 1.3 [\#2](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/2) ([tvdeyen](https://github.com/tvdeyen))
|
74
|
+
- Rename to solidus [\#1](https://github.com/solidusio-contrib/solidus_volume_pricing/pull/1) ([tvdeyen](https://github.com/tvdeyen))
|
75
|
+
|
76
|
+
## [v0.2.1](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v0.2.1) (2017-01-20)
|
77
|
+
|
78
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/v0.1.1...v0.2.1)
|
79
|
+
|
80
|
+
## [v0.1.1](https://github.com/solidusio-contrib/solidus_volume_pricing/tree/v0.1.1) (2017-01-20)
|
81
|
+
|
82
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_volume_pricing/compare/9bcf78426749d2d73878c6c7c8eb3bf0e5747ada...v0.1.1)
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
@@ -1,13 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
4
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
5
|
+
|
6
|
+
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
7
|
+
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
|
8
|
+
%w[solidusio/solidus solidusio/solidus_frontend]
|
9
|
+
else
|
10
|
+
%w[solidusio/solidus] * 2
|
11
|
+
end
|
12
|
+
gem 'solidus', github: solidus_git, branch: branch
|
13
|
+
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
|
2
14
|
|
3
|
-
|
4
|
-
|
15
|
+
# Needed to help Bundler figure out how to resolve dependencies,
|
16
|
+
# otherwise it takes forever to resolve them.
|
17
|
+
# See https://github.com/bundler/bundler/issues/6677
|
18
|
+
gem 'rails', '>0.a'
|
19
|
+
|
20
|
+
# Provides basic authentication functionality for testing parts of your engine
|
21
|
+
gem 'solidus_auth_devise'
|
5
22
|
|
6
23
|
case ENV['DB']
|
7
24
|
when 'mysql'
|
8
25
|
gem 'mysql2'
|
9
26
|
when 'postgresql'
|
10
27
|
gem 'pg'
|
28
|
+
else
|
29
|
+
gem 'sqlite3'
|
11
30
|
end
|
12
31
|
|
13
32
|
gemspec
|
33
|
+
|
34
|
+
# Use a local Gemfile to include development dependencies that might not be
|
35
|
+
# relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
|
36
|
+
send :eval_gemfile, 'Gemfile-local' if File.exist? 'Gemfile-local'
|
data/Guardfile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
guard 'rspec', cmd: 'bundle exec rspec' do
|
2
4
|
watch('spec/spec_helper.rb') { 'spec' }
|
3
5
|
watch('config/routes.rb') { 'spec/controllers' }
|
4
6
|
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
|
5
|
-
watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb"}
|
7
|
+
watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
6
8
|
watch(%r{^app/(.+)_decorator\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
9
|
watch(%r{^(app|lib)/(.+)(\.rb|\.erb)$}) { |m| "spec/#{m[2]}_spec.rb" }
|
8
10
|
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb" }
|
data/{LICENSE.md → LICENSE}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2009-2015 Spree Commerce and contributors
|
1
|
+
Copyright (c) 2009-2015 Spree Commerce and contributors, 2019 Sean Schofield
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -9,7 +9,7 @@ are permitted provided that the following conditions are met:
|
|
9
9
|
* Redistributions in binary form must reproduce the above copyright notice,
|
10
10
|
this list of conditions and the following disclaimer in the documentation
|
11
11
|
and/or other materials provided with the distribution.
|
12
|
-
* Neither the name
|
12
|
+
* Neither the name Solidus nor the names of its contributors may be used to
|
13
13
|
endorse or promote products derived from this software without specific
|
14
14
|
prior written permission.
|
15
15
|
|
data/README.md
CHANGED
@@ -1,24 +1,33 @@
|
|
1
1
|
# Volume Pricing
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_volume_pricing.svg?style=svg)](https://circleci.com/gh/solidusio-contrib/solidus_volume_pricing)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/solidusio-contrib/solidus_volume_pricing/badges/gpa.svg)](https://codeclimate.com/github/solidusio-contrib/solidus_volume_pricing)
|
5
5
|
|
6
|
-
Volume Pricing is an extension to Solidus that uses predefined ranges of quantities to determine the
|
6
|
+
Volume Pricing is an extension to Solidus that uses predefined ranges of quantities to determine the
|
7
|
+
price for a particular product variant.
|
7
8
|
|
8
|
-
|
9
|
+
For instance, this allows you to set a price for quantities between 1-10, another price for
|
10
|
+
quantities between (10-100) and another for quantities of 100 or more. If no volume price is defined
|
11
|
+
for a variant, then the standard price is used.
|
9
12
|
|
10
|
-
|
11
|
-
1. **Name:** The human readable representation of the quantity range (Ex. 10-100). (Optional)
|
12
|
-
1. **Discount Type** The type of discount to apply. **Price:** sets price to the amount specified. **Dollar:** subtracts specified amount from the Variant price. **Percent:** subtracts the specified amounts percentage from the Variant price.
|
13
|
-
1. **Range:** The quantity range for which the price is valid (See Below for Examples of Valid Ranges.)
|
14
|
-
1. **Amount:** The price of the product if the line item quantity falls within the specified range.
|
15
|
-
1. **Position:** Integer value for `acts_as_list` (Helps keep the volume prices in a defined order.)
|
13
|
+
Each VolumePrice contains the following values:
|
16
14
|
|
17
|
-
|
15
|
+
1. **Variant:** Each VolumePrice is associated with a _Variant_, which is used to link products to
|
16
|
+
particular prices.
|
17
|
+
2. **Name:** The human readable representation of the quantity range (Ex. 10-100). (Optional)
|
18
|
+
3. **Discount Type** The type of discount to apply. **Price:** sets price to the amount specified.
|
19
|
+
* **Dollar:** subtracts specified amount from the Variant price.
|
20
|
+
* **Percent:** subtracts the specified amounts percentage from the Variant price.
|
21
|
+
4. **Range:** The quantity range for which the price is valid (See Below for Examples of Valid
|
22
|
+
Ranges.)
|
23
|
+
5. **Amount:** The price of the product if the line item quantity falls within the specified range.
|
24
|
+
6. **Position:** Integer value for `acts_as_list` (Helps keep the volume prices in a defined order.)
|
18
25
|
|
19
26
|
## Install
|
20
27
|
|
21
|
-
The extension contains a rails generator that will add the necessary migrations and give you the
|
28
|
+
The extension contains a rails generator that will add the necessary migrations and give you the
|
29
|
+
option to run the migrations, or run them later, perhaps after installing other extensions. Once you
|
30
|
+
have bundled the extension, run the install generator and its ready to use.
|
22
31
|
|
23
32
|
rails generate solidus_volume_pricing:install
|
24
33
|
|
@@ -26,85 +35,81 @@ Easily add volume pricing display to your product page:
|
|
26
35
|
|
27
36
|
<%= render partial: 'spree/products/volume_pricing', locals: { product: @product } %>
|
28
37
|
|
29
|
-
---
|
30
|
-
|
31
38
|
## Ranges
|
32
39
|
|
33
|
-
Ranges are expressed as Strings and are similar to the format of a Range object in Ruby.
|
40
|
+
Ranges are expressed as Strings and are similar to the format of a Range object in Ruby. The lower
|
41
|
+
number of the range is always inclusive. If the range is defined with '..' then it also includes
|
42
|
+
the upper end of the range. If the range is defined with '...' then the upper end of the range is
|
43
|
+
not inclusive.
|
34
44
|
|
35
|
-
Ranges can also be defined as "open ended." Open ended ranges are defined with an integer followed
|
45
|
+
Ranges can also be defined as "open ended." Open ended ranges are defined with an integer followed
|
46
|
+
by a '+' character. These ranges are inclusive of the integer and any value higher then the
|
47
|
+
integer.
|
36
48
|
|
37
|
-
All ranges need to be expressed as Strings and can include or exclude parentheses. "(1..10)" and
|
38
|
-
|
39
|
-
---
|
49
|
+
All ranges need to be expressed as Strings and can include or exclude parentheses. "(1..10)" and
|
50
|
+
"1..10" are considered to be a valid range.
|
40
51
|
|
41
52
|
## Examples
|
42
53
|
|
43
54
|
Consider the following examples of volume prices:
|
44
55
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
| Variant | Name | Range | Amount | Position |
|
57
|
+
| ------- | ---- | ----- | ------ | -------- |
|
58
|
+
| Rails T-Shirt | 1-5 | (1..5) | 19.99 | 1 |
|
59
|
+
| Rails T-Shirt | 6-9 | (6...10) | 18.99 | 2 |
|
60
|
+
| Rails T-Shirt | 10 or more | (10+) | 17.99 | 3 |
|
50
61
|
|
51
62
|
### Example 1
|
52
63
|
|
53
64
|
Cart Contents:
|
54
65
|
|
55
|
-
|
56
|
-
|
57
|
-
|
66
|
+
| Product | Quantity | Price | Total |
|
67
|
+
| ------- | -------- | ----- | ----- |
|
68
|
+
| Rails T-Shirt | 1 | 19.99 | 19.99 |
|
58
69
|
|
59
70
|
### Example 2
|
60
71
|
|
61
72
|
Cart Contents:
|
62
73
|
|
63
|
-
|
64
|
-
|
65
|
-
|
74
|
+
| Product | Quantity | Price | Total |
|
75
|
+
| ------- | -------- | ----- | ----- |
|
76
|
+
| Rails T-Shirt | 5 | 19.99 | 99.95 |
|
66
77
|
|
67
78
|
### Example 3
|
68
79
|
|
69
80
|
Cart Contents:
|
70
81
|
|
71
|
-
|
72
|
-
|
73
|
-
|
82
|
+
| Product | Quantity | Price | Total |
|
83
|
+
| ------- | -------- | ----- | ----- |
|
84
|
+
| Rails T-Shirt | 6 | 18.99 | 113.94 |
|
74
85
|
|
75
86
|
### Example 4
|
76
87
|
|
77
88
|
Cart Contents:
|
78
89
|
|
79
|
-
|
80
|
-
|
81
|
-
|
90
|
+
| Product | Quantity | Price | Total |
|
91
|
+
| ------- | -------- | ----- | ----- |
|
92
|
+
| Rails T-Shirt | 10 | 17.99 | 179.90 |
|
82
93
|
|
83
94
|
### Example 5
|
84
95
|
|
85
96
|
Cart Contents:
|
86
97
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
---
|
98
|
+
| Product | Quantity | Price | Total |
|
99
|
+
| ------- | -------- | ----- | ----- |
|
100
|
+
| Rails T-Shirt | 20 | 17.99 | 359.80 |
|
92
101
|
|
93
102
|
## Additional Notes
|
94
103
|
|
95
|
-
* The volume price is applied based on the total quantity ordered for a particular variant.
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
## Contributing
|
100
|
-
|
101
|
-
See corresponding [contributing guidelines][1].
|
102
|
-
|
103
|
-
---
|
104
|
+
* The volume price is applied based on the total quantity ordered for a particular variant. It does
|
105
|
+
not apply different prices for the portion of the quantity that falls within a particular range.
|
106
|
+
Only the one price is used (although this would be an interesting configurable option if someone
|
107
|
+
wanted to write a patch.)
|
104
108
|
|
105
109
|
## License
|
106
110
|
|
107
|
-
Copyright (c) 2009-2015 [Spree Commerce][2] and [contributors][3], released under the
|
111
|
+
Copyright (c) 2009-2015 [Spree Commerce][2] and [contributors][3], released under the
|
112
|
+
[New BSD License][4].
|
108
113
|
|
109
114
|
[1]: https://github.com/solidusio-contrib/solidus_volume_pricing/blob/master/CONTRIBUTING.md
|
110
115
|
[2]: https://github.com/spree
|
data/Rakefile
CHANGED
@@ -1,21 +1,6 @@
|
|
1
|
-
|
2
|
-
Bundler::GemHelper.install_tasks
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
require '
|
5
|
-
|
3
|
+
require 'solidus_dev_support/rake_tasks'
|
4
|
+
SolidusDevSupport::RakeTasks.install
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
task :default do
|
10
|
-
if Dir["spec/dummy"].empty?
|
11
|
-
Rake::Task[:test_app].invoke
|
12
|
-
Dir.chdir("../../")
|
13
|
-
end
|
14
|
-
Rake::Task[:spec].invoke
|
15
|
-
end
|
16
|
-
|
17
|
-
desc 'Generates a dummy app for testing'
|
18
|
-
task :test_app do
|
19
|
-
ENV['LIB_NAME'] = 'solidus_volume_pricing'
|
20
|
-
Rake::Task['extension:test_app'].invoke
|
21
|
-
end
|
6
|
+
task default: 'extension:specs'
|
@@ -1,16 +1,2 @@
|
|
1
|
-
|
1
|
+
// Just here for backwards compatibility
|
2
2
|
|
3
|
-
// spree's version only handles 'input', not 'select', and this breaks solidus_volume_pricing
|
4
|
-
|
5
|
-
$(function () {
|
6
|
-
$('#add_volume_price').click( function() {
|
7
|
-
var target = $(this).data("target"),
|
8
|
-
new_table_row = $(target + ' tr:visible:first');
|
9
|
-
new_table_row.find('div.select2').remove();
|
10
|
-
$('select.select2').select2({
|
11
|
-
allowClear: true,
|
12
|
-
dropdownAutoWidth: true
|
13
|
-
});
|
14
|
-
});
|
15
|
-
|
16
|
-
});
|