mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-18 19:36:48 +00:00
Compare commits
449 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc805d94d8 | ||
|
|
d33cdd1327 | ||
|
|
daaff2f7e8 | ||
|
|
4de0b9ad11 | ||
|
|
14a258c661 | ||
|
|
3b3f9a7513 | ||
|
|
3e1b66fd01 | ||
|
|
1d9fbbf69e | ||
|
|
b378d7655f | ||
|
|
617a417dc2 | ||
|
|
bfbdb5f44b | ||
|
|
ae84dfe3cd | ||
|
|
8a6874326a | ||
|
|
68de510c4e | ||
|
|
230afd5024 | ||
|
|
41e696282c | ||
|
|
e655d5b188 | ||
|
|
7d15baef9d | ||
|
|
312f2544dd | ||
|
|
157bdd9f3d | ||
|
|
b4e041c7e9 | ||
|
|
23e2d28488 | ||
|
|
0f9ebfe34a | ||
|
|
b7adc5f551 | ||
|
|
7b0ce3272a | ||
|
|
5bbbe4b67a | ||
|
|
4705d306b5 | ||
|
|
2082404c87 | ||
|
|
c9a7230fe2 | ||
|
|
b2c778794d | ||
|
|
80eef9c302 | ||
|
|
f40b569a4a | ||
|
|
1f161bee1f | ||
|
|
cd71233163 | ||
|
|
6ef0e04c18 | ||
|
|
87274bccc6 | ||
|
|
82e38d7b91 | ||
|
|
5894246474 | ||
|
|
058a45f4e5 | ||
|
|
e5ccee42cc | ||
|
|
38f145549a | ||
|
|
f551bea00b | ||
|
|
f5ebc797c4 | ||
|
|
263b36d1d9 | ||
|
|
ea76615763 | ||
|
|
e076e23064 | ||
|
|
a272479483 | ||
|
|
6ec3e7ee0c | ||
|
|
ec4d091c2e | ||
|
|
eec117e769 | ||
|
|
eb621cae35 | ||
|
|
73f55ae776 | ||
|
|
19584ce6e0 | ||
|
|
8942d3d17b | ||
|
|
ddfbcacd83 | ||
|
|
c3a7acf9ad | ||
|
|
fb0d922d73 | ||
|
|
5c83a3277e | ||
|
|
c6332ab306 | ||
|
|
6b7030a6a8 | ||
|
|
b1fd6d9541 | ||
|
|
d73d6dcdb6 | ||
|
|
792d6d9569 | ||
|
|
1137e6890b | ||
|
|
52e934ec2b | ||
|
|
bc26a3aa07 | ||
|
|
01c477f2cb | ||
|
|
8335594351 | ||
|
|
44db511e66 | ||
|
|
8b89c901ef | ||
|
|
7b57f2358c | ||
|
|
b297299838 | ||
|
|
52843de1da | ||
|
|
77e644e3d4 | ||
|
|
72df2867d4 | ||
|
|
0cc8349c71 | ||
|
|
47ac118cf7 | ||
|
|
95d68b98a9 | ||
|
|
47a43163d8 | ||
|
|
b582b61414 | ||
|
|
6ead127b5c | ||
|
|
22cf05ad94 | ||
|
|
a2e68026e5 | ||
|
|
c9419d3437 | ||
|
|
c1f34bc680 | ||
|
|
a64d146bb1 | ||
|
|
a43d31a9d5 | ||
|
|
db2b381c3f | ||
|
|
9f0c0208dd | ||
|
|
8072e97579 | ||
|
|
977916cb11 | ||
|
|
f4edfcefa2 | ||
|
|
b078d3e0cc | ||
|
|
611475c48a | ||
|
|
21ecec894f | ||
|
|
0fc8c719fe | ||
|
|
4c3e20d25a | ||
|
|
13d95ecf1d | ||
|
|
7803e5d4ff | ||
|
|
2e2ff25ef7 | ||
|
|
3a61cf05ad | ||
|
|
ef80c3358d | ||
|
|
57a70455a8 | ||
|
|
885e67a39b | ||
|
|
25ae10dbe8 | ||
|
|
7b592fd80b | ||
|
|
4b6aced962 | ||
|
|
e32ad0b436 | ||
|
|
930721bea6 | ||
|
|
8e6f828f66 | ||
|
|
fa05327342 | ||
|
|
cafa17ec13 | ||
|
|
b3449137e0 | ||
|
|
da6af22d03 | ||
|
|
0468d46241 | ||
|
|
0c64720a9e | ||
|
|
4b279d28dd | ||
|
|
acd4706890 | ||
|
|
f7d21406a1 | ||
|
|
f9e29f3a78 | ||
|
|
def87485c0 | ||
|
|
6542b47e72 | ||
|
|
2827e07da6 | ||
|
|
23f6901fb4 | ||
|
|
db92e9d91c | ||
|
|
5207dbf8c6 | ||
|
|
7e40ad39cb | ||
|
|
a53a3259a8 | ||
|
|
8c483f2eab | ||
|
|
65ee9e1486 | ||
|
|
a73b608f8a | ||
|
|
4b0b4ad991 | ||
|
|
32d16eacd2 | ||
|
|
8e47949260 | ||
|
|
512394862b | ||
|
|
195f1e1237 | ||
|
|
26d5ea6cdc | ||
|
|
3518d1ba92 | ||
|
|
c5bb2f52e1 | ||
|
|
758030e81a | ||
|
|
da2ef3fae2 | ||
|
|
87431c188e | ||
|
|
0673f9a5ae | ||
|
|
8cb2767f9a | ||
|
|
1a70cc0c4c | ||
|
|
464a9b95a4 | ||
|
|
8b59b7a796 | ||
|
|
ad51b41bb3 | ||
|
|
472bd150bb | ||
|
|
af87943fd0 | ||
|
|
efb1a326b4 | ||
|
|
94b96e18ed | ||
|
|
80b7a5d39a | ||
|
|
61bbf0714e | ||
|
|
da3eea6005 | ||
|
|
6453bbcc1c | ||
|
|
541a340dcf | ||
|
|
593da4996f | ||
|
|
a3a52a07b7 | ||
|
|
ed13ee6cbc | ||
|
|
564e4d802c | ||
|
|
747c88fb35 | ||
|
|
f4a4f7c9ff | ||
|
|
81730f725d | ||
|
|
7bd56007bd | ||
|
|
d9de35799d | ||
|
|
67d4c38550 | ||
|
|
cc5daf51b1 | ||
|
|
f25de984d2 | ||
|
|
9a511e9e94 | ||
|
|
0671e52a29 | ||
|
|
9296686384 | ||
|
|
f6c754839b | ||
|
|
fc4f951a1a | ||
|
|
4e0bf75ecf | ||
|
|
a46b77d10c | ||
|
|
5a4bc79c74 | ||
|
|
bff7650b35 | ||
|
|
855ec1a708 | ||
|
|
1e817af5aa | ||
|
|
48c2e48b24 | ||
|
|
ca97a7f52d | ||
|
|
9a6e8a1113 | ||
|
|
94d71b8dce | ||
|
|
a5daee39e3 | ||
|
|
37617f63ea | ||
|
|
9b5f743fa5 | ||
|
|
e85dd99e04 | ||
|
|
ebe4a3d6ab | ||
|
|
382f8c38f6 | ||
|
|
a024d0e5ac | ||
|
|
f8f778eaa1 | ||
|
|
8011d85968 | ||
|
|
a7de56460d | ||
|
|
1f19642dad | ||
|
|
33d6454dd3 | ||
|
|
a0260c4ff7 | ||
|
|
cec81a3ae6 | ||
|
|
37eac5ed49 | ||
|
|
b232fa3d0c | ||
|
|
f6ac02dce5 | ||
|
|
9dbba35019 | ||
|
|
cf634d8d9b | ||
|
|
5fefd3b14b | ||
|
|
93da64f466 | ||
|
|
0d1f48ac0d | ||
|
|
ccbf20a73b | ||
|
|
5dc4a859f7 | ||
|
|
9323931a21 | ||
|
|
d81037d658 | ||
|
|
12d7db3dd6 | ||
|
|
cdf71b419f | ||
|
|
6f6b1ce9e6 | ||
|
|
2c2d244c56 | ||
|
|
c8cfbbb0b2 | ||
|
|
c000c0dd5d | ||
|
|
958c6fe8f3 | ||
|
|
9cc2d30920 | ||
|
|
e00a59212c | ||
|
|
e783594385 | ||
|
|
edee5c693b | ||
|
|
fea78884e7 | ||
|
|
4f290b5bc5 | ||
|
|
52c38428e8 | ||
|
|
538844a1fb | ||
|
|
4690cb102b | ||
|
|
4e33bd2713 | ||
|
|
286dade66f | ||
|
|
591f901935 | ||
|
|
aec28e0807 | ||
|
|
be31b9a897 | ||
|
|
6783e7f74c | ||
|
|
19c9eccffe | ||
|
|
561aa0e291 | ||
|
|
e45decf14e | ||
|
|
b851aba81a | ||
|
|
45040ca702 | ||
|
|
126da75167 | ||
|
|
71b24ef8b9 | ||
|
|
4ae93113f0 | ||
|
|
8ce82a9ad6 | ||
|
|
bd6bf9315a | ||
|
|
7b33405530 | ||
|
|
6e3c0858c1 | ||
|
|
fb8d2827d2 | ||
|
|
ae8d505367 | ||
|
|
cba9779168 | ||
|
|
17e9dbc0f7 | ||
|
|
e798277cbf | ||
|
|
3e97433920 | ||
|
|
038b93fdf6 | ||
|
|
e98d4af630 | ||
|
|
79374ce5d7 | ||
|
|
e0aa94e6af | ||
|
|
a4de128a76 | ||
|
|
96d1616b70 | ||
|
|
086cde83db | ||
|
|
4abe677cc6 | ||
|
|
fe2e510fdc | ||
|
|
ae152fd94f | ||
|
|
5173ddb7a0 | ||
|
|
bd698f5d81 | ||
|
|
136a4df4d9 | ||
|
|
7e168fad02 | ||
|
|
c574b2d8ba | ||
|
|
502abfdfce | ||
|
|
c714204877 | ||
|
|
cb84f6671a | ||
|
|
20c393e4e9 | ||
|
|
8e3cd4653d | ||
|
|
b4deb19d8e | ||
|
|
e30ebd3671 | ||
|
|
b7f8422f30 | ||
|
|
b3d628551e | ||
|
|
70e39174d2 | ||
|
|
b03cfa163a | ||
|
|
4c32548e83 | ||
|
|
7186526dc6 | ||
|
|
8c8b262ea1 | ||
|
|
6ae741936f | ||
|
|
cf8bab97e8 | ||
|
|
ba2ad4a0c4 | ||
|
|
4a8dc37b40 | ||
|
|
3942c4d808 | ||
|
|
ba8162c1d0 | ||
|
|
bf1fc736b9 | ||
|
|
bc1ae01eb6 | ||
|
|
e4cceffd5c | ||
|
|
887f886110 | ||
|
|
78fa44739f | ||
|
|
1f00ddeb3b | ||
|
|
46c19580bc | ||
|
|
e54acf3ca0 | ||
|
|
498d003684 | ||
|
|
90f4b1328b | ||
|
|
0c81ec0202 | ||
|
|
584430d64b | ||
|
|
8334923a5c | ||
|
|
61784ed174 | ||
|
|
906bfc5ae8 | ||
|
|
5a4b38ec55 | ||
|
|
6917125173 | ||
|
|
65506769ab | ||
|
|
9909e84cb9 | ||
|
|
e00ee364ea | ||
|
|
479c895a59 | ||
|
|
86cb86e8b5 | ||
|
|
9dd3a8bc5a | ||
|
|
68256346e7 | ||
|
|
44bf63137a | ||
|
|
e9ad573bcd | ||
|
|
215f3e97ad | ||
|
|
49f78f3706 | ||
|
|
9563dd6c51 | ||
|
|
aa36986d66 | ||
|
|
9843e0e450 | ||
|
|
53978de632 | ||
|
|
d9f5f7995d | ||
|
|
f201b9fd11 | ||
|
|
d53b2b94b9 | ||
|
|
4452ad2c51 | ||
|
|
6594419b22 | ||
|
|
4ba008f31b | ||
|
|
dd2e77a244 | ||
|
|
be561d1032 | ||
|
|
24fc941b4c | ||
|
|
21054c1a8a | ||
|
|
0778c5f550 | ||
|
|
1d04510365 | ||
|
|
6c7a089527 | ||
|
|
abbb61b943 | ||
|
|
36b5cb3b49 | ||
|
|
0cfe842bd6 | ||
|
|
eaca953106 | ||
|
|
cc5125f49e | ||
|
|
3f2b3b88eb | ||
|
|
7101bacc8c | ||
|
|
d76b274d25 | ||
|
|
8d7f39941a | ||
|
|
95839f88f2 | ||
|
|
728eee6d3f | ||
|
|
7089bd597e | ||
|
|
2aade10aaf | ||
|
|
4057df5b93 | ||
|
|
8270a3f386 | ||
|
|
a2aa5f2607 | ||
|
|
30a9e80024 | ||
|
|
612001fc3f | ||
|
|
2a93968370 | ||
|
|
b0a4fcdc26 | ||
|
|
326b0af35f | ||
|
|
91eaa522cf | ||
|
|
2a57dc9766 | ||
|
|
f37b681fac | ||
|
|
f4466b1aad | ||
|
|
33feb7f63f | ||
|
|
02e3184945 | ||
|
|
04778c6fa8 | ||
|
|
8861b6d077 | ||
|
|
52b1f40acb | ||
|
|
8ace56956b | ||
|
|
7718f7c0fc | ||
|
|
b74c368de2 | ||
|
|
e0a20bf8af | ||
|
|
17afdb5912 | ||
|
|
d55a43d4b1 | ||
|
|
bf3da0531e | ||
|
|
3a365b6dc6 | ||
|
|
ee7dc821ca | ||
|
|
07018370e0 | ||
|
|
bba665e2e1 | ||
|
|
5e69320ff5 | ||
|
|
d0242d28d2 | ||
|
|
9dbdcc9181 | ||
|
|
7819495d57 | ||
|
|
8723520848 | ||
|
|
b76d9045ce | ||
|
|
b42d6cf2ac | ||
|
|
f78e72af0d | ||
|
|
5e021b76b5 | ||
|
|
d03a5458ff | ||
|
|
3aef0b4029 | ||
|
|
cd5a83e814 | ||
|
|
a943d2fee6 | ||
|
|
b016ebd5b4 | ||
|
|
314459df92 | ||
|
|
eb0051c033 | ||
|
|
ca9a7d255e | ||
|
|
8f42c6fbed | ||
|
|
bb233c5656 | ||
|
|
be021f4697 | ||
|
|
f47d86c15b | ||
|
|
ae391f8af4 | ||
|
|
f28c52342c | ||
|
|
d3f1d4a5f9 | ||
|
|
cedfa35a98 | ||
|
|
c11b7ed268 | ||
|
|
b992daa1d8 | ||
|
|
10aa534f52 | ||
|
|
de990b906d | ||
|
|
41ef2a4ea5 | ||
|
|
077479346e | ||
|
|
19c33e4050 | ||
|
|
1ff3d4a534 | ||
|
|
8ae6a36b33 | ||
|
|
d8687f30cd | ||
|
|
bff2ddb8db | ||
|
|
2a9db0eea4 | ||
|
|
5c41022f76 | ||
|
|
a9dec41cc1 | ||
|
|
918cbb8d92 | ||
|
|
7cc7de7a5f | ||
|
|
56d8d1eaf7 | ||
|
|
b57685e9d5 | ||
|
|
a3fa4a0d3e | ||
|
|
d86aeaa22a | ||
|
|
97f18d7b86 | ||
|
|
bded15a869 | ||
|
|
fff5927cdf | ||
|
|
f9881b9af5 | ||
|
|
79182a2d32 | ||
|
|
77eec6e6f3 | ||
|
|
a6e3f43344 | ||
|
|
f525a9f5da | ||
|
|
2427bfa6ea | ||
|
|
7eea4fdd1c | ||
|
|
dde4bd39b2 | ||
|
|
091c271237 | ||
|
|
141a2a507d | ||
|
|
232088f3a2 | ||
|
|
66b9679a7c | ||
|
|
42753d85c7 | ||
|
|
3eca13e2bc | ||
|
|
1fd09617cb | ||
|
|
e5eb74f077 | ||
|
|
f474947d2d | ||
|
|
d1b90193a4 | ||
|
|
53ee5c32eb | ||
|
|
79ba223e12 | ||
|
|
27552c99b8 | ||
|
|
6b56a8df0a | ||
|
|
e18a242b90 | ||
|
|
60a5bf682b | ||
|
|
47c07831c1 | ||
|
|
bf53a02270 | ||
|
|
6291e3c587 | ||
|
|
3143cc9d92 | ||
|
|
84b711e130 | ||
|
|
4007b17b1e |
@@ -1,7 +1,11 @@
|
||||
# ENV vars for the development environment
|
||||
# Override locally with `.env.development.local`
|
||||
#
|
||||
# You may also want to use this when testing other environments locally:
|
||||
#
|
||||
# cp .env.development .env.local
|
||||
|
||||
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
|
||||
OFN_REDIS_URL="redis://localhost:6379/1"
|
||||
OFN_REDIS_JOBS_URL="redis://localhost:6379/2"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# ENV vars for the test environment
|
||||
# Override locally with `.env.test.local`
|
||||
|
||||
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
STRIPE_SECRET_TEST_API_KEY="bogus_key"
|
||||
STRIPE_CUSTOMER="bogus_customer"
|
||||
|
||||
SITE_URL="test.host"
|
||||
|
||||
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@@ -9,7 +9,6 @@ env:
|
||||
DISABLE_KNAPSACK: true
|
||||
TIMEZONE: UTC
|
||||
COVERAGE: true
|
||||
RSPEC_RETRY_RETRY_COUNT: 3
|
||||
RAILS_ENV: test
|
||||
|
||||
permissions:
|
||||
@@ -17,7 +16,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
rspec:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
@@ -36,13 +35,13 @@ jobs:
|
||||
specs:
|
||||
- "spec/controllers"
|
||||
- "spec/models"
|
||||
- "spec/features/admin/[a-o0-9]*_spec.rb"
|
||||
- "spec/lib"
|
||||
- "spec/migrations"
|
||||
- "spec/serializers"
|
||||
- "spec/system/admin/[a-o0-9]*_spec.rb"
|
||||
- "spec/system/admin/[p-z]*_spec.rb"
|
||||
- "spec/system/consumer"
|
||||
- "spec/system/admin/[a-o0-9]*"
|
||||
- "spec/system/admin/[p-z]*"
|
||||
- "spec/system/consumer/[a-o0-9]*"
|
||||
- "spec/system/consumer/[p-z]*"
|
||||
- "engines/*/spec"
|
||||
fail-fast: false
|
||||
steps:
|
||||
@@ -78,7 +77,7 @@ jobs:
|
||||
if-no-files-found: ignore
|
||||
|
||||
test-the-rest:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
|
||||
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
@@ -1,5 +1,7 @@
|
||||
name: Linters
|
||||
on: [push, pull_request]
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
jobs:
|
||||
rubocop:
|
||||
name: runner / rubocop
|
||||
|
||||
5
.github/workflows/mapi.yml
vendored
5
.github/workflows/mapi.yml
vendored
@@ -1,7 +1,12 @@
|
||||
name: 'Mayhem for API'
|
||||
on: workflow_dispatch
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
jobs:
|
||||
test:
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
security-events: write # to upload SARIF results (github/codeql-action/upload-sarif)
|
||||
if: ${{ github.repository_owner == 'openfoodfoundation' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -57,3 +57,6 @@ coverage
|
||||
/yarn-error.log
|
||||
yarn-debug.log*
|
||||
.yarn-integrity
|
||||
|
||||
/config/credentials.yml.enc
|
||||
/config/master.key
|
||||
|
||||
@@ -23,7 +23,7 @@ Metrics:
|
||||
Enabled: true
|
||||
|
||||
Metrics/BlockLength:
|
||||
IgnoredMethods: [
|
||||
AllowedMethods: [
|
||||
"class_eval",
|
||||
"collection",
|
||||
"context",
|
||||
@@ -41,8 +41,14 @@ Metrics/BlockLength:
|
||||
"resources",
|
||||
"scenario",
|
||||
"shared_examples",
|
||||
"xdescribe",
|
||||
]
|
||||
|
||||
Rails/ApplicationRecord:
|
||||
Exclude:
|
||||
# Migrations should not contain application code:
|
||||
- "db/migrate/*.rb"
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
AllowedMethods:
|
||||
- "touch"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400`
|
||||
# on 2022-03-29 16:07:39 UTC using RuboCop version 1.22.2.
|
||||
# on 2022-08-29 05:26:26 UTC using RuboCop version 1.35.1.
|
||||
# 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.
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
||||
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
||||
Bundler/OrderedGems:
|
||||
@@ -25,20 +25,13 @@ Gemspec/RequiredRubyVersion:
|
||||
- 'engines/web/web.gemspec'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/ClosingParenthesisIndentation:
|
||||
Exclude:
|
||||
- 'lib/reporting/queries/joins.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
||||
Layout/EmptyLineBetweenDefs:
|
||||
Exclude:
|
||||
- 'spec/lib/reports/report_loader_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, no_empty_lines
|
||||
Layout/EmptyLinesAroundBlockBody:
|
||||
@@ -47,15 +40,15 @@ Layout/EmptyLinesAroundBlockBody:
|
||||
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
||||
Layout/LeadingCommentSpace:
|
||||
Exclude:
|
||||
- 'spec/system/admin/enterprises_spec.rb'
|
||||
|
||||
# Offense count: 856
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# Offense count: 862
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
@@ -68,7 +61,6 @@ Layout/LineLength:
|
||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||
- 'app/controllers/api/v0/order_cycles_controller.rb'
|
||||
- 'app/controllers/payment_gateways/paypal_controller.rb'
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'app/controllers/user_confirmations_controller.rb'
|
||||
- 'app/helpers/angular_form_builder.rb'
|
||||
@@ -85,7 +77,6 @@ Layout/LineLength:
|
||||
- 'app/models/concerns/variant_stock.rb'
|
||||
- 'app/models/customer.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/product_import/entry_processor.rb'
|
||||
- 'app/models/product_import/spreadsheet_entry.rb'
|
||||
- 'app/models/product_import/unit_converter.rb'
|
||||
@@ -111,23 +102,15 @@ Layout/LineLength:
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/validator.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'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_applicator.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/open_food_network/scope_variants_for_search.rb'
|
||||
- 'lib/reporting/line_items.rb'
|
||||
- 'lib/reporting/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total.rb'
|
||||
- 'lib/reporting/reports/order_cycle_management/order_cycle_management_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/reporting/reports/orders_and_fulfillment/customer_totals_report.rb'
|
||||
- 'lib/reporting/reports/orders_and_fulfillment/distributor_totals_by_supplier_report.rb'
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
- 'lib/reporting/reports/products_and_inventory/lettuce_share_report.rb'
|
||||
- 'lib/reporting/reports/sales_tax/sales_tax_report.rb'
|
||||
- 'lib/reporting/reports/xero_invoices/base.rb'
|
||||
- 'lib/spree/localized_number.rb'
|
||||
- 'lib/tasks/data.rake'
|
||||
@@ -145,12 +128,10 @@ Layout/LineLength:
|
||||
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/base_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/exchange_products_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/logos_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/product_images_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/products_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/promo_images_controller_spec.rb'
|
||||
- 'spec/controllers/api/v0/terms_and_conditions_controller_spec.rb'
|
||||
@@ -164,7 +145,6 @@ Layout/LineLength:
|
||||
- 'spec/controllers/spree/admin/orders/invoices_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/payment_methods_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/reports_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
|
||||
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||
- 'spec/controllers/spree/orders_controller_spec.rb'
|
||||
@@ -187,13 +167,9 @@ Layout/LineLength:
|
||||
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
|
||||
- 'spec/lib/reports/customers_report_spec.rb'
|
||||
- 'spec/lib/reports/order_cycle_management_report_spec.rb'
|
||||
- 'spec/lib/reports/order_grouper_spec.rb'
|
||||
- 'spec/lib/reports/orders_and_fulfillment/orders_and_fulfillment_report_spec.rb'
|
||||
- 'spec/lib/reports/packing/packing_report_spec.rb'
|
||||
- 'spec/lib/reports/products_and_inventory_report_spec.rb'
|
||||
- 'spec/lib/reports/users_and_enterprises_report_spec.rb'
|
||||
- 'spec/lib/reports/xero_invoices_report_spec.rb'
|
||||
- 'spec/lib/stripe/authorize_response_patcher_spec.rb'
|
||||
- 'spec/mailers/order_mailer_spec.rb'
|
||||
- 'spec/mailers/producer_mailer_spec.rb'
|
||||
- 'spec/mailers/subscription_mailer_spec.rb'
|
||||
@@ -201,7 +177,6 @@ Layout/LineLength:
|
||||
- 'spec/models/concerns/calculated_adjustments_spec.rb'
|
||||
- 'spec/models/concerns/order_shipment_spec.rb'
|
||||
- 'spec/models/concerns/product_stock_spec.rb'
|
||||
- 'spec/models/enterprise_group_spec.rb'
|
||||
- 'spec/models/enterprise_relationship_spec.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
@@ -227,7 +202,6 @@ Layout/LineLength:
|
||||
- 'spec/models/tag_rule/filter_payment_methods_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_products_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_shipping_methods_spec.rb'
|
||||
- 'spec/models/terms_of_service_file_spec.rb'
|
||||
- 'spec/models/variant_override_spec.rb'
|
||||
- 'spec/requests/api/orders_spec.rb'
|
||||
- 'spec/requests/checkout/failed_checkout_spec.rb'
|
||||
@@ -287,6 +261,7 @@ Layout/LineLength:
|
||||
- 'spec/system/admin/variant_overrides_spec.rb'
|
||||
- 'spec/system/consumer/authentication_spec.rb'
|
||||
- 'spec/system/consumer/caching/shops_caching_spec.rb'
|
||||
- 'spec/system/consumer/cookies_spec.rb'
|
||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||
- 'spec/system/consumer/shopping/checkout_auth_spec.rb'
|
||||
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||
@@ -300,35 +275,20 @@ Layout/LineLength:
|
||||
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Layout/MultilineBlockLayout:
|
||||
Exclude:
|
||||
- 'spec/lib/reports/report_renderer_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: symmetrical, new_line, same_line
|
||||
Layout/MultilineMethodCallBraceLayout:
|
||||
Exclude:
|
||||
- 'lib/reporting/queries/joins.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
Exclude:
|
||||
- 'lib/reporting/reports/customers/customers_report.rb'
|
||||
|
||||
# Offense count: 20
|
||||
# Cop supports --auto-correct.
|
||||
# Offense count: 22
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||
- 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb'
|
||||
- 'spec/system/admin/enterprises_spec.rb'
|
||||
- 'spec/system/admin/order_spec.rb'
|
||||
- 'spec/system/admin/shipping_methods_spec.rb'
|
||||
- 'spec/system/flatpickr_spec.rb'
|
||||
@@ -357,6 +317,7 @@ Lint/DuplicateMethods:
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Lint/DuplicateRequire:
|
||||
Exclude:
|
||||
- 'spec/lib/open_food_network/scope_variants_to_search_spec.rb'
|
||||
@@ -378,9 +339,8 @@ Lint/IneffectiveAccessModifier:
|
||||
Exclude:
|
||||
- 'app/models/spree/user.rb'
|
||||
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
|
||||
Lint/RedundantSafeNavigation:
|
||||
@@ -388,6 +348,7 @@ Lint/RedundantSafeNavigation:
|
||||
- 'app/models/spree/payment.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: present?, blank?, presence, try, try!, in?
|
||||
Lint/SafeNavigationChain:
|
||||
@@ -396,22 +357,21 @@ Lint/SafeNavigationChain:
|
||||
- 'app/models/spree/stock/availability_validator.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
||||
Lint/UnusedMethodArgument:
|
||||
Exclude:
|
||||
- 'lib/reporting/queries/query_interface.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowComments.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Lint/UselessMethodDefinition:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/user_registrations_controller.rb'
|
||||
- 'app/models/spree/gateway.rb'
|
||||
|
||||
# Offense count: 38
|
||||
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
|
||||
# Offense count: 28
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes, Max.
|
||||
Metrics/AbcSize:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
@@ -433,20 +393,14 @@ Metrics/AbcSize:
|
||||
- 'app/models/spree/return_authorization.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/reporting/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/reporting/reports/customers/customers_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/reporting/reports/orders_and_distributors/orders_and_distributors_report.rb'
|
||||
- 'lib/reporting/reports/packing/customer.rb'
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
- 'lib/reporting/reports/sales_tax/sales_tax_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/tasks/enterprises.rake'
|
||||
- 'spec/services/order_checkout_restart_spec.rb'
|
||||
|
||||
# Offense count: 43
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
||||
# IgnoredMethods: refine
|
||||
# Offense count: 42
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
# AllowedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
Exclude:
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
@@ -474,7 +428,6 @@ Metrics/BlockLength:
|
||||
- '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'
|
||||
|
||||
# Offense count: 1
|
||||
@@ -483,7 +436,7 @@ Metrics/BlockNesting:
|
||||
Exclude:
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
|
||||
# Offense count: 50
|
||||
# Offense count: 45
|
||||
# Configuration parameters: CountComments, Max, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Exclude:
|
||||
@@ -502,7 +455,6 @@ Metrics/ClassLength:
|
||||
- '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/users_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
@@ -529,16 +481,13 @@ Metrics/ClassLength:
|
||||
- 'engines/order_management/app/services/order_management/order/updater.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'lib/reporting/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/scope.rb'
|
||||
- 'lib/reporting/reports/order_cycle_management/order_cycle_management_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/scope.rb'
|
||||
- 'lib/reporting/reports/xero_invoices/base.rb'
|
||||
|
||||
# Offense count: 39
|
||||
# Configuration parameters: IgnoredMethods, Max.
|
||||
# Offense count: 35
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
@@ -565,18 +514,14 @@ Metrics/CyclomaticComplexity:
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/reporting/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/reporting/reports/customers/customers_report.rb'
|
||||
- 'lib/reporting/reports/orders_and_fulfillment/customer_totals_report.rb'
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
- 'lib/reporting/reports/xero_invoices/base.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: 32
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
||||
# Offense count: 26
|
||||
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
Metrics/MethodLength:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
@@ -593,15 +538,12 @@ Metrics/MethodLength:
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/reporting/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/scope.rb'
|
||||
- 'lib/reporting/reports/order_cycle_management/order_cycle_management_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/scope.rb'
|
||||
- 'lib/reporting/reports/xero_invoices/base.rb'
|
||||
- 'lib/tasks/sample_data/product_factory.rb'
|
||||
|
||||
# Offense count: 54
|
||||
# Offense count: 51
|
||||
# Configuration parameters: CountComments, Max, CountAsOne.
|
||||
Metrics/ModuleLength:
|
||||
Exclude:
|
||||
@@ -641,9 +583,6 @@ Metrics/ModuleLength:
|
||||
- 'spec/lib/reports/customers_report_spec.rb'
|
||||
- 'spec/lib/reports/enterprise_fee_summary/authorizer_spec.rb'
|
||||
- 'spec/lib/reports/order_cycle_management_report_spec.rb'
|
||||
- 'spec/lib/reports/order_grouper_spec.rb'
|
||||
- 'spec/lib/reports/orders_and_fulfillment/customer_totals_report_spec.rb'
|
||||
- 'spec/lib/reports/orders_and_fulfillment/orders_and_fulfillment_report_spec.rb'
|
||||
- 'spec/lib/reports/products_and_inventory_report_spec.rb'
|
||||
- 'spec/lib/reports/users_and_enterprises_report_spec.rb'
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
@@ -670,8 +609,8 @@ Metrics/ParameterLists:
|
||||
- 'spec/support/controller_requests_helper.rb'
|
||||
- 'spec/system/admin/reports_spec.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Configuration parameters: IgnoredMethods, Max.
|
||||
# Offense count: 5
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
|
||||
Metrics/PerceivedComplexity:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||
@@ -679,10 +618,8 @@ Metrics/PerceivedComplexity:
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
- 'lib/reporting/reports/bulk_coop/bulk_coop_report.rb'
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 8
|
||||
Naming/AccessorMethodName:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/taxonomies_controller.rb'
|
||||
@@ -716,8 +653,8 @@ Naming/MethodParameterName:
|
||||
Exclude:
|
||||
- 'app/services/process_payment_intent.rb'
|
||||
|
||||
# Offense count: 30
|
||||
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
|
||||
# Offense count: 28
|
||||
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
||||
# SupportedStyles: snake_case, normalcase, non_integer
|
||||
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
||||
Naming/VariableNumber:
|
||||
@@ -725,7 +662,6 @@ Naming/VariableNumber:
|
||||
- 'app/controllers/spree/orders_controller.rb'
|
||||
- 'app/models/content_configuration.rb'
|
||||
- 'app/models/preference_sections/main_links_section.rb'
|
||||
- 'lib/reporting/reports/orders_and_fulfillment/customer_totals_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
- 'spec/controllers/spree/admin/search_controller_spec.rb'
|
||||
- 'spec/factories/stock_location_factory.rb'
|
||||
@@ -741,13 +677,13 @@ Rails/ActiveRecordOverride:
|
||||
- 'app/models/spree/product.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ApplicationController:
|
||||
Exclude:
|
||||
- 'engines/dfc_provider/app/controllers/dfc_provider/api/base_controller.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ApplicationJob:
|
||||
Exclude:
|
||||
- 'app/jobs/bulk_invoice_job.rb'
|
||||
@@ -758,19 +694,13 @@ Rails/ApplicationJob:
|
||||
- 'app/jobs/subscription_placement_job.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ApplicationMailer:
|
||||
Exclude:
|
||||
- 'app/mailers/spree/base_mailer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Rails/ApplicationRecord:
|
||||
Exclude:
|
||||
- 'lib/tasks/data/remove_transient_data.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
|
||||
Rails/Blank:
|
||||
Exclude:
|
||||
@@ -796,7 +726,7 @@ Rails/FilePath:
|
||||
- 'spec/models/content_configuration_spec.rb'
|
||||
- 'spec/support/downloads_helper.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Offense count: 12
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasAndBelongsToMany:
|
||||
@@ -804,6 +734,7 @@ Rails/HasAndBelongsToMany:
|
||||
- 'app/models/concerns/payment_method_distributors.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/option_value.rb'
|
||||
- 'app/models/spree/role.rb'
|
||||
@@ -812,7 +743,7 @@ Rails/HasAndBelongsToMany:
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
|
||||
# Offense count: 47
|
||||
# Offense count: 45
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
@@ -838,9 +769,8 @@ Rails/HasManyOrHasOneDependent:
|
||||
- 'app/models/spree/taxonomy.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
|
||||
# Offense count: 59
|
||||
# Offense count: 62
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/helpers/**/*.rb
|
||||
Rails/HelperInstanceVariable:
|
||||
@@ -881,7 +811,7 @@ Rails/InverseOf:
|
||||
|
||||
# Offense count: 38
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/controllers/**/*.rb
|
||||
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb
|
||||
Rails/LexicallyScopedActionFilter:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprise_groups_controller.rb'
|
||||
@@ -904,10 +834,9 @@ Rails/LexicallyScopedActionFilter:
|
||||
- 'app/controllers/spree/admin/zones_controller.rb'
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
|
||||
# Offense count: 19
|
||||
# Offense count: 18
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
- 'app/helpers/angular_form_helper.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/helpers/reports_helper.rb'
|
||||
@@ -922,7 +851,7 @@ Rails/OutputSafety:
|
||||
- 'spec/system/admin/order_print_ticket_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/RelativeDateConstant:
|
||||
Exclude:
|
||||
- 'lib/tasks/data/remove_transient_data.rb'
|
||||
@@ -936,7 +865,7 @@ Rails/SkipsModelValidations:
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: strict, flexible
|
||||
Rails/TimeZone:
|
||||
@@ -971,20 +900,20 @@ Security/Open:
|
||||
- 'app/services/image_importer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/BlockComments:
|
||||
Exclude:
|
||||
- 'spec/system/admin/tag_rules_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowOnConstant.
|
||||
Style/CaseEquality:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/CaseLikeIf:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||
@@ -992,7 +921,7 @@ Style/CaseLikeIf:
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
|
||||
# Offense count: 25
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: nested, compact
|
||||
Style/ClassAndModuleChildren:
|
||||
@@ -1027,13 +956,14 @@ Style/ClassVars:
|
||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
# SupportedStyles: annotated, template, unannotated
|
||||
Style/FormatStringToken:
|
||||
EnforcedStyle: unannotated
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
Style/FrozenStringLiteralComment:
|
||||
@@ -1041,7 +971,7 @@ Style/FrozenStringLiteralComment:
|
||||
- '.simplecov'
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/GlobalStdStream:
|
||||
Exclude:
|
||||
- 'lib/tasks/data.rake'
|
||||
@@ -1050,8 +980,8 @@ Style/GlobalStdStream:
|
||||
- 'lib/tasks/subscriptions/debug.rake'
|
||||
- 'lib/tasks/subscriptions/test.rake'
|
||||
|
||||
# Offense count: 39
|
||||
# Configuration parameters: MinBodyLength.
|
||||
# Offense count: 40
|
||||
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
@@ -1085,8 +1015,8 @@ Style/HashLikeCase:
|
||||
- 'app/models/enterprise.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IgnoredMethods.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
Style/MethodCallWithoutArgsParentheses:
|
||||
Exclude:
|
||||
- 'spec/system/flatpickr_spec.rb'
|
||||
@@ -1098,22 +1028,8 @@ Style/MissingRespondToMissing:
|
||||
- 'app/models/spree/gateway.rb'
|
||||
- 'app/models/spree/preferences/configuration.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Style/MixinUsage:
|
||||
Exclude:
|
||||
- 'lib/reporting/reports/orders_and_fulfillment/orders_and_fulfillment_report.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: literals, strict
|
||||
Style/MutableConstant:
|
||||
Exclude:
|
||||
- 'lib/reporting/report_template.rb'
|
||||
- 'lib/reporting/reports/packing/base.rb'
|
||||
|
||||
# Offense count: 22
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/NestedModifier:
|
||||
Exclude:
|
||||
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||
@@ -1127,7 +1043,7 @@ Style/NestedModifier:
|
||||
- 'spec/system/admin/payments_stripe_spec.rb'
|
||||
- 'spec/system/admin/reports_spec.rb'
|
||||
|
||||
# Offense count: 26
|
||||
# Offense count: 17
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: respond_to_missing?
|
||||
Style/OptionalBooleanParameter:
|
||||
@@ -1139,7 +1055,6 @@ Style/OptionalBooleanParameter:
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/product_import/entry_processor.rb'
|
||||
- 'app/models/spree/order_contents.rb'
|
||||
- 'app/models/spree/preferences/file_configuration.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
@@ -1147,7 +1062,7 @@ Style/OptionalBooleanParameter:
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: short, verbose
|
||||
Style/PreferredHashMethods:
|
||||
@@ -1155,13 +1070,13 @@ Style/PreferredHashMethods:
|
||||
- 'app/controllers/api/v0/shipments_controller.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowMultipleReturnValues.
|
||||
Style/RedundantReturn:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller.rb'
|
||||
|
||||
# Offense count: 205
|
||||
# Offense count: 209
|
||||
Style/Send:
|
||||
Exclude:
|
||||
- 'app/controllers/split_checkout_controller.rb'
|
||||
@@ -1195,17 +1110,16 @@ Style/Send:
|
||||
- 'spec/services/cart_service_spec.rb'
|
||||
- 'spec/services/products_renderer_spec.rb'
|
||||
- 'spec/services/variant_units/option_value_namer_spec.rb'
|
||||
- 'spec/spec_helper.rb'
|
||||
- 'spec/support/localized_number_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/SingleArgumentDig:
|
||||
Exclude:
|
||||
- 'app/services/checkout/form_data_adapter.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/SlicingWithRange:
|
||||
Exclude:
|
||||
- 'app/helpers/spree/admin/navigation_helper.rb'
|
||||
@@ -1213,8 +1127,8 @@ Style/SlicingWithRange:
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/validator.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
|
||||
# Offense count: 28
|
||||
# Cop supports --auto-correct.
|
||||
# Offense count: 29
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Mode.
|
||||
Style/StringConcatenation:
|
||||
Exclude:
|
||||
|
||||
14
Gemfile
14
Gemfile
@@ -97,7 +97,8 @@ gem 'redis', '>= 4.0', require: ['redis', 'redis/connection/hiredis']
|
||||
gem 'sidekiq'
|
||||
gem 'sidekiq-scheduler'
|
||||
|
||||
gem "cable_ready", "5.0.0.pre3"
|
||||
gem "cable_ready", "5.0.0.pre9"
|
||||
gem "stimulus_reflex", "3.5.0.pre9"
|
||||
|
||||
gem 'combine_pdf'
|
||||
gem 'wicked_pdf'
|
||||
@@ -115,8 +116,6 @@ gem 'coffee-rails', '~> 5.0.0'
|
||||
|
||||
gem 'mini_racer', '0.4.0'
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
|
||||
gem 'angular_rails_csrf'
|
||||
|
||||
gem 'jquery-rails', '4.4.0'
|
||||
@@ -131,7 +130,7 @@ gem 'flipper'
|
||||
gem 'flipper-active_record'
|
||||
gem 'flipper-ui'
|
||||
|
||||
gem "view_component", require: "view_component/engine"
|
||||
gem "view_component"
|
||||
|
||||
group :production, :staging do
|
||||
gem 'ddtrace'
|
||||
@@ -150,12 +149,9 @@ group :test, :development do
|
||||
gem 'knapsack'
|
||||
gem 'letter_opener', '>= 1.4.1'
|
||||
gem 'rspec-rails', ">= 3.5.2"
|
||||
gem 'rspec-retry'
|
||||
gem 'rswag-specs'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'shoulda-matchers'
|
||||
gem 'timecop'
|
||||
gem 'webdrivers'
|
||||
gem 'debug', '>= 1.0.0'
|
||||
end
|
||||
|
||||
@@ -164,6 +160,7 @@ group :test do
|
||||
gem 'rails-controller-testing'
|
||||
gem 'simplecov', require: false
|
||||
gem 'test-prof'
|
||||
gem 'vcr'
|
||||
gem 'webmock'
|
||||
# See spec/spec_helper.rb for instructions
|
||||
# gem 'perftools.rb'
|
||||
@@ -171,6 +168,7 @@ end
|
||||
|
||||
group :development do
|
||||
gem 'debugger-linecache'
|
||||
gem 'rails-erd'
|
||||
gem 'foreman'
|
||||
gem 'listen'
|
||||
gem 'pry', '~> 0.13.0'
|
||||
@@ -180,7 +178,7 @@ group :development do
|
||||
gem 'spring-commands-rspec'
|
||||
gem 'web-console'
|
||||
|
||||
gem "view_component_storybook", require: "view_component/storybook/engine"
|
||||
gem "view_component_storybook"
|
||||
|
||||
gem 'rack-mini-profiler', '< 3.0.0'
|
||||
end
|
||||
|
||||
236
Gemfile.lock
236
Gemfile.lock
@@ -51,66 +51,66 @@ GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
Ascii85 (1.1.0)
|
||||
actioncable (6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
actioncable (6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
activejob (= 6.1.6.1)
|
||||
activerecord (= 6.1.6.1)
|
||||
activestorage (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
actionmailbox (6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
activejob (= 6.1.7)
|
||||
activerecord (= 6.1.7)
|
||||
activestorage (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
actionview (= 6.1.6.1)
|
||||
activejob (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
actionmailer (6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
actionview (= 6.1.7)
|
||||
activejob (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.1.6.1)
|
||||
actionview (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
actionpack (6.1.7)
|
||||
actionview (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actionpack-action_caching (1.2.2)
|
||||
actionpack (>= 4.0.0)
|
||||
actiontext (6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
activerecord (= 6.1.6.1)
|
||||
activestorage (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
actiontext (6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
activerecord (= 6.1.7)
|
||||
activestorage (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
actionview (6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
active_model_serializers (0.8.4)
|
||||
activemodel (>= 3.0)
|
||||
active_storage_validations (0.9.8)
|
||||
active_storage_validations (1.0.0)
|
||||
activejob (>= 5.2.0)
|
||||
activemodel (>= 5.2.0)
|
||||
activestorage (>= 5.2.0)
|
||||
activesupport (>= 5.2.0)
|
||||
activejob (6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
activejob (6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
globalid (>= 0.3.6)
|
||||
activemerchant (1.123.0)
|
||||
activesupport (>= 4.2)
|
||||
builder (>= 2.1.2, < 4.0.0)
|
||||
i18n (>= 0.6.9)
|
||||
nokogiri (~> 1.4)
|
||||
activemodel (6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
activerecord (6.1.6.1)
|
||||
activemodel (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
activemodel (6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
activerecord (6.1.7)
|
||||
activemodel (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
activerecord-import (1.4.0)
|
||||
activerecord (>= 4.2)
|
||||
activerecord-postgresql-adapter (0.0.1)
|
||||
@@ -121,14 +121,14 @@ GEM
|
||||
multi_json (~> 1.11, >= 1.11.2)
|
||||
rack (>= 2.0.8, < 3)
|
||||
railties (>= 5.2.4.1)
|
||||
activestorage (6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
activejob (= 6.1.6.1)
|
||||
activerecord (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
activestorage (6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
activejob (= 6.1.7)
|
||||
activerecord (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
marcel (~> 1.0)
|
||||
mini_mime (>= 1.1.0)
|
||||
activesupport (6.1.6.1)
|
||||
activesupport (6.1.7)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
@@ -138,8 +138,8 @@ GEM
|
||||
activerecord (>= 5.0, < 6.2)
|
||||
acts_as_list (1.0.4)
|
||||
activerecord (>= 4.2)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
addressable (2.8.1)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
afm (0.2.2)
|
||||
angular-rails-templates (1.2.0)
|
||||
railties (>= 5.0, < 7.1)
|
||||
@@ -182,11 +182,16 @@ GEM
|
||||
bugsnag (6.24.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
builder (3.2.4)
|
||||
bullet (7.0.2)
|
||||
bullet (7.0.3)
|
||||
activesupport (>= 3.0.0)
|
||||
uniform_notifier (~> 1.11)
|
||||
cable_ready (5.0.0.pre3)
|
||||
rails (>= 5.2)
|
||||
cable_ready (5.0.0.pre9)
|
||||
actioncable (>= 5.2)
|
||||
actionpack (>= 5.2)
|
||||
actionview (>= 5.2)
|
||||
activerecord (>= 5.2)
|
||||
activesupport (>= 5.2)
|
||||
railties (>= 5.2)
|
||||
thread-local (>= 1.1.0)
|
||||
cancancan (1.15.0)
|
||||
capybara (3.37.1)
|
||||
@@ -203,7 +208,7 @@ GEM
|
||||
marcel (~> 1.0)
|
||||
nokogiri (~> 1.10, >= 1.10.4)
|
||||
rubyzip (>= 1.3.0, < 3)
|
||||
childprocess (4.1.0)
|
||||
choice (0.2.0)
|
||||
chronic (0.10.2)
|
||||
cliver (0.3.2)
|
||||
coderay (1.1.3)
|
||||
@@ -218,7 +223,7 @@ GEM
|
||||
matrix
|
||||
ruby-rc4 (>= 0.1.5)
|
||||
concurrent-ruby (1.1.10)
|
||||
connection_pool (2.2.5)
|
||||
connection_pool (2.3.0)
|
||||
crack (0.4.5)
|
||||
rexml
|
||||
crass (1.0.6)
|
||||
@@ -308,13 +313,13 @@ GEM
|
||||
nokogiri (>= 1.5.11, < 2.0.0)
|
||||
foreman (0.87.2)
|
||||
formatador (0.2.5)
|
||||
fugit (1.5.3)
|
||||
fugit (1.7.1)
|
||||
et-orbi (~> 1, >= 1.2.7)
|
||||
raabro (~> 1.4)
|
||||
fuubar (2.5.1)
|
||||
rspec-core (~> 3.0)
|
||||
ruby-progressbar (~> 1.4)
|
||||
geocoder (1.8.0)
|
||||
geocoder (1.8.1)
|
||||
globalid (1.0.0)
|
||||
activesupport (>= 5.0)
|
||||
gmaps4rails (2.1.2)
|
||||
@@ -357,7 +362,7 @@ GEM
|
||||
rspec (>= 2.0, < 4.0)
|
||||
jsonapi-serializer (2.2.0)
|
||||
activesupport (>= 4.2)
|
||||
jwt (2.4.1)
|
||||
jwt (2.5.0)
|
||||
knapsack (4.0.0)
|
||||
rake
|
||||
launchy (2.5.0)
|
||||
@@ -368,7 +373,7 @@ GEM
|
||||
listen (3.7.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
loofah (2.18.0)
|
||||
loofah (2.19.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
@@ -387,7 +392,7 @@ GEM
|
||||
mini_portile2 (2.8.0)
|
||||
mini_racer (0.4.0)
|
||||
libv8-node (~> 15.14.0.0)
|
||||
minitest (5.16.2)
|
||||
minitest (5.16.3)
|
||||
monetize (1.12.0)
|
||||
money (~> 6.12)
|
||||
money (6.16.0)
|
||||
@@ -414,7 +419,7 @@ GEM
|
||||
parallel (1.22.1)
|
||||
paranoia (2.6.0)
|
||||
activerecord (>= 5.1, < 7.1)
|
||||
parser (3.1.2.0)
|
||||
parser (3.1.2.1)
|
||||
ast (~> 2.4.1)
|
||||
paypal-sdk-core (0.3.4)
|
||||
multi_json (~> 1.0)
|
||||
@@ -432,8 +437,8 @@ GEM
|
||||
pry (0.13.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
public_suffix (4.0.7)
|
||||
puma (5.6.4)
|
||||
public_suffix (5.0.0)
|
||||
puma (5.6.5)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
racc (1.6.0)
|
||||
@@ -450,20 +455,20 @@ GEM
|
||||
rack-test (2.0.2)
|
||||
rack (>= 1.3)
|
||||
rack-timeout (0.6.3)
|
||||
rails (6.1.6.1)
|
||||
actioncable (= 6.1.6.1)
|
||||
actionmailbox (= 6.1.6.1)
|
||||
actionmailer (= 6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
actiontext (= 6.1.6.1)
|
||||
actionview (= 6.1.6.1)
|
||||
activejob (= 6.1.6.1)
|
||||
activemodel (= 6.1.6.1)
|
||||
activerecord (= 6.1.6.1)
|
||||
activestorage (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
rails (6.1.7)
|
||||
actioncable (= 6.1.7)
|
||||
actionmailbox (= 6.1.7)
|
||||
actionmailer (= 6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
actiontext (= 6.1.7)
|
||||
actionview (= 6.1.7)
|
||||
activejob (= 6.1.7)
|
||||
activemodel (= 6.1.7)
|
||||
activerecord (= 6.1.7)
|
||||
activestorage (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.6.1)
|
||||
railties (= 6.1.7)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
@@ -472,15 +477,20 @@ GEM
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-erd (1.7.2)
|
||||
activerecord (>= 4.2)
|
||||
activesupport (>= 4.2)
|
||||
choice (~> 0.2.0)
|
||||
ruby-graphviz (~> 1.2)
|
||||
rails-html-sanitizer (1.4.3)
|
||||
loofah (~> 2.3)
|
||||
rails-i18n (7.0.5)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 6.0.0, < 8)
|
||||
rails_safe_tasks (1.0.0)
|
||||
railties (6.1.6.1)
|
||||
actionpack (= 6.1.6.1)
|
||||
activesupport (= 6.1.6.1)
|
||||
railties (6.1.7)
|
||||
actionpack (= 6.1.7)
|
||||
activesupport (= 6.1.7)
|
||||
method_source
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0)
|
||||
@@ -494,7 +504,7 @@ GEM
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
redcarpet (3.5.1)
|
||||
redis (4.7.1)
|
||||
redis (4.8.0)
|
||||
regexp_parser (2.5.0)
|
||||
reline (0.3.1)
|
||||
io-console (~> 0.5)
|
||||
@@ -537,41 +547,41 @@ GEM
|
||||
rspec-expectations (~> 3.10)
|
||||
rspec-mocks (~> 3.10)
|
||||
rspec-support (~> 3.10)
|
||||
rspec-retry (0.6.2)
|
||||
rspec-core (> 3.3)
|
||||
rspec-support (3.10.3)
|
||||
rswag-api (2.5.1)
|
||||
rswag-api (2.6.0)
|
||||
railties (>= 3.1, < 7.1)
|
||||
rswag-specs (2.5.1)
|
||||
rswag-specs (2.6.0)
|
||||
activesupport (>= 3.1, < 7.1)
|
||||
json-schema (~> 2.2)
|
||||
railties (>= 3.1, < 7.1)
|
||||
rswag-ui (2.5.1)
|
||||
rswag-ui (2.6.0)
|
||||
actionpack (>= 3.1, < 7.1)
|
||||
railties (>= 3.1, < 7.1)
|
||||
rubocop (1.33.0)
|
||||
rubocop (1.36.0)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.0.0)
|
||||
parser (>= 3.1.2.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.19.1, < 2.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.19.1)
|
||||
rubocop-ast (1.21.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-rails (2.15.2)
|
||||
rubocop-rails (2.16.1)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
ruby-graphviz (1.2.5)
|
||||
rexml
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby-rc4 (0.1.5)
|
||||
ruby-vips (2.1.4)
|
||||
ffi (~> 1.12)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
rufus-scheduler (3.8.1)
|
||||
rufus-scheduler (3.8.2)
|
||||
fugit (~> 1.1, >= 1.1.6)
|
||||
sass (3.4.25)
|
||||
sass-rails (5.0.8)
|
||||
@@ -581,22 +591,17 @@ GEM
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sd_notify (0.1.1)
|
||||
selenium-webdriver (4.3.0)
|
||||
childprocess (>= 0.5, < 5.0)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
semantic_range (3.0.0)
|
||||
shoulda-matchers (5.1.0)
|
||||
shoulda-matchers (5.2.0)
|
||||
activesupport (>= 5.2.0)
|
||||
sidekiq (6.5.4)
|
||||
connection_pool (>= 2.2.2)
|
||||
sidekiq (6.5.7)
|
||||
connection_pool (>= 2.2.5)
|
||||
rack (~> 2.0)
|
||||
redis (>= 4.5.0)
|
||||
sidekiq-scheduler (4.0.2)
|
||||
redis (>= 4.5.0, < 5)
|
||||
sidekiq-scheduler (4.0.3)
|
||||
redis (>= 4.2.0)
|
||||
rufus-scheduler (~> 3.2)
|
||||
sidekiq (>= 4)
|
||||
sidekiq (>= 4, < 7)
|
||||
tilt (>= 1.4.0)
|
||||
simplecov (0.21.2)
|
||||
docile (~> 1.1)
|
||||
@@ -608,7 +613,7 @@ GEM
|
||||
axlsx_styler (>= 1.0.0, < 2)
|
||||
caxlsx (>= 2.0.2, < 4)
|
||||
rodf (>= 1.0.0, < 2)
|
||||
spring (4.0.0)
|
||||
spring (4.1.0)
|
||||
spring-commands-rspec (1.0.4)
|
||||
spring (>= 0.9.1)
|
||||
sprockets (3.7.2)
|
||||
@@ -625,11 +630,21 @@ GEM
|
||||
state_machines-activerecord (0.8.0)
|
||||
activerecord (>= 5.1)
|
||||
state_machines-activemodel (>= 0.8.0)
|
||||
stimulus_reflex (3.5.0.pre9)
|
||||
actioncable (>= 5.2)
|
||||
actionpack (>= 5.2)
|
||||
actionview (>= 5.2)
|
||||
activesupport (>= 5.2)
|
||||
cable_ready (>= 5.0.0.pre9)
|
||||
nokogiri
|
||||
rack
|
||||
railties (>= 5.2)
|
||||
redis
|
||||
stringex (2.8.5)
|
||||
stripe (7.0.0)
|
||||
stripe (7.1.0)
|
||||
temple (0.8.2)
|
||||
test-prof (1.0.9)
|
||||
test-unit (3.5.3)
|
||||
test-prof (1.0.10)
|
||||
test-unit (3.5.5)
|
||||
power_assert
|
||||
thor (1.2.1)
|
||||
thread-local (1.1.0)
|
||||
@@ -638,14 +653,13 @@ GEM
|
||||
ttfunk (1.7.0)
|
||||
tzinfo (2.0.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (2.2.0)
|
||||
unicode-display_width (2.3.0)
|
||||
uniform_notifier (1.16.0)
|
||||
valid_email2 (4.0.3)
|
||||
valid_email2 (4.0.4)
|
||||
activemodel (>= 3.2)
|
||||
mail (~> 2.5)
|
||||
view_component (2.64.0)
|
||||
vcr (6.1.0)
|
||||
view_component (2.74.1)
|
||||
activesupport (>= 5.0.0, < 8.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
method_source (~> 1.0)
|
||||
@@ -658,11 +672,7 @@ GEM
|
||||
activemodel (>= 6.0.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 6.0.0)
|
||||
webdrivers (5.0.0)
|
||||
nokogiri (~> 1.6)
|
||||
rubyzip (>= 1.3.0)
|
||||
selenium-webdriver (~> 4.0)
|
||||
webmock (3.17.1)
|
||||
webmock (3.18.1)
|
||||
addressable (>= 2.8.0)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
@@ -671,7 +681,6 @@ GEM
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 5.2)
|
||||
semantic_range (>= 2.3.0)
|
||||
websocket (1.2.9)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
@@ -683,7 +692,7 @@ GEM
|
||||
xml-simple (1.1.8)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.6.0)
|
||||
zeitwerk (2.6.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -709,7 +718,7 @@ DEPENDENCIES
|
||||
bootsnap
|
||||
bugsnag
|
||||
bullet
|
||||
cable_ready (= 5.0.0.pre3)
|
||||
cable_ready (= 5.0.0.pre9)
|
||||
cancancan (~> 1.15.0)
|
||||
capybara
|
||||
catalog!
|
||||
@@ -776,6 +785,7 @@ DEPENDENCIES
|
||||
rack-timeout
|
||||
rails (>= 6.1.4)
|
||||
rails-controller-testing
|
||||
rails-erd
|
||||
rails-i18n
|
||||
rails_safe_tasks (~> 1.0)
|
||||
ransack (= 2.4.2)
|
||||
@@ -786,7 +796,6 @@ DEPENDENCIES
|
||||
roadie-rails
|
||||
roo
|
||||
rspec-rails (>= 3.5.2)
|
||||
rspec-retry
|
||||
rswag-api
|
||||
rswag-specs
|
||||
rswag-ui
|
||||
@@ -794,7 +803,6 @@ DEPENDENCIES
|
||||
rubocop-rails
|
||||
sd_notify
|
||||
select2-rails!
|
||||
selenium-webdriver
|
||||
shoulda-matchers
|
||||
sidekiq
|
||||
sidekiq-scheduler
|
||||
@@ -803,18 +811,18 @@ DEPENDENCIES
|
||||
spring
|
||||
spring-commands-rspec
|
||||
state_machines-activerecord
|
||||
stimulus_reflex (= 3.5.0.pre9)
|
||||
stringex (~> 2.8.5)
|
||||
stripe
|
||||
test-prof
|
||||
test-unit (~> 3.5)
|
||||
timecop
|
||||
uglifier (>= 1.0.3)
|
||||
valid_email2
|
||||
vcr
|
||||
view_component
|
||||
view_component_storybook
|
||||
web!
|
||||
web-console
|
||||
webdrivers
|
||||
webmock
|
||||
webpacker (~> 5)
|
||||
whenever
|
||||
|
||||
@@ -22,24 +22,6 @@
|
||||
//= require angular-rails-templates
|
||||
//= require lodash.underscore.js
|
||||
|
||||
// datetimepicker (fil, nb)
|
||||
//= require flatpickr/dist/flatpickr.min
|
||||
//= require flatpickr/dist/l10n/ar
|
||||
//= require flatpickr/dist/l10n/cat
|
||||
//= require flatpickr/dist/l10n/cy
|
||||
//= require flatpickr/dist/l10n/de
|
||||
//= require flatpickr/dist/l10n/es
|
||||
//= require flatpickr/dist/l10n/fr
|
||||
//= require flatpickr/dist/l10n/it
|
||||
//= require flatpickr/dist/l10n/nl
|
||||
//= require flatpickr/dist/l10n/pl
|
||||
//= require flatpickr/dist/l10n/pt
|
||||
//= require flatpickr/dist/l10n/ru
|
||||
//= require flatpickr/dist/l10n/sv
|
||||
//= require flatpickr/dist/l10n/tr
|
||||
//= require shortcut-buttons-flatpickr/dist/shortcut-buttons-flatpickr.min
|
||||
//= require flatpickr/dist/plugins/labelPlugin/labelPlugin
|
||||
|
||||
// spree
|
||||
//= require admin/spree/spree
|
||||
//= require admin/spree/spree-select2
|
||||
@@ -105,6 +87,8 @@
|
||||
//= require moment/locale/tr.js
|
||||
//= require moment/locale/pl.js
|
||||
|
||||
//= require js-big-decimal/dist/web/js-big-decimal.min.js
|
||||
|
||||
// foundation
|
||||
//= require ../shared/mm-foundation-tpls-0.9.0-20180826174721.min.js
|
||||
|
||||
|
||||
@@ -256,10 +256,10 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
|
||||
$scope.packVariant = (product, variant) ->
|
||||
if variant.hasOwnProperty("unit_value_with_description")
|
||||
match = variant.unit_value_with_description.match(/^([\d\.]+(?= |$)|)( |)(.*)$/)
|
||||
match = variant.unit_value_with_description.match(/^([\d\.\,]+(?= |$)|)( |)(.*)$/)
|
||||
if match
|
||||
product = BulkProducts.find product.id
|
||||
variant.unit_value = parseFloat(match[1])
|
||||
variant.unit_value = parseFloat(match[1].replace(",", "."))
|
||||
variant.unit_value = null if isNaN(variant.unit_value)
|
||||
variant.unit_value *= product.variant_unit_scale if variant.unit_value && product.variant_unit_scale
|
||||
variant.unit_description = match[3]
|
||||
|
||||
@@ -39,9 +39,9 @@ angular.module("ofn.admin").directive "ofnDisplayAs", (OptionValueNamer) ->
|
||||
# get relevant variant properties
|
||||
variant = scope.$eval(attrs.ofnDisplayAs) # Like this so we can switch between 'master' and 'variant'
|
||||
if variant.unit_value_with_description?
|
||||
match = variant.unit_value_with_description.match(/^([\d\.]+(?= |$)|)( |)(.*)$/)
|
||||
match = variant.unit_value_with_description.match(/^([\d\.\,]+(?= |$)|)( |)(.*)$/)
|
||||
if match
|
||||
unit_value = parseFloat(match[1])
|
||||
unit_value = parseFloat(match[1].replace(",", "."))
|
||||
unit_value = null if isNaN(unit_value)
|
||||
unit_value *= variant_unit_scale if unit_value && variant_unit_scale
|
||||
unit_description = match[3]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
angular.module("admin.enterprise_groups")
|
||||
.controller "sideMenuCtrl", ($scope, SideMenu) ->
|
||||
$scope.menu = SideMenu
|
||||
$scope.select = SideMenu.select
|
||||
|
||||
$scope.menu.setItems [
|
||||
{ name: 'primary_details', label: t('primary_details'), icon_class: "icon-user" }
|
||||
{ name: 'users', label: t('users'), icon_class: "icon-user" }
|
||||
{ name: 'about', label: t('about'), icon_class: "icon-pencil" }
|
||||
{ name: 'images', label: t('images'), icon_class: "icon-picture" }
|
||||
{ name: 'contact', label: t('admin_enterprise_groups_contact'), icon_class: "icon-phone" }
|
||||
{ name: 'web', label: t('admin_enterprise_groups_web'), icon_class: "icon-globe" }
|
||||
]
|
||||
|
||||
$scope.select(0)
|
||||
@@ -1,20 +0,0 @@
|
||||
# Used in enterprise new and edit forms to reset the state when the country is changed
|
||||
angular.module("admin.enterprises").controller 'countryCtrl', ($scope, $timeout, availableCountries) ->
|
||||
$scope.address_type = "address"
|
||||
$scope.countries = availableCountries
|
||||
|
||||
$scope.countriesById = $scope.countries.reduce (obj, country) ->
|
||||
obj[country.id] = country
|
||||
obj
|
||||
, {}
|
||||
|
||||
$timeout ->
|
||||
$scope.$watch 'Enterprise.' + $scope.address_type + '.country_id', (newID, oldID) ->
|
||||
$scope.clearState() unless $scope.addressStateMatchesCountry()
|
||||
|
||||
$scope.clearState = ->
|
||||
$scope.Enterprise[$scope.address_type].state_id = null
|
||||
|
||||
$scope.addressStateMatchesCountry = ->
|
||||
$scope.countriesById[$scope.Enterprise[$scope.address_type].country_id].states.some (state) ->
|
||||
state.id == $scope.Enterprise[$scope.address_type].state_id
|
||||
@@ -1,9 +1,7 @@
|
||||
angular.module("admin.enterprises")
|
||||
.controller "enterpriseCtrl", ($scope, $http, $window, NavigationCheck, enterprise, Enterprises, EnterprisePaymentMethods, EnterpriseShippingMethods, SideMenu, StatusMessage, RequestMonitor) ->
|
||||
.controller "enterpriseCtrl", ($scope, $http, $window, NavigationCheck, enterprise, Enterprises, SideMenu, StatusMessage, RequestMonitor) ->
|
||||
$scope.Enterprise = enterprise
|
||||
$scope.Enterprises = Enterprises
|
||||
$scope.PaymentMethods = EnterprisePaymentMethods.paymentMethods
|
||||
$scope.ShippingMethods = EnterpriseShippingMethods.shippingMethods
|
||||
$scope.navClear = NavigationCheck.clear
|
||||
$scope.menu = SideMenu
|
||||
$scope.newManager = { id: null, email: (t('add_manager')) }
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
angular.module("admin.enterprises")
|
||||
.controller "permalinkCtrl", ($scope, PermalinkChecker) ->
|
||||
# locals
|
||||
initialPermalink = $scope.Enterprise.permalink
|
||||
pendingRequest = null
|
||||
|
||||
# variables on $scope
|
||||
$scope.availablility = ""
|
||||
$scope.checking = false
|
||||
|
||||
$scope.$watch "Enterprise.permalink", (newValue, oldValue) ->
|
||||
if newValue == initialPermalink
|
||||
$scope.availability = ""
|
||||
return
|
||||
|
||||
$scope.checking = true
|
||||
pendingRequest = PermalinkChecker.check(newValue)
|
||||
|
||||
pendingRequest.then (data) ->
|
||||
if data.permalink == initialPermalink
|
||||
$scope.availability = ""
|
||||
else
|
||||
$scope.availability = data.available
|
||||
$scope.Enterprise.permalink = data.permalink
|
||||
$scope.checking = false
|
||||
, (data) ->
|
||||
# Do nothing (this is hopefully an aborted request)
|
||||
@@ -1,49 +0,0 @@
|
||||
angular.module("admin.enterprises")
|
||||
.controller "sideMenuCtrl", ($scope, $parse, enterprise, SideMenu, enterprisePermissions) ->
|
||||
$scope.Enterprise = enterprise
|
||||
$scope.menu = SideMenu
|
||||
$scope.select = SideMenu.select
|
||||
|
||||
$scope.menu.setItems [
|
||||
{ name: 'primary_details', label: t('primary_details'), icon_class: "icon-home" }
|
||||
{ name: 'address', label: t('address'), icon_class: "icon-map-marker" }
|
||||
{ name: 'contact', label: t('contact'), icon_class: "icon-phone" }
|
||||
{ name: 'social', label: t('social'), icon_class: "icon-twitter" }
|
||||
{ name: 'about', label: t('about'), icon_class: "icon-pencil" }
|
||||
{ name: 'business_details', label: t('business_details'), icon_class: "icon-briefcase" }
|
||||
{ name: 'images', label: t('images'), icon_class: "icon-picture" }
|
||||
{ name: 'properties', label: t('properties'), icon_class: "icon-tags", show: "showProperties()" }
|
||||
{ name: 'shipping_methods', label: t('shipping_methods'), icon_class: "icon-truck", show: "showShippingMethods()" }
|
||||
{ name: 'payment_methods', label: t('payment_methods'), icon_class: "icon-money", show: "showPaymentMethods()" }
|
||||
{ name: 'enterprise_fees', label: t('enterprise_fees'), icon_class: "icon-tasks", show: "showEnterpriseFees()" }
|
||||
{ name: 'enterprise_permissions', label: t('enterprise_permissions'), icon_class: "icon-plug" }
|
||||
{ name: 'inventory_settings', label: t('inventory_settings'), icon_class: "icon-list-ol", show: "enterpriseIsShop()" }
|
||||
{ name: 'tag_rules', label: t('tag_rules'), icon_class: "icon-random", show: "enterpriseIsShop()" }
|
||||
{ name: 'shop_preferences', label: t('shop_preferences'), icon_class: "icon-shopping-cart", show: "enterpriseIsShop()" }
|
||||
{ name: 'users', label: t('users'), icon_class: "icon-user" }
|
||||
]
|
||||
|
||||
SideMenu.init()
|
||||
|
||||
$scope.showItem = (item) ->
|
||||
if item.show?
|
||||
$parse(item.show)($scope)
|
||||
else
|
||||
true
|
||||
|
||||
$scope.showProperties = ->
|
||||
!!$scope.Enterprise.is_primary_producer
|
||||
|
||||
$scope.showShippingMethods = ->
|
||||
enterprisePermissions.can_manage_shipping_methods && $scope.Enterprise.sells != "none"
|
||||
|
||||
$scope.showPaymentMethods = ->
|
||||
enterprisePermissions.can_manage_payment_methods && $scope.Enterprise.sells != "none"
|
||||
|
||||
$scope.showEnterpriseFees = ->
|
||||
enterprisePermissions.can_manage_enterprise_fees && ($scope.Enterprise.sells != "none" || $scope.Enterprise.is_primary_producer)
|
||||
|
||||
$scope.enterpriseIsShop = ->
|
||||
$scope.Enterprise.sells != "none"
|
||||
|
||||
$scope.menu.redirect_function('enterprise_permissions', '/admin/enterprise_relationships')
|
||||
@@ -1,20 +0,0 @@
|
||||
angular.module("admin.enterprises")
|
||||
.factory "EnterprisePaymentMethods", (enterprise, PaymentMethods) ->
|
||||
new class EnterprisePaymentMethods
|
||||
paymentMethods: PaymentMethods.all
|
||||
|
||||
constructor: ->
|
||||
for payment_method in @paymentMethods
|
||||
payment_method.selected = payment_method.id in enterprise.payment_method_ids
|
||||
|
||||
displayColor: ->
|
||||
if @paymentMethods.length > 0 && @selectedCount() > 0
|
||||
"blue"
|
||||
else
|
||||
"red"
|
||||
|
||||
selectedCount: ->
|
||||
@paymentMethods.reduce (count, payment_method) ->
|
||||
count++ if payment_method.selected
|
||||
count
|
||||
, 0
|
||||
@@ -1,20 +0,0 @@
|
||||
angular.module("admin.enterprises")
|
||||
.factory "EnterpriseShippingMethods", (enterprise, ShippingMethods) ->
|
||||
new class EnterpriseShippingMethods
|
||||
shippingMethods: ShippingMethods.all
|
||||
|
||||
constructor: ->
|
||||
for shipping_method in @shippingMethods
|
||||
shipping_method.selected = shipping_method.id in enterprise.shipping_method_ids
|
||||
|
||||
displayColor: ->
|
||||
if @shippingMethods.length > 0 && @selectedCount() > 0
|
||||
"blue"
|
||||
else
|
||||
"red"
|
||||
|
||||
selectedCount: ->
|
||||
@shippingMethods.reduce (count, shipping_method) ->
|
||||
count++ if shipping_method.selected
|
||||
count
|
||||
, 0
|
||||
@@ -25,6 +25,10 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
$scope.resetFilters()
|
||||
$scope.refreshData()
|
||||
|
||||
$scope.$watchCollection "[startDate, endDate]", (newValues, oldValues) ->
|
||||
if newValues != oldValues
|
||||
$scope.refreshData()
|
||||
|
||||
$scope.refreshData = ->
|
||||
unless !$scope.orderCycleFilter? || $scope.orderCycleFilter == ''
|
||||
$scope.setOrderCycleDateRange()
|
||||
|
||||
@@ -18,7 +18,8 @@ angular.module('admin.orderCycles')
|
||||
OrderCycle.exchangeDirection(exchange)
|
||||
|
||||
$scope.enterprisesWithFees = ->
|
||||
$scope.enterprises[id] for id in [OrderCycle.participatingEnterpriseIds()..., [OrderCycle.order_cycle.coordinator_id]...] when $scope.enterpriseFeesForEnterprise(id).length > 0
|
||||
ids = [OrderCycle.participatingEnterpriseIds()..., [OrderCycle.order_cycle.coordinator_id]...]
|
||||
$scope.enterprises[id] for id in Array.from(new Set(ids)) when $scope.enterpriseFeesForEnterprise(id).length > 0
|
||||
|
||||
$scope.removeExchange = ($event, exchange) ->
|
||||
$event.preventDefault()
|
||||
|
||||
@@ -1,21 +1,4 @@
|
||||
angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.enterprises'])
|
||||
.directive 'datetimepicker', ($timeout, $parse) ->
|
||||
require: "ngModel"
|
||||
link: (scope, element, attrs, ngModel) ->
|
||||
$timeout ->
|
||||
fp = flatpickr(element, Object.assign({},
|
||||
window.FLATPICKR_DATETIME_DEFAULT, {
|
||||
onOpen: (selectedDates, dateStr, instance) ->
|
||||
instance.setDate(ngModel.$modelValue)
|
||||
instance.input.dispatchEvent(new Event('focus', { bubbles: true }));
|
||||
}));
|
||||
fp.minuteElement.addEventListener "keyup", (e) ->
|
||||
if !isNaN(event.target.value)
|
||||
fp.setDate(fp.selectedDates[0].setMinutes(e.target.value), true)
|
||||
fp.hourElement.addEventListener "keyup", (e) ->
|
||||
if !isNaN(event.target.value)
|
||||
fp.setDate(fp.selectedDates[0].setHours(e.target.value), true)
|
||||
|
||||
.directive 'ofnOnChange', ->
|
||||
(scope, element, attrs) ->
|
||||
element.bind 'change', ->
|
||||
|
||||
@@ -93,9 +93,9 @@ angular.module('admin.orderCycles').factory 'OrderCycle', ($resource, $window, $
|
||||
variant_ids
|
||||
|
||||
participatingEnterpriseIds: ->
|
||||
suppliers = (exchange.enterprise_id for exchange in this.order_cycle.incoming_exchanges)
|
||||
distributors = (exchange.enterprise_id for exchange in this.order_cycle.outgoing_exchanges)
|
||||
jQuery.unique(suppliers.concat(distributors)).sort()
|
||||
suppliers = (parseInt(exchange.enterprise_id) for exchange in this.order_cycle.incoming_exchanges)
|
||||
distributors = (parseInt(exchange.enterprise_id) for exchange in this.order_cycle.outgoing_exchanges)
|
||||
Array.from(new Set([suppliers..., distributors...]))
|
||||
|
||||
exchangesByDirection: (direction) ->
|
||||
if direction == 'incoming'
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
angular.module("admin.orders").controller "bulkCancelCtrl", ($scope, $http, $timeout) ->
|
||||
|
||||
$scope.cancelOrder = (orderIds, sendEmailCancellation, restock_items) ->
|
||||
$http(
|
||||
method: 'post'
|
||||
url: "/admin/orders/bulk_cancel?order_ids=#{orderIds}&send_cancellation_email=#{sendEmailCancellation}&restock_items=#{restock_items}" ).then(->
|
||||
window.location.reload()
|
||||
)
|
||||
|
||||
$scope.cancelSelectedOrders = ->
|
||||
ofnCancelOrderAlert((confirm, sendEmailCancellation, restock_items) ->
|
||||
if confirm
|
||||
$scope.cancelOrder $scope.selected_orders, sendEmailCancellation, restock_items
|
||||
)
|
||||
@@ -29,6 +29,8 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, Reque
|
||||
$scope.q = {
|
||||
completed_at_not_null: true
|
||||
}
|
||||
e = new CustomEvent("flatpickr_clear");
|
||||
window.dispatchEvent(e)
|
||||
|
||||
$scope.clearFilters = () ->
|
||||
KeyValueMapStore.clearKeyValueMap()
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
angular.module("admin.paymentMethods").controller "paymentMethodsCtrl", ($scope, PaymentMethods) ->
|
||||
$scope.findPaymentMethodByID = (id) ->
|
||||
$scope.PaymentMethod = PaymentMethods.byID[id]
|
||||
@@ -32,7 +32,7 @@ angular.module("admin.products")
|
||||
if match
|
||||
$scope.product.master.unit_value = PriceParser.parse(match[1])
|
||||
$scope.product.master.unit_value = null if isNaN($scope.product.master.unit_value)
|
||||
$scope.product.master.unit_value *= $scope.product.variant_unit_scale if $scope.product.master.unit_value && $scope.product.variant_unit_scale
|
||||
$scope.product.master.unit_value = window.bigDecimal.multiply($scope.product.master.unit_value, $scope.product.variant_unit_scale, 2) if $scope.product.master.unit_value && $scope.product.variant_unit_scale
|
||||
$scope.product.master.unit_description = match[3]
|
||||
else
|
||||
value = $scope.product.master.unit_value
|
||||
|
||||
@@ -23,10 +23,10 @@ angular.module("admin.products").controller "variantUnitsCtrl", ($scope, Variant
|
||||
|
||||
$scope.updateValue = ->
|
||||
unit_value_human = angular.element('#unit_value_human').val()
|
||||
$scope.unit_value = PriceParser.parse(unit_value_human) * $scope.scale
|
||||
$scope.unit_value = bigDecimal.multiply(PriceParser.parse(unit_value_human), $scope.scale, 2)
|
||||
|
||||
variant_unit_value = angular.element('#variant_unit_value').val()
|
||||
$scope.unit_value_human = variant_unit_value / $scope.scale
|
||||
$scope.unit_value_human = parseFloat(bigDecimal.divide(variant_unit_value, $scope.scale, 2))
|
||||
|
||||
$timeout -> $scope.processUnitPrice()
|
||||
$timeout -> $scope.updateValue()
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
angular.module("admin.shippingMethods").controller "shippingMethodsCtrl", ($scope, ShippingMethods) ->
|
||||
$scope.findShippingMethodByID = (id) ->
|
||||
$scope.ShippingMethod = ShippingMethods.byID[id]
|
||||
@@ -1,29 +0,0 @@
|
||||
angular.module("admin.subscriptions").directive 'newSubscriptionDialog', ($rootScope, $compile, $window, $templateCache, DialogDefaults, shops) ->
|
||||
restrict: 'A'
|
||||
scope: true
|
||||
link: (scope, element, attr) ->
|
||||
scope.submitted = false
|
||||
scope.shops = shops
|
||||
scope.shop_id = null
|
||||
|
||||
scope.newSubscription = ->
|
||||
scope.new_subscription_form.$setPristine()
|
||||
scope.submitted = true
|
||||
if scope.shop_id?
|
||||
$window.location.href = "/admin/subscriptions/new?subscription[shop_id]=#{scope.shop_id}"
|
||||
return
|
||||
|
||||
# Compile modal template
|
||||
template = $compile($templateCache.get('admin/new_subscription_dialog.html'))(scope)
|
||||
|
||||
# Set Dialog options
|
||||
template.dialog(DialogDefaults)
|
||||
|
||||
# Link opening of dialog to click event on element
|
||||
element.bind 'click', (e) ->
|
||||
if shops.length == 1
|
||||
scope.shop_id = shops[0].id
|
||||
scope.newSubscription()
|
||||
else
|
||||
template.dialog('open')
|
||||
$rootScope.$evalAsync()
|
||||
@@ -1,70 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
var onClickButtons = function(index, fp) {
|
||||
var date;
|
||||
// Memorize index used for the 'Close' button
|
||||
// (currently it has index of 1)
|
||||
var closeButtonIndex = 1;
|
||||
switch (index) {
|
||||
case 0:
|
||||
date = new Date();
|
||||
break;
|
||||
case closeButtonIndex:
|
||||
fp.close();
|
||||
break;
|
||||
}
|
||||
// Set the date unless clicked button was the 'Close' one
|
||||
if (index != closeButtonIndex) {
|
||||
fp.setDate(date, true);
|
||||
}
|
||||
}
|
||||
window.FLATPICKR_DATE_DEFAULT = {
|
||||
altInput: true,
|
||||
altFormat: Spree.translations.flatpickr_date_format,
|
||||
dateFormat: "Y-m-d",
|
||||
locale: I18n.base_locale,
|
||||
plugins: [
|
||||
ShortcutButtonsPlugin({
|
||||
button: [
|
||||
{
|
||||
label: Spree.translations.today
|
||||
},
|
||||
{
|
||||
label: Spree.translations.close
|
||||
}
|
||||
],
|
||||
label: "or",
|
||||
onClick: onClickButtons
|
||||
}),
|
||||
labelPlugin({})
|
||||
]
|
||||
}
|
||||
window.FLATPICKR_DATETIME_DEFAULT = Object.assign(
|
||||
{},
|
||||
window.FLATPICKR_DATE_DEFAULT,
|
||||
{
|
||||
altInput: true,
|
||||
altFormat: Spree.translations.flatpickr_datetime_format,
|
||||
dateFormat: "Y-m-d H:i",
|
||||
enableTime: true,
|
||||
time_24hr: true,
|
||||
plugins: [
|
||||
ShortcutButtonsPlugin({
|
||||
button: [
|
||||
{
|
||||
label: Spree.translations.now
|
||||
},
|
||||
{
|
||||
label: Spree.translations.close
|
||||
}
|
||||
],
|
||||
label: "or",
|
||||
onClick: onClickButtons
|
||||
}),
|
||||
labelPlugin({})
|
||||
]
|
||||
}
|
||||
);
|
||||
flatpickr(".datetimepicker", window.FLATPICKR_DATETIME_DEFAULT);
|
||||
$('a.close').click(function(event){
|
||||
event.preventDefault();
|
||||
$(this).parent().slideUp(250);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
angular.module("admin.utils").directive "datepicker", ($window, $timeout) ->
|
||||
require: "ngModel"
|
||||
link: (scope, element, attrs, ngModel) ->
|
||||
$timeout ->
|
||||
flapickrInstance = flatpickr(element, Object.assign(
|
||||
{},
|
||||
$window.FLATPICKR_DATE_DEFAULT, {
|
||||
onOpen: (selectedDates, dateStr, instance) ->
|
||||
instance.setDate(ngModel.$modelValue)
|
||||
}
|
||||
));
|
||||
ngModel.$render = () ->
|
||||
newValue = ngModel.$viewValue;
|
||||
flapickrInstance?.setDate(newValue)
|
||||
@@ -1,14 +0,0 @@
|
||||
#new-subscription-dialog
|
||||
.text-normal.margin-bottom-30.text-center
|
||||
= t('js.admin.subscriptions.new.please_select_a_shop')
|
||||
|
||||
%form{ name: 'new_subscription_form', novalidate: true, ng: { submit: "newSubscription()" }}
|
||||
|
||||
.text-center.margin-bottom-30
|
||||
%input.ofn-select2.fullwidth#new_subscription_shop_id{ ng: { model: 'shop_id' }, required: true, name: 'shop_id', data: 'shops' }
|
||||
%div{ ng: { show: "submitted && new_subscription_form.$pristine" } }
|
||||
.error{ ng: { show: "new_subscription_form.shop_id.$error.required" } }
|
||||
= t('js.admin.subscriptions.new.please_select_a_shop')
|
||||
|
||||
.text-center
|
||||
%input.button.red.icon-plus{ type: 'submit', value: t('continue') }
|
||||
6
app/channels/application_cable/channel.rb
Normal file
6
app/channels/application_cable/channel.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
end
|
||||
24
app/channels/application_cable/connection.rb
Normal file
24
app/channels/application_cable/connection.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
identified_by :session_id, :current_user
|
||||
|
||||
def connect
|
||||
# initializes Warden after a cold start, in case you're visitor #1
|
||||
env["warden"].authenticated?
|
||||
# the problem with only using session is that users often login on multiple devices
|
||||
self.current_user = env["warden"].user
|
||||
# the problem with only using user is that sometimes you might want to use SR before you login
|
||||
self.session_id = request.session.id
|
||||
# and so, we recommend using both
|
||||
|
||||
# this assumes that you want to enable SR for unauthenticated users
|
||||
reject_unauthorized_connection unless current_user || session_id
|
||||
|
||||
# if you want to disable SR for unauthenticated users,
|
||||
# comment out the line above and uncomment the line below
|
||||
# reject_unauthorized_connection unless current_user
|
||||
end
|
||||
end
|
||||
end
|
||||
9
app/components/multiple_checked_select_component.rb
Normal file
9
app/components/multiple_checked_select_component.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MultipleCheckedSelectComponent < ViewComponent::Base
|
||||
def initialize(name:, options:, selected:)
|
||||
@name = name
|
||||
@options = options.map { |option| [option[0], option[1].to_sym] }
|
||||
@selected = selected.nil? ? [] : selected.map(&:to_sym)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
.ofn-drop-down.ofn-drop-down-v2{ data: { controller: "multiple-checked-select" } }
|
||||
%div.ofn-drop-down-label{ "data-multiple-checked-select-target": "button" }
|
||||
%span{class: "label"}= t('admin.columns')
|
||||
%span{ class: "icon-caret-down", "data-multiple-checked-select-target": "caret" }
|
||||
%div.menu{ class: "hidden", "data-multiple-checked-select-target": "options" }
|
||||
%div.filter
|
||||
%input{ type: "text", "data-multiple-checked-select-target": "filter", placeholder: I18n.t('components.multiple_checked_select.filter_placeholder') }
|
||||
%hr
|
||||
%div.menu_items
|
||||
- @options.each do |option|
|
||||
%label.menu_item{ "data-multiple-checked-select-target": "option", "data-value": option[1], "data-label": option[0] }
|
||||
%input.redesigned-input{ type: "checkbox", checked: @selected.include?(option[1]), name: "#{@name}[]", value: option[1] }
|
||||
= option[0]
|
||||
@@ -7,6 +7,7 @@ require 'open_food_network/order_cycle_permissions'
|
||||
module Admin
|
||||
class EnterprisesController < Admin::ResourceController
|
||||
include GeocodeEnterpriseAddress
|
||||
include CablecarResponses
|
||||
|
||||
# These need to run before #load_resource so that @object is initialised with sanitised values
|
||||
prepend_before_action :override_owner, only: :create
|
||||
@@ -44,7 +45,12 @@ module Admin
|
||||
def edit
|
||||
@object = Enterprise.where(permalink: params[:id]).
|
||||
includes(users: [:ship_address, :bill_address]).first
|
||||
super
|
||||
if params[:stimulus]
|
||||
@enterprise.is_primary_producer = params[:is_primary_producer]
|
||||
@enterprise.sells = params[:enterprise_sells]
|
||||
render operations: cable_car.morph("#side_menu", partial("admin/shared/side_menu"))
|
||||
.morph("#permalink", partial("admin/enterprises/form/permalink"))
|
||||
end
|
||||
end
|
||||
|
||||
def welcome
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
module Admin
|
||||
class OrderCyclesController < Admin::ResourceController
|
||||
include OrderCyclesHelper
|
||||
include ::OrderCyclesHelper
|
||||
include PaperTrailLogging
|
||||
|
||||
prepend_before_action :set_order_cycle_id, only: [:incoming, :outgoing]
|
||||
prepend_before_action :set_order_cycle_id, only: [:incoming, :outgoing, :checkout_options]
|
||||
before_action :load_data_for_index, only: :index
|
||||
before_action :require_coordinator, only: :new
|
||||
before_action :remove_protected_attrs, only: [:update]
|
||||
@@ -67,10 +67,12 @@ module Admin
|
||||
update_nil_subscription_line_items_price_estimate(@order_cycle)
|
||||
respond_to do |format|
|
||||
flash[:notice] = I18n.t(:order_cycles_update_notice) if params[:reloading] == '1'
|
||||
format.html { redirect_back(fallback_location: root_path) }
|
||||
format.html { redirect_to_after_update_path }
|
||||
format.json { render json: { success: true } }
|
||||
end
|
||||
else
|
||||
elsif request.format.html?
|
||||
render :checkout_options
|
||||
elsif request.format.json?
|
||||
render json: { errors: @order_cycle.errors.full_messages }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -190,6 +192,16 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
def redirect_to_after_update_path
|
||||
if params[:context] == "checkout_options" && params[:save]
|
||||
redirect_to main_app.admin_order_cycle_checkout_options_path(@order_cycle)
|
||||
elsif params[:context] == "checkout_options" && params[:save_and_back_to_list]
|
||||
redirect_to main_app.admin_order_cycles_path
|
||||
else
|
||||
redirect_back(fallback_location: root_path)
|
||||
end
|
||||
end
|
||||
|
||||
def require_coordinator
|
||||
@order_cycle.coordinator =
|
||||
permitted_coordinating_enterprises_for(@order_cycle).find_by(id: params[:coordinator_id])
|
||||
|
||||
@@ -40,7 +40,7 @@ module Api
|
||||
end
|
||||
|
||||
def restrict_feature
|
||||
not_found unless Flipper.enabled?(:api_v1, @current_api_user)
|
||||
not_found unless OpenFoodNetwork::FeatureToggle.enabled?(:api_v1, @current_api_user)
|
||||
end
|
||||
|
||||
def current_ability
|
||||
|
||||
@@ -165,8 +165,9 @@ class ApplicationController < ActionController::Base
|
||||
return unless current_spree_user.disabled
|
||||
|
||||
flash[:success] = nil
|
||||
flash.now[:error] = I18n.t("devise.failure.disabled")
|
||||
flash[:error] = I18n.t("devise.failure.disabled")
|
||||
sign_out current_spree_user
|
||||
redirect_to main_app.root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -16,12 +16,7 @@ class BaseController < ApplicationController
|
||||
private
|
||||
|
||||
def set_order_cycles
|
||||
unless @distributor.ready_for_checkout?
|
||||
@order_cycles = OrderCycle.where('false')
|
||||
return
|
||||
end
|
||||
|
||||
@order_cycles = Shop::OrderCyclesList.new(@distributor, current_customer).call
|
||||
@order_cycles = Shop::OrderCyclesList.ready_for_checkout_for(@distributor, current_customer)
|
||||
|
||||
set_order_cycle
|
||||
end
|
||||
|
||||
@@ -26,7 +26,10 @@ module OrderStockCheck
|
||||
current_order.set_order_cycle! nil
|
||||
|
||||
flash[:info] = I18n.t('order_cycle_closed')
|
||||
redirect_to main_app.shop_path
|
||||
respond_to do |format|
|
||||
format.json { render json: { path: main_app.shop_path }, status: :see_other }
|
||||
format.html { redirect_to main_app.shop_path, status: :see_other }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
@@ -36,7 +39,7 @@ module OrderStockCheck
|
||||
end
|
||||
|
||||
def reset_order_to_cart
|
||||
return if Flipper.enabled? :split_checkout, spree_current_user
|
||||
return if OpenFoodNetwork::FeatureToggle.enabled? :split_checkout, spree_current_user
|
||||
|
||||
OrderCheckoutRestart.new(@order).call
|
||||
end
|
||||
|
||||
17
app/controllers/errors_controller.rb
Normal file
17
app/controllers/errors_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ErrorsController < ApplicationController
|
||||
layout "errors"
|
||||
|
||||
def not_found
|
||||
render status: :not_found
|
||||
end
|
||||
|
||||
def internal_server_error
|
||||
render status: :internal_server_error
|
||||
end
|
||||
|
||||
def unprocessable_entity
|
||||
render status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -21,6 +21,10 @@ class SplitCheckoutController < ::BaseController
|
||||
|
||||
def edit
|
||||
redirect_to_step_based_on_order unless params[:step]
|
||||
check_step if params[:step]
|
||||
recalculate_tax if params[:step] == "summary"
|
||||
|
||||
flash_error_when_no_shipping_method_available if available_shipping_methods.none?
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -45,6 +49,10 @@ class SplitCheckoutController < ::BaseController
|
||||
|
||||
private
|
||||
|
||||
def flash_error_when_no_shipping_method_available
|
||||
flash[:error] = I18n.t('split_checkout.errors.no_shipping_methods_available')
|
||||
end
|
||||
|
||||
def clear_invalid_payments
|
||||
@order.payments.with_state(:invalid).delete_all
|
||||
end
|
||||
@@ -145,4 +153,18 @@ class SplitCheckoutController < ::BaseController
|
||||
end
|
||||
redirect_to_step_based_on_order
|
||||
end
|
||||
|
||||
def check_step
|
||||
case @order.state
|
||||
when "cart", "address", "delivery"
|
||||
redirect_to checkout_step_path(:details) unless params[:step] == "details"
|
||||
when "payment"
|
||||
redirect_to checkout_step_path(:payment) if params[:step] == "summary"
|
||||
end
|
||||
end
|
||||
|
||||
def recalculate_tax
|
||||
@order.create_tax_charge!
|
||||
@order.update_order!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,6 +67,18 @@ module Spree
|
||||
load_spree_api_key
|
||||
end
|
||||
|
||||
def bulk_cancel
|
||||
order_ids = params[:order_ids].split(',')
|
||||
|
||||
Spree::Order.where(id: order_ids).find_each do |order|
|
||||
order.send_cancellation_email = params[:send_cancellation_email] != "false"
|
||||
order.restock_items = params.fetch(:restock_items, "true") == "true"
|
||||
order.cancel
|
||||
end
|
||||
|
||||
flash[:success] = Spree.t(:order_updated)
|
||||
end
|
||||
|
||||
def fire
|
||||
event = params[:e]
|
||||
@order.send_cancellation_email = params[:send_cancellation_email] != "false"
|
||||
|
||||
@@ -18,19 +18,28 @@ module Spree
|
||||
end
|
||||
|
||||
def customers
|
||||
@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], first_name_start: search_params[:q],
|
||||
last_name_start: search_params[:q]).
|
||||
result.
|
||||
where(enterprise_id: search_params[:distributor_id].to_i)
|
||||
end
|
||||
render json: @customers, each_serializer: ::Api::Admin::CustomerSerializer
|
||||
render json: load_customers, each_serializer: ::Api::Admin::CustomerSerializer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_customers
|
||||
return [] unless valid_enterprise_given?
|
||||
|
||||
Customer.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
|
||||
|
||||
def valid_enterprise_given?
|
||||
return true if spree_current_user.admin?
|
||||
|
||||
spree_current_user.enterprises.where(
|
||||
id: search_params[:distributor_id].to_i
|
||||
).present?
|
||||
end
|
||||
|
||||
def ransack_hash
|
||||
{
|
||||
m: 'or',
|
||||
|
||||
@@ -48,30 +48,11 @@ module Spree
|
||||
@user.spree_roles = roles.reject(&:blank?).collect{ |r| Spree::Role.find(r) }
|
||||
end
|
||||
|
||||
message = if new_email_unconfirmed?
|
||||
Spree.t(:email_updated)
|
||||
else
|
||||
Spree.t(:account_updated)
|
||||
end
|
||||
flash.now[:success] = message
|
||||
flash.now[:success] = update_message
|
||||
end
|
||||
render :edit
|
||||
end
|
||||
|
||||
def generate_api_key
|
||||
if @user.generate_spree_api_key!
|
||||
flash[:success] = t('spree.api.key_generated')
|
||||
end
|
||||
redirect_to spree.edit_admin_user_path(@user)
|
||||
end
|
||||
|
||||
def clear_api_key
|
||||
if @user.clear_spree_api_key!
|
||||
flash[:success] = t('spree.api.key_cleared')
|
||||
end
|
||||
redirect_to spree.edit_admin_user_path(@user)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def collection
|
||||
@@ -100,6 +81,16 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def update_message
|
||||
return Spree.t(:show_api_key_view_toggled) if @user.show_api_key_view_previously_changed?
|
||||
|
||||
if new_email_unconfirmed?
|
||||
Spree.t(:email_updated)
|
||||
else
|
||||
Spree.t(:account_updated)
|
||||
end
|
||||
end
|
||||
|
||||
# handling raise from Admin::ResourceController#destroy
|
||||
def user_destroy_with_orders_error
|
||||
render status: :forbidden, text: Spree.t(:error_user_destroy_with_orders)
|
||||
@@ -137,7 +128,9 @@ module Spree
|
||||
end
|
||||
|
||||
def user_params
|
||||
::PermittedAttributes::User.new(params).call([:enterprise_limit])
|
||||
::PermittedAttributes::User.new(params).call(
|
||||
%i[enterprise_limit show_api_key_view]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
57
app/controllers/spree/api_keys_controller.rb
Normal file
57
app/controllers/spree/api_keys_controller.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
class ApiKeysController < ::BaseController
|
||||
include Spree::Core::ControllerHelpers
|
||||
include I18nHelper
|
||||
|
||||
prepend_before_action :load_object
|
||||
|
||||
def create
|
||||
@user.generate_api_key
|
||||
|
||||
if @user.save
|
||||
flash[:success] = t('spree.api.key_generated')
|
||||
end
|
||||
|
||||
redirect_to redirect_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user.spree_api_key = nil
|
||||
|
||||
if @user.save
|
||||
flash[:success] = t('spree.api.key_cleared')
|
||||
end
|
||||
|
||||
redirect_to redirect_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_object
|
||||
@user ||= find_user
|
||||
if @user
|
||||
authorize! params[:action].to_sym, @user
|
||||
else
|
||||
redirect_to main_app.login_path
|
||||
end
|
||||
end
|
||||
|
||||
def find_user
|
||||
Spree::User.find_by(id: params[:id]) || spree_current_user
|
||||
end
|
||||
|
||||
def redirect_path
|
||||
if request.referer.blank? || request.referer.include?(spree.account_path)
|
||||
developer_settings_path
|
||||
else
|
||||
request.referer
|
||||
end
|
||||
end
|
||||
|
||||
def developer_settings_path
|
||||
"#{spree.account_path}#/developer_settings"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,7 +6,6 @@ module Spree
|
||||
include Rails.application.routes.url_helpers
|
||||
include CablecarResponses
|
||||
|
||||
|
||||
layout 'darkswarm'
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :render_404
|
||||
|
||||
@@ -16,6 +16,7 @@ module Spree
|
||||
prepend_before_action :handle_unconfirmed_email
|
||||
before_action :set_checkout_redirect, only: :create
|
||||
after_action :ensure_valid_locale_persisted, only: :create
|
||||
skip_before_action :check_disabled_user
|
||||
|
||||
def create
|
||||
authenticate_spree_user!
|
||||
|
||||
@@ -78,7 +78,7 @@ module Spree
|
||||
|
||||
def load_object
|
||||
@user ||= spree_current_user
|
||||
if @user
|
||||
if @user && !@user.disabled
|
||||
authorize! params[:action].to_sym, @user
|
||||
else
|
||||
redirect_to main_app.login_path
|
||||
|
||||
16
app/helpers/admin/enterprise_groups_helper.rb
Normal file
16
app/helpers/admin/enterprise_groups_helper.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module EnterpriseGroupsHelper
|
||||
def enterprise_group_side_menu_items
|
||||
[
|
||||
{ name: 'primary_details', icon_class: "icon-user", selected: "selected" },
|
||||
{ name: 'users', icon_class: "icon-user" },
|
||||
{ name: 'about', icon_class: "icon-pencil" },
|
||||
{ name: 'images', icon_class: "icon-picture" },
|
||||
{ name: 'contact', icon_class: "icon-phone" },
|
||||
{ name: 'web', icon_class: "icon-globe" },
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -13,5 +13,34 @@ module Admin
|
||||
def select_only_item(producers)
|
||||
producers.size == 1 ? producers.first.id : nil
|
||||
end
|
||||
|
||||
def enterprise_side_menu_items(enterprise)
|
||||
is_shop = enterprise.sells != "none"
|
||||
show_properties = !!enterprise.is_primary_producer
|
||||
show_shipping_methods = can?(:manage_shipping_methods, enterprise) && is_shop
|
||||
show_payment_methods = can?(:manage_payment_methods, enterprise) && is_shop
|
||||
show_enterprise_fees = can?(:manage_enterprise_fees,
|
||||
enterprise) && (is_shop || enterprise.is_primary_producer)
|
||||
|
||||
[
|
||||
{ name: 'primary_details', icon_class: "icon-home", show: true, selected: 'selected' },
|
||||
{ name: 'address', icon_class: "icon-map-marker", show: true },
|
||||
{ name: 'contact', icon_class: "icon-phone", show: true },
|
||||
{ name: 'social', icon_class: "icon-twitter", show: true },
|
||||
{ name: 'about', icon_class: "icon-pencil", show: true, form_name: "about_us" },
|
||||
{ name: 'business_details', icon_class: "icon-briefcase", show: true },
|
||||
{ name: 'images', icon_class: "icon-picture", show: true },
|
||||
{ name: 'properties', icon_class: "icon-tags", show: show_properties },
|
||||
{ name: 'shipping_methods', icon_class: "icon-truck", show: show_shipping_methods },
|
||||
{ name: 'payment_methods', icon_class: "icon-money", show: show_payment_methods },
|
||||
{ name: 'enterprise_fees', icon_class: "icon-tasks", show: show_enterprise_fees },
|
||||
{ name: 'enterprise_permissions', icon_class: "icon-plug", show: true,
|
||||
href: admin_enterprise_relationships_path },
|
||||
{ name: 'inventory_settings', icon_class: "icon-list-ol", show: is_shop },
|
||||
{ name: 'tag_rules', icon_class: "icon-random", show: is_shop },
|
||||
{ name: 'shop_preferences', icon_class: "icon-shopping-cart", show: is_shop },
|
||||
{ name: 'users', icon_class: "icon-user", show: true }
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,25 +32,9 @@ module CheckoutHelper
|
||||
}
|
||||
end
|
||||
|
||||
enterprise_fee_adjustments = adjustments.select { |a|
|
||||
a.originator_type == 'EnterpriseFee' && a.adjustable_type != 'Spree::LineItem'
|
||||
}
|
||||
adjustments.reject! { |a|
|
||||
a.originator_type == 'EnterpriseFee' && a.adjustable_type != 'Spree::LineItem'
|
||||
}
|
||||
unless exclude.include? :admin_and_handling
|
||||
adjustments << Spree::Adjustment.new(
|
||||
label: I18n.t(:orders_form_admin), amount: enterprise_fee_adjustments.sum(&:amount)
|
||||
)
|
||||
end
|
||||
|
||||
adjustments
|
||||
end
|
||||
|
||||
def display_line_item_fees_total_for(order)
|
||||
Spree::Money.new order.adjustments.enterprise_fee.sum(:amount), currency: order.currency
|
||||
end
|
||||
|
||||
def checkout_line_item_fees(order)
|
||||
order.line_item_adjustments.enterprise_fee
|
||||
end
|
||||
@@ -70,10 +54,13 @@ module CheckoutHelper
|
||||
def display_checkout_taxes_hash(order)
|
||||
totals = OrderTaxAdjustmentsFetcher.new(order).totals
|
||||
|
||||
totals.each_with_object({}) do |(tax_rate, tax_amount), hash|
|
||||
hash[number_to_percentage(tax_rate.amount * 100, precision: 1)] =
|
||||
Spree::Money.new tax_amount, currency: order.currency
|
||||
end
|
||||
totals.map do |tax_rate, tax_amount|
|
||||
{
|
||||
amount: Spree::Money.new(tax_amount, currency: order.currency),
|
||||
percentage: number_to_percentage(tax_rate.amount * 100, precision: 1),
|
||||
rate_amount: tax_rate.amount,
|
||||
}
|
||||
end.sort_by { |tax| tax[:rate_amount] }
|
||||
end
|
||||
|
||||
def display_line_item_tax_rates(line_item)
|
||||
|
||||
@@ -14,15 +14,7 @@ module EnterprisesHelper
|
||||
end
|
||||
|
||||
def available_shipping_methods
|
||||
return [] if current_distributor.blank?
|
||||
|
||||
shipping_methods = current_distributor.shipping_methods.display_on_checkout.to_a
|
||||
|
||||
applicator = OpenFoodNetwork::TagRuleApplicator.new(current_distributor,
|
||||
"FilterShippingMethods", current_customer&.tag_list)
|
||||
applicator.filter!(shipping_methods)
|
||||
|
||||
shipping_methods.uniq
|
||||
OrderAvailableShippingMethods.new(current_order, current_customer).to_a
|
||||
end
|
||||
|
||||
def available_payment_methods
|
||||
|
||||
@@ -56,10 +56,6 @@ module OrderCyclesHelper
|
||||
@simple_index ||= !OpenFoodNetwork::Permissions.new(spree_current_user).can_manage_complex_order_cycles?
|
||||
end
|
||||
|
||||
def order_cycles_simple_form
|
||||
@order_cycles_simple_form ||= @order_cycle.coordinator.sells == 'own'
|
||||
end
|
||||
|
||||
def pickup_time(order_cycle = current_order_cycle)
|
||||
order_cycle.exchanges.to_enterprises(current_distributor).outgoing.first.pickup_time
|
||||
end
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
|
||||
module Spree
|
||||
class ShipmentMailer < BaseMailer
|
||||
def shipped_email(shipment, resend = false)
|
||||
def shipped_email(shipment, delivery:)
|
||||
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
|
||||
subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '') + base_subject
|
||||
@delivery = delivery
|
||||
subject = base_subject
|
||||
mail(to: @shipment.order.email, from: from_address, subject: subject)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def base_subject
|
||||
"#{@shipment.order.distributor.name} #{default_i18n_subject} ##{@shipment.order.number}"
|
||||
default_subject = !@delivery ? t('.picked_up_subject') : default_i18n_subject
|
||||
"#{@shipment.order.distributor.name} #{default_subject} ##{@shipment.order.number}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# A customer record is created the first time a person orders from a shop.
|
||||
#
|
||||
# It's a relationship between a user and an enterprise but for guest orders it
|
||||
# can also be between an email address and an enterprise.
|
||||
#
|
||||
# The main purpose is tagging of customers to access private shops, receive
|
||||
# discounts et cetera. A customer record is also needed for subscriptions.
|
||||
class Customer < ApplicationRecord
|
||||
include SetUnusedAddressFields
|
||||
|
||||
@@ -7,7 +14,7 @@ class Customer < ApplicationRecord
|
||||
|
||||
searchable_attributes :first_name, :last_name, :email, :code
|
||||
|
||||
belongs_to :enterprise
|
||||
belongs_to :enterprise, optional: false
|
||||
belongs_to :user, class_name: "Spree::User"
|
||||
has_many :orders, class_name: "Spree::Order"
|
||||
before_destroy :update_orders_and_delete_canceled_subscriptions
|
||||
@@ -26,7 +33,6 @@ class Customer < ApplicationRecord
|
||||
validates :code, uniqueness: { scope: :enterprise_id, allow_nil: true }
|
||||
validates :email, presence: true, 'valid_email_2/email': true,
|
||||
uniqueness: { scope: :enterprise_id, message: I18n.t('validation_msg_is_associated_with_an_exising_customer') }
|
||||
validates :enterprise, presence: true
|
||||
|
||||
scope :of, ->(enterprise) { where(enterprise_id: enterprise) }
|
||||
|
||||
|
||||
@@ -16,6 +16,19 @@ class Enterprise < ApplicationRecord
|
||||
large: { resize_to_fill: [1200, 260] },
|
||||
}.freeze
|
||||
|
||||
self.ignored_columns = %i(terms_and_conditions_file_name
|
||||
terms_and_conditions_content_type
|
||||
terms_and_conditions_file_size
|
||||
terms_and_conditions_updated_at
|
||||
logo_file_name
|
||||
logo_content_type
|
||||
logo_file_size
|
||||
logo_updated_at
|
||||
promo_image_file_name
|
||||
promo_image_content_type
|
||||
promo_image_file_size
|
||||
promo_image_updated_at)
|
||||
|
||||
searchable_attributes :sells, :is_primary_producer
|
||||
searchable_associations :properties
|
||||
searchable_scopes :is_primary_producer, :is_distributor, :is_hub, :activated, :visible,
|
||||
@@ -120,6 +133,7 @@ class Enterprise < ApplicationRecord
|
||||
joins(:shipping_methods).
|
||||
joins(:payment_methods).
|
||||
merge(Spree::PaymentMethod.available).
|
||||
merge(Spree::ShippingMethod.frontend).
|
||||
select('DISTINCT enterprises.*')
|
||||
}
|
||||
scope :not_ready_for_checkout, lambda {
|
||||
@@ -387,7 +401,7 @@ class Enterprise < ApplicationRecord
|
||||
end
|
||||
|
||||
def ready_for_checkout?
|
||||
shipping_methods.any? && payment_methods.available.any?
|
||||
shipping_methods.frontend.any? && payment_methods.available.any?
|
||||
end
|
||||
|
||||
def self.find_available_permalink(test_permalink)
|
||||
|
||||
@@ -5,6 +5,15 @@ require 'open_food_network/locking'
|
||||
class EnterpriseGroup < ApplicationRecord
|
||||
include PermalinkGenerator
|
||||
|
||||
self.ignored_columns = %i(logo_file_name
|
||||
logo_content_type
|
||||
logo_file_size
|
||||
logo_updated_at
|
||||
promo_image_file_name
|
||||
promo_image_content_type
|
||||
promo_image_file_size
|
||||
promo_image_updated_at)
|
||||
|
||||
acts_as_list
|
||||
|
||||
has_and_belongs_to_many :enterprises, join_table: 'enterprise_groups_enterprises'
|
||||
|
||||
@@ -22,9 +22,11 @@ class OrderCycle < ApplicationRecord
|
||||
|
||||
has_many :suppliers, -> { distinct }, source: :sender, through: :cached_incoming_exchanges
|
||||
has_many :distributors, -> { distinct }, source: :receiver, through: :cached_outgoing_exchanges
|
||||
|
||||
has_many :order_cycle_schedules
|
||||
has_many :schedules, through: :order_cycle_schedules
|
||||
has_and_belongs_to_many :selected_distributor_shipping_methods,
|
||||
class_name: 'DistributorShippingMethod',
|
||||
join_table: 'order_cycles_distributor_shipping_methods'
|
||||
has_paper_trail meta: { custom_data: proc { |order_cycle| order_cycle.schedule_ids.to_s } }
|
||||
|
||||
attr_accessor :incoming_exchanges, :outgoing_exchanges
|
||||
@@ -150,6 +152,20 @@ class OrderCycle < ApplicationRecord
|
||||
]
|
||||
end
|
||||
|
||||
def attachable_payment_methods
|
||||
Spree::PaymentMethod.available(:both).
|
||||
joins("INNER JOIN distributors_payment_methods
|
||||
ON payment_method_id = spree_payment_methods.id").
|
||||
where("distributor_id IN (?)", distributor_ids).
|
||||
distinct
|
||||
end
|
||||
|
||||
def attachable_distributor_shipping_methods
|
||||
DistributorShippingMethod.joins(:shipping_method).
|
||||
merge(Spree::ShippingMethod.frontend).
|
||||
where("distributor_id IN (?)", distributor_ids)
|
||||
end
|
||||
|
||||
def clone!
|
||||
oc = dup
|
||||
oc.name = I18n.t("models.order_cycle.cloned_order_cycle_name", order_cycle: oc.name)
|
||||
@@ -161,6 +177,9 @@ class OrderCycle < ApplicationRecord
|
||||
oc.schedule_ids = schedule_ids
|
||||
oc.save!
|
||||
exchanges.each { |e| e.clone!(oc) }
|
||||
oc.selected_distributor_shipping_method_ids = (
|
||||
attachable_distributor_shipping_methods.map(&:id) & selected_distributor_shipping_method_ids
|
||||
)
|
||||
sync_subscriptions
|
||||
oc.reload
|
||||
end
|
||||
@@ -274,6 +293,22 @@ class OrderCycle < ApplicationRecord
|
||||
items.each { |li| scoper.scope(li.variant) }
|
||||
end
|
||||
|
||||
def distributor_shipping_methods
|
||||
if simple? || selected_distributor_shipping_methods.none?
|
||||
attachable_distributor_shipping_methods
|
||||
else
|
||||
attachable_distributor_shipping_methods.where(
|
||||
"distributors_shipping_methods.id IN (?) OR distributor_id NOT IN (?)",
|
||||
selected_distributor_shipping_methods.map(&:id),
|
||||
selected_distributor_shipping_methods.map(&:distributor_id)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def simple?
|
||||
coordinator.sells == 'own'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def opening?
|
||||
|
||||
@@ -99,7 +99,7 @@ module Spree
|
||||
item.order.changes_allowed?
|
||||
end
|
||||
|
||||
can [:cancel], Spree::Order do |order|
|
||||
can [:cancel, :bulk_cancel], Spree::Order do |order|
|
||||
order.user == user
|
||||
end
|
||||
|
||||
@@ -243,7 +243,9 @@ module Spree
|
||||
end
|
||||
|
||||
def add_order_cycle_management_abilities(user)
|
||||
can [:admin, :index, :read, :edit, :update, :incoming, :outgoing], OrderCycle do |order_cycle|
|
||||
can [
|
||||
:admin, :index, :read, :edit, :update, :incoming, :outgoing, :checkout_options
|
||||
], OrderCycle do |order_cycle|
|
||||
OrderCycle.visible_by(user).include? order_cycle
|
||||
end
|
||||
can [:admin, :index, :create], Schedule
|
||||
|
||||
@@ -9,6 +9,13 @@ module Spree
|
||||
large: { resize_to_limit: [600, 600] },
|
||||
}.freeze
|
||||
|
||||
self.ignored_columns = %i(attachment_file_name
|
||||
attachment_content_type
|
||||
attachment_file_size
|
||||
attachment_updated_at
|
||||
attachment_width
|
||||
attachment_height)
|
||||
|
||||
has_one_attached :attachment
|
||||
|
||||
validates :attachment, attached: true, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||
|
||||
@@ -25,7 +25,7 @@ module Spree
|
||||
order.payment_required?
|
||||
}
|
||||
go_to_state :confirmation, if: ->(order) {
|
||||
Flipper.enabled? :split_checkout, order.created_by
|
||||
OpenFoodNetwork::FeatureToggle.enabled? :split_checkout, order.created_by
|
||||
}
|
||||
go_to_state :complete
|
||||
end
|
||||
@@ -311,7 +311,7 @@ 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)
|
||||
return if state.in?(["cart", "address", "delivery"]) && OpenFoodNetwork::FeatureToggle.enabled?(:split_checkout)
|
||||
|
||||
clear_legacy_taxes!
|
||||
|
||||
@@ -704,43 +704,12 @@ module Spree
|
||||
end
|
||||
|
||||
def require_customer?
|
||||
return false if new_record? || state == 'cart'
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def customer_is_valid?
|
||||
return true unless require_customer?
|
||||
|
||||
customer.present? && customer.enterprise_id == distributor_id && customer.email == email_for_customer
|
||||
end
|
||||
|
||||
def email_for_customer
|
||||
(user&.email || email)&.downcase
|
||||
end
|
||||
|
||||
def associate_customer
|
||||
return customer if customer.present?
|
||||
|
||||
Customer.of(distributor).find_by(email: email_for_customer)
|
||||
end
|
||||
|
||||
def create_customer
|
||||
return if customer_is_valid?
|
||||
|
||||
Customer.create(
|
||||
enterprise: distributor,
|
||||
email: email_for_customer,
|
||||
user: user,
|
||||
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
|
||||
)
|
||||
persisted? && state != "cart"
|
||||
end
|
||||
|
||||
def ensure_customer
|
||||
self.customer = associate_customer || create_customer
|
||||
self.customer ||= CustomerSyncer.find_and_update_customer(self)
|
||||
self.customer ||= CustomerSyncer.create_customer(self) if require_customer?
|
||||
end
|
||||
|
||||
def update_adjustment!(adjustment)
|
||||
|
||||
@@ -343,7 +343,8 @@ module Spree
|
||||
end
|
||||
|
||||
def send_shipped_email
|
||||
ShipmentMailer.shipped_email(id).deliver_later
|
||||
delivery = !!shipping_method.require_ship_address
|
||||
ShipmentMailer.shipped_email(id, delivery: delivery).deliver_later
|
||||
end
|
||||
|
||||
def update_adjustments
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
module Spree
|
||||
class ShippingMethod < ApplicationRecord
|
||||
include CalculatedAdjustments
|
||||
DISPLAY = [:both, :front_end, :back_end].freeze
|
||||
DISPLAY_ON_OPTIONS = {
|
||||
both: "",
|
||||
back_end: "back_end"
|
||||
}.freeze
|
||||
|
||||
acts_as_paranoid
|
||||
acts_as_taggable
|
||||
@@ -27,6 +30,7 @@ module Spree
|
||||
validates :name, presence: true
|
||||
validate :distributor_validation
|
||||
validate :at_least_one_shipping_category
|
||||
validates :display_on, inclusion: { in: DISPLAY_ON_OPTIONS.values }, allow_nil: true
|
||||
|
||||
after_save :touch_distributors
|
||||
|
||||
@@ -51,9 +55,6 @@ module Spree
|
||||
}
|
||||
|
||||
scope :by_name, -> { order('spree_shipping_methods.name ASC') }
|
||||
scope :display_on_checkout, -> {
|
||||
where("spree_shipping_methods.display_on is null OR spree_shipping_methods.display_on = ''")
|
||||
}
|
||||
|
||||
# Here we allow checkout with shipping methods without zones (see issue #3928 for details)
|
||||
# and also checkout with addresses outside of the zones of the selected shipping method
|
||||
@@ -101,16 +102,26 @@ module Spree
|
||||
]
|
||||
end
|
||||
|
||||
def self.on_backend_query
|
||||
"#{table_name}.display_on != 'front_end' OR #{table_name}.display_on IS NULL"
|
||||
def self.backend
|
||||
where(display_on: DISPLAY_ON_OPTIONS[:back_end])
|
||||
end
|
||||
|
||||
def self.on_frontend_query
|
||||
"#{table_name}.display_on != 'back_end' OR #{table_name}.display_on IS NULL"
|
||||
def self.frontend
|
||||
where(display_on: [nil, ""])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def no_active_or_upcoming_order_cycle_distributors_with_only_one_shipping_method?
|
||||
return true if new_record?
|
||||
|
||||
distributors.
|
||||
with_order_cycles_as_distributor_outer.
|
||||
merge(OrderCycle.active.or(OrderCycle.upcoming)).none? do |distributor|
|
||||
distributor.shipping_method_ids.one?
|
||||
end
|
||||
end
|
||||
|
||||
def at_least_one_shipping_category
|
||||
return unless shipping_categories.empty?
|
||||
|
||||
|
||||
@@ -8,14 +8,7 @@ module Spree
|
||||
scope :frontend,
|
||||
-> {
|
||||
includes(:shipping_method).
|
||||
where(ShippingMethod.on_frontend_query).
|
||||
references(:shipping_method).
|
||||
order("cost ASC")
|
||||
}
|
||||
scope :backend,
|
||||
-> {
|
||||
includes(:shipping_method).
|
||||
where(ShippingMethod.on_backend_query).
|
||||
merge(ShippingMethod.frontend).
|
||||
references(:shipping_method).
|
||||
order("cost ASC")
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ module Spree
|
||||
set_reset_password_token
|
||||
end
|
||||
|
||||
def generate_api_key
|
||||
self.spree_api_key = SecureRandom.hex(24)
|
||||
end
|
||||
|
||||
def known_users
|
||||
if admin?
|
||||
Spree::User.where(nil)
|
||||
@@ -132,16 +136,6 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def generate_spree_api_key!
|
||||
self.spree_api_key = SecureRandom.hex(24)
|
||||
save!
|
||||
end
|
||||
|
||||
def clear_spree_api_key!
|
||||
self.spree_api_key = nil
|
||||
save!
|
||||
end
|
||||
|
||||
def last_incomplete_spree_order
|
||||
spree_orders.incomplete.where(created_by_id: id).order('created_at DESC').first
|
||||
end
|
||||
|
||||
@@ -5,6 +5,11 @@ class TermsOfServiceFile < ApplicationRecord
|
||||
|
||||
validates :attachment, attached: true
|
||||
|
||||
self.ignored_columns = %i(attachment_file_name
|
||||
attachment_content_type
|
||||
attachment_file_size
|
||||
attachment_updated_at)
|
||||
|
||||
# The most recently uploaded file is the current one.
|
||||
def self.current
|
||||
order(:id).last
|
||||
|
||||
19
app/reflexes/application_reflex.rb
Normal file
19
app/reflexes/application_reflex.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationReflex < StimulusReflex::Reflex
|
||||
# Put application-wide Reflex behavior and callbacks in this file.
|
||||
#
|
||||
# Learn more at: https://docs.stimulusreflex.com/rtfm/reflex-classes
|
||||
#
|
||||
# If your ActionCable connection is: `identified_by :current_user`
|
||||
# delegate :current_user, to: :connection
|
||||
#
|
||||
# If you need to localize your Reflexes, you can set the I18n locale here:
|
||||
#
|
||||
# before_reflex do
|
||||
# I18n.locale = :fr
|
||||
# end
|
||||
#
|
||||
# For code examples, considerations and caveats, see:
|
||||
# https://docs.stimulusreflex.com/rtfm/patterns#internationalization
|
||||
end
|
||||
@@ -63,7 +63,7 @@ module Api
|
||||
|
||||
def hubs
|
||||
ActiveModel::ArraySerializer.new(
|
||||
enterprise.distributors, each_serializer: Api::EnterpriseThinSerializer
|
||||
enterprise.distributors.not_hidden, each_serializer: Api::EnterpriseThinSerializer
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
48
app/services/customer_syncer.rb
Normal file
48
app/services/customer_syncer.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Create, find and update customer records.
|
||||
#
|
||||
# P.S.: I almost couldn't resist to call this CustomerService.
|
||||
class CustomerSyncer
|
||||
def self.find_and_update_customer(order)
|
||||
find_customer(order).tap { |customer| synchronise_email(order, customer) }
|
||||
end
|
||||
|
||||
def self.find_customer(order)
|
||||
order.user&.customers&.of(order.distributor)&.first ||
|
||||
Customer.of(order.distributor).find_by(email: customer_email(order))
|
||||
end
|
||||
|
||||
def self.synchronise_email(order, customer)
|
||||
email = order.user&.email
|
||||
|
||||
return unless email && customer && email != customer.email
|
||||
|
||||
duplicate = Customer.find_by(email: email, enterprise: order.distributor)
|
||||
|
||||
if duplicate.present?
|
||||
Spree::Order.where(customer_id: duplicate.id).update_all(customer_id: customer.id)
|
||||
Subscription.where(customer_id: duplicate.id).update_all(customer_id: customer.id)
|
||||
|
||||
duplicate.destroy
|
||||
end
|
||||
|
||||
customer.update(email: email)
|
||||
end
|
||||
|
||||
def self.create_customer(order)
|
||||
Customer.create(
|
||||
enterprise: order.distributor,
|
||||
email: customer_email(order),
|
||||
user: order.user,
|
||||
first_name: order.bill_address&.first_name.to_s,
|
||||
last_name: order.bill_address&.last_name.to_s,
|
||||
bill_address: order.bill_address&.clone,
|
||||
ship_address: order.ship_address&.clone
|
||||
)
|
||||
end
|
||||
|
||||
def self.customer_email(order)
|
||||
(order.user&.email || order.email)&.downcase
|
||||
end
|
||||
end
|
||||
@@ -68,12 +68,12 @@ class EmbeddedPageService
|
||||
end
|
||||
|
||||
def current_referer
|
||||
return if @request.referer.blank?
|
||||
|
||||
uri = URI(@request.referer)
|
||||
return if uri.host.blank?
|
||||
uri = URI.parse(@request.referer)
|
||||
return unless uri.is_a?(URI::HTTP) && uri.host.present?
|
||||
|
||||
uri.host.downcase
|
||||
rescue URI::InvalidURIError
|
||||
false
|
||||
end
|
||||
|
||||
def current_referer_without_www
|
||||
|
||||
37
app/services/order_available_shipping_methods.rb
Normal file
37
app/services/order_available_shipping_methods.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class OrderAvailableShippingMethods
|
||||
attr_reader :order, :customer
|
||||
|
||||
delegate :distributor,
|
||||
:order_cycle,
|
||||
to: :order
|
||||
|
||||
def initialize(order, customer = nil)
|
||||
@order, @customer = order, customer
|
||||
end
|
||||
|
||||
def to_a
|
||||
return [] if distributor.blank?
|
||||
|
||||
shipping_methods = shipping_methods_before_tag_rules_applied
|
||||
|
||||
applicator = OpenFoodNetwork::TagRuleApplicator.new(distributor,
|
||||
"FilterShippingMethods", customer&.tag_list)
|
||||
applicator.filter!(shipping_methods)
|
||||
|
||||
shipping_methods.uniq
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def shipping_methods_before_tag_rules_applied
|
||||
if order_cycle.nil? || order_cycle.simple?
|
||||
distributor.shipping_methods
|
||||
else
|
||||
distributor.shipping_methods.where(
|
||||
id: order_cycle.distributor_shipping_methods.select(:shipping_method_id)
|
||||
)
|
||||
end.frontend.to_a
|
||||
end
|
||||
end
|
||||
@@ -30,11 +30,10 @@ class OrderCartReset
|
||||
return unless current_user
|
||||
|
||||
order.associate_user!(current_user) if order.user.blank? || order.email.blank?
|
||||
order.__send__(:associate_customer) if order.customer.nil? # Only associates existing customers
|
||||
end
|
||||
|
||||
def reset_order_cycle(current_customer)
|
||||
listed_order_cycles = Shop::OrderCyclesList.new(distributor, current_customer).call
|
||||
listed_order_cycles = Shop::OrderCyclesList.active_for(distributor, current_customer)
|
||||
|
||||
if order_cycle_not_listed?(order.order_cycle, listed_order_cycles)
|
||||
order.order_cycle = nil
|
||||
|
||||
@@ -8,9 +8,13 @@ class OrderCycleForm
|
||||
def initialize(order_cycle, order_cycle_params, user)
|
||||
@order_cycle = order_cycle
|
||||
@order_cycle_params = order_cycle_params
|
||||
@specified_params = order_cycle_params.keys
|
||||
@user = user
|
||||
@permissions = OpenFoodNetwork::Permissions.new(user)
|
||||
@schedule_ids = order_cycle_params.delete(:schedule_ids)
|
||||
@selected_distributor_shipping_method_ids = order_cycle_params.delete(
|
||||
:selected_distributor_shipping_method_ids
|
||||
)
|
||||
end
|
||||
|
||||
def save
|
||||
@@ -20,13 +24,15 @@ class OrderCycleForm
|
||||
|
||||
order_cycle.transaction do
|
||||
order_cycle.save!
|
||||
order_cycle.schedule_ids = schedule_ids
|
||||
order_cycle.schedule_ids = schedule_ids if parameter_specified?(:schedule_ids)
|
||||
order_cycle.save!
|
||||
apply_exchange_changes
|
||||
attach_selected_distributor_shipping_methods
|
||||
sync_subscriptions
|
||||
true
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
add_exception_to_order_cycle_errors(e)
|
||||
false
|
||||
end
|
||||
|
||||
@@ -34,24 +40,50 @@ class OrderCycleForm
|
||||
|
||||
attr_accessor :order_cycle, :order_cycle_params, :user, :permissions
|
||||
|
||||
def add_exception_to_order_cycle_errors(exception)
|
||||
error = exception.message.split(":").last.strip
|
||||
order_cycle.errors.add(:base, error) if order_cycle.errors.to_a.exclude?(error)
|
||||
end
|
||||
|
||||
def apply_exchange_changes
|
||||
return if exchanges_unchanged?
|
||||
|
||||
OpenFoodNetwork::OrderCycleFormApplicator.new(order_cycle, user).go!
|
||||
end
|
||||
|
||||
def attach_selected_distributor_shipping_methods
|
||||
return if @selected_distributor_shipping_method_ids.nil?
|
||||
|
||||
order_cycle.reload # so outgoing exchanges are up-to-date for shipping method validations
|
||||
order_cycle.selected_distributor_shipping_method_ids = selected_distributor_shipping_method_ids
|
||||
order_cycle.save!
|
||||
end
|
||||
|
||||
def attachable_distributor_shipping_method_ids
|
||||
@attachable_distributor_shipping_method_ids ||= order_cycle.attachable_distributor_shipping_methods.map(&:id)
|
||||
end
|
||||
|
||||
def exchanges_unchanged?
|
||||
[:incoming_exchanges, :outgoing_exchanges].all? do |direction|
|
||||
order_cycle_params[direction].nil?
|
||||
end
|
||||
end
|
||||
|
||||
def schedule_ids?
|
||||
@schedule_ids.present?
|
||||
def selected_distributor_shipping_method_ids
|
||||
@selected_distributor_shipping_method_ids = (
|
||||
attachable_distributor_shipping_method_ids &
|
||||
@selected_distributor_shipping_method_ids.reject(&:blank?).map(&:to_i)
|
||||
)
|
||||
|
||||
if attachable_distributor_shipping_method_ids.sort == @selected_distributor_shipping_method_ids.sort
|
||||
@selected_distributor_shipping_method_ids = []
|
||||
end
|
||||
|
||||
@selected_distributor_shipping_method_ids
|
||||
end
|
||||
|
||||
def build_schedule_ids
|
||||
return unless schedule_ids?
|
||||
return unless parameter_specified?(:schedule_ids)
|
||||
|
||||
result = existing_schedule_ids
|
||||
result |= (requested_schedule_ids & permitted_schedule_ids) # Add permitted and requested
|
||||
@@ -60,7 +92,7 @@ class OrderCycleForm
|
||||
end
|
||||
|
||||
def sync_subscriptions
|
||||
return unless schedule_ids?
|
||||
return unless parameter_specified?(:schedule_ids)
|
||||
return unless schedule_sync_required?
|
||||
|
||||
OrderManagement::Subscriptions::ProxyOrderSyncer.new(subscriptions_to_sync).sync!
|
||||
@@ -78,6 +110,10 @@ class OrderCycleForm
|
||||
@schedule_ids.map(&:to_i)
|
||||
end
|
||||
|
||||
def parameter_specified?(key)
|
||||
@specified_params.map(&:to_s).include?(key.to_s)
|
||||
end
|
||||
|
||||
def permitted_schedule_ids
|
||||
Schedule.where(id: requested_schedule_ids | existing_schedule_ids)
|
||||
.merge(permissions.editable_schedules).pluck(:id)
|
||||
|
||||
@@ -12,9 +12,9 @@ module PermittedAttributes
|
||||
:email, :special_instructions,
|
||||
:existing_card_id, :shipping_method_id,
|
||||
{ payments_attributes: [
|
||||
:payment_method_id,
|
||||
{ source_attributes: PermittedAttributes::PaymentSource.attributes }
|
||||
],
|
||||
:payment_method_id,
|
||||
{ source_attributes: PermittedAttributes::PaymentSource.attributes }
|
||||
],
|
||||
ship_address_attributes: PermittedAttributes::Address.attributes,
|
||||
bill_address_attributes: PermittedAttributes::Address.attributes }
|
||||
],
|
||||
|
||||
@@ -17,7 +17,7 @@ module PermittedAttributes
|
||||
:name, :orders_open_at, :orders_close_at, :coordinator_id,
|
||||
:preferred_product_selection_from_coordinator_inventory_only,
|
||||
:automatic_notifications,
|
||||
{ schedule_ids: [], coordinator_fee_ids: [] }
|
||||
{ schedule_ids: [], selected_distributor_shipping_method_ids: [], coordinator_fee_ids: [] }
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -47,10 +47,9 @@ module Sets
|
||||
end
|
||||
|
||||
def update_product(product, attributes)
|
||||
original_supplier = product.supplier_id
|
||||
return false unless update_product_only_attributes(product, attributes)
|
||||
|
||||
ExchangeVariantDeleter.new.delete(product) if original_supplier != product.supplier_id
|
||||
ExchangeVariantDeleter.new.delete(product) if product.saved_change_to_supplier_id?
|
||||
|
||||
update_product_variants(product, attributes) &&
|
||||
update_product_master(product, attributes)
|
||||
@@ -110,6 +109,8 @@ module Sets
|
||||
end
|
||||
|
||||
def create_variant(product, variant_attributes)
|
||||
return if variant_attributes.blank?
|
||||
|
||||
on_hand = variant_attributes.delete(:on_hand)
|
||||
on_demand = variant_attributes.delete(:on_demand)
|
||||
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
# Lists available order cycles for a given customer in a given distributor
|
||||
module Shop
|
||||
class OrderCyclesList
|
||||
def self.active_for(distributor, customer)
|
||||
new(distributor, customer).call
|
||||
end
|
||||
|
||||
def self.ready_for_checkout_for(distributor, customer)
|
||||
return OrderCycle.none unless distributor.ready_for_checkout?
|
||||
|
||||
new(distributor, customer).call
|
||||
end
|
||||
|
||||
def initialize(distributor, customer)
|
||||
@distributor = distributor
|
||||
@customer = customer
|
||||
|
||||
@@ -56,7 +56,7 @@ module VariantUnits
|
||||
def option_value_value_unit_scaled
|
||||
unit_scale, unit_name = scale_for_unit_value
|
||||
|
||||
value = @variant.unit_value / unit_scale
|
||||
value = BigDecimal(@variant.unit_value / unit_scale, 6)
|
||||
|
||||
[value, unit_name]
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
= render 'spree/shared/error_messages', target: @enterprise
|
||||
|
||||
= form_for [main_app, :admin, @enterprise_group] do |f|
|
||||
.row{ ng: {app: 'admin.enterprise_groups', controller: 'enterpriseGroupCtrl'} }
|
||||
.row{ ng: {app: 'admin.enterprise_groups', controller: 'enterpriseGroupCtrl'}, data: { controller: 'tabs-and-panels', "tabs-and-panels-class-name-value": "selected" } }
|
||||
.sixteen.columns.alpha
|
||||
.four.columns.alpha
|
||||
= render 'admin/shared/side_menu'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='about'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
%fieldset.alpha.no-border-bottom#about_panel{ data: { "tabs-and-panels-target": "panel" } }
|
||||
%legend= t('.about')
|
||||
= f.field_container :long_description do
|
||||
%text-angular{'id' => 'enterprise_group_long_description', 'name' => 'enterprise_group[long_description]', 'class' => 'text-angular', "textangular-links-target-blank" => true,
|
||||
'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]"}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
= f.fields_for :address do |af|
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='contact'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
%fieldset.alpha.no-border-bottom#contact_panel{ data: { "tabs-and-panels-target": "panel" } }
|
||||
%legend= t('.contact')
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= af.label :phone
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='images'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
%fieldset.alpha.no-border-bottom#images_panel{ data: { "tabs-and-panels-target": "panel" } }
|
||||
%legend= t('.images')
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :logo, 'ofn-with-tip' => t('admin_enterprise_groups_data_powertip_logo')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='primary_details'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
%fieldset.alpha.no-border-bottom#primary_details_panel{ data: { "tabs-and-panels-target": "panel default" } }
|
||||
%legend= t('.primary_details')
|
||||
= f.field_container :name do
|
||||
= f.label :name
|
||||
%br/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='users'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
%fieldset.alpha.no-border-bottom#users_panel{ data: { "tabs-and-panels-target": "panel" } }
|
||||
%legend= t('.users')
|
||||
.row
|
||||
.three.columns.alpha
|
||||
=f.label :owner_id, t(:admin_enterprise_groups_owner)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='web'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
%fieldset.alpha.no-border-bottom#web_panel{ data: { "tabs-and-panels-target": "panel" } }
|
||||
%legend= t('.web')
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :website
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
= t('.producer')
|
||||
- if spree_current_user.admin?
|
||||
%td= enterprise_form.select :sells, Enterprise::SELLS, {}, class: 'select2 fullwidth'
|
||||
%td= enterprise_form.check_box :visible
|
||||
%td= enterprise_form.check_box :visible, {}, 'public', 'hidden'
|
||||
- if spree_current_user.admin?
|
||||
%td= enterprise_form.select :owner_id, enterprise.users.map{ |e| [ e.email, e.id ] }, {}, class: "select2 fullwidth"
|
||||
%td{"data-hook" => "admin_users_index_row_actions"}
|
||||
|
||||
@@ -1,63 +1,21 @@
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='primary_details'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/primary_details', f: f
|
||||
- enterprise_side_menu_items(@enterprise).each do |item|
|
||||
- case item[:name]
|
||||
- when 'primary_details'
|
||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { controller: "primary-details", "primary-details-primary-producer-value": @enterprise.is_primary_producer.to_s, "primary-details-enterprise-sells-value": @enterprise.sells, "tabs-and-panels-target": "panel default" }}
|
||||
%legend= t(".#{ item[:name] }.legend")
|
||||
= render "admin/enterprises/form/#{ item[:form_name] || item[:name] }", f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='users'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/users', f: f
|
||||
- when 'address'
|
||||
= f.fields_for :address do |af|
|
||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
||||
%legend= t(".#{ item[:name] }.legend")
|
||||
= render 'admin/enterprises/form/address', af: af
|
||||
|
||||
= f.fields_for :address do |af|
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='address'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/address', af: af
|
||||
- when 'enterprise_permissions'
|
||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
||||
%legend= t(".#{ item[:name] }.legend")
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='contact'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/contact', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='social'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/social', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='business_details'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/business_details', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='about'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/about_us', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='images'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/images', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='properties'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/properties', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='shipping_methods'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/shipping_methods', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='payment_methods'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/payment_methods', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='enterprise_fees'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/enterprise_fees', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='enterprise_permissions'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='inventory_settings'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/inventory_settings', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='shop_preferences'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/shop_preferences', f: f
|
||||
|
||||
%fieldset.alpha.no-border-bottom{ ng: { if: "menu.selected.name=='tag_rules'" } }
|
||||
%legend {{menu.selected.label}}
|
||||
= render 'admin/enterprises/form/tag_rules', f: f
|
||||
- else
|
||||
%fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }}
|
||||
%legend= t(".#{ item[:form_name] || item[:name] }.legend")
|
||||
= render "admin/enterprises/form/#{ item[:form_name] || item[:name] }", f: f
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= f.label :name, t('admin.enterprises.form.primary_details.name')
|
||||
= f.label :name, t('primary_details.name', scope: scope)
|
||||
%span.required *
|
||||
.nine.columns.omega
|
||||
= f.text_field :name, { placeholder: t('admin.enterprises.form.primary_details.name_placeholder'), class: "fullwidth" }
|
||||
= f.text_field :name, { placeholder: t('primary_details.name_placeholder', scope: scope), class: "fullwidth" }
|
||||
|
||||
- if spree_current_user.admin?
|
||||
.row
|
||||
@@ -17,8 +17,8 @@
|
||||
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner'
|
||||
.row
|
||||
.three.columns.alpha
|
||||
%label= t('admin.enterprises.form.primary_details.primary_producer')
|
||||
%div{'ofn-with-tip' => t('admin.enterprises.form.primary_details.primary_producer_tip')}
|
||||
%label= t('primary_details.primary_producer', scope: scope)
|
||||
%div{'ofn-with-tip' => t('primary_details.primary_producer_tip', scope: scope)}
|
||||
%a= t('admin.whats_this')
|
||||
.five.columns.omega
|
||||
= f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
|
||||
@@ -28,42 +28,42 @@
|
||||
.row
|
||||
.alpha.eleven.columns
|
||||
.three.columns.alpha
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.sells')
|
||||
%div{'ofn-with-tip' => t('admin.enterprises.form.primary_details.sells_tip')}
|
||||
= f.label :sells, t('primary_details.sells', scope: scope)
|
||||
%div{'ofn-with-tip' => t('primary_details.sells_tip', scope: scope)}
|
||||
%a What's this?
|
||||
.two.columns
|
||||
= f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
|
||||
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.none'), value: "none"
|
||||
= f.label :sells, t('primary_details.none', scope: scope), value: "none"
|
||||
.two.columns
|
||||
= f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
|
||||
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.own'), value: "own"
|
||||
= f.label :sells, t('primary_details.own', scope: scope), value: "own"
|
||||
.four.columns.omega
|
||||
= f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
|
||||
|
||||
= f.label :sells, t('admin.enterprises.form.primary_details.any'), value: "any"
|
||||
= f.label :sells, t('primary_details.any', scope: scope), value: "any"
|
||||
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :contact_name, t('.contact_name')
|
||||
.omega.nine.columns
|
||||
= f.text_field :contact_name, { placeholder: t('admin.enterprises.form.contact.name_placeholder')}
|
||||
= f.text_field :contact_name, { placeholder: t('contact.name_placeholder', scope: scope)}
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :email_address, t('admin.enterprises.form.contact.email_address')
|
||||
= f.label :email_address, t('contact.email_address', scope: scope)
|
||||
.omega.nine.columns
|
||||
= f.text_field :email_address, { placeholder: t('admin.enterprises.form.contact.email_address_placeholder'), "ng-model" => "Enterprise.email_address" }
|
||||
= f.text_field :email_address, { placeholder: t('contact.email_address_placeholder', scope: scope), "ng-model" => "Enterprise.email_address" }
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :phone, t('admin.enterprises.form.contact.phone')
|
||||
= f.label :phone, t('contact.phone', scope: scope)
|
||||
.omega.nine.columns
|
||||
= f.text_field :phone, { placeholder: t('admin.enterprises.form.contact.phone_placeholder')}
|
||||
= f.text_field :phone, { placeholder: t('contact.phone_placeholder', scope: scope)}
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :website, t('admin.enterprises.form.contact.website')
|
||||
= f.label :website, t('contact.website', scope: scope)
|
||||
.omega.nine.columns
|
||||
= f.text_field :website, { placeholder: t('admin.enterprises.form.contact.website_placeholder')}
|
||||
= f.text_field :website, { placeholder: t('contact.website_placeholder', scope: scope)}
|
||||
|
||||
= f.fields_for :address do |af|
|
||||
.row
|
||||
@@ -87,16 +87,16 @@
|
||||
= af.text_field :city, { placeholder: t(:city_placeholder)}
|
||||
.five.columns.omega
|
||||
= af.text_field :zipcode, { placeholder: t(:postcode_placeholder)}
|
||||
%div{ "ng-controller" => "countryCtrl" }
|
||||
%div{"data-controller": "dependant-select", "data-dependant-select-options-value": countries_with_states }
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= af.label :state_id, t(:state)
|
||||
\/
|
||||
= af.label :country_id, t(:country)
|
||||
.four.columns
|
||||
%input.ofn-select2.fullwidth#enterprise_address_attributes_state_id{ name: 'enterprise[address_attributes][state_id]', type: 'number', data: 'countriesById[Enterprise.address.country_id].states', placeholder: t('admin.choose'), ng: { model: 'Enterprise.address.state_id' } }
|
||||
= af.select :country_id, available_countries.map { |c| [c.name, c.id] }, {}, { "data-controller": "tom-select", "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange", class: "primary" }
|
||||
.five.columns.omega
|
||||
%input.ofn-select2.fullwidth#enterprise_address_attributes_country_id{ name: 'enterprise[address_attributes][country_id]', type: 'number', data: 'countries', placeholder: t('admin.choose'), ng: { model: 'Enterprise.address.country_id' } }
|
||||
= af.select :state_id, @enterprise.address.country.states.map { |s| [s.name, s.id] }, {}, { "data-controller": "tom-select", "data-dependant-select-target": "select", class: "primary" }
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= af.label :latitude, t(:latitude)
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
%input.red{ type: "button", value: t(:update), ng: { click: "submit()", disabled: "!enterprise_form.$dirty" } }
|
||||
%input{ type: "button", ng: { value: "enterprise_form.$dirty ? '#{t(:cancel)}' : '#{t(:close)}'", click: "cancel('#{main_app.admin_enterprises_path}')" } }
|
||||
|
||||
.row
|
||||
.row{ data: {
|
||||
controller: "tabs-and-panels", "tabs-and-panels-class-name-value": "selected" }}
|
||||
.sixteen.columns.alpha
|
||||
.four.columns.alpha
|
||||
= render 'admin/shared/side_menu'
|
||||
|
||||
@@ -25,24 +25,23 @@
|
||||
= af.text_field :city, { placeholder: t(:city_placeholder) }
|
||||
.four.columns.omega
|
||||
= af.text_field :zipcode, { placeholder: t(:postcode_placeholder) }
|
||||
.row
|
||||
.row{"data-controller": "dependent-select", "data-dependent-select-options-value": countries_with_states }
|
||||
.three.columns.alpha
|
||||
= af.label :state_id, t(:state)
|
||||
\/
|
||||
= af.label :country_id, t(:country)
|
||||
%span.required *
|
||||
.four.columns{ "ng-controller" => "countryCtrl" }
|
||||
%input.ofn-select2.fullwidth#enterprise_address_attributes_state_id{ name: 'enterprise[address_attributes][state_id]', type: 'number', data: 'countriesById[Enterprise.address.country_id].states', placeholder: t('admin.choose'), ng: { model: 'Enterprise.address.state_id' } }
|
||||
.four.columns.omega{ "ng-controller" => "countryCtrl" }
|
||||
%input.ofn-select2.fullwidth#enterprise_address_attributes_country_id{ name: 'enterprise[address_attributes][country_id]', type: 'number', data: 'countries', placeholder: t('admin.choose'), ng: { model: 'Enterprise.address.country_id' } }
|
||||
.four.columns
|
||||
= af.select :state_id, @enterprise.address.country.states.map { |s| [s.name, s.id] }, {}, { "data-controller": "tom-select", "data-dependent-select-target": "select", class: "primary" }
|
||||
.four.columns.omega{ data: { controller: "primary-details" }}
|
||||
= af.select :country_id, available_countries.map { |c| [c.name, c.id] }, {}, { "data-controller": "tom-select", "data-dependent-select-target": "source", "data-action": "dependent-select#handleSelectChange", class: "primary" }
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= af.label :latitude, t(:latitude)
|
||||
\/
|
||||
= af.label :longitude, t(:longitude)
|
||||
%span.required *
|
||||
%div{'ofn-with-tip' => t('latitude_longitude_tip')}
|
||||
%a= t('admin.whats_this')
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('latitude_longitude_tip')}
|
||||
.four.columns
|
||||
= af.text_field :latitude, { placeholder: t(:latitude_placeholder) }
|
||||
.four.columns.omega
|
||||
|
||||
@@ -29,12 +29,11 @@
|
||||
= bf.label :country_id, t(:country)
|
||||
\/
|
||||
= bf.label :state_id, t(:state)
|
||||
%div{ "ng-controller": "countryCtrl", "ng-init": "address_type='business_address'" }
|
||||
%div{"data-controller": "dependant-select", "data-dependant-select-options-value": countries_with_states }
|
||||
.four.columns
|
||||
%input.ofn-select2.fullwidth#enterprise_business_address_attributes_country_id{ name: 'enterprise[business_address_attributes][country_id]', type: 'number', data: 'countries', placeholder: t('admin.choose'), ng: { model: 'Enterprise.business_address.country_id' } }
|
||||
= bf.select :country_id, available_countries.map { |c| [c.name, c.id] }, {}, { "data-controller": "tom-select", "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange", class: "primary" }
|
||||
.four.columns.omega
|
||||
%input.ofn-select2.fullwidth#enterprise_business_address_attributes_state_id{ name: 'enterprise[business_address_attributes][state_id]', type: 'number', data: 'countriesById[Enterprise.address.country_id].states', placeholder: t('admin.choose'), ng: { model: 'Enterprise.business_address.state_id' } }
|
||||
|
||||
= bf.select :state_id, @enterprise.address.country.states.map { |s| [s.name, s.id] }, {}, { "data-controller": "tom-select", "data-dependant-select-target": "select", class: "primary" }
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
= f.fields_for :business_address, @enterprise.business_address || @enterprise.build_business_address do |bf|
|
||||
%fieldset.alpha.no-border-bottom
|
||||
%legend= t('business_address')
|
||||
%legend= t('.business_address_legend')
|
||||
= render 'admin/enterprises/form/business_address', bf: bf
|
||||
|
||||
.row{"data-controller": "updateinput"}
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
.row
|
||||
%fieldset.alpha.no-border-bottom
|
||||
%legend= t('.Invoice_item_sorting')
|
||||
%legend= t('.invoice_item_sorting_legend')
|
||||
.three.columns.alpha
|
||||
%label= t('.sort_items_by_supplier?')
|
||||
%div{'ofn-with-tip' => t('.sort_items_by_supplier_tip')}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :email_address, t('.email_address')
|
||||
%div{'ofn-with-tip' => t('.email_address_tip')}
|
||||
%a= t('admin.whats_this')
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.email_address_tip')}
|
||||
|
||||
.omega.eight.columns
|
||||
= f.text_field :email_address, { placeholder: t('.email_address_placeholder') }
|
||||
.row
|
||||
@@ -18,8 +18,8 @@
|
||||
.row
|
||||
.alpha.three.columns
|
||||
= f.label :whatsapp_phone, t('.whatsapp_phone')
|
||||
%div{'ofn-with-tip' => t('.whatsapp_phone_tip')}
|
||||
%a= t('admin.whats_this')
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.whatsapp_phone_tip')}
|
||||
|
||||
.omega.eight.columns
|
||||
= f.text_field :whatsapp_phone, { placeholder: t('.whatsapp_phone_placeholder') }
|
||||
.row
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
%th
|
||||
%tbody
|
||||
- @payment_methods.each do |payment_method|
|
||||
%tr{ ng: { controller: 'paymentMethodsCtrl', init: "findPaymentMethodByID(#{payment_method.id})" } }
|
||||
%tr
|
||||
%td= payment_method.name
|
||||
%td= f.check_box :payment_method_ids, { multiple: true, 'ng-model' => 'PaymentMethod.selected' }, payment_method.id, nil
|
||||
%td= f.check_box :payment_method_ids, { multiple: true }, payment_method.id, nil
|
||||
%td= link_to t(:edit), edit_admin_payment_method_path(payment_method)
|
||||
%br
|
||||
.row
|
||||
|
||||
32
app/views/admin/enterprises/form/_permalink.html.haml
Normal file
32
app/views/admin/enterprises/form/_permalink.html.haml
Normal file
@@ -0,0 +1,32 @@
|
||||
.permalink#permalink{ data: { controller: 'permalink', permalink: { 'initial-permalink-value': @enterprise.permalink, 'url-value': check_permalink_enterprises_url } }}
|
||||
- unless @enterprise.sells == 'none'
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= label_tag :permalink, t('.permalink')
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.permalink_tip', link: main_app.root_url)}
|
||||
.eight.columns
|
||||
= text_field_tag "enterprise[permalink]", @enterprise.permalink, data: { action: "input->permalink#validate", "permalink-target": "permalinkField" }
|
||||
.two.columns.omega
|
||||
%div{ style: "width: 30px; height: 30px;", class: "hidden", data: { "permalink-target": "spinner" } }
|
||||
= render partial: "components/admin_spinner"
|
||||
%span.available.hidden{data: { "permalink-target": "available" }}
|
||||
= t('available')
|
||||
%i.icon-ok-sign
|
||||
%span.unavailable.hidden{data: { "permalink-target": "unavailable" }}
|
||||
= t('js.unavailable')
|
||||
%i.icon-remove-sign
|
||||
|
||||
- unless @enterprise.sells == 'none'
|
||||
.row
|
||||
.three.columns.alpha
|
||||
%label= t('.link_to_front')
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.link_to_front_tip')}
|
||||
.eight.columns.omega
|
||||
- front_shop_path = "#{main_app.root_url}#{@enterprise.permalink}/shop"
|
||||
= link_to front_shop_path, front_shop_path , target: "_blank"
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= label_tag :id, t('.ofn_uid')
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('.ofn_uid_tip')}
|
||||
.six.columns
|
||||
= @enterprise.id
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user