mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Compare commits
323 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
147d15332c | ||
|
|
31b60ca069 | ||
|
|
1c5ada4d7c | ||
|
|
04ed7e4a94 | ||
|
|
d4a4a36b14 | ||
|
|
6474055380 | ||
|
|
3cf2db68b1 | ||
|
|
1522263cfc | ||
|
|
3e4b39c26b | ||
|
|
e3a529be5d | ||
|
|
60ad92c4ff | ||
|
|
20d5c45b7a | ||
|
|
6ce29f81d8 | ||
|
|
e2f68dac54 | ||
|
|
6f6a78b5a2 | ||
|
|
16fcde7053 | ||
|
|
a6486c2701 | ||
|
|
509a114d51 | ||
|
|
1fdd36e491 | ||
|
|
0ccba7f144 | ||
|
|
915714246f | ||
|
|
adcdca812d | ||
|
|
aa71e12020 | ||
|
|
1fe7ebcec2 | ||
|
|
440e5aaf97 | ||
|
|
53d1994b2a | ||
|
|
e2bdc69a90 | ||
|
|
e0e800a53f | ||
|
|
3820d4c591 | ||
|
|
b0fd333126 | ||
|
|
5606be7199 | ||
|
|
8982b34342 | ||
|
|
be2898f5a2 | ||
|
|
80ad18a684 | ||
|
|
6729119489 | ||
|
|
0b6288d97f | ||
|
|
f8f57a31db | ||
|
|
9724b07062 | ||
|
|
0a9c3b1538 | ||
|
|
87723217ec | ||
|
|
9a8082e35c | ||
|
|
bd031f4870 | ||
|
|
078309d4e7 | ||
|
|
f47de45346 | ||
|
|
e14dad1575 | ||
|
|
3e85762143 | ||
|
|
96d4ee3f4f | ||
|
|
2976b0717c | ||
|
|
f573423d3a | ||
|
|
d052c4f8a4 | ||
|
|
c44de8dbb3 | ||
|
|
e266475cde | ||
|
|
1338bcbf57 | ||
|
|
d84b6ce2ad | ||
|
|
e47198f1e5 | ||
|
|
eeae67e2d0 | ||
|
|
499ad982c3 | ||
|
|
f6304892c2 | ||
|
|
7a6f3d67e2 | ||
|
|
eb56027505 | ||
|
|
f0cd9de1c3 | ||
|
|
50ab0731d7 | ||
|
|
8ac2035d0c | ||
|
|
751e817deb | ||
|
|
82b6d39191 | ||
|
|
daffe333c5 | ||
|
|
c4bf36d402 | ||
|
|
d336ab52a1 | ||
|
|
ae3eb90668 | ||
|
|
09cd9b8462 | ||
|
|
9449c7c919 | ||
|
|
9dceda7e20 | ||
|
|
e6b4f462ef | ||
|
|
cee6a0f17f | ||
|
|
7acae6522b | ||
|
|
2d1e746c64 | ||
|
|
3382c1d0bb | ||
|
|
0c89479de4 | ||
|
|
b999673dfc | ||
|
|
1d15f35522 | ||
|
|
decab911bd | ||
|
|
0b616aa9ce | ||
|
|
10217e2ec8 | ||
|
|
9bf0667d04 | ||
|
|
36e3f1b7a6 | ||
|
|
d945e69404 | ||
|
|
385cd49964 | ||
|
|
28ac9d980c | ||
|
|
dbf5eb76f8 | ||
|
|
89dc9b938b | ||
|
|
7590b3ecf8 | ||
|
|
9966b5b33c | ||
|
|
07d20d2ba0 | ||
|
|
cefd5db6eb | ||
|
|
1113aefe11 | ||
|
|
27bc5805ae | ||
|
|
6c695df917 | ||
|
|
9a27addd14 | ||
|
|
a6c5d8ca73 | ||
|
|
4dbf047647 | ||
|
|
bcd306ebd4 | ||
|
|
012e91879a | ||
|
|
716286497e | ||
|
|
7be2f418d0 | ||
|
|
0e053a2601 | ||
|
|
00fa84e3b5 | ||
|
|
5913720c85 | ||
|
|
4592827261 | ||
|
|
4260422ea7 | ||
|
|
d4488fdb3f | ||
|
|
8c8b9d1b23 | ||
|
|
22de758e3a | ||
|
|
33969de371 | ||
|
|
a6dee77071 | ||
|
|
78946f908a | ||
|
|
4c50ca69ea | ||
|
|
fd815a6af6 | ||
|
|
feaa92406a | ||
|
|
68193efcf6 | ||
|
|
9a12957e27 | ||
|
|
de4d074cb3 | ||
|
|
d09ba16411 | ||
|
|
07314af3f6 | ||
|
|
554a8625e5 | ||
|
|
5c9dd81595 | ||
|
|
6d986deb2d | ||
|
|
4cb31d04a7 | ||
|
|
50302163c0 | ||
|
|
9682b9256b | ||
|
|
d016c47789 | ||
|
|
b8afb7ec4d | ||
|
|
836a60a6c7 | ||
|
|
23776c7a3e | ||
|
|
75345a95af | ||
|
|
eefd9891d6 | ||
|
|
7c25127ab6 | ||
|
|
ca46359224 | ||
|
|
9b93102a96 | ||
|
|
ba6523bb76 | ||
|
|
5ca4d549e7 | ||
|
|
d0f347efaa | ||
|
|
405b7e6e17 | ||
|
|
711a51f2ff | ||
|
|
5fba7811c4 | ||
|
|
5be1b139b9 | ||
|
|
8084ad0068 | ||
|
|
b017420319 | ||
|
|
9215ccc353 | ||
|
|
7c7a09a75c | ||
|
|
0d2374f07e | ||
|
|
1b7d72ffa7 | ||
|
|
2952b0582a | ||
|
|
4726e7a8a4 | ||
|
|
46c0baee4f | ||
|
|
1d5ebe42a9 | ||
|
|
e9e5ad2221 | ||
|
|
d69f42e940 | ||
|
|
2de2703e1f | ||
|
|
a9d7fa473e | ||
|
|
ddfda4011d | ||
|
|
e4030e673d | ||
|
|
74ed878a0c | ||
|
|
6acd8a29f2 | ||
|
|
699e9acfa5 | ||
|
|
ad44bd854b | ||
|
|
3418e5282a | ||
|
|
7601bdfd45 | ||
|
|
42a0a973ba | ||
|
|
0338753421 | ||
|
|
996bc05b4f | ||
|
|
15fc50441f | ||
|
|
e5818955ff | ||
|
|
43cd604405 | ||
|
|
f60068c0ce | ||
|
|
e50247db5a | ||
|
|
d858d6f941 | ||
|
|
5519b8b455 | ||
|
|
dd4f45a504 | ||
|
|
6e2c4a385a | ||
|
|
d8936b412e | ||
|
|
820417e6cc | ||
|
|
0802b04feb | ||
|
|
af8500e98c | ||
|
|
a99ecc473d | ||
|
|
c9b19811ad | ||
|
|
50f547af98 | ||
|
|
8624fa2a85 | ||
|
|
17906f378a | ||
|
|
92cd918e5a | ||
|
|
9c786ff39e | ||
|
|
570f9f2dc0 | ||
|
|
fb920c8960 | ||
|
|
026d4dd087 | ||
|
|
463473f2c3 | ||
|
|
30c1d89525 | ||
|
|
61a4a72b97 | ||
|
|
a951fd2c06 | ||
|
|
4db72f7475 | ||
|
|
0ebe46a17f | ||
|
|
f065b4c787 | ||
|
|
8dc743f2d4 | ||
|
|
1c180299a5 | ||
|
|
37b5e1b014 | ||
|
|
3152fef2ef | ||
|
|
f0d6cd1f59 | ||
|
|
ee77210e81 | ||
|
|
d1339fa253 | ||
|
|
eaeda23e4f | ||
|
|
65ed199ba9 | ||
|
|
e6f7c961e1 | ||
|
|
8f5cb7bd91 | ||
|
|
9d67606490 | ||
|
|
ae2726fc6b | ||
|
|
3a6fc59f80 | ||
|
|
1ba56851bb | ||
|
|
97bdceb78a | ||
|
|
c0c7663452 | ||
|
|
4a3e0ea9b9 | ||
|
|
dfe8ed26d9 | ||
|
|
572a65b324 | ||
|
|
f8002ae49a | ||
|
|
242459fae4 | ||
|
|
d0bb52f709 | ||
|
|
78cbd7b5c7 | ||
|
|
0d729fa0a8 | ||
|
|
f2c3afdbfd | ||
|
|
3ae5672d1a | ||
|
|
4c0b3bf9bf | ||
|
|
f7de43e8b7 | ||
|
|
8a1fcf8a62 | ||
|
|
08d7a4de92 | ||
|
|
0777212607 | ||
|
|
e403fc171d | ||
|
|
c4751d7056 | ||
|
|
e2695fdbfb | ||
|
|
cd0542af85 | ||
|
|
a8e29d7c07 | ||
|
|
67be08b40e | ||
|
|
2e6d8c1216 | ||
|
|
6468b7d98d | ||
|
|
787b643832 | ||
|
|
b45f0f3416 | ||
|
|
6293e927bc | ||
|
|
433227cc09 | ||
|
|
f77ecc1968 | ||
|
|
7235d1813d | ||
|
|
35392cb117 | ||
|
|
31e6405125 | ||
|
|
ca0166a420 | ||
|
|
998f7afdc4 | ||
|
|
012527522c | ||
|
|
bbf10a7198 | ||
|
|
b995c3ed49 | ||
|
|
031258e1ee | ||
|
|
e060a059d8 | ||
|
|
f02c79751c | ||
|
|
2938de7eee | ||
|
|
8d18279f53 | ||
|
|
5eb88e020c | ||
|
|
81f5755e3d | ||
|
|
4e4d9bb5a5 | ||
|
|
5b434ca7c4 | ||
|
|
11ed1574ca | ||
|
|
5e6dd1e6e1 | ||
|
|
d97381548a | ||
|
|
ddaac654ef | ||
|
|
da6be441f8 | ||
|
|
ae0a71b29d | ||
|
|
fdeadd0940 | ||
|
|
d8391aa1d3 | ||
|
|
293bc10dde | ||
|
|
3abef1b703 | ||
|
|
5f02ab79d4 | ||
|
|
8e1272b1e8 | ||
|
|
091c04427c | ||
|
|
7c0a631f7f | ||
|
|
0516ec6f15 | ||
|
|
5e321c9f48 | ||
|
|
611beb2e90 | ||
|
|
908a22bcb6 | ||
|
|
370ec17818 | ||
|
|
bf4428b688 | ||
|
|
7e62bfcdfb | ||
|
|
448e4bb67b | ||
|
|
22d5a63a5b | ||
|
|
f3792acf55 | ||
|
|
8b59ef20db | ||
|
|
794e0e0326 | ||
|
|
13a7fb79cf | ||
|
|
77d8e7da90 | ||
|
|
a522e597e1 | ||
|
|
6116fd8881 | ||
|
|
50389a864a | ||
|
|
89e692c6c8 | ||
|
|
0577b46f3f | ||
|
|
8a18a4de66 | ||
|
|
04da148af0 | ||
|
|
6561a7246b | ||
|
|
798af2dafc | ||
|
|
a6bf6470f7 | ||
|
|
6c6e5ca316 | ||
|
|
6856f21e7e | ||
|
|
aae40c74a9 | ||
|
|
0397a68072 | ||
|
|
ccb9df708b | ||
|
|
23a7ba2479 | ||
|
|
e077607767 | ||
|
|
115dfe445b | ||
|
|
4a436978a9 | ||
|
|
0eb97f1cdc | ||
|
|
a1b21d7706 | ||
|
|
f6e64f3a3c | ||
|
|
c5beff249e | ||
|
|
4c508a5bf9 | ||
|
|
da9c0f4b8c | ||
|
|
467183af48 | ||
|
|
515e2cfc51 | ||
|
|
b746eacd11 | ||
|
|
5db50481dd | ||
|
|
d4435b5f10 | ||
|
|
9cf5645478 | ||
|
|
7b2a9df326 | ||
|
|
3922ffa6a9 |
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
@@ -11,6 +11,8 @@ jobs:
|
||||
- name: rubocop
|
||||
uses: reviewdog/action-rubocop@v2
|
||||
with:
|
||||
rubocop_version: gemfile
|
||||
rubocop_extensions: rubocop-rails:gemfile
|
||||
reporter: github-pr-check
|
||||
level: error
|
||||
fail_on_error: true
|
||||
|
||||
@@ -10,6 +10,9 @@ inherit_from:
|
||||
# The automatically generated todo list to ignore all current violations.
|
||||
- .rubocop_todo.yml
|
||||
|
||||
# The relaxed style rules as a common starting point which we can refine.
|
||||
- .rubocop_relaxed_styleguide.yml
|
||||
|
||||
# Our Open Food Network style guide. If you want to see all violations,
|
||||
# then use only that configuration:
|
||||
#
|
||||
|
||||
153
.rubocop_relaxed_styleguide.yml
Normal file
153
.rubocop_relaxed_styleguide.yml
Normal file
@@ -0,0 +1,153 @@
|
||||
# Relaxed.Ruby.Style
|
||||
## Version 2.5
|
||||
|
||||
Style/Alias:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylealias
|
||||
|
||||
Style/AsciiComments:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleasciicomments
|
||||
|
||||
Style/BeginBlock:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylebeginblock
|
||||
|
||||
Style/BlockDelimiters:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleblockdelimiters
|
||||
|
||||
Style/CommentAnnotation:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylecommentannotation
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styledocumentation
|
||||
|
||||
Layout/DotPosition:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#layoutdotposition
|
||||
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styledoublenegation
|
||||
|
||||
Style/EndBlock:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleendblock
|
||||
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleformatstring
|
||||
|
||||
Style/IfUnlessModifier:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleifunlessmodifier
|
||||
|
||||
Style/Lambda:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylelambda
|
||||
|
||||
Style/ModuleFunction:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylemodulefunction
|
||||
|
||||
Style/MultilineBlockChain:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylemultilineblockchain
|
||||
|
||||
Style/NegatedIf:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylenegatedif
|
||||
|
||||
Style/NegatedWhile:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylenegatedwhile
|
||||
|
||||
Style/NumericPredicate:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylenumericpredicate
|
||||
|
||||
Style/ParallelAssignment:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleparallelassignment
|
||||
|
||||
Style/PercentLiteralDelimiters:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylepercentliteraldelimiters
|
||||
|
||||
Style/PerlBackrefs:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styleperlbackrefs
|
||||
|
||||
Style/Semicolon:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylesemicolon
|
||||
|
||||
Style/SignalException:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylesignalexception
|
||||
|
||||
Style/SingleLineBlockParams:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylesinglelineblockparams
|
||||
|
||||
Style/SingleLineMethods:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylesinglelinemethods
|
||||
|
||||
Layout/SpaceBeforeBlockBraces:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#layoutspacebeforeblockbraces
|
||||
|
||||
Layout/SpaceInsideParens:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#layoutspaceinsideparens
|
||||
|
||||
Style/SpecialGlobalVars:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylespecialglobalvars
|
||||
|
||||
Style/StringLiterals:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylestringliterals
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarguments
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarrayliteral
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainhashliteral
|
||||
|
||||
Style/SymbolArray:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylesymbolarray
|
||||
|
||||
Style/WhileUntilModifier:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylewhileuntilmodifier
|
||||
|
||||
Style/WordArray:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#stylewordarray
|
||||
|
||||
Lint/AmbiguousRegexpLiteral:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#lintambiguousregexpliteral
|
||||
|
||||
Lint/AssignmentInCondition:
|
||||
Enabled: false
|
||||
StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
|
||||
|
||||
Layout/LineLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics:
|
||||
Enabled: false
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
inherit_from:
|
||||
- .rubocop.yml
|
||||
|
||||
# This rubocop config file is only used for specs
|
||||
# Here we allow specs to be 300 lines long
|
||||
Metrics/ModuleLength:
|
||||
Max: 300
|
||||
@@ -19,6 +19,25 @@ AllCops:
|
||||
#
|
||||
# Cop settings that have been agreed upon by the OFN community
|
||||
|
||||
Metrics:
|
||||
Enabled: true
|
||||
|
||||
Metrics/BlockLength:
|
||||
IgnoredMethods: [
|
||||
"class_eval",
|
||||
"collection",
|
||||
"context",
|
||||
"describe",
|
||||
"feature",
|
||||
"it",
|
||||
"member",
|
||||
"namespace",
|
||||
"resource",
|
||||
"resources",
|
||||
"scenario",
|
||||
"shared_examples",
|
||||
]
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
AllowedMethods:
|
||||
- "touch"
|
||||
@@ -46,6 +65,7 @@ Layout/MultilineMethodCallIndentation:
|
||||
EnforcedStyle: indented
|
||||
|
||||
Layout/LineLength:
|
||||
Enabled: true
|
||||
Max: 100
|
||||
|
||||
Lint/RaiseException:
|
||||
@@ -75,156 +95,16 @@ Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- spec/**/*
|
||||
|
||||
## Relaxed.Ruby.Style SETTINGS
|
||||
#
|
||||
# These styles are a starting point for the conversation around conventions
|
||||
# They should be removed or tweaked and moved above as decisions are made
|
||||
# NOTE: Cops which did not fail at the time of writing were removed
|
||||
|
||||
Layout/DotPosition:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styledotposition
|
||||
|
||||
Layout/SpaceBeforeBlockBraces:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
|
||||
|
||||
Layout/SpaceInsideParens:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
|
||||
|
||||
Style/Alias:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylealias
|
||||
|
||||
Style/BlockDelimiters:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
|
||||
|
||||
Style/CommentAnnotation:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylecommentannotation
|
||||
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styledoublenegation
|
||||
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styleformatstring
|
||||
|
||||
Style/HashEachMethods:
|
||||
Enabled: false
|
||||
|
||||
Style/HashTransformKeys:
|
||||
Enabled: false
|
||||
|
||||
Style/HashTransformValues:
|
||||
Enabled: false
|
||||
|
||||
Style/IfUnlessModifier:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
|
||||
|
||||
Style/Lambda:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylelambda
|
||||
|
||||
Style/MultilineBlockChain:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
|
||||
|
||||
Style/NegatedIf:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylenegatedif
|
||||
|
||||
Style/NegatedWhile:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
|
||||
|
||||
Style/ParallelAssignment:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
|
||||
|
||||
Style/PercentLiteralDelimiters:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
|
||||
|
||||
Style/Semicolon:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylesemicolon
|
||||
|
||||
Style/SingleLineMethods:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
|
||||
|
||||
Style/WordArray:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#stylewordarray
|
||||
|
||||
Style/SymbolArray:
|
||||
Enabled: false
|
||||
StyleGuide: https://rubocop.readthedocs.io/en/latest/cops_style/#stylesymbolarray
|
||||
|
||||
Lint/AmbiguousRegexpLiteral:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
|
||||
|
||||
Lint/AssignmentInCondition:
|
||||
Enabled: false
|
||||
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
|
||||
|
||||
Metrics/AbcSize:
|
||||
Max: 15
|
||||
|
||||
Metrics/BlockLength:
|
||||
Max: 25
|
||||
IgnoredMethods: [
|
||||
"class_eval",
|
||||
"collection",
|
||||
"context",
|
||||
"describe",
|
||||
"feature",
|
||||
"it",
|
||||
"member",
|
||||
"namespace",
|
||||
"resource",
|
||||
"resources",
|
||||
"scenario"
|
||||
]
|
||||
|
||||
Metrics/BlockNesting:
|
||||
Max: 3
|
||||
|
||||
Metrics/ClassLength:
|
||||
Max: 100
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Max: 100
|
||||
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 6
|
||||
Max: 30 # default 17
|
||||
|
||||
Metrics/MethodLength:
|
||||
Max: 10
|
||||
|
||||
Metrics/ParameterLists:
|
||||
Max: 5
|
||||
Enabled: true
|
||||
Max: 25 # default 10
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 7
|
||||
Enabled: true
|
||||
Max: 14 # default 8
|
||||
|
||||
Naming/PredicateName:
|
||||
Enabled: false
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400`
|
||||
# on 2021-12-09 22:28:37 UTC using RuboCop version 1.22.2.
|
||||
# on 2022-02-25 01:04:47 UTC using RuboCop version 1.22.2.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
||||
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
||||
Bundler/OrderedGems:
|
||||
Exclude:
|
||||
- 'Gemfile'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: Include.
|
||||
# Include: **/*.gemspec
|
||||
@@ -45,7 +53,7 @@ Layout/LeadingCommentSpace:
|
||||
Exclude:
|
||||
- 'spec/system/admin/enterprises_spec.rb'
|
||||
|
||||
# Offense count: 814
|
||||
# Offense count: 828
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
@@ -59,11 +67,13 @@ Layout/LineLength:
|
||||
- 'app/controllers/admin/schedules_controller.rb'
|
||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||
- 'app/controllers/api/v0/order_cycles_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/controllers/spree/paypal_controller.rb'
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'app/controllers/user_confirmations_controller.rb'
|
||||
- 'app/helpers/angular_form_builder.rb'
|
||||
- 'app/helpers/angular_form_helper.rb'
|
||||
- 'app/helpers/checkout_helper.rb'
|
||||
- 'app/helpers/enterprises_helper.rb'
|
||||
- 'app/helpers/order_cycles_helper.rb'
|
||||
- 'app/helpers/spree/orders_helper.rb'
|
||||
@@ -91,7 +101,6 @@ Layout/LineLength:
|
||||
- 'app/models/subscription.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
- 'app/serializers/api/admin/subscription_line_item_serializer.rb'
|
||||
- 'app/serializers/api/admin/subscription_serializer.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
- 'app/services/checkout/post_checkout_actions.rb'
|
||||
- 'app/services/embedded_page_service.rb'
|
||||
@@ -101,7 +110,6 @@ Layout/LineLength:
|
||||
- 'app/services/variant_units/variant_and_line_item_naming.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/validator.rb'
|
||||
- 'engines/order_management/spec/services/order_management/order/stripe_sca_payment_authorize_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/order/updater_spec.rb'
|
||||
- 'engines/web/app/helpers/web/cookies_policy_helper.rb'
|
||||
- 'engines/web/spec/features/consumer/cookies_spec.rb'
|
||||
@@ -147,6 +155,7 @@ Layout/LineLength:
|
||||
- 'spec/controllers/checkout_controller_spec.rb'
|
||||
- 'spec/controllers/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/line_items_controller_spec.rb'
|
||||
- 'spec/controllers/registration_controller_spec.rb'
|
||||
- 'spec/controllers/shops_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders/invoices_spec.rb'
|
||||
@@ -159,8 +168,8 @@ Layout/LineLength:
|
||||
- 'spec/controllers/stripe/callbacks_controller_spec.rb'
|
||||
- 'spec/controllers/stripe/webhooks_controller_spec.rb'
|
||||
- 'spec/controllers/user_confirmations_controller_spec.rb'
|
||||
- 'spec/factories/order_factory.rb'
|
||||
- 'spec/factories/stock_location_factory.rb'
|
||||
- 'spec/features/consumer/multilingual_spec.rb'
|
||||
- 'spec/helpers/enterprises_helper_spec.rb'
|
||||
- 'spec/helpers/injection_helper_spec.rb'
|
||||
- 'spec/helpers/order_cycles_helper_spec.rb'
|
||||
@@ -198,7 +207,6 @@ Layout/LineLength:
|
||||
- 'spec/models/spree/address_spec.rb'
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
- 'spec/models/spree/classification_spec.rb'
|
||||
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
|
||||
- 'spec/models/spree/inventory_unit_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order/checkout_spec.rb'
|
||||
@@ -219,7 +227,7 @@ Layout/LineLength:
|
||||
- 'spec/models/variant_override_spec.rb'
|
||||
- 'spec/requests/api/orders_spec.rb'
|
||||
- 'spec/requests/checkout/failed_checkout_spec.rb'
|
||||
- 'spec/requests/embedded_shopfronts_headers_spec.rb'
|
||||
- 'spec/routing/stripe_spec.rb'
|
||||
- 'spec/serializers/api/admin/exchange_serializer_spec.rb'
|
||||
- 'spec/serializers/api/admin/order_cycle_serializer_spec.rb'
|
||||
- 'spec/services/address_geocoder_spec.rb'
|
||||
@@ -242,7 +250,6 @@ Layout/LineLength:
|
||||
- 'spec/support/matchers/table_matchers.rb'
|
||||
- 'spec/support/request/stripe_stubs.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
- 'spec/swagger_helper.rb'
|
||||
- 'spec/system/admin/adjustments_spec.rb'
|
||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||
- 'spec/system/admin/bulk_product_update_spec.rb'
|
||||
@@ -280,7 +287,6 @@ Layout/LineLength:
|
||||
- 'spec/system/consumer/shopping/checkout_auth_spec.rb'
|
||||
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||
- 'spec/system/consumer/shopping/checkout_stripe_spec.rb'
|
||||
- 'spec/system/consumer/shopping/embedded_shopfronts_spec.rb'
|
||||
- 'spec/system/consumer/shopping/products_spec.rb'
|
||||
- 'spec/system/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/system/consumer/shopping/unit_price_spec.rb'
|
||||
@@ -303,7 +309,7 @@ Layout/MultilineMethodCallBraceLayout:
|
||||
Exclude:
|
||||
- 'lib/reporting/queries/joins.rb'
|
||||
|
||||
# Offense count: 15
|
||||
# Offense count: 17
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
@@ -338,6 +344,11 @@ Lint/DuplicateMethods:
|
||||
Exclude:
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Lint/DuplicateRequire:
|
||||
Exclude:
|
||||
- 'spec/lib/open_food_network/scope_variants_to_search_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowComments.
|
||||
Lint/EmptyFile:
|
||||
@@ -392,179 +403,43 @@ Lint/UselessMethodDefinition:
|
||||
- 'app/controllers/spree/user_registrations_controller.rb'
|
||||
- 'app/models/spree/gateway.rb'
|
||||
|
||||
# Offense count: 262
|
||||
# Offense count: 39
|
||||
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
|
||||
Metrics/AbcSize:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/bulk_line_items_controller.rb'
|
||||
- 'app/controllers/admin/customers_controller.rb'
|
||||
- 'app/controllers/admin/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/admin/resource_controller.rb'
|
||||
- 'app/controllers/admin/schedules_controller.rb'
|
||||
- 'app/controllers/admin/stripe_accounts_controller.rb'
|
||||
- 'app/controllers/admin/subscription_line_items_controller.rb'
|
||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||
- 'app/controllers/api/v0/enterprises_controller.rb'
|
||||
- 'app/controllers/api/v0/product_images_controller.rb'
|
||||
- 'app/controllers/api/v0/products_controller.rb'
|
||||
- 'app/controllers/api/v0/shipments_controller.rb'
|
||||
- 'app/controllers/api/v0/taxons_controller.rb'
|
||||
- 'app/controllers/api/v0/variants_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/discourse_sso_controller.rb'
|
||||
- 'app/controllers/enterprises_controller.rb'
|
||||
- 'app/controllers/split_checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/adjustments_controller.rb'
|
||||
- 'app/controllers/spree/admin/general_settings_controller.rb'
|
||||
- 'app/controllers/spree/admin/images_controller.rb'
|
||||
- 'app/controllers/spree/admin/mail_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders/customer_details_controller.rb'
|
||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders_controller.rb'
|
||||
- 'app/controllers/spree/admin/overview_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/payments_controller.rb'
|
||||
- 'app/controllers/spree/admin/products_controller.rb'
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/controllers/spree/admin/search_controller.rb'
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
- 'app/controllers/spree/admin/users_controller.rb'
|
||||
- 'app/controllers/spree/admin/variants_controller.rb'
|
||||
- 'app/controllers/spree/credit_cards_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/controllers/spree/paypal_controller.rb'
|
||||
- 'app/controllers/spree/user_passwords_controller.rb'
|
||||
- 'app/controllers/spree/user_sessions_controller.rb'
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'app/controllers/stripe/callbacks_controller.rb'
|
||||
- 'app/controllers/user_confirmations_controller.rb'
|
||||
- 'app/controllers/user_passwords_controller.rb'
|
||||
- 'app/controllers/user_registrations_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/helpers/checkout_helper.rb'
|
||||
- 'app/helpers/order_cycles_helper.rb'
|
||||
- 'app/helpers/spree/admin/base_helper.rb'
|
||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||
- 'app/helpers/spree/admin/zones_helper.rb'
|
||||
- 'app/helpers/spree/base_helper.rb'
|
||||
- 'app/helpers/spree/orders_helper.rb'
|
||||
- 'app/helpers/tax_helper.rb'
|
||||
- 'app/mailers/producer_mailer.rb'
|
||||
- 'app/mailers/spree/order_mailer.rb'
|
||||
- 'app/models/calculator/flat_percent_per_item.rb'
|
||||
- 'app/models/column_preference.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/product_import/entry_processor.rb'
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'app/models/product_import/unit_converter.rb'
|
||||
- 'app/models/proxy_order.rb'
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/gateway/pay_pal_express.rb'
|
||||
- 'app/models/spree/image.rb'
|
||||
- 'app/models/spree/item_adjustments.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/payment.rb'
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
- 'app/models/spree/preference.rb'
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'app/models/spree/product.rb'
|
||||
- 'app/models/spree/return_authorization.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/tax_rate.rb'
|
||||
- 'app/models/spree/taxon.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/serializers/api/admin/enterprise_serializer.rb'
|
||||
- 'app/serializers/api/variant_serializer.rb'
|
||||
- 'app/services/cap_quantity.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
- 'app/services/create_order_cycle.rb'
|
||||
- 'app/services/order_cycle_form.rb'
|
||||
- 'app/services/order_factory.rb'
|
||||
- 'app/services/order_syncer.rb'
|
||||
- 'app/services/place_proxy_order.rb'
|
||||
- 'app/services/process_payment_intent.rb'
|
||||
- 'app/services/products_renderer.rb'
|
||||
- 'app/services/search_orders.rb'
|
||||
- 'app/services/sets/model_set.rb'
|
||||
- 'app/services/variant_units/option_value_namer.rb'
|
||||
- 'app/services/variant_units/variant_and_line_item_naming.rb'
|
||||
- 'app/services/variants_stock_levels.rb'
|
||||
- 'engines/order_management/app/services/order_management/order/updater.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/package.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/packer.rb'
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/form.rb'
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/validator.rb'
|
||||
- 'lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/open_food_network/group_buy_report.rb'
|
||||
- 'lib/open_food_network/lettuce_share_report.rb'
|
||||
- 'lib/open_food_network/order_and_distributor_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_cycle_management_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/open_food_network/order_grouper.rb'
|
||||
- 'lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report.rb'
|
||||
- 'lib/open_food_network/payments_report.rb'
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'lib/open_food_network/products_and_inventory_report.rb'
|
||||
- 'lib/open_food_network/reports/line_items.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/users_and_enterprises_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/reporting/queries/query_builder.rb'
|
||||
- 'lib/reporting/reports/packing/base.rb'
|
||||
- 'lib/reporting/reports/packing/customer.rb'
|
||||
- 'lib/reporting/reports/packing/supplier.rb'
|
||||
- 'lib/session_cookie_upgrader.rb'
|
||||
- 'lib/spree/api/controller_setup.rb'
|
||||
- 'lib/spree/core/controller_helpers/auth.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/spree/core/controller_helpers/respond_with.rb'
|
||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||
- 'lib/spree/core/permalinks.rb'
|
||||
- 'lib/spree/core/product_duplicator.rb'
|
||||
- 'lib/spree/core/s3_support.rb'
|
||||
- 'lib/spree/localized_number.rb'
|
||||
- 'lib/stripe/account_connector.rb'
|
||||
- 'lib/stripe/authorize_response_patcher.rb'
|
||||
- 'lib/stripe/profile_storer.rb'
|
||||
- 'lib/tasks/enterprises.rake'
|
||||
- 'lib/tasks/sample_data/order_factory.rb'
|
||||
- 'lib/tasks/sample_data/product_factory.rb'
|
||||
- 'spec/controllers/api/v0/reports/packing_report_spec.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
- 'spec/services/order_checkout_restart_spec.rb'
|
||||
- 'spec/support/i18n_translations_checker.rb'
|
||||
- 'spec/support/performance_helper.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
- 'spec/system/admin/product_import_spec.rb'
|
||||
- 'spec/system/admin/reports_spec.rb'
|
||||
- 'spec/system/admin/subscriptions_spec.rb'
|
||||
- 'spec/system/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/system/consumer/shopping/variant_overrides_spec.rb'
|
||||
|
||||
# Offense count: 48
|
||||
# Offense count: 45
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
||||
# IgnoredMethods: refine
|
||||
Metrics/BlockLength:
|
||||
@@ -582,7 +457,6 @@ Metrics/BlockLength:
|
||||
- 'spec/factories/line_item_factory.rb'
|
||||
- 'spec/factories/order_cycle_factory.rb'
|
||||
- 'spec/factories/order_factory.rb'
|
||||
- 'spec/factories/payment_method_factory.rb'
|
||||
- 'spec/factories/product_factory.rb'
|
||||
- 'spec/factories/shipment_factory.rb'
|
||||
- 'spec/factories/shipping_method_factory.rb'
|
||||
@@ -595,10 +469,8 @@ Metrics/BlockLength:
|
||||
- 'spec/support/cancan_helper.rb'
|
||||
- 'spec/support/matchers/select2_matchers.rb'
|
||||
- 'spec/support/matchers/table_matchers.rb'
|
||||
- 'spec/swagger_helper.rb'
|
||||
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
||||
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||
- 'spec/system/consumer/shopping/embedded_shopfronts_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: CountBlocks, Max.
|
||||
@@ -619,6 +491,8 @@ Metrics/ClassLength:
|
||||
- 'app/controllers/api/v0/products_controller.rb'
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||
- 'app/controllers/split_checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/payments_controller.rb'
|
||||
@@ -626,7 +500,6 @@ Metrics/ClassLength:
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/controllers/spree/admin/users_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/controllers/spree/paypal_controller.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/product_import/entry_processor.rb'
|
||||
@@ -660,208 +533,71 @@ Metrics/ClassLength:
|
||||
- 'lib/open_food_network/users_and_enterprises_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
|
||||
# Offense count: 72
|
||||
# Offense count: 40
|
||||
# Configuration parameters: IgnoredMethods, Max.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/payments_controller.rb'
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
- 'app/controllers/spree/admin/users_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/helpers/checkout_helper.rb'
|
||||
- 'app/helpers/order_cycles_helper.rb'
|
||||
- 'app/helpers/spree/admin/base_helper.rb'
|
||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||
- 'app/helpers/spree/admin/orders_helper.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/payment.rb'
|
||||
- 'app/models/spree/preference.rb'
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'app/models/spree/product.rb'
|
||||
- 'app/models/spree/return_authorization.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/tax_rate.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
- 'app/services/products_renderer.rb'
|
||||
- 'app/services/sets/model_set.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/enterprise_fee_summary/parameters.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/validator.rb'
|
||||
- 'lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/open_food_network/group_buy_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/open_food_network/orders_and_fulfillments_report/customer_totals_report.rb'
|
||||
- 'lib/open_food_network/payments_report.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/spree/core/controller_helpers/respond_with.rb'
|
||||
- 'lib/spree/localized_number.rb'
|
||||
- 'lib/stripe/authorize_response_patcher.rb'
|
||||
- 'lib/stripe/credit_card_clone_destroyer.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
- 'spec/support/i18n_translations_checker.rb'
|
||||
|
||||
# Offense count: 254
|
||||
# Offense count: 31
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
||||
Metrics/MethodLength:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/bulk_line_items_controller.rb'
|
||||
- 'app/controllers/admin/contents_controller.rb'
|
||||
- 'app/controllers/admin/customers_controller.rb'
|
||||
- 'app/controllers/admin/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/admin/manager_invitations_controller.rb'
|
||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||
- 'app/controllers/admin/resource_controller.rb'
|
||||
- 'app/controllers/admin/stripe_accounts_controller.rb'
|
||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||
- 'app/controllers/api/v0/exchange_products_controller.rb'
|
||||
- 'app/controllers/api/v0/product_images_controller.rb'
|
||||
- 'app/controllers/api/v0/products_controller.rb'
|
||||
- 'app/controllers/api/v0/shipments_controller.rb'
|
||||
- 'app/controllers/api/v0/taxons_controller.rb'
|
||||
- 'app/controllers/api/v0/variants_controller.rb'
|
||||
- 'app/controllers/shop_controller.rb'
|
||||
- 'app/controllers/split_checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders/customer_details_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/payments_controller.rb'
|
||||
- 'app/controllers/spree/admin/products_controller.rb'
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/controllers/spree/admin/tax_categories_controller.rb'
|
||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
- 'app/controllers/spree/admin/users_controller.rb'
|
||||
- 'app/controllers/spree/admin/variants_controller.rb'
|
||||
- 'app/controllers/spree/credit_cards_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/controllers/spree/paypal_controller.rb'
|
||||
- 'app/controllers/spree/user_sessions_controller.rb'
|
||||
- 'app/controllers/stripe/callbacks_controller.rb'
|
||||
- 'app/controllers/user_confirmations_controller.rb'
|
||||
- 'app/controllers/user_passwords_controller.rb'
|
||||
- 'app/controllers/user_registrations_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/helpers/checkout_helper.rb'
|
||||
- 'app/helpers/order_cycles_helper.rb'
|
||||
- 'app/helpers/spree/admin/base_helper.rb'
|
||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||
- 'app/mailers/producer_mailer.rb'
|
||||
- 'app/models/calculator/default_tax.rb'
|
||||
- 'app/models/column_preference.rb'
|
||||
- 'app/models/concerns/calculated_adjustments.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/preference_sections/footer_and_external_links_section.rb'
|
||||
- 'app/models/preference_sections/main_links_section.rb'
|
||||
- 'app/models/product_import/entry_processor.rb'
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
- 'app/models/spree/gateway/pay_pal_express.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'app/models/spree/order_contents.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
- 'app/models/spree/preference.rb'
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'app/models/spree/preferences/store.rb'
|
||||
- 'app/models/spree/product.rb'
|
||||
- 'app/models/spree/return_authorization.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/tax_rate.rb'
|
||||
- 'app/models/spree/taxon.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/serializers/api/admin/order_cycle_serializer.rb'
|
||||
- 'app/serializers/api/cached_enterprise_serializer.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
- 'app/services/mail_configuration.rb'
|
||||
- 'app/services/order_cycle_form.rb'
|
||||
- 'app/services/permitted_attributes/checkout.rb'
|
||||
- 'app/services/permitted_attributes/enterprise.rb'
|
||||
- 'app/services/place_proxy_order.rb'
|
||||
- 'app/services/process_payment_intent.rb'
|
||||
- 'app/services/products_renderer.rb'
|
||||
- 'app/services/variant_units/option_value_namer.rb'
|
||||
- 'engines/order_management/app/services/order_management/order/updater.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_allocation_report.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_supplier_report.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/enterprise_fee_summary/scope.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/package.rb'
|
||||
- 'lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/column_preference_defaults.rb'
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/open_food_network/group_buy_report.rb'
|
||||
- 'lib/open_food_network/lettuce_share_report.rb'
|
||||
- 'lib/open_food_network/order_and_distributor_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_cycle_management_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/open_food_network/order_grouper.rb'
|
||||
- 'lib/open_food_network/payments_report.rb'
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'lib/open_food_network/products_and_inventory_report.rb'
|
||||
- 'lib/open_food_network/reports/line_items.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/users_and_enterprises_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/reporting/reports/packing/base.rb'
|
||||
- 'lib/reporting/reports/packing/customer.rb'
|
||||
- 'lib/reporting/reports/packing/supplier.rb'
|
||||
- 'lib/session_cookie_upgrader.rb'
|
||||
- 'lib/spree/api/controller_setup.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/spree/core/controller_helpers/respond_with.rb'
|
||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||
- 'lib/spree/core/permalinks.rb'
|
||||
- 'lib/spree/core/s3_support.rb'
|
||||
- 'lib/spree/localized_number.rb'
|
||||
- 'lib/spree/responder.rb'
|
||||
- 'lib/stripe/credit_card_clone_finder.rb'
|
||||
- 'lib/stripe/profile_storer.rb'
|
||||
- 'lib/tasks/sample_data/group_factory.rb'
|
||||
- 'lib/tasks/sample_data/order_factory.rb'
|
||||
- 'lib/tasks/sample_data/product_factory.rb'
|
||||
- 'spec/controllers/api/v0/reports/packing_report_spec.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
- 'spec/support/i18n_translations_checker.rb'
|
||||
- 'spec/support/request/checkout_request_helper.rb'
|
||||
- 'spec/system/admin/reports_spec.rb'
|
||||
- 'spec/system/consumer/shopping/variant_overrides_spec.rb'
|
||||
|
||||
# Offense count: 19
|
||||
# Offense count: 51
|
||||
# Configuration parameters: CountComments, Max, CountAsOne.
|
||||
Metrics/ModuleLength:
|
||||
Exclude:
|
||||
@@ -873,17 +609,49 @@ Metrics/ModuleLength:
|
||||
- 'app/helpers/spree/admin/orders_helper.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
- 'engines/catalog/spec/services/catalog/product_import/products_reset_strategy_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/order/updater_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/stock/package_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/estimator_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/form_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/proxy_order_syncer_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/summarizer_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/summary_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/validator_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/variants_list_spec.rb'
|
||||
- 'lib/open_food_network/column_preference_defaults.rb'
|
||||
- 'spec/controllers/admin/customers_controller_spec.rb'
|
||||
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
||||
- 'spec/controllers/payment_gateways/stripe_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/payment_methods_controller_spec.rb'
|
||||
- 'spec/lib/open_food_network/address_finder_spec.rb'
|
||||
- 'spec/lib/open_food_network/customers_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_management_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_permissions_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_grouper_spec.rb'
|
||||
- 'spec/lib/open_food_network/permissions_spec.rb'
|
||||
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/scope_variant_to_hub_spec.rb'
|
||||
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
|
||||
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
- 'spec/models/spree/credit_card_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order/tax_spec.rb'
|
||||
- 'spec/models/spree/product_spec.rb'
|
||||
- 'spec/models/spree/shipping_method_spec.rb'
|
||||
- 'spec/models/spree/tax_rate_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/services/permissions/order_spec.rb'
|
||||
- 'spec/services/variant_units/option_value_namer_spec.rb'
|
||||
- 'spec/support/request/shop_workflow.rb'
|
||||
- 'spec/support/request/stripe_stubs.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
|
||||
@@ -895,49 +663,18 @@ Metrics/ParameterLists:
|
||||
- 'spec/support/controller_requests_helper.rb'
|
||||
- 'spec/system/admin/reports_spec.rb'
|
||||
|
||||
# Offense count: 46
|
||||
# Offense count: 8
|
||||
# Configuration parameters: IgnoredMethods, Max.
|
||||
Metrics/PerceivedComplexity:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/api/v0/variants_controller.rb'
|
||||
- 'app/controllers/spree/admin/orders_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/payments_controller.rb'
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
- 'app/controllers/spree/admin/users_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/helpers/checkout_helper.rb'
|
||||
- 'app/helpers/order_cycles_helper.rb'
|
||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'app/models/spree/product.rb'
|
||||
- 'app/models/spree/return_authorization.rb'
|
||||
- 'app/models/spree/tax_rate.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/services/products_renderer.rb'
|
||||
- 'app/services/sets/model_set.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/open_food_network/group_buy_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/open_food_network/payments_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/spree/core/controller_helpers/respond_with.rb'
|
||||
- 'lib/spree/localized_number.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
|
||||
# Offense count: 9
|
||||
Naming/AccessorMethodName:
|
||||
@@ -957,12 +694,11 @@ Naming/HeredocDelimiterNaming:
|
||||
Exclude:
|
||||
- 'app/models/content_configuration.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Offense count: 5
|
||||
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
||||
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
||||
Naming/MemoizedInstanceVariableName:
|
||||
Exclude:
|
||||
- 'app/constraints/split_checkout_constraint.rb'
|
||||
- 'app/mailers/producer_mailer.rb'
|
||||
- 'app/models/concerns/balance.rb'
|
||||
- 'lib/open_food_network/address_finder.rb'
|
||||
@@ -1004,12 +740,13 @@ Rails/ApplicationController:
|
||||
Exclude:
|
||||
- 'engines/dfc_provider/app/controllers/dfc_provider/api/base_controller.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
Rails/ApplicationJob:
|
||||
Exclude:
|
||||
- 'app/jobs/bulk_invoice_job.rb'
|
||||
- 'app/jobs/heartbeat_job.rb'
|
||||
- 'app/jobs/order_cycle_closing_job.rb'
|
||||
- 'app/jobs/order_cycle_notification_job.rb'
|
||||
- 'app/jobs/subscription_confirm_job.rb'
|
||||
- 'app/jobs/subscription_placement_job.rb'
|
||||
@@ -1043,22 +780,15 @@ Rails/Date:
|
||||
Exclude:
|
||||
- 'spec/system/flatpickr_spec.rb'
|
||||
|
||||
# Offense count: 15
|
||||
# Offense count: 4
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: slashes, arguments
|
||||
Rails/FilePath:
|
||||
Exclude:
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'lib/tasks/karma.rake'
|
||||
- 'spec/controllers/api/v0/logos_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/product_images_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/promo_images_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/terms_and_conditions_controller_spec.rb'
|
||||
- 'spec/factories/product_factory.rb'
|
||||
- 'spec/models/content_configuration_spec.rb'
|
||||
- 'spec/serializers/api/admin/enterprise_serializer_spec.rb'
|
||||
- 'spec/support/downloads_helper.rb'
|
||||
- 'spec/system/admin/enterprises/images_spec.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Configuration parameters: Include.
|
||||
@@ -1119,7 +849,7 @@ Rails/HelperInstanceVariable:
|
||||
- 'app/helpers/spree/orders_helper.rb'
|
||||
|
||||
# Offense count: 36
|
||||
# Configuration parameters: Include.
|
||||
# Configuration parameters: IgnoreScopes, Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/InverseOf:
|
||||
Exclude:
|
||||
@@ -1143,7 +873,7 @@ Rails/InverseOf:
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/subscription_line_item.rb'
|
||||
|
||||
# Offense count: 39
|
||||
# Offense count: 38
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/controllers/**/*.rb
|
||||
Rails/LexicallyScopedActionFilter:
|
||||
@@ -1167,7 +897,6 @@ Rails/LexicallyScopedActionFilter:
|
||||
- 'app/controllers/spree/admin/users_controller.rb'
|
||||
- 'app/controllers/spree/admin/zones_controller.rb'
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'app/controllers/user_passwords_controller.rb'
|
||||
|
||||
# Offense count: 18
|
||||
Rails/OutputSafety:
|
||||
@@ -1188,125 +917,17 @@ Rails/OutputSafety:
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect.
|
||||
Rails/RelativeDateConstant:
|
||||
Exclude:
|
||||
- 'lib/tasks/data/remove_transient_data.rb'
|
||||
|
||||
# Offense count: 297
|
||||
# Offense count: 4
|
||||
# Configuration parameters: ForbiddenMethods, AllowedMethods.
|
||||
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
|
||||
Rails/SkipsModelValidations:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/resource_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
- 'app/controllers/spree/credit_cards_controller.rb'
|
||||
- 'app/jobs/subscription_confirm_job.rb'
|
||||
- 'app/models/concerns/line_item_stock_changes.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/product_import/inventory_reset_strategy.rb'
|
||||
- 'app/models/proxy_order.rb'
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
- 'app/models/spree/gateway/pay_pal_express.rb'
|
||||
- 'app/models/spree/inventory_unit.rb'
|
||||
- 'app/models/spree/item_adjustments.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'app/models/spree/payment.rb'
|
||||
- 'app/models/spree/product.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'app/models/spree/tax_category.rb'
|
||||
- 'app/models/spree/taxonomy.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
- 'app/services/order_factory.rb'
|
||||
- 'app/services/place_proxy_order.rb'
|
||||
- 'engines/order_management/app/services/order_management/order/updater.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/enterprise_fee_summary/report_service_spec.rb'
|
||||
- 'engines/order_management/spec/services/order_management/subscriptions/stripe_payment_setup_spec.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/tasks/data/anonymize_data.rake'
|
||||
- 'lib/tasks/sample_data/product_factory.rb'
|
||||
- 'lib/tasks/users.rake'
|
||||
- 'spec/controllers/admin/bulk_line_items_controller_spec.rb'
|
||||
- 'spec/controllers/admin/customers_controller_spec.rb'
|
||||
- 'spec/controllers/admin/subscription_line_items_controller_spec.rb'
|
||||
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/products_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/shipments_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/variants_controller_spec.rb'
|
||||
- 'spec/controllers/checkout_controller_spec.rb'
|
||||
- 'spec/controllers/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders/invoices_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders/payments/payments_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/overview_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/payment_methods_controller_spec.rb'
|
||||
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||
- 'spec/controllers/spree/orders_controller_spec.rb'
|
||||
- 'spec/factories.rb'
|
||||
- 'spec/factories/order_factory.rb'
|
||||
- 'spec/factories/shipment_factory.rb'
|
||||
- 'spec/helpers/enterprises_helper_spec.rb'
|
||||
- 'spec/helpers/order_cycles_helper_spec.rb'
|
||||
- 'spec/lib/open_food_network/address_finder_spec.rb'
|
||||
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/permissions_spec.rb'
|
||||
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/scope_variant_to_hub_spec.rb'
|
||||
- 'spec/lib/reports/packing/packing_report_spec.rb'
|
||||
- 'spec/lib/stripe/credit_card_cloner_spec.rb'
|
||||
- 'spec/lib/tasks/data/remove_transient_data_spec.rb'
|
||||
- 'spec/models/concerns/variant_stock_spec.rb'
|
||||
- 'spec/models/enterprise_relationship_spec.rb'
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
- 'spec/models/spree/asset_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order/tax_spec.rb'
|
||||
- 'spec/models/spree/order_inventory_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
- 'spec/models/spree/tax_category_spec.rb'
|
||||
- 'spec/models/spree/tax_rate_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/queries/customers_with_balance_spec.rb'
|
||||
- 'spec/queries/outstanding_balance_spec.rb'
|
||||
- 'spec/serializers/api/admin/subscription_line_item_serializer_spec.rb'
|
||||
- 'spec/services/cache_service_spec.rb'
|
||||
- 'spec/services/cap_quantity_spec.rb'
|
||||
- 'spec/services/order_cart_reset_spec.rb'
|
||||
- 'spec/services/order_checkout_restart_spec.rb'
|
||||
- 'spec/services/order_cycle_distributed_products_spec.rb'
|
||||
- 'spec/services/order_factory_spec.rb'
|
||||
- 'spec/services/order_syncer_spec.rb'
|
||||
- 'spec/services/process_payment_intent_spec.rb'
|
||||
- 'spec/services/product_tag_rules_filterer_spec.rb'
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
- 'spec/support/request/shop_workflow.rb'
|
||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||
- 'spec/system/admin/bulk_product_update_spec.rb'
|
||||
- 'spec/system/admin/configuration/tax_rates_spec.rb'
|
||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||
- 'spec/system/admin/order_spec.rb'
|
||||
- 'spec/system/admin/payments_spec.rb'
|
||||
- 'spec/system/consumer/caching/shops_caching_spec.rb'
|
||||
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||
- 'spec/system/consumer/shopping/products_spec.rb'
|
||||
- 'spec/system/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/system/consumer/shopping/unit_price_spec.rb'
|
||||
- 'spec/views/spree/shared/_order_details.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
@@ -1331,12 +952,11 @@ Rails/UniqueValidationWithoutIndex:
|
||||
- 'app/models/spree/tax_category.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 1
|
||||
# Configuration parameters: Environments.
|
||||
# Environments: development, test, production
|
||||
Rails/UnknownEnv:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/payment_methods_controller.rb'
|
||||
- 'app/models/spree/app_configuration.rb'
|
||||
|
||||
# Offense count: 1
|
||||
@@ -1424,7 +1044,7 @@ Style/GlobalStdStream:
|
||||
- 'lib/tasks/subscriptions/debug.rake'
|
||||
- 'lib/tasks/subscriptions/test.rake'
|
||||
|
||||
# Offense count: 41
|
||||
# Offense count: 39
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
@@ -1501,30 +1121,6 @@ Style/NestedModifier:
|
||||
- 'spec/system/admin/payments_stripe_spec.rb'
|
||||
- 'spec/system/admin/reports_spec.rb'
|
||||
|
||||
# Offense count: 31
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IgnoredMethods.
|
||||
# SupportedStyles: predicate, comparison
|
||||
Style/NumericPredicate:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/helpers/checkout_helper.rb'
|
||||
- 'app/helpers/shared_helper.rb'
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'app/models/product_import/spreadsheet_entry.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order_contents.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||
- 'lib/open_food_network/products_and_inventory_report_base.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/tasks/sample_data.rake'
|
||||
|
||||
# Offense count: 25
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: respond_to_missing?
|
||||
@@ -1568,13 +1164,14 @@ Style/RedundantReturn:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||
|
||||
# Offense count: 220
|
||||
# Offense count: 213
|
||||
Style/Send:
|
||||
Exclude:
|
||||
- 'app/controllers/split_checkout_controller.rb'
|
||||
- 'engines/order_management/spec/services/order_management/reports/bulk_coop/bulk_coop_report_spec.rb'
|
||||
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||
- 'spec/controllers/checkout_controller_spec.rb'
|
||||
- 'spec/controllers/payment_gateways/paypal_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/base_controller_spec.rb'
|
||||
- 'spec/controllers/spree/orders_controller_spec.rb'
|
||||
- 'spec/helpers/order_cycles_helper_spec.rb'
|
||||
@@ -1594,7 +1191,6 @@ Style/Send:
|
||||
- 'spec/models/calculator/weight_spec.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
|
||||
- 'spec/models/spree/order_inventory_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
@@ -1625,7 +1221,7 @@ Style/SlicingWithRange:
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'spec/lib/open_food_network/order_grouper_spec.rb'
|
||||
|
||||
# Offense count: 41
|
||||
# Offense count: 31
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Mode.
|
||||
Style/StringConcatenation:
|
||||
@@ -1646,12 +1242,10 @@ Style/StringConcatenation:
|
||||
- 'lib/open_food_network/orders_and_fulfillments_report/customer_totals_report.rb'
|
||||
- 'lib/spree/api/controller_setup.rb'
|
||||
- 'lib/spree/core/environment_extension.rb'
|
||||
- 'spec/controllers/user_confirmations_controller_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_grouper_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/product_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/requests/embedded_shopfronts_headers_spec.rb'
|
||||
- 'spec/services/embedded_page_service_spec.rb'
|
||||
- 'spec/support/api_helper.rb'
|
||||
- 'spec/support/features/datepicker_helper.rb'
|
||||
|
||||
@@ -49,11 +49,10 @@ RUN sh -c "echo 'deb https://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main'
|
||||
apt-get update && \
|
||||
apt-get install -yqq --no-install-recommends postgresql-client-9.5 libpq-dev
|
||||
|
||||
# Install node & yarn
|
||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y nodejs yarn
|
||||
# Install NodeJs and yarn
|
||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
|
||||
&& apt-get install --no-install-recommends -y nodejs \
|
||||
&& npm install -g yarn
|
||||
|
||||
# Install Chrome
|
||||
RUN wget --quiet -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
||||
|
||||
@@ -60,7 +60,7 @@ If the script succeeds you're ready to start developing. If not, take a look at
|
||||
|
||||
Now, your dreams of spinning up a development server can be realised:
|
||||
|
||||
bundle exec rails server
|
||||
foreman start
|
||||
|
||||
Go to [http://localhost:3000](http://localhost:3000) to play around!
|
||||
|
||||
|
||||
5
Gemfile
5
Gemfile
@@ -59,6 +59,9 @@ gem 'oauth2', '~> 1.4.7' # Used for Stripe Connect
|
||||
|
||||
gem 'pagy', '~> 5.1'
|
||||
|
||||
gem 'rswag-api'
|
||||
gem 'rswag-ui'
|
||||
|
||||
gem 'angularjs-rails', '1.8.0'
|
||||
gem 'aws-sdk', '1.67.0'
|
||||
gem 'bugsnag'
|
||||
@@ -145,7 +148,7 @@ group :test, :development do
|
||||
gem 'letter_opener', '>= 1.4.1'
|
||||
gem 'rspec-rails', ">= 3.5.2"
|
||||
gem 'rspec-retry'
|
||||
gem 'rswag'
|
||||
gem 'rswag-specs'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'shoulda-matchers'
|
||||
gem 'timecop'
|
||||
|
||||
16
Gemfile.lock
16
Gemfile.lock
@@ -372,7 +372,7 @@ GEM
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_mime (1.1.2)
|
||||
mini_portile2 (2.7.1)
|
||||
mini_portile2 (2.8.0)
|
||||
mini_racer (0.4.0)
|
||||
libv8-node (~> 15.14.0.0)
|
||||
minitest (5.15.0)
|
||||
@@ -385,8 +385,8 @@ GEM
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.13.1)
|
||||
mini_portile2 (~> 2.7.0)
|
||||
nokogiri (1.13.3)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
racc (~> 1.4)
|
||||
oauth2 (1.4.7)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
@@ -430,7 +430,7 @@ GEM
|
||||
byebug (~> 11.0)
|
||||
pry (~> 0.13.0)
|
||||
public_suffix (4.0.6)
|
||||
puma (5.5.2)
|
||||
puma (5.6.2)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
racc (1.6.0)
|
||||
@@ -532,10 +532,6 @@ GEM
|
||||
rspec-retry (0.6.2)
|
||||
rspec-core (> 3.3)
|
||||
rspec-support (3.10.2)
|
||||
rswag (2.4.0)
|
||||
rswag-api (= 2.4.0)
|
||||
rswag-specs (= 2.4.0)
|
||||
rswag-ui (= 2.4.0)
|
||||
rswag-api (2.4.0)
|
||||
railties (>= 3.1, < 7.0)
|
||||
rswag-specs (2.4.0)
|
||||
@@ -780,7 +776,9 @@ DEPENDENCIES
|
||||
roo!
|
||||
rspec-rails (>= 3.5.2)
|
||||
rspec-retry
|
||||
rswag
|
||||
rswag-api
|
||||
rswag-specs
|
||||
rswag-ui
|
||||
rubocop
|
||||
rubocop-rails
|
||||
sd_notify
|
||||
|
||||
@@ -128,29 +128,53 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
$scope.selectedUnitsProduct = unitsProduct
|
||||
$scope.selectedUnitsVariant = unitsVariant
|
||||
|
||||
$scope.getLineItemScale = (lineItem) ->
|
||||
if lineItem.units_product && lineItem.units_variant && (lineItem.units_product.variant_unit == "weight" || lineItem.units_product.variant_unit == "volume")
|
||||
lineItem.units_product.variant_unit_scale
|
||||
else
|
||||
1
|
||||
|
||||
$scope.sumUnitValues = ->
|
||||
sum = $scope.filteredLineItems?.reduce (sum,lineItem) ->
|
||||
sum + lineItem.final_weight_volume
|
||||
sum = $scope.filteredLineItems?.reduce (sum, lineItem) ->
|
||||
sum + $scope.roundToThreeDecimals(lineItem.final_weight_volume / $scope.getLineItemScale(lineItem))
|
||||
, 0
|
||||
|
||||
$scope.sumMaxUnitValues = ->
|
||||
sum = $scope.filteredLineItems?.reduce (sum,lineItem) ->
|
||||
sum + lineItem.max_quantity * lineItem.units_variant.unit_value
|
||||
sum + lineItem.max_quantity * $scope.roundToThreeDecimals(lineItem.units_variant.unit_value / $scope.getLineItemScale(lineItem))
|
||||
, 0
|
||||
|
||||
$scope.roundToThreeDecimals = (value) ->
|
||||
Math.round(value * 1000) / 1000
|
||||
|
||||
$scope.allFinalWeightVolumesPresent = ->
|
||||
for i,lineItem of $scope.filteredLineItems
|
||||
return false if !lineItem.hasOwnProperty('final_weight_volume') || !(lineItem.final_weight_volume > 0)
|
||||
true
|
||||
|
||||
# How is this different to OptionValueNamer#name?
|
||||
# Should it be extracted to that class or VariantUnitManager?
|
||||
$scope.formattedValueWithUnitName = (value, unitsProduct, unitsVariant) ->
|
||||
# A Units Variant is an API object which holds unit properies of a variant
|
||||
if unitsProduct.hasOwnProperty("variant_unit") && (unitsProduct.variant_unit == "weight" || unitsProduct.variant_unit == "volume") && value > 0
|
||||
scale = VariantUnitManager.getScale(value, unitsProduct.variant_unit)
|
||||
Math.round(value/scale * 1000)/1000 + " " + VariantUnitManager.getUnitName(scale, unitsProduct.variant_unit)
|
||||
$scope.getScale = (unitsProduct, unitsVariant) ->
|
||||
if unitsProduct.hasOwnProperty("variant_unit") && (unitsProduct.variant_unit == "weight" || unitsProduct.variant_unit == "volume")
|
||||
unitsProduct.variant_unit_scale
|
||||
else
|
||||
null
|
||||
|
||||
$scope.getFormattedValueWithUnitName = (value, unitsProduct, unitsVariant, scale) ->
|
||||
unit_name = VariantUnitManager.getUnitName(scale, unitsProduct.variant_unit)
|
||||
$scope.roundToThreeDecimals(value) + " " + unit_name
|
||||
|
||||
$scope.getGroupBySizeFormattedValueWithUnitName = (value, unitsProduct, unitsVariant) ->
|
||||
scale = $scope.getScale(unitsProduct, unitsVariant)
|
||||
if scale
|
||||
value = value / scale if scale != 28.35 && scale != 1 && scale != 453.6 # divide by scale if not smallest unit
|
||||
$scope.getFormattedValueWithUnitName(value, unitsProduct, unitsVariant, scale)
|
||||
else
|
||||
''
|
||||
|
||||
$scope.formattedValueWithUnitName = (value, unitsProduct, unitsVariant) ->
|
||||
scale = $scope.getScale(unitsProduct, unitsVariant)
|
||||
if scale
|
||||
$scope.getFormattedValueWithUnitName(value, unitsProduct, unitsVariant, scale)
|
||||
else
|
||||
''
|
||||
|
||||
$scope.fulfilled = (sumOfUnitValues) ->
|
||||
@@ -158,7 +182,9 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
if $scope.selectedUnitsProduct.hasOwnProperty("group_buy_unit_size") && $scope.selectedUnitsProduct.group_buy_unit_size > 0 &&
|
||||
$scope.selectedUnitsProduct.hasOwnProperty("variant_unit") &&
|
||||
( $scope.selectedUnitsProduct.variant_unit == "weight" || $scope.selectedUnitsProduct.variant_unit == "volume" )
|
||||
Math.round( sumOfUnitValues / $scope.selectedUnitsProduct.group_buy_unit_size * 1000)/1000
|
||||
scale = $scope.getScale($scope.selectedUnitsProduct, $scope.selectedUnitsVariant)
|
||||
sumOfUnitValues = sumOfUnitValues / scale if scale == 28.35 || scale == 453.6 # divide by scale if smallest unit
|
||||
$scope.roundToThreeDecimals(sumOfUnitValues / $scope.selectedUnitsProduct.group_buy_unit_size * $scope.selectedUnitsVariant.unit_value)
|
||||
else
|
||||
''
|
||||
|
||||
|
||||
@@ -37,17 +37,6 @@ angular.module("admin.products").factory "VariantUnitManager", (availableUnits)
|
||||
options.push [[I18n.t('items'), 'items']]
|
||||
options = [].concat options...
|
||||
|
||||
@getScale: (value, unitType) ->
|
||||
scaledValue = null
|
||||
validScales = []
|
||||
unitScales = VariantUnitManager.unitScales(unitType)
|
||||
|
||||
validScales.unshift scale for scale in unitScales when value/scale >= 1
|
||||
if validScales.length > 0
|
||||
validScales[0]
|
||||
else
|
||||
unitScales[0]
|
||||
|
||||
@getUnitName: (scale, unitType) ->
|
||||
if @units[unitType][scale]
|
||||
@units[unitType][scale]['name']
|
||||
|
||||
@@ -82,10 +82,23 @@ adjustItems = function(shipment_number, variant_id, quantity){
|
||||
var inventory_units = _.where(shipment.inventory_units, {variant_id: variant_id});
|
||||
|
||||
if (quantity == 0 && inventory_units.length == shipment.inventory_units.length) {
|
||||
ofnAlert(t("js.admin.orders.cannot_remove_last_item"));
|
||||
ofnCancelOrderAlert((confirm, sendEmailCancellation) => {
|
||||
if (confirm) {
|
||||
doAdjustItems(shipment_number, variant_id, quantity, inventory_units, () => {
|
||||
var redirectTo = new URL(Spree.routes.cancel_order.toString());
|
||||
redirectTo.searchParams.append("send_cancellation_email", sendEmailCancellation);
|
||||
window.location.href = redirectTo.toString();
|
||||
});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
doAdjustItems(shipment_number, variant_id, quantity, inventory_units, () => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
doAdjustItems = function(shipment_number, variant_id, quantity, inventory_units, callback) {
|
||||
var url = Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipment_number;
|
||||
|
||||
var new_quantity = 0;
|
||||
@@ -106,7 +119,7 @@ adjustItems = function(shipment_number, variant_id, quantity){
|
||||
url: Spree.url(url),
|
||||
data: { variant_id: variant_id, quantity: new_quantity }
|
||||
}).done(function( msg ) {
|
||||
window.location.reload();
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -181,6 +194,24 @@ ofnAlert = function(message) {
|
||||
$('#custom-alert').show();
|
||||
}
|
||||
|
||||
ofnCancelOrderAlert = function(callback) {
|
||||
$('#custom-confirm .message').html(
|
||||
` ${t("js.admin.orders.cancel_the_order_html")}
|
||||
<div class="form">
|
||||
<input type="checkbox" name="send_cancellation_email" value="1" id="send_cancellation_email" />
|
||||
<label for="send_cancellation_email">${t("js.admin.orders.cancel_the_order_send_cancelation_email")}</label>
|
||||
</div>`);
|
||||
$('#custom-confirm button.confirm').unbind( "click" ).click(() => {
|
||||
$('#custom-confirm').hide();
|
||||
callback(true, $('#send_cancellation_email').is(':checked'));
|
||||
});
|
||||
$('#custom-confirm button.cancel').click(() => {
|
||||
$('#custom-confirm').hide();
|
||||
callback(false)
|
||||
});
|
||||
$('#custom-confirm').show();
|
||||
}
|
||||
|
||||
ofnConfirm = function(callback) {
|
||||
$('#custom-confirm').data($(event.target).data());
|
||||
$('#custom-confirm button.confirm').click(callback);
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
$(document).ready ->
|
||||
progressTimer = null
|
||||
$(document).ajaxStart ->
|
||||
$("#progress").fadeIn()
|
||||
progressTimer = setTimeout ->
|
||||
$("#progress").fadeIn()
|
||||
, 500
|
||||
|
||||
$(document).ajaxStop ->
|
||||
$("#progress").fadeOut()
|
||||
clearTimeout(progressTimer) if progressTimer?
|
||||
$("#progress").stop().hide()
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
#= require_tree .
|
||||
|
||||
document.addEventListener "turbo:load", ->
|
||||
window.injector = angular.bootstrap document.body, ["Darkswarm"]
|
||||
try
|
||||
window.injector = angular.bootstrap document.body, ["Darkswarm"]
|
||||
true
|
||||
|
||||
document.addEventListener "turbo:before-render", ->
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
angular.module('Darkswarm').controller "ForgotCtrl", ($scope, $http, $location, AuthenticationService) ->
|
||||
$scope.path = "/forgot"
|
||||
$scope.sent = false
|
||||
|
||||
$scope.submit = ->
|
||||
if $scope.spree_user.email != null
|
||||
$http.post("/user/spree_user/password", {spree_user: $scope.spree_user}).then (response)->
|
||||
$scope.sent = true
|
||||
.catch (response) ->
|
||||
$scope.errors = response.data.error
|
||||
$scope.user_unconfirmed = (response.status == 401)
|
||||
else
|
||||
$scope.errors = t 'email_required'
|
||||
|
||||
$scope.resend_confirmation = ->
|
||||
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).then (response)->
|
||||
$scope.messages = t('devise.confirmations.send_instructions')
|
||||
.catch (response) ->
|
||||
$scope.errors = t('devise.confirmations.failed_to_send')
|
||||
@@ -1,36 +0,0 @@
|
||||
angular.module('Darkswarm').controller "LoginCtrl", ($scope, $timeout, $location, $http, $window, AuthenticationService, Redirections, Loading) ->
|
||||
$scope.path = "/login"
|
||||
|
||||
$scope.modalMessage = null
|
||||
|
||||
$scope.$watch (->
|
||||
AuthenticationService.modalMessage
|
||||
), (newValue) ->
|
||||
$scope.errors = newValue
|
||||
|
||||
$scope.submit = ->
|
||||
Loading.message = t 'logging_in'
|
||||
$http.post("/user/spree_user/sign_in", {spree_user: $scope.spree_user}).then (response)->
|
||||
if window._paq
|
||||
window._paq.push(['trackEvent', 'Signin/Signup', 'Login Submit Success', $location.absUrl()]);
|
||||
if Redirections.after_login
|
||||
$window.location.href = $window.location.origin + Redirections.after_login
|
||||
else
|
||||
$window.location.href = $window.location.origin + $window.location.pathname # Strips out hash fragments
|
||||
.catch (response) ->
|
||||
Loading.clear()
|
||||
$scope.errors = response.data.message || response.data.error
|
||||
$scope.user_unconfirmed = (response.data.error == t('devise.failure.unconfirmed'))
|
||||
|
||||
$scope.resend_confirmation = ->
|
||||
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).then (response)->
|
||||
$scope.messages = t('devise.confirmations.send_instructions')
|
||||
.catch (response) ->
|
||||
$scope.errors = t('devise.confirmations.failed_to_send')
|
||||
|
||||
$timeout ->
|
||||
if angular.isDefined($location.search()['validation'])
|
||||
if $location.search()['validation'] == 'confirmed'
|
||||
$scope.messages = t('devise.confirmations.confirmed')
|
||||
if $location.search()['validation'] == 'not_confirmed'
|
||||
$scope.errors = t('devise.confirmations.not_confirmed')
|
||||
@@ -1,17 +0,0 @@
|
||||
angular.module('Darkswarm').controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) ->
|
||||
$scope.path = "/signup"
|
||||
|
||||
$scope.spree_user.password_confirmation = ''
|
||||
|
||||
$scope.errors =
|
||||
email: null
|
||||
password: null
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).then (response)->
|
||||
$scope.errors = {email: null, password: null}
|
||||
$scope.messages = t('devise.user_registrations.spree_user.signed_up_but_unconfirmed')
|
||||
if window._paq
|
||||
window._paq.push(['trackEvent', 'Signin/Signup', 'Signup Submit Success', $location.absUrl()]);
|
||||
.catch (response) ->
|
||||
$scope.errors = response.data
|
||||
@@ -1,12 +0,0 @@
|
||||
angular.module('Darkswarm').controller "AuthenticationCtrl", ($scope, AuthenticationService, SpreeUser)->
|
||||
$scope.open = AuthenticationService.open
|
||||
$scope.toggle = AuthenticationService.toggle
|
||||
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.isActive = AuthenticationService.isActive
|
||||
$scope.select = AuthenticationService.select
|
||||
|
||||
$scope.tabs =
|
||||
login: { active: $scope.isActive('/login') }
|
||||
signup: { active: $scope.isActive('/signup') }
|
||||
forgot: { active: $scope.isActive('/forgot') }
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('Darkswarm').controller "CheckoutCtrl", ($scope, localStorageService, Checkout, CurrentUser, CurrentHub, AuthenticationService, SpreeUser, $http) ->
|
||||
angular.module('Darkswarm').controller "CheckoutCtrl", ($scope, localStorageService, Checkout, CurrentUser, CurrentHub, $http) ->
|
||||
$scope.Checkout = Checkout
|
||||
$scope.submitted = false
|
||||
|
||||
@@ -35,14 +35,9 @@ angular.module('Darkswarm').controller "CheckoutCtrl", ($scope, localStorageServ
|
||||
$scope.$broadcast 'purchaseFormInvalid', $scope.formdata
|
||||
|
||||
$scope.ensureUserIsGuest = (callback = null) ->
|
||||
$http.post("/user/registered_email", {email: $scope.order.email}).then (response)->
|
||||
if response.data.registered == true
|
||||
$scope.promptLogin()
|
||||
else
|
||||
$http.post("/user/registered_email", {email: $scope.order.email})
|
||||
.then (response)->
|
||||
window.CableReady.perform(response.data)
|
||||
.catch ->
|
||||
$scope.validateForm() if $scope.submitted
|
||||
callback() if callback
|
||||
|
||||
$scope.promptLogin = ->
|
||||
SpreeUser.spree_user.email = $scope.order.email
|
||||
AuthenticationService.pushMessage t('devise.failure.already_registered')
|
||||
AuthenticationService.open '/login'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('Darkswarm').controller "DetailsCtrl", ($scope, $timeout, $http, CurrentUser, AuthenticationService, SpreeUser, $controller) ->
|
||||
angular.module('Darkswarm').controller "DetailsCtrl", ($scope, $timeout, $http, CurrentUser, SpreeUser, $controller) ->
|
||||
angular.extend this, $controller('FieldsetMixin', {$scope: $scope})
|
||||
|
||||
$scope.name = "details"
|
||||
|
||||
@@ -67,7 +67,7 @@ angular.module('Darkswarm').controller "ProductsCtrl", ($scope, $sce, $filter, $
|
||||
page: page || $scope.page,
|
||||
per_page: $scope.per_page,
|
||||
'q[name_or_meta_keywords_or_variants_display_as_or_variants_display_name_or_supplier_name_cont]': $scope.query,
|
||||
'q[properties_id_or_supplier_properties_id_in_any][]': $scope.activeProperties,
|
||||
'q[with_properties][]': $scope.activeProperties,
|
||||
'q[primary_taxon_id_in_any][]': $scope.activeTaxons
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
angular.module('Darkswarm').directive 'auth', (AuthenticationService) ->
|
||||
restrict: 'A'
|
||||
link: (scope, elem, attrs) ->
|
||||
elem.bind "click", ->
|
||||
AuthenticationService.open '/' + attrs.auth
|
||||
|
||||
window.addEventListener "login:modal:open", ->
|
||||
AuthenticationService.open '/login'
|
||||
|
||||
scope.$on "$destroy", ->
|
||||
window.removeEventListener "login:modal:open"
|
||||
@@ -1,57 +0,0 @@
|
||||
# This class deals with displaying things in the login modal. It chooses
|
||||
# the modal tab templates and deals with switching tabs and passing data
|
||||
# between the tabs. It has direct access to the instance of the login modal,
|
||||
# and provides that access to other controllers as a service.
|
||||
|
||||
angular.module('Darkswarm').factory "AuthenticationService", (Navigation, $modal, $location, Redirections, Loading)->
|
||||
|
||||
new class AuthenticationService
|
||||
selectedPath: "/login"
|
||||
modalMessage: null
|
||||
|
||||
constructor: ->
|
||||
if $location.path() in ["/login", "/signup", "/forgot"] || location.pathname is '/register/auth'
|
||||
@open @initialTab(), @initialTemplate()
|
||||
|
||||
open: (path = false, template = 'authentication.html') =>
|
||||
@modalInstance = $modal.open
|
||||
templateUrl: template
|
||||
windowClass: "login-modal medium"
|
||||
@modalInstance.result.then @close, @close
|
||||
@selectedPath = path || @selectedPath
|
||||
Navigation.navigate @selectedPath
|
||||
|
||||
if window._paq
|
||||
window._paq.push(['trackEvent', 'Signin/Signup', 'Login Modal View', window.location.href])
|
||||
|
||||
# Opens the /login tab if returning from email confirmation,
|
||||
# the /signup tab if opened from the enterprise registration page,
|
||||
# otherwise opens whichever tab is selected in the URL params ('/login', '/signup', or '/forgot')
|
||||
initialTab: ->
|
||||
if angular.isDefined($location.search()['validation'])
|
||||
'/login'
|
||||
else if location.pathname is '/register/auth'
|
||||
'/signup'
|
||||
else
|
||||
$location.path()
|
||||
|
||||
# Loads the registration page modal when needed, otherwise the default modal
|
||||
initialTemplate: ->
|
||||
if location.pathname is '/register/auth'
|
||||
'registration_authentication.html'
|
||||
else
|
||||
'authentication.html'
|
||||
pushMessage: (message) ->
|
||||
@modalMessage = String(message)
|
||||
|
||||
select: (path)=>
|
||||
@selectedPath = path
|
||||
Navigation.navigate @selectedPath
|
||||
|
||||
isActive: Navigation.isActive
|
||||
|
||||
close: ->
|
||||
if location.pathname in ["/register", "/register/auth"]
|
||||
Loading.message = t 'going_back_to_home_page'
|
||||
location.hash = ""
|
||||
location.pathname = "/"
|
||||
@@ -1,3 +0,0 @@
|
||||
angular.module('Darkswarm').factory "Redirections", ($location)->
|
||||
new class Redirections
|
||||
after_login: $location.search().after_login
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
.sixteen.columns.alpha#loading{ 'ng-show' => 'productsLoading()' }
|
||||
%br
|
||||
%img.spinner{ src: image_path("/spinning-circles.svg")}
|
||||
%i.spinner.fa.fa-spin.fa-circle-o-notch
|
||||
%h1
|
||||
{{ 'js.admin.panels.exchange_products.loading_variants' | t }}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
%div{"ng-controller" => "AuthenticationCtrl"}
|
||||
%tabset
|
||||
%ng-include{src: "'login.html'"}
|
||||
%ng-include{src: "'signup.html'"}
|
||||
%ng-include{src: "'forgot.html'"}
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
@@ -1,31 +0,0 @@
|
||||
%tab#forgot{ heading: "{{'forgot_password' | t}}", active: "tabs.forgot.active", select: "select(path)"}
|
||||
%form{ ng: { controller: "ForgotCtrl", submit: "submit()" } }
|
||||
.row
|
||||
.large-12.columns
|
||||
.alert-box.success{"ng-show" => "sent"}
|
||||
{{ 'password_reset_sent' | t }}
|
||||
|
||||
.alert-box.success{"ng-show" => "messages != null"}
|
||||
{{ messages }}
|
||||
|
||||
.alert-box.alert{"ng-show" => "errors != null"}
|
||||
{{ errors }}
|
||||
%a{ng: {show: 'user_unconfirmed', click: 'resend_confirmation()'}}
|
||||
= t('devise.confirmations.resend_confirmation_email')
|
||||
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "email"} {{'signup_email' | t}}
|
||||
%input.title.input-text{name: "email",
|
||||
type: "email",
|
||||
id: "email",
|
||||
tabindex: 1,
|
||||
inputmode: "email",
|
||||
"ng-model" => "spree_user.email"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "3",
|
||||
type: "submit",
|
||||
value: "{{'reset_password' | t}}"}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
%tab#login-content{ heading: "{{'label_login' | t}}", active: "tabs.login.active", select: "select(path)"}
|
||||
%form{ ng: { controller: "LoginCtrl", submit: "submit()" } }
|
||||
.row
|
||||
.large-12.columns
|
||||
.alert-box.alert{"ng-show" => "errors != null"}
|
||||
{{ errors }}
|
||||
%a{ng: {show: 'user_unconfirmed', click: 'resend_confirmation()'}}
|
||||
= t('devise.confirmations.resend_confirmation_email')
|
||||
.alert-box.success{ng: {show: 'messages != null'}}
|
||||
{{ messages }}
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "email"} {{'email' | t}}
|
||||
%input.title.input-text{name: "email",
|
||||
type: "email",
|
||||
id: "email",
|
||||
tabindex: "1",
|
||||
inputmode: "email",
|
||||
"ng-model" => "spree_user.email"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "password"} {{'password' | t}}
|
||||
%input.title.input-text{name: "password",
|
||||
type: "password",
|
||||
id: "password",
|
||||
autocomplete: "off",
|
||||
tabindex: "2",
|
||||
inputmode: "password",
|
||||
"ng-model" => "spree_user.password"}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input{name: "remember_me",
|
||||
type: "checkbox",
|
||||
id: "remember_me",
|
||||
value: "1",
|
||||
tabindex: "3",
|
||||
"ng-model" => "spree_user.remember_me"}
|
||||
%label{for: "remember_me"} {{'remember_me' | t}}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "4",
|
||||
type: "submit",
|
||||
value: "{{'label_login' | t}}"}
|
||||
@@ -1,17 +0,0 @@
|
||||
.container
|
||||
.row.modal-centered
|
||||
%h2 {{'js.registration.welcome_to_ofn' | t}}
|
||||
%h5 {{'js.registration.signup_or_login' | t}}:
|
||||
%div{"ng-controller" => "AuthenticationCtrl"}
|
||||
%tabset
|
||||
%ng-include{src: "'signup.html'"}
|
||||
%ng-include{src: "'login.html'"}
|
||||
%ng-include{src: "'forgot.html'"}
|
||||
%div{ ng: { show: "active('/signup')"} }
|
||||
%hr
|
||||
{{'js.registration.have_an_account' | t}}
|
||||
%a{ href: "", ng: { click: "select('/login')"}}
|
||||
{{'js.registration.action_login' | t}}
|
||||
|
||||
%a.close-reveal-modal{"ng-click" => "$close()"}
|
||||
%i.ofn-i_009-close
|
||||
@@ -1,51 +0,0 @@
|
||||
%tab#sign-up-content{ heading: "{{'label_signup' | t}}", active: 'tabs.signup.active', select: "select(path)"}
|
||||
%form{ ng: { controller: "SignupCtrl", submit: "submit()" } }
|
||||
.row
|
||||
.large-12.columns
|
||||
.alert-box.success{ng: {show: 'messages != null'}}
|
||||
{{ messages }}
|
||||
.large-12.columns
|
||||
.alert-box.alert{ng: {show: 'errors.message != null'}}
|
||||
{{ errors.message }}
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "email"} {{'signup_email' | t}}
|
||||
%input.title.input-text{name: "email",
|
||||
type: "email",
|
||||
id: "email",
|
||||
tabindex: 1,
|
||||
inputmode: "email",
|
||||
"ng-model" => "spree_user.email"}
|
||||
%span.error{"ng-show" => "errors.email != null"}
|
||||
{{ errors.email.join(' ') }}
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "password"} {{'choose_password' | t}}
|
||||
%input.title.input-text{name: "password",
|
||||
type: "password",
|
||||
id: "password",
|
||||
autocomplete: "off",
|
||||
tabindex: 2,
|
||||
inputmode: "password",
|
||||
"ng-model" => "spree_user.password"}
|
||||
%span.error{"ng-show" => "errors.password != null"}
|
||||
{{ errors.password.join(' ') }}
|
||||
.row
|
||||
.large-12.columns
|
||||
%label{for: "password_confirmation"} {{'confirm_password' | t}}
|
||||
%input.title.input-text{name: "password_confirmation",
|
||||
type: "password",
|
||||
id: "password_confirmation",
|
||||
autocomplete: "off",
|
||||
tabindex: 2,
|
||||
inputmode: "password",
|
||||
"ng-model" => "spree_user.password_confirmation"}
|
||||
%span.error{"ng-show" => "errors.password_confirmation != null"}
|
||||
{{ errors.password_confirmation.join(' ') }}
|
||||
.row
|
||||
.large-12.columns
|
||||
%input.button.primary{name: "commit",
|
||||
tabindex: "3",
|
||||
type: "submit",
|
||||
value: "{{'action_signup' | t}}"}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
class SplitCheckoutConstraint
|
||||
def matches?(request)
|
||||
Flipper.enabled? :split_checkout, current_user(request)
|
||||
OpenFoodNetwork::FeatureToggle.enabled? :split_checkout, current_user(request)
|
||||
end
|
||||
|
||||
def current_user(request)
|
||||
@spree_current_user ||= request.env['warden'].user
|
||||
request.env['warden'].user
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ module Admin
|
||||
|
||||
def customer_params
|
||||
params.require(:customer).permit(
|
||||
:enterprise_id, :name, :email, :code, :tag_list,
|
||||
:enterprise_id, :first_name, :last_name, :email, :code, :tag_list,
|
||||
ship_address_attributes: PermittedAttributes::Address.attributes,
|
||||
bill_address_attributes: PermittedAttributes::Address.attributes,
|
||||
)
|
||||
|
||||
@@ -16,15 +16,16 @@ module Admin
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
if view_context.subscriptions_setup_complete?(@shops)
|
||||
@order_cycles = OrderCycle.joins(:schedules).managed_by(spree_current_user)
|
||||
@payment_methods = Spree::PaymentMethod.managed_by(spree_current_user)
|
||||
@order_cycles = OrderCycle.joins(:schedules).managed_by(spree_current_user).includes([:distributors, :cached_incoming_exchanges])
|
||||
@payment_methods = Spree::PaymentMethod.managed_by(spree_current_user).includes(:taggings)
|
||||
@payment_method_tags = payment_method_tags_by_id
|
||||
@shipping_methods = Spree::ShippingMethod.managed_by(spree_current_user)
|
||||
else
|
||||
@shop = @shops.first
|
||||
render :setup_explanation
|
||||
end
|
||||
end
|
||||
format.json { render_as_json @collection, ams_prefix: params[:ams_prefix] }
|
||||
format.json { render_as_json @collection, ams_prefix: params[:ams_prefix], payment_method_tags: payment_method_tags_by_id }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -165,5 +166,21 @@ module Admin
|
||||
@subscription_params ||= PermittedAttributes::Subscription.new(params).call.
|
||||
to_h.with_indifferent_access
|
||||
end
|
||||
|
||||
def payment_method_tags_by_id
|
||||
payment_method_tags = ::ActsAsTaggableOn::Tag.
|
||||
joins(:taggings).
|
||||
includes(:taggings).
|
||||
where(taggings: { taggable_type: "Spree::PaymentMethod",
|
||||
taggable_id: Spree::PaymentMethod.from(Enterprise.managed_by(spree_current_user).
|
||||
select('enterprises.id').find_by(id: params[:enterprise_id])),
|
||||
context: 'tags' })
|
||||
|
||||
payment_method_tags.each_with_object({}) do |tag, hash|
|
||||
payment_method_id = tag.taggings.first.taggable_id
|
||||
hash[payment_method_id] ||= []
|
||||
hash[payment_method_id] << tag.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -81,8 +81,7 @@ module Api
|
||||
|
||||
def permitted_ransack_params
|
||||
[:name_or_meta_keywords_or_variants_display_as_or_variants_display_name_or_supplier_name_cont,
|
||||
:properties_id_or_supplier_properties_id_in_any,
|
||||
:primary_taxon_id_in_any]
|
||||
:with_properties, :primary_taxon_id_in_any]
|
||||
end
|
||||
|
||||
def distributor
|
||||
|
||||
@@ -38,6 +38,7 @@ class ApplicationController < ActionController::Base
|
||||
include Spree::Core::ControllerHelpers::Common
|
||||
|
||||
before_action :set_cache_headers # prevent cart emptying via cache when using back button #1213
|
||||
before_action :set_after_login_url
|
||||
|
||||
include RawParams
|
||||
include EnterprisesHelper
|
||||
@@ -61,15 +62,11 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def set_checkout_redirect
|
||||
referer_path = OpenFoodNetwork::RefererParser.path(request.referer)
|
||||
if referer_path
|
||||
is_checkout_path_the_referer = [main_app.checkout_path].include?(referer_path)
|
||||
session["spree_user_return_to"] = if is_checkout_path_the_referer
|
||||
referer_path
|
||||
else
|
||||
main_app.root_path
|
||||
end
|
||||
end
|
||||
referer_path = URI(request.referer.to_s).path
|
||||
return unless referer_path == main_app.checkout_path ||
|
||||
referer_path == main_app.checkout_step_path(:details)
|
||||
|
||||
session["spree_user_return_to"] = main_app.checkout_path
|
||||
end
|
||||
|
||||
def shopfront_session
|
||||
@@ -102,6 +99,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
private
|
||||
|
||||
def set_after_login_url
|
||||
store_location_for(:spree_user, params[:after_login]) if params[:after_login]
|
||||
end
|
||||
|
||||
def shopfront_redirect
|
||||
session[:shopfront_redirect]
|
||||
end
|
||||
@@ -111,7 +112,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def require_distributor_chosen
|
||||
unless @distributor = current_distributor
|
||||
unless (@distributor = current_distributor)
|
||||
redirect_to main_app.root_path
|
||||
false
|
||||
end
|
||||
@@ -139,17 +140,6 @@ class ApplicationController < ActionController::Base
|
||||
!current_distributor.ready_for_checkout?
|
||||
end
|
||||
|
||||
def check_order_cycle_expiry
|
||||
if current_order_cycle&.closed?
|
||||
Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order)
|
||||
current_order.empty!
|
||||
current_order.set_order_cycle! nil
|
||||
flash[:info] = I18n.t('order_cycle_closed')
|
||||
|
||||
redirect_to main_app.shop_path
|
||||
end
|
||||
end
|
||||
|
||||
# All render calls within the block will be performed with the specified format
|
||||
# Useful for rendering html within a JSON response, particularly if the specified
|
||||
# template or partial then goes on to render further partials without specifying
|
||||
|
||||
@@ -12,7 +12,6 @@ class BaseController < ApplicationController
|
||||
include OrderCyclesHelper
|
||||
|
||||
before_action :set_locale
|
||||
before_action :check_order_cycle_expiry
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ class CheckoutController < ::BaseController
|
||||
def checkout_workflow(shipping_method_id)
|
||||
while @order.state != "complete"
|
||||
if @order.state == "payment"
|
||||
update_payment_total
|
||||
return if redirect_to_payment_gateway
|
||||
|
||||
return action_failed if @order.errors.any?
|
||||
@@ -110,6 +111,11 @@ class CheckoutController < ::BaseController
|
||||
update_response
|
||||
end
|
||||
|
||||
def update_payment_total
|
||||
@order.updater.update_totals
|
||||
@order.updater.update_pending_payment
|
||||
end
|
||||
|
||||
def redirect_to_payment_gateway
|
||||
return unless selected_payment_method.external_gateway?
|
||||
return unless (redirect_url = selected_payment_method.external_payment_url(order: @order))
|
||||
|
||||
@@ -14,7 +14,7 @@ module CheckoutCallbacks
|
||||
prepend_before_action :require_distributor_chosen
|
||||
|
||||
before_action :load_order, :associate_user, :load_saved_addresses, :load_saved_credit_cards
|
||||
before_action :load_shipping_methods, :load_countries, if: -> { params[:step] == "details" }
|
||||
before_action :load_shipping_methods, if: -> { params[:step] == "details" }
|
||||
|
||||
before_action :ensure_order_not_completed
|
||||
before_action :ensure_checkout_allowed
|
||||
@@ -46,16 +46,10 @@ module CheckoutCallbacks
|
||||
end
|
||||
|
||||
def load_shipping_methods
|
||||
@shipping_methods = Spree::ShippingMethod.for_distributor(@order.distributor).order(:name)
|
||||
end
|
||||
|
||||
def load_countries
|
||||
@countries = available_countries.map { |c| [c.name, c.id] }
|
||||
@countries_with_states = available_countries.map { |c|
|
||||
[c.id, c.states.map { |s|
|
||||
[s.name, s.id]
|
||||
}]
|
||||
}
|
||||
@shipping_methods = Spree::ShippingMethod.
|
||||
for_distributor(@order.distributor).
|
||||
display_on_checkout.
|
||||
order(:name)
|
||||
end
|
||||
|
||||
def redirect_to_shop?
|
||||
|
||||
@@ -18,6 +18,17 @@ module OrderStockCheck
|
||||
redirect_to main_app.cart_path
|
||||
end
|
||||
|
||||
def check_order_cycle_expiry
|
||||
return unless current_order_cycle&.closed?
|
||||
|
||||
Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order)
|
||||
current_order.empty!
|
||||
current_order.set_order_cycle! nil
|
||||
|
||||
flash[:info] = I18n.t('order_cycle_closed')
|
||||
redirect_to main_app.shop_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sufficient_stock?
|
||||
|
||||
@@ -8,6 +8,7 @@ module PaymentGateways
|
||||
before_action :destroy_orphaned_paypal_payments, only: :confirm
|
||||
before_action :load_checkout_order, only: [:express, :confirm]
|
||||
before_action :handle_insufficient_stock, only: [:express, :confirm]
|
||||
before_action :check_order_cycle_expiry, only: [:express, :confirm]
|
||||
before_action :permit_parameters!
|
||||
|
||||
after_action :reset_order_when_complete, only: :confirm
|
||||
|
||||
@@ -7,6 +7,7 @@ module PaymentGateways
|
||||
|
||||
before_action :load_checkout_order, only: :confirm
|
||||
before_action :validate_payment_intent, only: :confirm
|
||||
before_action :check_order_cycle_expiry, only: :confirm
|
||||
before_action :validate_stock, only: :confirm
|
||||
|
||||
def confirm
|
||||
@@ -46,7 +47,7 @@ module PaymentGateways
|
||||
return if session[:access_token] || params[:order_token] || spree_current_user
|
||||
|
||||
flash[:error] = I18n.t("spree.orders.edit.login_to_view_order")
|
||||
redirect_to root_path(anchor: "login?after_login=#{request.env['PATH_INFO']}")
|
||||
redirect_to root_path(anchor: "login", after_login: request.original_fullpath)
|
||||
end
|
||||
|
||||
def validate_stock
|
||||
|
||||
@@ -9,7 +9,7 @@ class PaymentsController < BaseController
|
||||
@payment = Spree::Payment.find(params[:id])
|
||||
authorize! :show, @payment.order
|
||||
|
||||
if url = @payment.cvv_response_message
|
||||
if (url = @payment.cvv_response_message)
|
||||
redirect_to url
|
||||
else
|
||||
redirect_to order_url(@payment.order)
|
||||
@@ -21,7 +21,9 @@ class PaymentsController < BaseController
|
||||
def require_logged_in
|
||||
return if session[:access_token] || spree_current_user
|
||||
|
||||
store_location_for :spree_user, request.original_fullpath
|
||||
|
||||
flash[:error] = I18n.t("spree.orders.edit.login_to_view_order")
|
||||
redirect_to main_app.root_path(anchor: "login?after_login=#{request.env['PATH_INFO']}")
|
||||
redirect_to main_app.root_path(anchor: "/login", after_login: request.original_fullpath)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ class RegistrationController < BaseController
|
||||
|
||||
def check_user
|
||||
if spree_current_user.nil?
|
||||
redirect_to registration_auth_path(anchor: "signup?after_login=#{request.env['PATH_INFO']}")
|
||||
redirect_to registration_auth_path(anchor: "/signup", after_login: request.original_fullpath)
|
||||
elsif !spree_current_user.can_own_more_enterprises?
|
||||
render :limit_reached
|
||||
end
|
||||
|
||||
@@ -16,8 +16,10 @@ class SplitCheckoutController < ::BaseController
|
||||
helper 'spree/orders'
|
||||
helper OrderHelper
|
||||
|
||||
before_action :set_checkout_redirect
|
||||
|
||||
def edit
|
||||
redirect_to_step unless params[:step]
|
||||
redirect_to_step_based_on_order unless params[:step]
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -58,7 +60,7 @@ class SplitCheckoutController < ::BaseController
|
||||
return unless selected_payment_method&.external_gateway?
|
||||
return unless (redirect_url = selected_payment_method.external_payment_url(order: @order))
|
||||
|
||||
render operations: cable_car.redirect_to(url: URI(redirect_url))
|
||||
render operations: cable_car.redirect_to(url: redirect_url)
|
||||
true
|
||||
end
|
||||
|
||||
@@ -71,6 +73,7 @@ class SplitCheckoutController < ::BaseController
|
||||
|
||||
@order.select_shipping_method(params[:shipping_method_id])
|
||||
@order.update(order_params)
|
||||
@order.updater.update_totals_and_states
|
||||
|
||||
validate_current_step!
|
||||
|
||||
@@ -115,7 +118,7 @@ class SplitCheckoutController < ::BaseController
|
||||
@order_params ||= Checkout::Params.new(@order, params, spree_current_user).call
|
||||
end
|
||||
|
||||
def redirect_to_step
|
||||
def redirect_to_step_based_on_order
|
||||
case @order.state
|
||||
when "cart", "address", "delivery"
|
||||
redirect_to checkout_step_path(:details)
|
||||
@@ -127,4 +130,14 @@ class SplitCheckoutController < ::BaseController
|
||||
redirect_to order_path(@order)
|
||||
end
|
||||
end
|
||||
|
||||
def redirect_to_step
|
||||
case params[:step]
|
||||
when "details"
|
||||
return redirect_to checkout_step_path(:payment)
|
||||
when "payment"
|
||||
return redirect_to checkout_step_path(:summary)
|
||||
end
|
||||
redirect_to_step_based_on_order
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,6 +65,7 @@ module Spree
|
||||
|
||||
def fire
|
||||
event = params[:e]
|
||||
@order.send_cancellation_email = params[:send_cancellation_email] == "true"
|
||||
if @order.public_send(event.to_s)
|
||||
flash[:success] = Spree.t(:order_updated)
|
||||
else
|
||||
|
||||
@@ -21,7 +21,8 @@ module Spree
|
||||
@customers = []
|
||||
if spree_current_user.enterprises.pluck(:id).include? search_params[:distributor_id].to_i
|
||||
@customers = Customer.
|
||||
ransack(m: 'or', email_start: search_params[:q], name_start: search_params[:q]).
|
||||
ransack(m: 'or', email_start: search_params[:q], first_name_start: search_params[:q],
|
||||
last_name_start: search_params[:q]).
|
||||
result.
|
||||
where(enterprise_id: search_params[:distributor_id].to_i)
|
||||
end
|
||||
|
||||
@@ -139,8 +139,10 @@ module Spree
|
||||
def require_order_authentication
|
||||
return if session[:access_token] || params[:order_token] || spree_current_user
|
||||
|
||||
store_location_for :spree_user, request.original_fullpath
|
||||
|
||||
flash[:error] = I18n.t("spree.orders.edit.login_to_view_order")
|
||||
redirect_to main_app.root_path(anchor: "login?after_login=#{request.env['PATH_INFO']}")
|
||||
redirect_to main_app.root_path(anchor: "/login", after_login: request.original_fullpath)
|
||||
end
|
||||
|
||||
def order_to_update
|
||||
|
||||
@@ -16,24 +16,6 @@ module Spree
|
||||
include I18nHelper
|
||||
before_action :set_locale
|
||||
|
||||
# Overridden due to bug in Devise.
|
||||
# respond_with resource, :location => new_session_path(resource_name)
|
||||
# is generating bad url /session/new.user
|
||||
#
|
||||
# overridden to:
|
||||
# respond_with resource, :location => spree.login_path
|
||||
#
|
||||
def create
|
||||
self.resource = resource_class.send_reset_password_instructions(raw_params[resource_name])
|
||||
|
||||
if resource.errors.empty?
|
||||
set_flash_message(:notice, :send_instructions) if is_navigational_format?
|
||||
respond_with resource, location: spree.login_path
|
||||
else
|
||||
respond_with_navigational(resource) { render :new }
|
||||
end
|
||||
end
|
||||
|
||||
# Devise::PasswordsController allows for blank passwords.
|
||||
# Silly Devise::PasswordsController!
|
||||
# Fixes spree/spree#2190.
|
||||
|
||||
@@ -6,11 +6,12 @@ require "spree/core/controller_helpers/order"
|
||||
|
||||
module Spree
|
||||
class UserSessionsController < Devise::SessionsController
|
||||
helper 'spree/base'
|
||||
|
||||
include Spree::Core::ControllerHelpers::Auth
|
||||
include Spree::Core::ControllerHelpers::Common
|
||||
include Spree::Core::ControllerHelpers::Order
|
||||
include CablecarResponses
|
||||
|
||||
helper 'spree/base'
|
||||
|
||||
before_action :set_checkout_redirect, only: :create
|
||||
after_action :ensure_valid_locale_persisted, only: :create
|
||||
@@ -19,25 +20,16 @@ module Spree
|
||||
authenticate_spree_user!
|
||||
|
||||
if spree_user_signed_in?
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:success] = t('devise.success.logged_in_succesfully')
|
||||
redirect_back_or_default(after_sign_in_path_for(spree_current_user))
|
||||
}
|
||||
format.js {
|
||||
render json: { email: spree_current_user.login }, status: :ok
|
||||
}
|
||||
end
|
||||
flash[:success] = t('devise.success.logged_in_succesfully')
|
||||
|
||||
render operations: cable_car.redirect_to(
|
||||
url: return_url_or_default(after_sign_in_path_for(spree_current_user))
|
||||
)
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash.now[:error] = t('devise.failure.invalid')
|
||||
render :new
|
||||
}
|
||||
format.js {
|
||||
render json: { message: t('devise.failure.invalid') }, status: :unauthorized
|
||||
}
|
||||
end
|
||||
render status: :unauthorized, operations: cable_car.inner_html(
|
||||
"#login-feedback",
|
||||
partial("layouts/alert", locals: { type: "alert", message: t('devise.failure.invalid') })
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,11 +49,6 @@ module Spree
|
||||
Spree.t(:login)
|
||||
end
|
||||
|
||||
def redirect_back_or_default(default)
|
||||
redirect_to(session["spree_user_return_to"] || default)
|
||||
session["spree_user_return_to"] = nil
|
||||
end
|
||||
|
||||
def ensure_valid_locale_persisted
|
||||
# When creating a new user session we have to wait until after a successful
|
||||
# login to be able to persist a selected locale on the current user
|
||||
|
||||
@@ -4,6 +4,7 @@ module Spree
|
||||
class UsersController < ::BaseController
|
||||
include Spree::Core::ControllerHelpers
|
||||
include I18nHelper
|
||||
include CablecarResponses
|
||||
|
||||
layout 'darkswarm'
|
||||
|
||||
@@ -26,16 +27,33 @@ module Spree
|
||||
|
||||
# Endpoint for queries to check if a user is already registered
|
||||
def registered_email
|
||||
user = Spree::User.find_by email: params[:email]
|
||||
render json: { registered: user.present? }
|
||||
registered = Spree::User.find_by(email: params[:email]).present?
|
||||
|
||||
if registered
|
||||
render status: :ok, operations: cable_car.
|
||||
inner_html(
|
||||
"#login-feedback",
|
||||
partial("layouts/alert", locals: { type: "alert", message: t('devise.failure.already_registered') })
|
||||
).
|
||||
dispatch_event(name: "login:modal:open")
|
||||
else
|
||||
head :not_found
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@user = Spree::User.new(user_params)
|
||||
|
||||
if @user.save
|
||||
redirect_back_or_default(main_app.root_url)
|
||||
render operations: cable_car.inner_html(
|
||||
"#signup-feedback",
|
||||
partial("layouts/alert", locals: { type: "success", message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') })
|
||||
)
|
||||
else
|
||||
render :new
|
||||
render status: :unprocessable_entity, operations: cable_car.morph(
|
||||
"#signup-tab",
|
||||
partial("layouts/signup_tab", locals: { signup_form_user: @user })
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class UserConfirmationsController < DeviseController
|
||||
# Needed for access to current_ability, so we can authorize! actions
|
||||
include Spree::Core::ControllerHelpers::Auth
|
||||
include CablecarResponses
|
||||
|
||||
# GET /resource/confirmation/new
|
||||
def new
|
||||
@@ -20,6 +21,12 @@ class UserConfirmationsController < DeviseController
|
||||
else
|
||||
set_flash_message(:error, :confirmation_not_sent)
|
||||
end
|
||||
else
|
||||
render operations: cable_car.inner_html(
|
||||
"#forgot-feedback",
|
||||
partial("layouts/alert", locals: { type: "success", message: t("devise.confirmations.send_instructions") })
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
respond_with_navigational(resource){ redirect_to login_path }
|
||||
@@ -39,22 +46,25 @@ class UserConfirmationsController < DeviseController
|
||||
end
|
||||
|
||||
def after_confirmation_path_for(resource)
|
||||
result =
|
||||
if resource.errors.empty?
|
||||
'confirmed'
|
||||
else
|
||||
'not_confirmed'
|
||||
end
|
||||
result = resource.errors.empty? ? "confirmed" : "not_confirmed"
|
||||
|
||||
if result == 'confirmed' && resource.reset_password_token.present?
|
||||
raw_reset_password_token = resource.regenerate_reset_password_token
|
||||
return spree.edit_spree_user_password_path(
|
||||
reset_password_token: raw_reset_password_token
|
||||
reset_password_token: resource.regenerate_reset_password_token
|
||||
)
|
||||
end
|
||||
|
||||
path = (session[:confirmation_return_url] || login_path).to_s
|
||||
path += path.include?('?') ? '&' : '?'
|
||||
path + "validation=#{result}"
|
||||
path = session[:confirmation_return_url] || root_path(anchor: "/login")
|
||||
append_query_to_url(path, "validation", result)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def append_query_to_url(url, key, value)
|
||||
uri = URI.parse(url.to_s)
|
||||
query = URI.decode_www_form(uri.query || "") << [key, value]
|
||||
uri.query = URI.encode_www_form(query)
|
||||
|
||||
uri.to_s
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserPasswordsController < Spree::UserPasswordsController
|
||||
include CablecarResponses
|
||||
|
||||
layout 'darkswarm'
|
||||
|
||||
before_action :set_admin_redirect, only: :edit
|
||||
|
||||
def create
|
||||
render_unconfirmed_response && return if user_unconfirmed?
|
||||
return render_unconfirmed_response if user_unconfirmed?
|
||||
|
||||
self.resource = resource_class.send_reset_password_instructions(raw_params[resource_name])
|
||||
|
||||
if resource.errors.empty?
|
||||
set_flash_message(:success, :send_instructions) if is_navigational_format?
|
||||
respond_with resource, location: main_app.login_path
|
||||
render operations: cable_car.inner_html(
|
||||
"#forgot-feedback",
|
||||
partial("layouts/alert", locals: { type: "success", message: t(:password_reset_sent) })
|
||||
)
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
respond_with_navigational(resource) { render :new }
|
||||
end
|
||||
format.js do
|
||||
render json: { error: t('email_not_found') }, status: :not_found
|
||||
end
|
||||
end
|
||||
render status: :not_found, operations: cable_car.inner_html(
|
||||
"#forgot-feedback",
|
||||
partial("layouts/alert", locals: { type: "alert", message: t(:email_not_found) })
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_admin_redirect
|
||||
session["spree_user_return_to"] = params[:return_to] if params[:return_to]
|
||||
end
|
||||
|
||||
def render_unconfirmed_response
|
||||
render json: { error: t('email_unconfirmed') }, status: :unauthorized
|
||||
render status: :unprocessable_entity, operations: cable_car.inner_html(
|
||||
"#forgot-feedback",
|
||||
partial("layouts/alert",
|
||||
locals: { type: "alert", message: t(:email_unconfirmed), unconfirmed: true })
|
||||
)
|
||||
end
|
||||
|
||||
def user_unconfirmed?
|
||||
|
||||
@@ -48,4 +48,13 @@ module ApplicationHelper
|
||||
classes << "off-canvas" unless @hide_menu
|
||||
classes << @shopfront_layout
|
||||
end
|
||||
|
||||
def pdf_stylesheet_pack_tag(source)
|
||||
if running_in_development?
|
||||
options = { media: "all", host: "#{Webpacker.dev_server.host}:#{Webpacker.dev_server.port}" }
|
||||
stylesheet_pack_tag(source, **options)
|
||||
else
|
||||
wicked_pdf_stylesheet_pack_tag(source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ module EnterprisesHelper
|
||||
def available_payment_methods
|
||||
return [] if current_distributor.blank?
|
||||
|
||||
payment_methods = current_distributor.payment_methods.available(:front_end).to_a
|
||||
payment_methods = current_distributor.payment_methods.available(:both).to_a
|
||||
|
||||
filter = OpenFoodNetwork::AvailablePaymentMethodFilter.new
|
||||
filter.filter!(payment_methods)
|
||||
|
||||
@@ -17,6 +17,24 @@ module Spree
|
||||
end.sort { |a, b| a.name <=> b.name }
|
||||
end
|
||||
|
||||
def countries
|
||||
available_countries.map { |c| [c.name, c.id] }
|
||||
end
|
||||
|
||||
def states_for_country(country)
|
||||
country.states.map do |state|
|
||||
[state.name, state.id]
|
||||
end
|
||||
end
|
||||
|
||||
def countries_with_states
|
||||
available_countries.map { |c|
|
||||
[c.id, c.states.map { |s|
|
||||
[s.name, s.id]
|
||||
}]
|
||||
}
|
||||
end
|
||||
|
||||
def pretty_time(time)
|
||||
[I18n.l(time.to_date, format: :long),
|
||||
time.strftime("%l:%M %p")].join(" ")
|
||||
|
||||
@@ -8,9 +8,7 @@ class PaymentMailer < Spree::BaseMailer
|
||||
subject = I18n.t('spree.payment_mailer.authorize_payment.subject',
|
||||
distributor: @payment.order.distributor.name)
|
||||
I18n.with_locale valid_locale(@payment.order.user) do
|
||||
mail(to: payment.order.user.email,
|
||||
from: from_address,
|
||||
subject: subject)
|
||||
mail(to: payment.order.email, from: from_address, subject: subject)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class Customer < ApplicationRecord
|
||||
|
||||
acts_as_taggable
|
||||
|
||||
searchable_attributes :name, :email, :code
|
||||
searchable_attributes :first_name, :last_name, :email, :code
|
||||
|
||||
belongs_to :enterprise
|
||||
belongs_to :user, class_name: "Spree::User"
|
||||
@@ -34,6 +34,10 @@ class Customer < ApplicationRecord
|
||||
|
||||
attr_accessor :gateway_recurring_payment_client_secret, :gateway_shop_id
|
||||
|
||||
def full_name
|
||||
"#{first_name} #{last_name}".strip
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def downcase_email
|
||||
|
||||
@@ -29,6 +29,7 @@ class OrderCycle < ApplicationRecord
|
||||
attr_accessor :incoming_exchanges, :outgoing_exchanges
|
||||
|
||||
before_update :reset_processed_at, if: :will_save_change_to_orders_close_at?
|
||||
after_save :sync_subscriptions, if: :opening?
|
||||
|
||||
validates :name, :coordinator_id, presence: true
|
||||
validate :orders_close_at_after_orders_open_at?
|
||||
@@ -156,8 +157,10 @@ class OrderCycle < ApplicationRecord
|
||||
# rubocop:disable Layout/LineLength
|
||||
oc.preferred_product_selection_from_coordinator_inventory_only = preferred_product_selection_from_coordinator_inventory_only
|
||||
# rubocop:enable Layout/LineLength
|
||||
oc.schedule_ids = schedule_ids
|
||||
oc.save!
|
||||
exchanges.each { |e| e.clone!(oc) }
|
||||
sync_subscriptions
|
||||
oc.reload
|
||||
end
|
||||
|
||||
@@ -272,6 +275,22 @@ class OrderCycle < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def opening?
|
||||
(open? || upcoming?) && saved_change_to_orders_close_at? && was_closed?
|
||||
end
|
||||
|
||||
def was_closed?
|
||||
orders_close_at_previously_was.blank? || Time.zone.now > orders_close_at_previously_was
|
||||
end
|
||||
|
||||
def sync_subscriptions
|
||||
return unless schedule_ids.any?
|
||||
|
||||
OrderManagement::Subscriptions::ProxyOrderSyncer.new(
|
||||
Subscription.where(schedule_id: schedule_ids)
|
||||
).sync!
|
||||
end
|
||||
|
||||
def orders_close_at_after_orders_open_at?
|
||||
return if orders_open_at.blank? || orders_close_at.blank?
|
||||
return if orders_close_at > orders_open_at
|
||||
|
||||
@@ -73,11 +73,13 @@ module ProductImport
|
||||
'variant_unit_scale', 'primary_taxon_id')
|
||||
)
|
||||
new_variant.save
|
||||
if entry.attributes['on_demand'].present?
|
||||
new_variant.on_demand = entry.attributes['on_demand']
|
||||
end
|
||||
if entry.attributes['on_hand'].present?
|
||||
new_variant.on_hand = entry.attributes['on_hand']
|
||||
if new_variant.persisted?
|
||||
if entry.attributes['on_demand'].present?
|
||||
new_variant.on_demand = entry.attributes['on_demand']
|
||||
end
|
||||
if entry.attributes['on_hand'].present?
|
||||
new_variant.on_hand = entry.attributes['on_hand']
|
||||
end
|
||||
end
|
||||
|
||||
new_variant.product_id = product_id
|
||||
|
||||
@@ -35,7 +35,7 @@ module Spree
|
||||
end
|
||||
|
||||
def options
|
||||
preferences.each_with_object({}){ |(key, value), memo| memo[key.to_sym] = value; }
|
||||
preferences.transform_keys(&:to_sym)
|
||||
end
|
||||
|
||||
def method_missing(method, *args)
|
||||
|
||||
@@ -84,8 +84,7 @@ module Spree
|
||||
before_validation :set_currency
|
||||
before_validation :generate_order_number, on: :create
|
||||
before_validation :clone_billing_address, if: :use_billing?
|
||||
before_validation :associate_customer, unless: :customer_id?
|
||||
before_validation :ensure_customer, unless: :customer_is_valid?
|
||||
before_validation :ensure_customer
|
||||
|
||||
before_create :link_by_email
|
||||
after_create :create_tax_charge!
|
||||
@@ -106,6 +105,7 @@ module Spree
|
||||
|
||||
after_save_commit DefaultAddressUpdater
|
||||
|
||||
attribute :send_cancellation_email, type: :boolean, default: true
|
||||
# -- Scopes
|
||||
scope :not_empty, -> {
|
||||
left_outer_joins(:line_items).where.not(spree_line_items: { id: nil })
|
||||
@@ -310,6 +310,8 @@ module Spree
|
||||
# Creates new tax charges if there are any applicable rates. If prices already
|
||||
# include taxes then price adjustments are created instead.
|
||||
def create_tax_charge!
|
||||
return if state.in?(["cart", "address", "delivery"]) && Flipper.enabled?(:split_checkout)
|
||||
|
||||
clear_legacy_taxes!
|
||||
|
||||
Spree::TaxRate.adjust(self, line_items)
|
||||
@@ -374,7 +376,7 @@ module Spree
|
||||
end
|
||||
|
||||
def available_payment_methods
|
||||
@available_payment_methods ||= PaymentMethod.available(:front_end)
|
||||
@available_payment_methods ||= PaymentMethod.available(:both)
|
||||
end
|
||||
|
||||
# "Checkout" is the initial state and, for card payments, "pending" is the state after auth
|
||||
@@ -658,7 +660,7 @@ module Spree
|
||||
def after_cancel
|
||||
shipments.each(&:cancel!)
|
||||
|
||||
OrderMailer.cancel_email(id).deliver_later
|
||||
OrderMailer.cancel_email(id).deliver_later if send_cancellation_email
|
||||
self.payment_state = 'credit_owed' unless shipped?
|
||||
end
|
||||
|
||||
@@ -709,23 +711,25 @@ module Spree
|
||||
def associate_customer
|
||||
return customer if customer.present?
|
||||
|
||||
self.customer = Customer.of(distributor).find_by(email: email_for_customer)
|
||||
Customer.of(distributor).find_by(email: email_for_customer)
|
||||
end
|
||||
|
||||
def ensure_customer
|
||||
return if associate_customer
|
||||
def create_customer
|
||||
return if customer_is_valid?
|
||||
|
||||
self.customer = Customer.new(
|
||||
Customer.create(
|
||||
enterprise: distributor,
|
||||
email: email_for_customer,
|
||||
user: user,
|
||||
name: bill_address&.full_name,
|
||||
first_name: bill_address&.first_name.to_s,
|
||||
last_name: bill_address&.last_name.to_s,
|
||||
bill_address: bill_address&.clone,
|
||||
ship_address: ship_address&.clone
|
||||
)
|
||||
customer.save
|
||||
end
|
||||
|
||||
Bugsnag.notify(customer.errors.full_messages.join(", ")) unless customer.persisted?
|
||||
def ensure_customer
|
||||
self.customer = associate_customer || create_customer
|
||||
end
|
||||
|
||||
def update_adjustment!(adjustment)
|
||||
@@ -734,16 +738,5 @@ module Spree
|
||||
adjustment.update_adjustment!(force: true)
|
||||
updater.update_totals_and_states
|
||||
end
|
||||
|
||||
# object_params sets the payment amount to the order total, but it does this
|
||||
# before the shipping method is set. This results in the customer not being
|
||||
# charged for their order's shipping. To fix this, we refresh the payment
|
||||
# amount here.
|
||||
def set_payment_amount!
|
||||
update_totals
|
||||
return unless pending_payments.any?
|
||||
|
||||
pending_payments.first.update_attribute :amount, total
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -81,7 +81,6 @@ module Spree
|
||||
after_transition to: :complete, do: :finalize!
|
||||
after_transition to: :resumed, do: :after_resume
|
||||
after_transition to: :canceled, do: :after_cancel
|
||||
after_transition to: :payment, do: :set_payment_amount!
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ module Spree
|
||||
adjustment.originator = payment_method
|
||||
adjustment.label = adjustment_label
|
||||
adjustment.save
|
||||
elsif payment_method.present?
|
||||
elsif !processing_refund? && payment_method.present?
|
||||
payment_method.create_adjustment(adjustment_label, self, true)
|
||||
adjustment.reload
|
||||
end
|
||||
@@ -163,6 +163,10 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def processing_refund?
|
||||
amount.negative?
|
||||
end
|
||||
|
||||
# Don't charge fees for invalid or failed payments.
|
||||
# This is called twice for failed payments, because the persistence of the 'failed'
|
||||
# state is acheived through some trickery using an after_rollback callback on the
|
||||
@@ -206,7 +210,7 @@ module Spree
|
||||
# Makes newly entered payments invalidate previously entered payments so the most recent payment
|
||||
# is used by the gateway.
|
||||
def invalidate_old_payments
|
||||
order.payments.with_state('checkout').where.not(id: id).each do |payment|
|
||||
order.payments.incomplete.where.not(id: id).each do |payment|
|
||||
# Using update_column skips validations and so it skips validate_source. As we are just
|
||||
# invalidating past payments here, we don't want to validate all of them at this stage.
|
||||
payment.update_columns(
|
||||
|
||||
@@ -10,7 +10,7 @@ module Spree
|
||||
acts_as_taggable
|
||||
acts_as_paranoid
|
||||
|
||||
DISPLAY = [:both, :front_end, :back_end].freeze
|
||||
DISPLAY = [:both, :back_end].freeze
|
||||
default_scope -> { where(deleted_at: nil) }
|
||||
|
||||
has_many :credit_cards, class_name: "Spree::CreditCard"
|
||||
|
||||
@@ -93,7 +93,7 @@ module Spree
|
||||
end
|
||||
|
||||
def clear_preferences
|
||||
preferences.keys.each { |pref| preference_store.delete preference_cache_key(pref) }
|
||||
preferences.each_key { |pref| preference_store.delete preference_cache_key(pref) }
|
||||
end
|
||||
|
||||
private
|
||||
@@ -121,7 +121,6 @@ module Spree
|
||||
when :integer
|
||||
value.to_i
|
||||
when :boolean
|
||||
# rubocop:disable Style/NumericPredicate
|
||||
if value.is_a?(FalseClass) ||
|
||||
value.nil? ||
|
||||
value == 0 ||
|
||||
@@ -131,7 +130,6 @@ module Spree
|
||||
else
|
||||
true
|
||||
end
|
||||
# rubocop:enable Style/NumericPredicate
|
||||
else
|
||||
value
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ module Spree
|
||||
|
||||
searchable_attributes :supplier_id, :primary_taxon_id, :meta_keywords
|
||||
searchable_associations :supplier, :properties, :primary_taxon, :variants, :master
|
||||
searchable_scopes :active
|
||||
searchable_scopes :active, :with_properties
|
||||
|
||||
has_many :product_option_types, dependent: :destroy
|
||||
# We have an after_destroy callback on Spree::ProductOptionType. However, if we
|
||||
@@ -69,6 +69,19 @@ module Spree
|
||||
|
||||
has_many :stock_items, through: :variants
|
||||
|
||||
has_many :supplier_properties, through: :supplier, source: :properties
|
||||
|
||||
scope :with_properties, ->(*property_ids) {
|
||||
left_outer_joins(:product_properties).
|
||||
left_outer_joins(:supplier_properties).
|
||||
where(inherits_properties: true).
|
||||
where(producer_properties: { property_id: property_ids }).
|
||||
or(
|
||||
where(spree_product_properties: { property_id: property_ids })
|
||||
).
|
||||
distinct
|
||||
}
|
||||
|
||||
delegate_belongs_to :master, :sku, :price, :currency, :display_amount, :display_price, :weight,
|
||||
:height, :width, :depth, :is_master, :cost_currency,
|
||||
:price_in, :amount_in, :unit_value, :unit_description
|
||||
|
||||
@@ -79,6 +79,8 @@ module Spree
|
||||
after_create :create_stock_items
|
||||
after_create :set_position
|
||||
|
||||
before_save :convert_variant_weight_to_decimal
|
||||
|
||||
around_destroy :destruction
|
||||
|
||||
# default variant scope only lists non-deleted variants
|
||||
@@ -243,5 +245,9 @@ module Spree
|
||||
|
||||
self.unit_value = 1.0
|
||||
end
|
||||
|
||||
def convert_variant_weight_to_decimal
|
||||
self.weight = weight.to_d
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
module Api
|
||||
module Admin
|
||||
class CustomerSerializer < ActiveModel::Serializer
|
||||
attributes :id, :email, :enterprise_id, :user_id, :code, :tags, :tag_list, :name,
|
||||
:allow_charges, :default_card_present?
|
||||
attributes :id, :email, :enterprise_id, :user_id, :code, :tags, :tag_list, :first_name,
|
||||
:last_name, :allow_charges, :default_card_present?
|
||||
|
||||
has_one :ship_address, serializer: Api::AddressSerializer
|
||||
has_one :bill_address, serializer: Api::AddressSerializer
|
||||
|
||||
def name
|
||||
object.name.presence || object.bill_address&.full_name
|
||||
def full_name
|
||||
object.full_name.presence || object.bill_address&.full_name
|
||||
end
|
||||
|
||||
def tag_list
|
||||
|
||||
@@ -7,11 +7,19 @@ module Api
|
||||
attributes :id, :name, :type, :tag_list, :tags
|
||||
|
||||
def tag_list
|
||||
object.tag_list.join(",")
|
||||
payment_method_tag_list.join(",")
|
||||
end
|
||||
|
||||
def tags
|
||||
object.tag_list.map{ |t| { text: t } }
|
||||
payment_method_tag_list.map{ |t| { text: t } }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def payment_method_tag_list
|
||||
return object.tag_list unless options[:payment_method_tags]
|
||||
|
||||
options.dig(:payment_method_tags, object.id) || []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,9 +7,9 @@ module Api
|
||||
|
||||
def method_serializer
|
||||
if object.type == 'Spree::Gateway::StripeSCA'
|
||||
Api::Admin::PaymentMethod::StripeSerializer.new(object)
|
||||
Api::Admin::PaymentMethod::StripeSerializer.new(object, options)
|
||||
else
|
||||
Api::Admin::PaymentMethod::BaseSerializer.new(object)
|
||||
Api::Admin::PaymentMethod::BaseSerializer.new(object, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,8 +4,8 @@ module Api
|
||||
module Admin
|
||||
class SubscriptionSerializer < ActiveModel::Serializer
|
||||
attributes :id, :shop_id, :customer_id, :schedule_id, :payment_method_id, :shipping_method_id,
|
||||
:begins_at, :ends_at,
|
||||
:customer_email, :customer_name, :schedule_name, :edit_path, :canceled_at, :paused_at, :state,
|
||||
:begins_at, :ends_at, :customer_email, :customer_first_name, :customer_last_name,
|
||||
:customer_full_name, :schedule_name, :edit_path, :canceled_at, :paused_at, :state,
|
||||
:shipping_fee_estimate, :payment_fee_estimate
|
||||
|
||||
has_many :subscription_line_items, serializer: Api::Admin::SubscriptionLineItemSerializer
|
||||
@@ -34,8 +34,16 @@ module Api
|
||||
object.customer&.email
|
||||
end
|
||||
|
||||
def customer_name
|
||||
object.customer&.name
|
||||
def customer_first_name
|
||||
object.customer&.first_name
|
||||
end
|
||||
|
||||
def customer_last_name
|
||||
object.customer&.last_name
|
||||
end
|
||||
|
||||
def customer_full_name
|
||||
object.customer&.full_name
|
||||
end
|
||||
|
||||
def schedule_name
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module Api
|
||||
module Admin
|
||||
class UnitsProductSerializer < ActiveModel::Serializer
|
||||
attributes :id, :name, :group_buy_unit_size, :variant_unit
|
||||
attributes :id, :name, :group_buy_unit_size, :variant_unit, :variant_unit_scale
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module Api
|
||||
class CustomerSerializer < ActiveModel::Serializer
|
||||
attributes :id, :enterprise_id, :name, :code, :email, :allow_charges
|
||||
attributes :id, :enterprise_id, :first_name, :last_name, :code, :email, :allow_charges
|
||||
|
||||
def attributes
|
||||
hash = super
|
||||
|
||||
@@ -27,14 +27,14 @@ class DefaultAddressUpdater
|
||||
:bill_address_id, :ship_address_id, to: :order
|
||||
|
||||
def assign_bill_addresses
|
||||
return unless save_bill_address
|
||||
return if save_bill_address == "0"
|
||||
|
||||
customer.bill_address_id = bill_address_id
|
||||
user&.bill_address_id = bill_address_id
|
||||
end
|
||||
|
||||
def assign_ship_addresses
|
||||
return unless save_ship_address
|
||||
return if save_ship_address == "0"
|
||||
|
||||
customer.ship_address_id = ship_address_id
|
||||
user&.ship_address_id = ship_address_id
|
||||
|
||||
@@ -20,11 +20,17 @@ class TaxRateFinder
|
||||
case originator
|
||||
when Spree::TaxRate
|
||||
[originator]
|
||||
when Spree::ShippingMethod
|
||||
shipping_method_fee_tax_rates(originator, adjustable)
|
||||
when EnterpriseFee
|
||||
enterprise_fee_tax_rates(originator, adjustable)
|
||||
end
|
||||
end
|
||||
|
||||
def shipping_method_fee_tax_rates(shipping_method, _adjustable)
|
||||
shipping_method.tax_category ? shipping_method.tax_category.tax_rates : []
|
||||
end
|
||||
|
||||
def enterprise_fee_tax_rates(enterprise_fee, adjustable)
|
||||
case adjustable
|
||||
when Spree::LineItem
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
.row{ 'ng-if' => 'shop_id && RequestMonitor.loading' }
|
||||
.sixteen.columns.alpha#loading
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
=t :loading_customers
|
||||
= t :loading_customers
|
||||
|
||||
.row{ :class => "sixteen columns alpha", 'ng-show' => '!RequestMonitor.loading && filteredCustomers.length == 0'}
|
||||
%h1#no_results
|
||||
@@ -50,7 +50,8 @@
|
||||
|
||||
%table.index#customers
|
||||
%col.email{ width: "20%", 'ng-show' => 'columns.email.visible' }
|
||||
%col.name{ width: "20%", 'ng-show' => 'columns.name.visible' }
|
||||
%col.first_name{ width: "20%", 'ng-show' => 'columns.first_name.visible' }
|
||||
%col.last_name{ width: "20%", 'ng-show' => 'columns.last_name.visible' }
|
||||
%col.code{ width: "10%", 'ng-show' => 'columns.code.visible' }
|
||||
%col.tags{ width: "20%", 'ng-show' => 'columns.tags.visible' }
|
||||
%col.bill_address{ width: "10%", 'ng-show' => 'columns.bill_address.visible' }
|
||||
@@ -63,8 +64,10 @@
|
||||
-# %input{ :type => "checkbox", :name => 'toggle_bulk', 'ng-click' => 'toggleAllCheckboxes()', 'ng-checked' => "allBoxesChecked()" }
|
||||
%th.email{ 'ng-show' => 'columns.email.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('email')" }=t('admin.email')
|
||||
%th.name{ 'ng-show' => 'columns.name.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('name')" }=t('admin.name')
|
||||
%th.first_name{ 'ng-show' => 'columns.first_name.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('first_name')" }=t('admin.first_name')
|
||||
%th.last_name{ 'ng-show' => 'columns.last_name.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('last_name')" }=t('admin.last_name')
|
||||
%th.code{ 'ng-show' => 'columns.code.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('code')" }=t('admin.customers.index.code')
|
||||
%th.tags{ 'ng-show' => 'columns.tags.visible' }=t('admin.tags')
|
||||
@@ -78,8 +81,10 @@
|
||||
%td.email{ 'ng-show' => 'columns.email.visible'}
|
||||
%span{ 'ng-bind' => '::customer.email' }
|
||||
%span.guest-label{ 'ng-show' => 'customer.user_id == null' }= t('.guest_label')
|
||||
%td.name{ 'ng-show' => 'columns.name.visible'}
|
||||
%input{ type: 'text', name: 'name', ng: { model: 'customer.name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'name'}
|
||||
%td.first_name{ 'ng-show' => 'columns.first_name.visible'}
|
||||
%input{ type: 'text', name: 'first_name', ng: { model: 'customer.first_name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'first_name'}
|
||||
%td.last_name{ 'ng-show' => 'columns.last_name.visible'}
|
||||
%input{ type: 'text', name: 'last_name', ng: { model: 'customer.last_name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'last_name'}
|
||||
%td.code{ 'ng-show' => 'columns.code.visible' }
|
||||
%input{ type: 'text', name: 'code', ng: {model: 'customer.code', change: 'checkForDuplicateCodes()'}, "obj-for-update" => "customer", "attr-for-update" => "code" }
|
||||
%i.icon-warning-sign{ ng: {if: 'duplicate'} }
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
%columns-dropdown{ action: "#{controller_name}_#{action_name}" }
|
||||
.row{ 'ng-if' => '!loaded' }
|
||||
.sixteen.columns.alpha#loading
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.loading_enterprises')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading_enterprises')
|
||||
.row{ :class => "sixteen columns alpha", 'ng-show' => 'loaded && filteredEnterprises.length == 0'}
|
||||
%h1#no_results= t('.no_enterprises_found')
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
= f.text_field :permalink, { 'ng-model' => "Enterprise.permalink", placeholder: "eg. your-shop-name", 'ng-model-options' => "{ updateOn: 'default blur', debounce: {'default': 300, 'blur': 0} }" }
|
||||
.two.columns.omega
|
||||
%div{ng: {show: "checking", cloak: true}, style: "width: 30px; height: 30px;"}
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%span{ ng: { class: 'availability.toLowerCase()', hide: "checking" } }
|
||||
{{ availability }}
|
||||
%i{ ng: { class: "{'icon-ok-sign': availability == 'Available', 'icon-remove-sign': availability == 'Unavailable'}" } }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%div.sixteen.columns.alpha.omega#loading{ ng: { cloak: true, if: 'RequestMonitor.loading' } }
|
||||
= render partial: "components/spinner"
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1{ ng: { hide: 'orderCycles.length > 0' } }
|
||||
=t('.loading_order_cycles')
|
||||
= t('.loading_order_cycles')
|
||||
%h1{ ng: { show: 'orderCycles.length > 0' } }
|
||||
=t('.loading')
|
||||
= t('.loading')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "shops", @shops, Api::Admin::IdNameSerializer if @shops
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "customers", @customers, Api::Admin::IdEmailSerializer if @customers
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "schedules", @schedules, Api::Admin::IdNameSerializer if @schedules
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "paymentMethods", @payment_methods, Api::Admin::PaymentMethodSerializer if @payment_methods
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "paymentMethods", @payment_methods, Api::Admin::PaymentMethodSerializer, { payment_method_tags: @payment_method_tags } if @payment_methods
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "shippingMethods", @shipping_methods, Api::Admin::IdNameSerializer if @shipping_methods
|
||||
= admin_inject_json_ams_array "admin.subscriptions", "orderCycles", @order_cycles, Api::Admin::BasicOrderCycleSerializer if @order_cycles
|
||||
= admin_inject_available_countries(module: "admin.subscriptions")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
%div.sixteen.columns.alpha.omega#loading{ ng: { cloak: true, if: 'shop_id && RequestMonitor.loading' } }
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.loading')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading')
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
%td.customer.text-center{ ng: { show: 'columns.customer.visible'}}
|
||||
%span{ "ng-bind": '::subscription.customer_email' }
|
||||
%br
|
||||
%span{ "ng-bind": '::subscription.customer_name' }
|
||||
%span{ "ng-bind": '::subscription.customer_full_name' }
|
||||
%td.schedule.text-center{ ng: { show: 'columns.schedule.visible', bind: '::subscription.schedule_name' } }
|
||||
%td.items.panel-toggle.text-center{ name: 'products', ng: { show: 'columns.items.visible' } }
|
||||
%h5{ ng: { bind: 'itemCount(subscription)' } }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
%div.sixteen.columns.alpha.omega#loading{ ng: { cloak: true, if: 'hub_id && products.length == 0 && RequestMonitor.loading' } }
|
||||
= render partial: "components/spinner"
|
||||
%h1= t('.loading_inventory')
|
||||
= render partial: "components/admin_spinner"
|
||||
%h1
|
||||
= t('.loading_inventory')
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
.small-12.columns.text-center
|
||||
%h3.pad-top
|
||||
= t :checkout_headline
|
||||
.row.pad-top
|
||||
-if guest_checkout_allowed?
|
||||
.row.pad-top{ "data-controller": "login-modal" }
|
||||
- if guest_checkout_allowed?
|
||||
.small-5.columns.text-center
|
||||
%button.primary.expand{"auth" => "login"}
|
||||
%button.primary.expand{ "data-action": "click->login-modal#call" }
|
||||
= t :label_login
|
||||
.small-2.columns.text-center
|
||||
%p.pad-top= "#{t :action_or}"
|
||||
.small-5.columns.text-center
|
||||
%button.neutral-btn.dark.expand{"ng-click" => "enabled = true"}
|
||||
= t :checkout_as_guest
|
||||
-else
|
||||
- else
|
||||
.small-6.columns.small-centered
|
||||
%button.primary.expand{"auth" => "login"}
|
||||
%button.primary.expand{ "data-action": "click->login-modal#call" }
|
||||
= t :label_login
|
||||
|
||||
1
app/views/components/_admin_spinner.haml
Normal file
1
app/views/components/_admin_spinner.haml
Normal file
@@ -0,0 +1 @@
|
||||
%i.spinner.fa.fa-spin.fa-circle-o-notch
|
||||
5
app/views/layouts/_alert.html.haml
Normal file
5
app/views/layouts/_alert.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
.alert-box{ class: "#{type}" }
|
||||
= message
|
||||
- if local_assigns[:unconfirmed]
|
||||
%a{ "data-action": "login-modal#resend_confirmation" }
|
||||
= t('devise.confirmations.resend_confirmation_email')
|
||||
12
app/views/layouts/_forgot_tab.html.haml
Normal file
12
app/views/layouts/_forgot_tab.html.haml
Normal file
@@ -0,0 +1,12 @@
|
||||
#forgot-tab
|
||||
= form_with url: spree_user_password_path, scope: :spree_user, data: { remote: "true" } do |form|
|
||||
.row
|
||||
.large-12.columns#forgot-feedback
|
||||
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.label :email, t(:signup_email)
|
||||
= form.email_field :email, { tabindex: 1, inputmode: "email", "data-login-modal-target": "email", "data-action": "input->login-modal#emailOnInput" }
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.submit t(:reset_password), { class: "button primary", tabindex: 2 }
|
||||
24
app/views/layouts/_login_modal.html.haml
Normal file
24
app/views/layouts/_login_modal.html.haml
Normal file
@@ -0,0 +1,24 @@
|
||||
%div{"data-controller": "login-modal" }
|
||||
.reveal-modal-bg.fade{ "data-login-modal-target": "background", "data-action": "click->login-modal#close" }
|
||||
|
||||
.reveal-modal.fade.login-modal.medium{ "data-login-modal-target": "modal" }
|
||||
%div{ "data-controller": "tabs" }
|
||||
%dl.tabs
|
||||
%dd
|
||||
%a{ data: { "tabs-target": "tab", "action": "tabs#select" } }= t(:label_login)
|
||||
%dd
|
||||
%a{ data: { "tabs-target": "tab", "action": "tabs#select" } }= t(:label_signup)
|
||||
%dd
|
||||
%a{ data: { "tabs-target": "tab", "action": "tabs#select" } }= t(:forgot_password)
|
||||
|
||||
.tabs-content
|
||||
.content.active
|
||||
%div{ data: { "tabs-target": "content" } }
|
||||
= render "layouts/login_tab"
|
||||
%div{ data: { "tabs-target": "content" } }
|
||||
= render "layouts/signup_tab"
|
||||
%div{ data: { "tabs-target": "content" } }
|
||||
= render "layouts/forgot_tab"
|
||||
|
||||
%a.close-reveal-modal{ "data-action": "click->login-modal#close" }
|
||||
%i.ofn-i_009-close
|
||||
24
app/views/layouts/_login_tab.html.haml
Normal file
24
app/views/layouts/_login_tab.html.haml
Normal file
@@ -0,0 +1,24 @@
|
||||
#login-content
|
||||
= form_with url: spree.spree_user_session_path, scope: :spree_user, data: { remote: "true" } do |form|
|
||||
.row
|
||||
.large-12.columns#login-feedback
|
||||
- confirmation_result = request.query_parameters[:validation]
|
||||
- if confirmation_result.in? ["confirmed", "not_confirmed"]
|
||||
.alert-box{ class: "#{confirmation_result == "confirmed" ? "success" : "alert" }" }
|
||||
= t("devise.confirmations.#{confirmation_result}")
|
||||
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.label :email, t(:email)
|
||||
= form.email_field :email, { tabindex: 1, inputmode: "email", autocomplete: "off", "data-login-modal-target": "email", "data-action": "input->login-modal#emailOnInput" }
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.label :password, t(:password)
|
||||
= form.password_field :password, { tabindex: 2, inputmode: "password" }
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.check_box :remember_me, { tabindex: 3 }
|
||||
= form.label :remember_me, t(:remember_me)
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.submit t(:label_login), { class: "button primary", tabindex: 4 }
|
||||
25
app/views/layouts/_signup_tab.html.haml
Normal file
25
app/views/layouts/_signup_tab.html.haml
Normal file
@@ -0,0 +1,25 @@
|
||||
- signup_form_user = Spree::User.new if local_assigns[:signup_form_user].nil?
|
||||
|
||||
#signup-tab
|
||||
= form_with model: signup_form_user, url: spree.account_path, scope: :user, data: { remote: "true" } do |form|
|
||||
.row
|
||||
.large-12.columns#signup-feedback
|
||||
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.label :email, t(:signup_email)
|
||||
= form.email_field :email, { tabindex: 1, "data-login-modal-target": "email", "data-action": "input->login-modal#emailOnInput" }
|
||||
= form.error_message_on :email
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.label :password, t(:choose_password)
|
||||
= form.password_field :password, { tabindex: 2, autocomplete: "off" }
|
||||
= form.error_message_on :password
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.label :password_confirmation, t(:confirm_password)
|
||||
= form.password_field :password_confirmation, { tabindex: 3, autocomplete: "off" }
|
||||
= form.error_message_on :password_confirmation
|
||||
.row
|
||||
.large-12.columns
|
||||
= form.submit t(:action_signup), { class: "button primary", tabindex: 4 }
|
||||
@@ -57,3 +57,5 @@
|
||||
= yield :injection_data
|
||||
|
||||
= render "layouts/matomo_tag"
|
||||
|
||||
= render "layouts/login_modal"
|
||||
|
||||
@@ -1 +1,28 @@
|
||||
%div{"ng-controller" => "AuthenticationCtrl"}
|
||||
%div{"data-controller": "login-modal" }
|
||||
.reveal-modal-bg.fade.in{ "data-login-modal-target": "background", "data-action": "click->login-modal#returnHome", style: "display: block;" }
|
||||
|
||||
.reveal-modal.fade.login-modal.medium.in{ "data-login-modal-target": "modal", style: "display: block;" }
|
||||
.row.modal-centered
|
||||
%h2= t('js.registration.welcome_to_ofn')
|
||||
%h5= t('js.registration.signup_or_login')
|
||||
|
||||
%div{ "data-controller": "tabs" }
|
||||
%dl.tabs
|
||||
%dd
|
||||
%a{ data: { "tabs-target": "tab", "action": "tabs#select" } }= t(:label_signup)
|
||||
%dd
|
||||
%a{ data: { "tabs-target": "tab", "action": "tabs#select" } }= t(:label_login)
|
||||
%dd
|
||||
%a{ data: { "tabs-target": "tab", "action": "tabs#select" } }= t(:forgot_password)
|
||||
|
||||
.tabs-content
|
||||
.content.active
|
||||
%div{ data: { "tabs-target": "content" } }
|
||||
= render "layouts/signup_tab"
|
||||
%div{ data: { "tabs-target": "content" } }
|
||||
= render "layouts/login_tab"
|
||||
%div{ data: { "tabs-target": "content" } }
|
||||
= render "layouts/forgot_tab"
|
||||
|
||||
%a.close-reveal-modal{ "data-action": "click->login-modal#returnHome" }
|
||||
%i.ofn-i_009-close
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
- if spree_current_user.nil?
|
||||
%li#login-link= link_to t(:label_login), "#login", id: "sidebarLoginButton", class: "sidebar-button"
|
||||
%li#login-name.hide
|
||||
%li.divider
|
||||
%li#sign-up-link= link_to t(:label_signup), "#signup", id: "sidebarSignUpButton", class: "sidebar-button"
|
||||
%li#sign-out-link.hide= link_to "Sign Out", "/logout"
|
||||
- else
|
||||
%li#login-link.hide= link_to t(:label_login), "#sidebar", id: "sidebarLoginButton", class: "sidebar-button"
|
||||
%li#login-name= link_to "#{spree_current_user.email}", "#"
|
||||
%li.divider
|
||||
%li#sign-up-link.hide= link_to t(:label_signup), "#"
|
||||
%li#sign-out-link= link_to t(:label_logout), "/logout"
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
%div.fullwidth
|
||||
%a.edit-cart.button.large.dark.left{href: main_app.cart_path, "ng-disabled" => "Cart.dirty || Cart.empty()", "ng-class" => "{ dirty: Cart.dirty }"}
|
||||
= "{{ Cart.dirty ? '#{t(:cart_updating)}' : (Cart.empty() ? '#{t(:cart_empty)}' : '#{t('.edit_cart')}' ) }}"
|
||||
%div{ ng: { if: "Cart.dirty" } }= t(:cart_updating)
|
||||
%div{ ng: { if: "!Cart.dirty && Cart.empty()" } }= t(:cart_empty)
|
||||
%div{ ng: { if: "!Cart.dirty && !Cart.empty()" } }= t('.edit_cart')
|
||||
%a.checkout.button.large.bright.right{href: main_app.checkout_path, "ng-disabled" => "Cart.dirty || Cart.empty()"}
|
||||
= t '.checkout'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%li#login-link
|
||||
%a{"auth" => "login"}
|
||||
%li#login-link{ "data-controller": "login-modal" }
|
||||
%a{"auth": "login", "data-action": "click->login-modal#call" }
|
||||
%img{ src: image_pack_path("menu/icn-login.svg") }
|
||||
%span
|
||||
= t 'label_login'
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
.content{ "darker-background" => true }
|
||||
.row.footer-pad
|
||||
.small-12.columns
|
||||
.small-12.columns{ "data-controller": "login-modal" }
|
||||
%strong
|
||||
= t '.require_customer_login'
|
||||
%p
|
||||
- if spree_current_user.nil?
|
||||
%p
|
||||
= t('.require_login_html', login: ('<a auth="login">' + t('.login') + '</a>').html_safe, signup: ('<a auth="signup">' + t('.signup') + '</a>').html_safe)
|
||||
= t('.require_login_link_html', login: ('<a data-action="click->login-modal#call">' + t('.login') + '</a>').html_safe)
|
||||
%p
|
||||
= t('.require_login_2_html', contact: link_to(t('.contact'), '#contact'), enterprise: current_distributor.name)
|
||||
- else
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
= bill_address.text_field :phone, { placeholder: t("split_checkout.step1.your_details.phone.placeholder") }
|
||||
= f.error_message_on "bill_address.phone"
|
||||
|
||||
%div.checkout-substep{ "data-controller": "dependant-select", "data-dependant-select-options-value": @countries_with_states }
|
||||
%div.checkout-substep
|
||||
-# BILLING ADDRESS
|
||||
%div.checkout-title
|
||||
= t("split_checkout.step1.billing_address.title")
|
||||
@@ -45,18 +45,21 @@
|
||||
= bill_address.text_field :city, { placeholder: t("split_checkout.step1.address.city.placeholder") }
|
||||
= f.error_message_on "bill_address.city"
|
||||
|
||||
%div.checkout-input
|
||||
= bill_address.label :state_id, t("split_checkout.step1.address.state_id.label")
|
||||
= bill_address.select :state_id, @countries_with_states, { }, { "data-dependant-select-target": "select" }
|
||||
|
||||
%div.checkout-input
|
||||
= bill_address.label :zipcode, t("split_checkout.step1.address.zipcode.label")
|
||||
= bill_address.text_field :zipcode, { placeholder: t("split_checkout.step1.address.zipcode.placeholder") }
|
||||
= f.error_message_on "bill_address.zipcode"
|
||||
|
||||
%div.checkout-input
|
||||
= bill_address.label :country_id, t("split_checkout.step1.address.country_id.label")
|
||||
= bill_address.select :country_id, @countries, { selected: @order.bill_address.country_id || DefaultCountry.id }, {"data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange"}
|
||||
%div{ "data-controller": "dependant-select", "data-dependant-select-options-value": countries_with_states }
|
||||
- bill_address_country = @order.bill_address.country || DefaultCountry.country
|
||||
|
||||
%div.checkout-input
|
||||
= bill_address.label :country_id, t("split_checkout.step1.address.country_id.label")
|
||||
= bill_address.select :country_id, countries, { selected: bill_address_country.id }, { "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange" }
|
||||
|
||||
%div.checkout-input
|
||||
= bill_address.label :state_id, t("split_checkout.step1.address.state_id.label")
|
||||
= bill_address.select :state_id, states_for_country(bill_address_country), { selected: @order.bill_address&.state_id }, { "data-dependant-select-target": "select" }
|
||||
|
||||
- if spree_current_user||true
|
||||
%div.checkout-input
|
||||
@@ -71,6 +74,7 @@
|
||||
- display_ship_address = false
|
||||
- ship_method_description = nil
|
||||
|
||||
- selected_shipping_method ||= @shipping_methods[0].id if @shipping_methods.length == 1
|
||||
- @shipping_methods.each do |shipping_method|
|
||||
%div.checkout-input.checkout-input-radio
|
||||
= fields_for shipping_method do |shipping_method_form|
|
||||
@@ -85,7 +89,7 @@
|
||||
= shipping_method_form.label shipping_method.id, shipping_method.name, {for: "shipping_method_" + shipping_method.id.to_s }
|
||||
%em.light
|
||||
= payment_or_shipping_price(shipping_method, @order)
|
||||
- display_ship_address = (shipping_method.id == selected_shipping_method.to_i && shipping_method.require_ship_address)
|
||||
- display_ship_address = display_ship_address || (shipping_method.id == selected_shipping_method.to_i && shipping_method.require_ship_address)
|
||||
- if shipping_method.id == selected_shipping_method.to_i
|
||||
- ship_method_description = shipping_method.description
|
||||
|
||||
@@ -121,18 +125,21 @@
|
||||
= ship_address.text_field :city, { placeholder: t("split_checkout.step1.address.city.placeholder") }
|
||||
= f.error_message_on "ship_address.city"
|
||||
|
||||
%div.checkout-input
|
||||
= ship_address.label :state_id, t("split_checkout.step1.address.state_id.label")
|
||||
= ship_address.select :state_id, @countries_with_states, { }, { "data-dependant-select-target": "select" }
|
||||
|
||||
%div.checkout-input
|
||||
= ship_address.label :zipcode, t("split_checkout.step1.address.zipcode.label")
|
||||
= ship_address.text_field :zipcode, { placeholder: t("split_checkout.step1.address.zipcode.placeholder") }
|
||||
= f.error_message_on "ship_address.zipcode"
|
||||
|
||||
%div.checkout-input
|
||||
= ship_address.label :country_id, t("split_checkout.step1.address.country_id.label")
|
||||
= ship_address.select :country_id, @countries, { selected: @order.ship_address.country_id || DefaultCountry.id }, {"data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange"}
|
||||
%div{ "data-controller": "dependant-select", "data-dependant-select-options-value": countries_with_states }
|
||||
- ship_address_country = @order.ship_address.country || DefaultCountry.country
|
||||
|
||||
%div.checkout-input
|
||||
= ship_address.label :country_id, t("split_checkout.step1.address.country_id.label")
|
||||
= ship_address.select :country_id, countries, { selected: ship_address_country.id }, { "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange" }
|
||||
|
||||
%div.checkout-input
|
||||
= ship_address.label :state_id, t("split_checkout.step1.address.state_id.label")
|
||||
= ship_address.select :state_id, states_for_country(ship_address_country), { selected: @order.ship_address&.state_id }, { "data-dependant-select-target": "select" }
|
||||
|
||||
- if spree_current_user
|
||||
%div.checkout-input{ "data-toggle-target": "content", style: "display: none" }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
= t("split_checkout.step2.payment_method.title")
|
||||
|
||||
- selected_payment_method = @order.payments&.with_state(:checkout)&.first&.payment_method_id
|
||||
- selected_payment_method ||= available_payment_methods[0].id if available_payment_methods.length == 1
|
||||
- available_payment_methods.each do |payment_method|
|
||||
%div.checkout-input.checkout-input-radio
|
||||
= f.radio_button :payment_method_id, payment_method.id,
|
||||
|
||||
@@ -71,10 +71,11 @@
|
||||
|
||||
= render 'spree/orders/summary', order: @order
|
||||
|
||||
- if any_terms_required?(@order.distributor)
|
||||
= render partial: "terms_and_conditions", locals: { f: f }
|
||||
|
||||
%div.checkout-submit.medium-6
|
||||
= f.submit t("split_checkout.step3.submit"), name: "confirm_order", class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
|
||||
%a.button.cancel{href: main_app.cart_path}
|
||||
= t("split_checkout.step3.cancel")
|
||||
.checkout-step3{"data-controller": "sticky", "data-sticky-target": "container"}
|
||||
- if any_terms_required?(@order.distributor)
|
||||
= render partial: "terms_and_conditions", locals: { f: f }
|
||||
.medium-6
|
||||
.checkout-submit
|
||||
= f.submit t("split_checkout.step3.submit"), name: "confirm_order", class: "button primary", disabled: @terms_and_conditions_accepted == false || @platform_tos_accepted == false
|
||||
%a.button.cancel{href: main_app.checkout_step_path(:payment)}
|
||||
= t("split_checkout.step3.cancel")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user