Compare commits

...

479 Commits

Author SHA1 Message Date
luisramos0
93aabf6741 Update all locales with the latest Transifex translations 2019-02-07 19:26:00 +00:00
Pau Pérez Fabregat
676fa3d84d Merge pull request #3433 from Matt-Yorkley/bi/user_permission
Update cancan permissions for second iteration of bulk invoices
2019-02-07 20:17:34 +01:00
Luis Ramos
8c0683938a Merge pull request #3416 from kristinalim/fix/race_condition_in_bulk_order_management_feature_specs
3417,2962,3358 [Flaky Spec] Address some race conditions for bulk order management specs
2019-02-07 11:28:54 +00:00
Kristina Lim
0030428647 Do not show table until first time dereferencing is done 2019-02-07 04:39:45 +08:00
Kristina Lim
428e58f8f7 Remove unused have_no_selector argument in feature test 2019-02-07 04:39:44 +08:00
Kristina Lim
35ecbe1584 Compile row ID with higher priority 2019-02-07 04:39:44 +08:00
Kristina Lim
ed5856afa4 Compile edit link with higher priority 2019-02-07 04:39:44 +08:00
Kristina Lim
fdede83086 Support selecting date in next months
This was causing failures when selecting tomorrow when running tests on
the last day of the month.
2019-02-07 04:39:43 +08:00
Kristina Lim
bb51f7e36b Improve sync between keyword filter and selecting all 2019-02-07 04:36:28 +08:00
Kristina Lim
3eedee313e Wait for datepicker to associate and open before selecting date 2019-02-07 04:36:24 +08:00
Pau Pérez Fabregat
8f63be9519 Merge pull request #2733 from kristinalim/fix-subscription_should_not_require_future_oc
Reduce restrictions for adding a variant to a subscription
2019-02-06 21:24:57 +01:00
Pau Pérez Fabregat
cd1f469588 Merge pull request #3389 from openfoodfoundation/dependabot/bundler/redcarpet-3.4.0
Bump redcarpet from 3.2.3 to 3.4.0
2019-02-06 21:23:21 +01:00
Pau Pérez Fabregat
433d10c42f Merge pull request #3386 from leandroalemao/fix-moment-deprecation-warning
[ISSUE-3348] LC: Fix moment.js deprecation warning
2019-02-06 21:22:58 +01:00
Pau Pérez Fabregat
b4ba9e65e1 Merge pull request #3367 from openfoodfoundation/dependabot/bundler/jwt-2.1.0
Bump jwt from 1.5.6 to 2.1.0
2019-02-06 21:22:37 +01:00
Pau Pérez Fabregat
6239397589 Merge pull request #3357 from openfoodfoundation/dependabot/bundler/stripe-4.5.0
Bump stripe from 3.3.2 to 4.5.0
2019-02-06 21:22:19 +01:00
Matt-Yorkley
2c3eeec2b9 Update cancan permissions for second iteration of bulk invoices 2019-02-06 18:19:53 +00:00
Maikel
a910468fc7 Merge pull request #3418 from Jefferson-Faseler/change-rake-tasks-namespace
Update Rake task namespace
2019-02-05 16:21:59 +11:00
Luis Ramos
5a4205d151 Merge pull request #3432 from kristinalim/fix/3327-intermittent_spec_failures
3327 [Flaky Spec] Fix shop accidentally becoming order coordinator
2019-02-03 19:32:40 +00:00
Luis Ramos
4b133bbc31 Merge pull request #3412 from kristinalim/fix/3059-race_condition_in_enterprise_image_specs
3059 [Flaky Spec] Fix race condition in enterprise image feature specs
2019-02-03 19:32:11 +00:00
Luis Ramos
a0b5509850 Merge pull request #3430 from kristinalim/fix/3420-intermittent_spec_failures
3420 [Flaky Spec] Fix date format in spec when single-digit day of month
2019-02-03 19:30:22 +00:00
Kristina Lim
3104862739 Fix shop accidentally becoming order coordinator
The original setup of the order calls:

  create(:simple_order_cycle)

Which picks an arbitrary distributor as coordinator:

  coordinator { Enterprise.is_distributor.first || ... }

There is a chance that any of the existing distributor enterprises
becomes coordinator, causing a test to intermittently fail.

This commit makes the relationship between the reference enterprises and
the order consistent.
2019-02-01 20:28:36 +00:00
Kristina Lim
4bff256f6d Match date format in spec with import date filter
This was failing if the current day of month only has one digit. The
test could not find the date in the import date filter.

Before this commit, the resulting string in the test replaced "  " with
" ", so "February  2" was being changed to "February 2". The import date
filter however uses two spaces in this case, even if the browser shows
only one (HTML inline text renders two spaces as just one).
2019-02-02 01:43:52 +08:00
Pau Pérez Fabregat
e1fb005e70 Merge pull request #3387 from kristinalim/fix/3384-product_import_timeout
3384 [Product Import] Process only one batch of rows at a time
2019-02-01 17:29:04 +01:00
Maikel
a9bac2c1af Merge pull request #3411 from openfoodfoundation/transifex
Transifex
2019-01-31 13:42:50 +11:00
Transifex-Openfoodnetwork
32c5c48709 Updating translations for config/locales/en_US.yml 2019-01-31 12:38:44 +11:00
Jefferson Faseler
d4d0489328 Update name spaces for rake tasks to shorter 'ofn'. 2019-01-30 17:14:00 -05:00
Kristina Lim
65438e2619 Refactor checking no preview image in specs 2019-01-31 05:04:18 +08:00
Kristina Lim
a3c808a172 Refactor checking of preview image path in specs 2019-01-31 05:02:57 +08:00
Kristina Lim
777712a0e9 Fix race condition in enterprise image feature specs 2019-01-31 04:52:40 +08:00
Transifex-Openfoodnetwork
24c12897de Updating translations for config/locales/fr_CA.yml 2019-01-31 07:42:29 +11:00
Transifex-Openfoodnetwork
bd43e06605 Updating translations for config/locales/fr_CA.yml 2019-01-31 07:41:40 +11:00
Luis Ramos
cf744bb663 Merge pull request #3407 from openfoodfoundation/transifex
Transifex
2019-01-30 13:58:26 +00:00
Transifex-Openfoodnetwork
2b13516d3d Updating translations for config/locales/nb.yml 2019-01-30 19:20:56 +11:00
Transifex-Openfoodnetwork
1b50ba2729 Updating translations for config/locales/fr.yml 2019-01-30 19:16:54 +11:00
Maikel
e8ac0e4a9f Merge pull request #3402 from openfoodfoundation/transifex
Transifex
2019-01-30 14:45:39 +11:00
Maikel
bef7684505 Merge pull request #3399 from kristinalim/fix/3381-address_failing_tests
3381 [Flaky Spec] Load enterprise users tab before inspecting table
2019-01-30 14:29:16 +11:00
Transifex-Openfoodnetwork
f7b7e98fec Updating translations for config/locales/en_GB.yml 2019-01-30 05:12:58 +11:00
luisramos0
c07b90ffb0 Update all locales with the latest Transifex translations 2019-01-29 12:45:28 +00:00
Pau Pérez Fabregat
2b3ffd8c82 Merge pull request #2833 from kristinalim/fix-variant_override_permissions
Add tests for permissions for variant overrides
2019-01-29 09:51:41 +01:00
Pau Pérez Fabregat
a5ed17f0f5 Merge pull request #3390 from openfoodfoundation/dependabot/bundler/oj-3.7.8
Bump oj from 3.7.4 to 3.7.8
2019-01-29 09:50:25 +01:00
Pau Pérez Fabregat
c9a8ec84c0 Merge pull request #3359 from kevinchristianson/ready
Convert sass files to scss
2019-01-28 20:02:37 +01:00
Kristina Lim
2129ab991b Load enterprise users tab before inspecting table 2019-01-26 12:11:41 +08:00
Kristina Lim
5992bba97b Import color variables in new page SCSS partials
"admin/all.css" which imports these SCSS partials already imports the
color variables in "admin/variables", so actually there should be no
need to import the variables again.

However, "application.css" calls "require_tree", which means asset
precompilation through Sprockets would attempt to compile each of the
SCSS partials individually. When compiled individually, the color
variables are not available to these partials.

This is a quick solution to allow precompilation of "application.css" to
complete.
2019-01-26 03:29:19 +08:00
Kristina Lim
4a58aedf09 Use clearer translation for "No Upcoming OC" 2019-01-26 02:03:57 +08:00
Kristina Lim
c33808e8f5 Extract some actions in tests into methods 2019-01-26 02:03:56 +08:00
Kristina Lim
da4d6a092a Add spec helper for choosing today from datepicker 2019-01-26 02:03:56 +08:00
Kristina Lim
9965e95c65 Refactor methods in SubscriptionVariantsService 2019-01-26 02:03:55 +08:00
Kristina Lim
b691d727a7 Move OFN::SubscriptionService to SubscriptionVariantsService 2019-01-26 02:03:55 +08:00
Kristina Lim
c23002102c Add warning for unavailable subscription items 2019-01-26 02:03:55 +08:00
Kristina Lim
929290fc77 Reduce restrictions for creating subscriptions
Allow the following variants:

* Variants of permitted producers
* Variants of hub
* Variants that are in outgoing exchanges where the hub is receiver
2019-01-26 02:03:54 +08:00
Kristina Lim
57f6a7a3b9 Support clicking different text for select2 helper
Interaction with the variant autocomplete is not precise. The specs only
search for the product name, then click the first result that matches
the product name which they see.

This could have been the case because searching using the full variant
name does not match the variant. For example, searching "Some Product -
1kg" would not have results, while searching only "Some Product" (the
product name) would list "Some Product - 1kg".

Clicking the first match does not work in all scenarios.

This allows using a separate text for searching and for clicking.
2019-01-26 02:03:54 +08:00
Kristina Lim
d3f20289f8 Move setup of feature specs for creating subscriptions 2019-01-26 02:03:53 +08:00
Kristina Lim
35c0bcb3df Add tests for eligible variants for a subscription 2019-01-26 02:03:53 +08:00
Kristina Lim
28c70c7719 Fix nesting of specs for editing subscriptions 2019-01-26 02:03:53 +08:00
Kristina Lim
b9492d6483 Fix setup in tests for SubscriptionValidator 2019-01-26 02:03:49 +08:00
Kristina Lim
b6d8611359 Return early in JS if last batch 2019-01-25 09:06:25 +08:00
Kristina Lim
4425b0416d Rename import_data feature test method 2019-01-25 04:42:11 +08:00
Kristina Lim
b0efc3a2fa Add feature spec for large file import 2019-01-25 04:42:06 +08:00
dependabot[bot]
33ee46b224 Bump oj from 3.7.4 to 3.7.8
Bumps [oj](https://github.com/ohler55/oj) from 3.7.4 to 3.7.8.
- [Release notes](https://github.com/ohler55/oj/releases)
- [Changelog](https://github.com/ohler55/oj/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ohler55/oj/compare/v3.7.4...v3.7.8)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-24 19:16:56 +00:00
dependabot[bot]
5610f64c7a Bump redcarpet from 3.2.3 to 3.4.0
Bumps [redcarpet](https://github.com/vmg/redcarpet) from 3.2.3 to 3.4.0.
- [Release notes](https://github.com/vmg/redcarpet/releases)
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vmg/redcarpet/compare/v3.2.3...v3.4.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-24 19:14:52 +00:00
Kristina Lim
b67ba89aca Process batches of the import CSV one after another
Start the HTTP request for processing next batches only after the
previous batch has completed.

A con of this approach is that the user needs to keep their browser open
for later parts of the large CSV to be processed, but this is better
than a higher chance of requests timing out.
2019-01-25 00:33:13 +08:00
Kristina Lim
bf084cd8df Move import batch size outside method 2019-01-25 00:28:56 +08:00
leandroalemao
dfa11834e3 [ISSUE-3348] LC: Fix moment.js deprecation warning 2019-01-24 11:16:31 +00:00
Maikel
4cc6a8c966 Merge pull request #3350 from openfoodfoundation/dependabot/bundler/delayed_job_active_record-4.1.3
Bump delayed_job_active_record from 4.1.2 to 4.1.3
2019-01-24 11:58:32 +11:00
Maikel
66cb0e6a91 Merge pull request #3352 from openfoodfoundation/dependabot/bundler/foundation-rails-5.5.2.1
Bump foundation-rails from 5.5.0.0 to 5.5.2.1
2019-01-24 10:29:17 +11:00
Maikel
a3cd1dc945 Merge pull request #3344 from mkllnk/3279-moment-upgrade
Avoid deprecation warnings of momentjs
2019-01-24 10:28:41 +11:00
Kristina Lim
cf7f8b887f Add tests for permissions for variant overrides 2019-01-24 07:08:54 +11:00
Pau Pérez Fabregat
7881f96cac Merge pull request #3341 from openfoodfoundation/dependabot/bundler/daemons-1.3.1
Bump daemons from 1.2.2 to 1.3.1
2019-01-23 16:09:28 +01:00
Pau Pérez Fabregat
8320dc75e8 Merge pull request #3002 from kevinchristianson/margin-fix
Fix bad spacing on account settings error page
2019-01-23 16:09:14 +01:00
Pau Pérez Fabregat
77fd0b228e Merge pull request #3360 from brases/wording_order_cofirmation
Fix wording in email template for orders confirmation
2019-01-23 13:35:00 +01:00
Maikel
2064ffe548 Merge pull request #3354 from luisramos0/knapsack
New Knapsack report
2019-01-22 10:58:13 +11:00
Maikel
06af79d1b0 Merge pull request #3339 from Matt-Yorkley/headless4
[Headless Chrome] Fix embedded_shopfront_spec unhandled alert
2019-01-22 10:46:42 +11:00
dependabot[bot]
ea7f62123b Bump jwt from 1.5.6 to 2.1.0
Bumps [jwt](https://github.com/jwt/ruby-jwt) from 1.5.6 to 2.1.0.
- [Release notes](https://github.com/jwt/ruby-jwt/releases)
- [Changelog](https://github.com/jwt/ruby-jwt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jwt/ruby-jwt/compare/v1.5.6...v2.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-21 19:14:44 +00:00
Pau Pérez Fabregat
8b1c1881f7 Merge pull request #3351 from openfoodfoundation/dependabot/bundler/diffy-3.3.0
Bump diffy from 3.1.0 to 3.3.0
2019-01-21 15:08:24 +01:00
Kevin Christianson
6b7273f685 Convert sass files to scss 2019-01-19 22:40:41 -06:00
nozakis
972bfd5e62 Fixed bad margins on the account settings error page. 2019-01-19 16:23:13 -06:00
Brases
3437257515 Fix wording in order confirmation email template
Fixes issue #3063 "Repeated translation in Order Confirmation Screen and Email".
Now "Ready for" (collection time) is not repeated in place of "Collection
details" (collection instructions)
2019-01-19 20:37:21 +00:00
luisramos0
d155bb142c Make proxy order spec a bit more resilient by allowing two secs diff in timestamps 2019-01-19 15:53:05 +00:00
luisramos0
6f7a351ffa Update knapsack report to get build jobs more balanced 2019-01-18 23:46:09 +00:00
dependabot[bot]
990b90009e Bump stripe from 3.3.2 to 4.5.0
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 3.3.2 to 4.5.0.
- [Release notes](https://github.com/stripe/stripe-ruby/releases)
- [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-ruby/compare/v3.3.2...v4.5.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-18 19:17:05 +00:00
Matt-Yorkley
3929689d48 Ensure login via modal is completed 2019-01-18 19:06:42 +00:00
dependabot[bot]
49e3aa5070 Bump daemons from 1.2.2 to 1.3.1
Bumps [daemons](https://github.com/thuehlinger/daemons) from 1.2.2 to 1.3.1.
- [Release notes](https://github.com/thuehlinger/daemons/releases)
- [Changelog](https://github.com/thuehlinger/daemons/blob/master/Releases)
- [Commits](https://github.com/thuehlinger/daemons/compare/v1.2.2...v1.3.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-18 16:52:13 +00:00
dependabot[bot]
1e01cf81ec Bump diffy from 3.1.0 to 3.3.0
Bumps [diffy](https://github.com/samg/diffy) from 3.1.0 to 3.3.0.
- [Release notes](https://github.com/samg/diffy/releases)
- [Changelog](https://github.com/samg/diffy/blob/master/CHANGELOG)
- [Commits](https://github.com/samg/diffy/compare/3.1.0...3.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-18 16:51:42 +00:00
Pau Pérez Fabregat
a95dd98ed6 Merge pull request #2869 from Matt-Yorkley/bi/bulk_invoices
[Bulk Invoice Printing] Bulk invoices
2019-01-18 17:49:34 +01:00
Pau Pérez Fabregat
ee28cc5a29 Merge pull request #3323 from openfoodfoundation/dependabot/bundler/paper_trail-5.2.3
Bump paper_trail from 3.0.9 to 5.2.3
2019-01-18 17:48:56 +01:00
dependabot[bot]
2e993542a7 Bump foundation-rails from 5.5.0.0 to 5.5.2.1
Bumps [foundation-rails](http://foundation.zurb.com) from 5.5.0.0 to 5.5.2.1.

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-17 19:20:09 +00:00
dependabot[bot]
560e52a0ce Bump delayed_job_active_record from 4.1.2 to 4.1.3
Bumps [delayed_job_active_record](https://github.com/collectiveidea/delayed_job_active_record) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/collectiveidea/delayed_job_active_record/releases)
- [Commits](https://github.com/collectiveidea/delayed_job_active_record/compare/v4.1.2...v4.1.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-17 19:17:20 +00:00
dependabot[bot]
adfa6b306c Bump paper_trail from 3.0.9 to 5.2.3
Bumps [paper_trail](https://github.com/airblade/paper_trail) from 3.0.9 to 5.2.3.
- [Release notes](https://github.com/airblade/paper_trail/releases)
- [Changelog](https://github.com/paper-trail-gem/paper_trail/blob/master/CHANGELOG.md)
- [Commits](https://github.com/airblade/paper_trail/compare/v3.0.9...v5.2.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-17 19:08:33 +00:00
Pau Pérez Fabregat
c178478a4f Merge pull request #3346 from luisramos0/headless-chrome
Merge Headless Chrome to master
2019-01-17 20:04:27 +01:00
Pau Pérez Fabregat
29990f25c1 Merge pull request #3325 from mkllnk/2469-fix-async-js-requests
2469 Fix async js requests
2019-01-17 20:03:54 +01:00
Pau Pérez Fabregat
e8dd6e9ce7 Merge pull request #3322 from luisramos0/delete_archive_spec
Delete dead code and unused folders
2019-01-17 20:01:49 +01:00
Luis Ramos
a8998fad79 Merge branch 'master' into headless-chrome 2019-01-17 18:22:25 +00:00
Pau Pérez Fabregat
fd00ad4e94 Merge pull request #3342 from openfoodfoundation/dependabot/bundler/letter_opener-1.7.0
Bump letter_opener from 1.6.0 to 1.7.0
2019-01-17 16:55:46 +01:00
Pau Pérez Fabregat
c51aa0f3b8 Merge pull request #3340 from openfoodfoundation/dependabot/bundler/whenever-0.10.0
Bump whenever from 0.9.2 to 0.10.0
2019-01-17 16:52:21 +01:00
Matt-Yorkley
e7e208061f Assign polling numbers to variables and add comments 2019-01-17 09:37:32 +00:00
Maikel Linke
4d3aed8467 Avoid deprecation warnings of momentjs 2019-01-17 14:49:43 +11:00
Maikel
9322c3f0c8 Merge pull request #3343 from Matt-Yorkley/headless5
[Headless Chrome] Fix datepicker interactions in bulk_order_management_spec
2019-01-17 14:19:00 +11:00
Maikel Linke
520ec5d047 Fix whenever upgrade by declaring dependency
Whenever doesn't depend on ActiveSupport any more. So we can't rely on
YAML being automatically loaded for us. We have to require it.
2019-01-17 10:41:11 +11:00
Maikel
7272ec8738 Merge pull request #3333 from Matt-Yorkley/headless3
[Headless Chrome] Fix shipping method tests
2019-01-17 09:18:12 +11:00
Matt-Yorkley
b3849778fa Fix datepicker interactions in bulk_order_management_spec 2019-01-16 21:51:15 +00:00
dependabot[bot]
d884be54f9 Bump letter_opener from 1.6.0 to 1.7.0
Bumps [letter_opener](https://github.com/ryanb/letter_opener) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/ryanb/letter_opener/releases)
- [Changelog](https://github.com/ryanb/letter_opener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ryanb/letter_opener/compare/v1.6.0...v1.7.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-16 19:22:19 +00:00
dependabot[bot]
483d8893f2 Bump whenever from 0.9.2 to 0.10.0
Bumps [whenever](https://github.com/javan/whenever) from 0.9.2 to 0.10.0.
- [Release notes](https://github.com/javan/whenever/releases)
- [Changelog](https://github.com/javan/whenever/blob/master/CHANGELOG.md)
- [Commits](https://github.com/javan/whenever/compare/v0.9.2...v0.10.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-16 19:18:32 +00:00
Matt-Yorkley
07dff0af7f Check tag js has finished executing before submitting form 2019-01-16 17:46:56 +00:00
Matt-Yorkley
7487a6da3c Fix shipping method tests 2019-01-16 17:17:10 +00:00
Matt-Yorkley
5caa958db0 Merge pull request #3336 from luisramos0/chrome-helper-fix
Fix Gemfile.lock by running bundle install. Adds missing chromedriver-helper.
2019-01-16 17:16:22 +00:00
Pau Pérez Fabregat
e557e06a7b Merge pull request #3324 from openfoodfoundation/dependabot/bundler/spring-1.7.2
Bump spring from 1.1.3 to 1.7.2
2019-01-16 17:50:08 +01:00
luisramos0
41cd8c7ed3 Fix Gemfile.lock by running bundle install. Adds missing chromedriver-helper. 2019-01-16 16:29:55 +00:00
Matt-Yorkley
21bdaf9960 Fix enterprise images spec 2019-01-16 16:24:01 +00:00
Matt-Yorkley
0589516368 Add chromedriver-helper to Gemfile for test and development 2019-01-16 16:24:01 +00:00
Matt-Yorkley
40ccabc2b4 Fix broken product import spec 2019-01-16 16:24:01 +00:00
Maikel Linke
f391eab5b0 Revert "Temporarily move 2 broken specs to pending (shops and producers search by url) due to google maps api changes"
This reverts commit 7dc208fb8c.
2019-01-16 16:24:01 +00:00
Maikel Linke
6a53e5fd3d Avoid alert by waiting until shop loaded 2019-01-16 16:24:01 +00:00
Maikel Linke
dd5bd5b616 Remove js_errors = false from specs because it is not available in Selenium ChromeDriver
If the js errors this line was hidding become a problem we will need to address them
2019-01-16 16:24:01 +00:00
luisramos0
fce56776f6 Make embedded_shopfronts_spec work with selenium 2019-01-16 16:24:01 +00:00
luisramos0
5fb4faac91 Make features/admin/subscriptions_spec and shopworkflow work with selenium
Also, remove a test support method, dead code
2019-01-16 16:24:01 +00:00
Maikel Linke
e49eb42af6 Make Chrome accepting alerts 2019-01-16 16:21:30 +00:00
Maikel Linke
843ec2c08f Wait for table rows before testing them
Unfortunately, the exact table row matcher doesn't wait correctly for
changes on the page. Waiting correctly would mean to assemble a very
complicated xpath similar to this gem:

https://github.com/jnicklas/capybara_table
2019-01-16 16:21:30 +00:00
Maikel Linke
1407ae7778 Make TableMatcher match exactly, not part of row
Reverts dbf3a7aaaf9d458f99e14983ca9db2d4cbe4b564.

The reverted commit tried to avoid a 30 second delay by using
have_selector. While that was successful in reducing test time, it made
the matcher find rows that where not exactly the wanted row, but contained
text of the wanted row. This wasn't a problem until we experimented with
Chrome as test browser returns text on select boxes.

This commit makes the matcher precise again. We still have to deal with
the 30 second delay.
2019-01-16 16:21:30 +00:00
Rob Harrington
ef68bd1b43 Replace unnecessary perform_and_ensure* type helpers with standard actions and expectations 2019-01-16 16:21:30 +00:00
Rob Harrington
98f4ae9b60 Change screen size back to large after authentication_spec 2019-01-16 16:21:30 +00:00
Rob Harrington
a988fad2db Update orders_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
98a5b40aec Ensure multiligual switcher specs run in large screen 2019-01-16 16:21:30 +00:00
Rob Harrington
3a781049ed Update orders_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
3b40ede0b8 Fix table row matchers
The matcher was silently failing on the check step (adding ~30 seconds to out specs each time it was used!), so I changed it to fail if the basic step does not succeed
2019-01-16 16:21:30 +00:00
Rob Harrington
56c07aac5c Don't run ticket printing spec 2019-01-16 16:21:30 +00:00
Rob Harrington
4951863e9b Update enterprises_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
eccf874f03 Update shopping_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
2b48b4ee18 Update cart_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
bba8b2020c Replace use of 'trigger' in ui_component helper 2019-01-16 16:21:30 +00:00
Rob Harrington
23fa57ff6d Update multilingual_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
bbaf6359f3 Update shopping_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
1923c0dbc6 Update enterprise_fees_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
c2432fab0b Use all_options_absent method instead of poorly written no_options_present
SAVES 30 SECONDS FOR EVERY SPEC THAT IS IT USED IN!
2019-01-16 16:21:30 +00:00
Rob Harrington
3e90f9aa1d Update customers_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
189856a92a Reimplement resize helper methods to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
1bad08c1c0 Update checkout_workflow and spec_helper to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
3ab7a3d62b Update order_cycles_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
50a8554b55 Update enterprises_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
69e44bdeb3 Update enterprise_roles_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
5ae33747ea Update enterprise_relationships_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
7dc792b6fe Update enterprise_groups_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
e97f5e36a6 Update bulk_order_management_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
2ece6bfb49 Update subscriptions_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
8416af4995 Update variants_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
8413c5f60a Update variant_overrides_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
5c268e9359 Update schedules_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
708e308b7c Update products_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
c6a383aafd Update bulk_product_update_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
cc55f59b00 Update tag_rules_spec to work with Selenium 2019-01-16 16:21:30 +00:00
Rob Harrington
118d26b2ff Add aynchronous select2 search helper
select2_search from spree times out after 1 second, so this new method just waits for a result to be returned before attempting to select it
2019-01-16 16:21:30 +00:00
Rob Harrington
70502a7a32 Switch to using selenium as js driver for capybara specs
PhantomJS is no longer being maintained
2019-01-16 16:21:30 +00:00
Rob Harrington
6608655e9a Use headless chrome for karma specs instead of PhantomJS
PhantomJS is no longer being maintained
2019-01-16 16:21:30 +00:00
Pau Pérez Fabregat
d2325fc7dd Merge pull request #3230 from luisramos0/stock_levels
3222 Improve stock levels calculation code on cart populate and add specs to test handling of variant overrides
2019-01-16 12:54:25 +01:00
Pau Pérez Fabregat
5bb327efbd Merge pull request #3234 from openfoodfoundation/dependabot/bundler/oauth2-1.4.1
Bump oauth2 from 1.2.0 to 1.4.1
2019-01-16 12:33:39 +01:00
Maikel
54311c2d1b Merge pull request #3304 from HugsDaniel/3288-3291-translation-issues
Add I18n keys for order state and order firstname and lastname filters
2019-01-16 09:43:28 +11:00
Maikel
2c197d40bb Merge pull request #3326 from mkllnk/cleanup-specs
Cleanup specs
2019-01-16 09:23:06 +11:00
luisramos0
ea61e415e1 Add bugsnag notifications to detect potential dead code scenarios in variants_stock_levels and cart_service 2019-01-15 13:42:51 +00:00
luisramos0
d926f7c776 Reorganize and improve cart controller spec 2019-01-15 13:42:51 +00:00
luisramos0
aa603c9a84 Make rubocop happy on cart controller, cart service and stock levels service 2019-01-15 13:42:51 +00:00
luisramos0
b0449be302 Add spec to test cart controller handling of variant overrides on cart populate 2019-01-15 13:38:58 +00:00
luisramos0
c0473a4505 Extract variants_stock_levels from cart_controller and refactor some names 2019-01-15 13:38:58 +00:00
Maikel
e56915e65a Merge pull request #3303 from openfoodfoundation/transifex
Transifex
2019-01-15 17:19:21 +11:00
Maikel Linke
5a5db3c458 Fix state of RequestMonitor
`@loading` was set to false when the request with the last id finished.
But another request started earlier (having a lower id) could take
longer. `@loading` was set to false even though these long requests were
still active.
2019-01-15 15:45:49 +11:00
Maikel Linke
ca9673f562 Fix Dereferencer service
It failed when `object[attr]` was `undefined` instead of `null`.
2019-01-15 15:43:00 +11:00
Maikel
8ba0e3b474 Merge pull request #3302 from mkllnk/74-bundler-version
Add script to install required bundler version
2019-01-15 09:36:18 +11:00
dependabot[bot]
22c225968a Bump spring from 1.1.3 to 1.7.2
Bumps [spring](https://github.com/rails/spring) from 1.1.3 to 1.7.2.
- [Release notes](https://github.com/rails/spring/releases)
- [Changelog](https://github.com/rails/spring/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/spring/compare/v1.1.3...v1.7.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-14 19:18:25 +00:00
luisramos0
90240f1802 Delete unused folders under /vendor 2019-01-14 14:38:51 +00:00
luisramos0
497974db74 Delete outdated archived version of checkout spec 2019-01-14 14:32:51 +00:00
luisramos0
e2c966244a Delete /doc.
The list of specs is outdated and the images were transfered to the wiki itself

The project docs should be in the wiki
2019-01-14 14:31:31 +00:00
Pau Pérez Fabregat
ccc0a2cf96 Merge pull request #3280 from openfoodfoundation/dependabot/bundler/uglifier-4.1.20
Bump uglifier from 4.1.19 to 4.1.20
2019-01-11 19:46:04 +01:00
Maikel Linke
4abacb3691 Remove unused spec helpers
They all seem to have been used in the past. People forgot to remove
them after removing the using spec code.
2019-01-11 18:04:24 +11:00
Maikel Linke
e89a836e72 Remove forgotten code from spec
Commit e4ebeb8a29 forgot to remove this
code.
2019-01-11 18:04:24 +11:00
Maikel Linke
223982f571 Prepare spec for Chrome testing 2019-01-11 18:04:24 +11:00
Maikel Linke
cbdda54989 DRY specs with new helper 2019-01-11 18:04:24 +11:00
Maikel
4920782742 Merge pull request #3072 from luisramos0/2-0-calc-line-items-for-take-2
Fix bug on calculator_decorator line_items_for where input is line_item with a nil order
2019-01-11 14:49:25 +11:00
dependabot[bot]
1548c7c25a Bump oauth2 from 1.2.0 to 1.4.1
Bumps [oauth2](https://github.com/oauth-xx/oauth2) from 1.2.0 to 1.4.1.
- [Release notes](https://github.com/oauth-xx/oauth2/releases)
- [Changelog](https://github.com/oauth-xx/oauth2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/oauth-xx/oauth2/compare/v1.2.0...v1.4.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-10 23:46:45 +00:00
dependabot[bot]
7f09112d7b Bump uglifier from 4.1.19 to 4.1.20
Bumps [uglifier](https://github.com/lautis/uglifier) from 4.1.19 to 4.1.20.
- [Release notes](https://github.com/lautis/uglifier/releases)
- [Changelog](https://github.com/lautis/uglifier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/lautis/uglifier/compare/v4.1.19...v4.1.20)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-10 23:45:22 +00:00
Maikel
ab14b73e17 Merge pull request #3211 from openfoodfoundation/dependabot/bundler/blockenspiel-0.5.0
Bump blockenspiel from 0.4.5 to 0.5.0
2019-01-11 10:42:40 +11:00
Maikel
fff054efc1 Merge pull request #3169 from luisramos0/hubPermissions
Add guard clause on variant overrides filter in case hub id is not present in the hubPermissions
2019-01-11 10:41:57 +11:00
Maikel
6c3d769121 Merge pull request #3229 from mkllnk/3127-tax-rates-report
3127 More robust tax rates report
2019-01-11 10:41:12 +11:00
Maikel
935e233605 Merge pull request #3244 from luisramos0/ruby-racer
Revert to the ruby racer
2019-01-11 10:40:02 +11:00
Hugo Daniel
026fe55f1d Add I18n keys for order state and order firstname and lastname filters 2019-01-10 15:32:23 +01:00
Transifex-Openfoodnetwork
e70b8c03ce Updating translations for config/locales/nb.yml 2019-01-10 22:18:58 +11:00
Matt-Yorkley
e624faaacb Add 'please wait' message to bulk invoice modal 2019-01-10 09:57:06 +00:00
Matt-Yorkley
0e478ff501 Increase polling to 150 seconds maximum before showing error message. 2019-01-10 09:57:06 +00:00
Matt-Yorkley
66ac61f591 Rename background processing method 2019-01-10 09:57:06 +00:00
Matt-Yorkley
4f9f8adcd6 Add Service and remove Job 2019-01-10 09:57:06 +00:00
Matt-Yorkley
003014daf8 Extract invoice methods from ordersCtrl 2019-01-10 09:57:06 +00:00
Matt-Yorkley
bb814f91ef Extract timeout to named function 2019-01-10 09:57:06 +00:00
Matt-Yorkley
6b6a41cfbc Update CSS 2019-01-10 09:57:06 +00:00
Matt-Yorkley
638dc6eada Add polling and show action 2019-01-10 09:57:06 +00:00
Matt-Yorkley
b0f75162ac Add delayed job for create bulk invoice 2019-01-10 09:57:06 +00:00
Matt-Yorkley
7d82020657 Move bulk invoice to new RESTful route 2019-01-10 09:57:06 +00:00
Matt-Yorkley
4a88fb0626 Use simpler array for selected ids 2019-01-10 09:57:06 +00:00
Matt-Yorkley
5279210254 Improve invoice order querying 2019-01-10 09:57:06 +00:00
Matt-Yorkley
f3585befff Fix customer missing from some order records - guest checkout? 2019-01-10 09:57:06 +00:00
Matt-Yorkley
24207053e4 Reset selected orders on filter change 2019-01-10 09:57:06 +00:00
Matt-Yorkley
5cc8bad42b Improve UI layout for select all option 2019-01-10 09:57:06 +00:00
Matt-Yorkley
42cf96e635 Disable button unless orders selected 2019-01-10 09:57:06 +00:00
Matt-Yorkley
4ec0f0ff73 Add bulk invoices printing 2019-01-10 09:57:06 +00:00
Matt-Yorkley
96d530b473 Tidy up invoice template selection 2019-01-10 09:57:06 +00:00
Matt-Yorkley
9a71236abd Add combine_pdf gem 2019-01-10 09:57:06 +00:00
Matt-Yorkley
f263ef7dc0 Add selectable checkboxes 2019-01-10 09:57:06 +00:00
Maikel
4f5bb96484 Merge pull request #3300 from openfoodfoundation/transifex
Transifex
2019-01-10 17:52:28 +11:00
Maikel Linke
199dee3f64 Use install-bundler in setup script 2019-01-10 17:44:13 +11:00
Maikel Linke
dafa433788 Add script to install required bundler version
The newest version of bundler is not compatible with our current version
of Ruby. This script helps to install the bundler version defined in
Gemfile.lock.
2019-01-10 17:44:09 +11:00
Transifex-Openfoodnetwork
15e197b3b0 Updating translations for config/locales/en_GB.yml 2019-01-10 07:31:46 +11:00
Pau Pérez Fabregat
399cc5f796 Merge pull request #3224 from alvaro-chalar/footer-message
Add custom footer message in reports section
2019-01-09 16:01:02 +01:00
Pau Pérez Fabregat
1815a2116d Merge pull request #3257 from coopdevs/refactor-enterprise-controller-shop-injection
Refactor to reveal how we load enterprises in shop
2019-01-09 13:21:56 +01:00
Maikel
abe4f78e5c Merge pull request #2988 from Matt-Yorkley/pi/utf8
Pi/utf8
2019-01-09 15:39:05 +11:00
Pau Pérez Fabregat
57267ab4a4 Merge pull request #3297 from openfoodfoundation/transifex
Transifex
2019-01-08 22:45:55 +01:00
Transifex-Openfoodnetwork
f05f4ce0b1 Updating translations for config/locales/en_GB.yml 2019-01-09 07:06:27 +11:00
Pau Pérez Fabregat
bd10400457 Merge pull request #3295 from coopdevs/pull-translations
Update all locales with the latest Transifex translations
2019-01-08 17:58:51 +01:00
Pau Perez
f1f1ab9daf Update all locales with the latest Transifex translations 2019-01-08 17:17:35 +01:00
luisramos0
364f9f9abd Improve variable names in cart spec 2019-01-07 11:40:42 +00:00
Pau Pérez Fabregat
34876cc255 Merge pull request #3275 from openfoodfoundation/transifex
Transifex
2019-01-07 11:43:06 +01:00
Pau Pérez Fabregat
ed8f719769 Merge pull request #3245 from luisramos0/spring
Add spring, a rails preloader alternative to zeus, to our gemfile
2019-01-07 11:07:34 +01:00
luisramos0
2893f1c141 Add test to cover weight calculation bug #3072 2019-01-07 01:18:40 +00:00
Maikel Linke
d2ba305ce6 Fix context data for tax rate finder spec
The spec was accidentally finding an exact tax rate match. The new test
data provides only close matches to choose from.

The naming of variables has been simplified as well.
2019-01-04 18:31:46 +11:00
Maikel Linke
a8ccb9b818 Explain why we look for the closest tax rate of a fee 2019-01-04 17:24:45 +11:00
Maikel
1024fc1f34 Merge pull request #3273 from coopdevs/fix-fr-BE-link
Fix menu_1_url translation for fr_BE
2019-01-04 09:52:44 +11:00
Transifex-Openfoodnetwork
9da7ff5698 Updating translations for config/locales/fr.yml 2019-01-04 02:15:57 +11:00
Pau Pérez Fabregat
9f0c6a6bac Merge pull request #3251 from openfoodfoundation/dependabot/bundler/webmock-3.5.1
Bump webmock from 3.4.2 to 3.5.1
2019-01-03 11:18:59 +01:00
Pau Perez
edffbd72fe Update rubocop_manual_todo 2019-01-03 11:17:10 +01:00
Pau Perez
ddf916814f Reduce complexity of EnterprisesController#shop
As asked by Rubocop.
2019-01-03 11:17:10 +01:00
Pau Perez
e3edb51d3e Update rubocop_todo 2019-01-03 11:17:10 +01:00
Pau Perez
51da607ab1 Fix too long line 2019-01-03 11:17:10 +01:00
Pau Perez
46760ce28c Do not double-render when there is no stock 2019-01-03 11:17:10 +01:00
Pau Perez
cca15e75a6 Refactor to reveal how we load enterprises in shop
By sticking to Rails conventions we make it more obvious how (badly) we
are loading enterprises in EnterprisesController#shop and shed some
light on the obscure InjectionHelper.

This will also make it easier to improve its performance in the future as
it's among the top offenders. See https://www.skylight.io/app/applications/ibo3NOqCYMnq/1545851520/1d/endpoints/EnterprisesController%23shop?responseType=html
2019-01-03 11:17:10 +01:00
Maikel
ac76580932 Merge pull request #3274 from openfoodfoundation/transifex
Transifex
2019-01-03 11:35:47 +11:00
Transifex-Openfoodnetwork
89bf819b37 Updating translations for config/locales/en_US.yml 2019-01-03 00:33:56 +11:00
Pau Perez
112080d8c6 Fix menu_1_url translation for fr_BE
The first menu item in OFN BE is currently broken.
2019-01-02 13:10:33 +01:00
dependabot[bot]
8170937708 Bump webmock from 3.4.2 to 3.5.1
Bumps [webmock](https://github.com/bblimke/webmock) from 3.4.2 to 3.5.1.
- [Release notes](https://github.com/bblimke/webmock/releases)
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bblimke/webmock/compare/v3.4.2...v3.5.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 19:16:35 +00:00
Pau Pérez Fabregat
d88be202a6 Merge pull request #3223 from kristinalim/fix-rubocop_block_length_ignore_rake_routes_dsl
Ignore Rake and routes DSL methods in Rubocop BlockLength
2018-12-27 17:14:57 +01:00
Pau Pérez Fabregat
755eca5abe Merge pull request #3236 from openfoodfoundation/dependabot/bundler/guard-2.15.0
Bump guard from 2.14.1 to 2.15.0
2018-12-27 17:14:32 +01:00
Alvaro Chalar
6dccbeca70 Add custom footer message in reports section 2018-12-27 12:22:48 +01:00
luisramos0
fd21914a15 Add spring, a rails preloader alternative to zeus, to our gemfile
Add /bin to gitignore, bin is used by spring, rails preloader
2018-12-26 13:36:48 +00:00
luisramos0
4eaaeb37c9 Reverting to therubyracer because mini racer is causing trouble to some developers using osx.
We will probably be able to move back to the faster mini racer when we upgrade to newer rails versions
2018-12-26 13:07:52 +00:00
Pau Pérez Fabregat
1ab50798fe Merge pull request #3189 from luisramos0/3043-i18n-emails
Make all mailers use appropriate locale when sending emails
2018-12-24 14:59:04 +01:00
albarnaz
5d515712ed Fix for instagram links (#2849)
* Add new attribute instagram_placeholder to local yml

* Add placeholder to instagram link input

* Add migration to fix wrong instagram links

* Add new attribute facebook_placeholder to local yml

* Add placeholder to facebook link input

* Add new attribute linkedin_placeholder to local yml

* Add placeholder to linkedin link input

* Change each for find_each in migration

* Add new attribute instagram_placeholder to local yml

* Add migration to fix wrong instagram links

* Add new attribute linkedin_placeholder to local yml

* Add placeholder to linkedin link input
2018-12-21 14:42:28 +11:00
Maikel
9557457ec2 Merge pull request #3088 from kristinalim/cleanup-test_scripts
Run RSpec tests in custom engines (and some fixes, cleanup)
2018-12-21 14:32:56 +11:00
dependabot[bot]
e680559169 Bump guard from 2.14.1 to 2.15.0
Bumps [guard](https://github.com/guard/guard) from 2.14.1 to 2.15.0.
- [Release notes](https://github.com/guard/guard/releases)
- [Changelog](https://github.com/guard/guard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/guard/guard/compare/v2.14.1...v2.15.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-20 19:18:59 +00:00
Pau Pérez Fabregat
e61b7139cc Merge pull request #3212 from openfoodfoundation/dependabot/bundler/wkhtmltopdf-binary-0.12.4
Bump wkhtmltopdf-binary from 0.12.3.1 to 0.12.4
2018-12-20 16:43:24 +01:00
Pau Pérez Fabregat
0876986215 Merge pull request #3227 from openfoodfoundation/dependabot/bundler/momentjs-rails-2.20.1
Bump momentjs-rails from 2.5.1 to 2.20.1
2018-12-20 16:36:40 +01:00
dependabot[bot]
aac8706f9a Bump blockenspiel from 0.4.5 to 0.5.0
Bumps [blockenspiel](https://github.com/dazuma/blockenspiel) from 0.4.5 to 0.5.0.
- [Release notes](https://github.com/dazuma/blockenspiel/releases)
- [Changelog](https://github.com/dazuma/blockenspiel/blob/master/History.rdoc)
- [Commits](https://github.com/dazuma/blockenspiel/commits/v0.5.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-20 08:35:01 +00:00
Pau Pérez Fabregat
2a759a9c0d Merge pull request #3196 from openfoodfoundation/dependabot/bundler/angularjs-file-upload-rails-2.4.1
Bump angularjs-file-upload-rails from 1.1.6 to 2.4.1
2018-12-20 09:31:49 +01:00
Maikel
073f88b1c2 Merge pull request #3198 from kristinalim/fix-variant_override_stock_settings_validation
Validation and others for keeping variant override "On Demand" and "Count on Hand" compatible
2018-12-20 14:05:20 +11:00
Kristina Lim
4adae0a1e8 Disable Knapsack when running engine RSpec tests 2018-12-19 17:50:52 +08:00
Kristina Lim
a460e9d35f Allow disabling Knapsack when running RSpec tests 2018-12-19 17:50:29 +08:00
Kristina Lim
abcb71f8b3 Document running app engine RSpec tests 2018-12-19 17:11:03 +08:00
Kristina Lim
12780b722e Make Travis CI run RSpec tests in app engines 2018-12-19 17:08:27 +08:00
Kristina Lim
74ea1eee6b Add description for Rake tasks 2018-12-19 17:08:24 +08:00
Kristina Lim
571ad37c3e Add Rake task openfoodnetwork:specs:engines:rspec 2018-12-19 17:06:33 +08:00
Kristina Lim
f7e03ca60e Add Rake tasks openfoodnetwork:specs:engines:NAME:rspec
The task name follows the directory name under engines/. For example,
for the Web engine in engines/web, run:

    bundle exec rake openfoodnetwork:specs:engines:web:rspec
2018-12-19 17:02:19 +08:00
Maikel Linke
a978e992bf Remove tax_rates shortcut from adjustment
Becoming less dependent on Spree, using our own namespace, keeping
decorators small.
2018-12-19 14:42:38 +11:00
Maikel Linke
fc1b182275 Simplify method complexity and comply with rubocop 2018-12-19 14:31:29 +11:00
Maikel Linke
3169a384ba Find approximate tax rate if no other is found
There are several cases in which a tax rate is not associated with an
adjustment. We find the closest one for reporting here. It is not a good
solution, but a workaround introduced for reporting:
https://github.com/openfoodfoundation/openfoodnetwork/pull/1496
2018-12-19 14:31:29 +11:00
Maikel Linke
a341561446 Move tax rate finding into service and spec it
The `#tax_rates` method is actually not present in Spree. We encapsulate
the logic in this commit and enable better unit testing. The new tests
cover a current bug: https://github.com/openfoodfoundation/openfoodnetwork/issues/3127
2018-12-19 14:31:29 +11:00
Maikel
84f2f9af3c Merge pull request #3156 from HugsDaniel/3121-deface-payment-methods-new
[Defacepocalypse] De-deface payment methods new and form
2018-12-19 09:44:57 +11:00
dependabot[bot]
6de1844b7c Bump momentjs-rails from 2.5.1 to 2.20.1
Bumps [momentjs-rails](https://github.com/derekprior/momentjs-rails) from 2.5.1 to 2.20.1.
- [Release notes](https://github.com/derekprior/momentjs-rails/releases)
- [Changelog](https://github.com/derekprior/momentjs-rails/blob/master/news.md)
- [Commits](https://github.com/derekprior/momentjs-rails/compare/v2.5.1...v2.20.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-18 19:14:54 +00:00
luisramos0
5e960512ac Set user locale on user registrations #create
This is done so that user.locale is used in the first confirmation email. This also stores user.locale in the DB from registration.
2018-12-18 15:30:01 +00:00
luisramos0
a9222665b8 Refactor user registrations controller, early return to reduce indentation 2018-12-18 15:26:49 +00:00
Maikel
f36c045425 Merge pull request #3213 from kristinalim/fix-rubocop_block_length_ignore_it
Ignore `it` in Rubocop BlockLength
2018-12-18 11:42:14 +11:00
Matt-Yorkley
d34b8c52b8 Update all locales with the latest Transifex translations 2018-12-17 11:17:54 +00:00
Pau Pérez Fabregat
54775f6b6a Merge pull request #3221 from zvkemp/skylight-1.7.2
update Skylight to 1.7.2
2018-12-17 10:44:16 +01:00
Pau Pérez Fabregat
1876ec42dc Merge pull request #3201 from kevinchristianson/add-missing-stars
Add missing 'required field' stars in new product form
2018-12-17 10:36:51 +01:00
Pau Pérez Fabregat
554d650b8c Merge pull request #3176 from kevinchristianson/button-translation-fix
Fix untranslated buttons at image step of registration modal
2018-12-17 10:36:07 +01:00
Pau Pérez Fabregat
2deffb9c9f Merge pull request #3076 from Matt-Yorkley/orders_checkboxes
Fix checkbox values on orders page
2018-12-17 10:35:46 +01:00
Kristina Lim
216c598e74 Ignore more methods in Metrics/BlockLength cop
Ignore these additional methods:

* collection
* member
* namespace
* resource
* resources
2018-12-17 05:21:20 +08:00
Kristina Lim
fb5a9356dc Fix spec_helper.rb of web engine
This fixes the tests of the web engine when running the following from
its root: bundle exec rspec

An engine is meant to have some independence from the main application,
and its tests should be run independently.

This should be using the engine's own dummy application, actually, or
the dummy application of a dependency.
2018-12-15 16:11:15 +08:00
Kristina Lim
93940ced3a Remove outdated comment recommending knapsack
We are already using this.
2018-12-15 16:11:12 +08:00
zvkemp
d3d43c8808 update Skylight to 1.7.2 2018-12-14 12:25:41 -08:00
Pau Pérez Fabregat
fe0c56c800 Merge pull request #3174 from kevinchristianson/footer-url-fix
Fix broken registration link in footer
2018-12-14 15:42:08 +01:00
dependabot[bot]
2f19b37b54 Bump angularjs-file-upload-rails from 1.1.6 to 2.4.1
Bumps [angularjs-file-upload-rails](https://github.com/marthyn/angularjs-file-upload-rails) from 1.1.6 to 2.4.1.
- [Release notes](https://github.com/marthyn/angularjs-file-upload-rails/releases)
- [Commits](https://github.com/marthyn/angularjs-file-upload-rails/commits/v2.4.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-14 14:29:42 +00:00
Pau Pérez Fabregat
34a42cc592 Merge pull request #3181 from luisramos0/roadie-rails-upgrade
Bump roadie-rails from 1.0.3 to 1.1.1
2018-12-14 15:26:25 +01:00
Kristina Lim
d0d10eba4b Ignore it method in Rubocop BlockLength 2018-12-14 17:44:19 +08:00
Kristina Lim
77a6562762 Make DB migration generate summary by distributor 2018-12-14 13:02:43 +08:00
Kristina Lim
a6664d0ac6 Move report generated by migration to subdirectory
This is in preparation of an upcoming change to split the main CSV file
by distributor.
2018-12-14 13:00:42 +08:00
Kristina Lim
91e5a523f0 Add /reports/ to .gitignore but ignore README
Using the first slash to make sure that other reports/ directories are
not ignored.
2018-12-14 10:25:23 +08:00
Kristina Lim
d859939c79 Add README.md to reports/ directory 2018-12-14 10:24:26 +08:00
Kristina Lim
6458127892 Add undo logic for DB migration script 2018-12-14 10:09:09 +08:00
Kristina Lim
5a98acd101 Log changes from DB migration to CSV file 2018-12-14 10:09:09 +08:00
Kristina Lim
842a11b564 Refactor DB migration script 2018-12-14 10:09:08 +08:00
dependabot[bot]
2ecec93514 Bump wkhtmltopdf-binary from 0.12.3.1 to 0.12.4
Bumps [wkhtmltopdf-binary](https://github.com/zakird/wkhtmltopdf_binary_gem) from 0.12.3.1 to 0.12.4.
- [Release notes](https://github.com/zakird/wkhtmltopdf_binary_gem/releases)
- [Changelog](https://github.com/zakird/wkhtmltopdf_binary_gem/blob/master/CHANGELOG)
- [Commits](https://github.com/zakird/wkhtmltopdf_binary_gem/compare/0.12.3.1...0.12.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-13 19:19:36 +00:00
Pau Pérez Fabregat
2eb6d0a047 Merge pull request #3185 from openfoodfoundation/dependabot/bundler/oj-3.7.4
Bump oj from 3.6.10 to 3.7.4
2018-12-13 18:10:55 +01:00
Kristina Lim
aa92dd8771 Declare VariantOverride in migration for safe use 2018-12-13 23:29:05 +08:00
Kristina Lim
9e3332ba2a Rename DB migration file 2018-12-13 23:25:48 +08:00
Maikel
eb016c0471 Merge pull request #3145 from openfoodfoundation/dependabot/bundler/i18n-js-3.1.0
Bump i18n-js from 3.0.11 to 3.1.0
2018-12-13 10:58:22 +11:00
Pau Pérez Fabregat
d317603872 Merge pull request #3187 from openfoodfoundation/dependabot/bundler/rspec-rails-3.8.1
Bump rspec-rails from 3.7.2 to 3.8.1
2018-12-12 17:14:05 +01:00
Pau Pérez Fabregat
64e41712c6 Merge pull request #3130 from coopdevs/extract-restart-checkout
Extract restart checkout
2018-12-12 17:12:53 +01:00
luisramos0
e274442d77 Cover i18nhelper.valid_locale and user mailer with tests related to localized emails 2018-12-11 11:16:50 +00:00
haseleyi
835617159e Add missing 'required field' stars in new product form 2018-12-10 18:02:39 -08:00
Matt-Yorkley
0c5ac99e0f Fix multiple results with 'inventory_items_shipment_id_null' ransack query
The q['inventory_items_shipment_id_null'] search element was generating duplicates where there were multiple line items on an order that were ready to be shipped, with id = null
2018-12-10 20:48:53 +00:00
Matt-Yorkley
e711c5ed03 Add spec for search filters 2018-12-10 20:48:53 +00:00
Matt-Yorkley
d48774e3a2 Add comment 2018-12-10 20:48:53 +00:00
Matt-Yorkley
997169b974 Fix checkbox values on orders page 2018-12-10 20:48:53 +00:00
luisramos0
38ff99717a Fix bug on calculator_decorator line_items_for where input is line_item with an nil order. Adapted line_items_for so that weight_calculator.line_items_for could be removed. 2018-12-09 19:37:11 +00:00
Kristina Lim
df51d137dc Update some code style for product import 2018-12-10 03:30:52 +08:00
Kristina Lim
cec50e81f5 Make product import set correct VO stock settings 2018-12-10 03:30:46 +08:00
Kristina Lim
0de829017a Refactor finding or initializing VO for product import 2018-12-10 03:30:39 +08:00
Kristina Lim
c873a7b8e3 Move stock settings override validation to concern 2018-12-09 23:29:36 +08:00
Kristina Lim
1bfdb708c1 Add app/models/concerns to autoload path 2018-12-09 23:29:36 +08:00
Kristina Lim
d67b3faf01 Address affected specs from new VO validations 2018-12-09 21:48:08 +08:00
Kristina Lim
34313c94ca Make reset stock settings for VO force limited stock 2018-12-09 21:47:05 +08:00
Kristina Lim
ad35ea1102 Add factory stock traits for variant overrides 2018-12-09 21:47:05 +08:00
Kristina Lim
210a11783c Test that saving invalid variant override provides error 2018-12-09 21:43:57 +08:00
Kristina Lim
4c0c0bbfd0 Simplify stock configuration in existing variant overrides 2018-12-07 14:40:15 +08:00
Kristina Lim
83b6973bc2 Require compatible VO on_demand and count_on_hand 2018-12-07 14:39:36 +08:00
Maikel
046ba14da4 Merge pull request #3191 from openfoodfoundation/dependabot/bundler/knapsack-1.17.1
Bump knapsack from 1.16.0 to 1.17.1
2018-12-07 15:18:25 +11:00
haseleyi
3f6e96dd5d Fix comment 2018-12-06 14:07:45 -08:00
haseleyi
4a0744dd94 Add comment to explain hard-coded link 2018-12-06 11:49:39 -08:00
dependabot[bot]
6ae2df7b92 Bump knapsack from 1.16.0 to 1.17.1
Bumps [knapsack](https://github.com/ArturT/knapsack) from 1.16.0 to 1.17.1.
- [Release notes](https://github.com/ArturT/knapsack/releases)
- [Changelog](https://github.com/ArturT/knapsack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ArturT/knapsack/compare/v1.16.0...v1.17.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-06 19:16:09 +00:00
luisramos0
b9b91231ae Fix rubocop issues in mailers 2018-12-06 14:18:24 +00:00
luisramos0
0f442a911e Improve I18nHelper.valid_locale to handle empty objects 2018-12-06 12:48:48 +00:00
luisramos0
feea499298 Make all mailers use appropriate locale when sending emails 2018-12-06 11:45:44 +00:00
Kristina Lim
71db9f5289 Import CSS variables in admin/components/input 2018-12-06 14:08:06 +08:00
luisramos0
c33ca508f7 Add guard clause on variant overrides filter in case hub id is not present in the hubPermissions 2018-12-06 15:35:44 +11:00
Maikel
3a3c9f3847 Merge pull request #3177 from coopdevs/dont-clean-db-twice-in-feature-specs
Do not clean DB twice on feature specs
2018-12-06 12:36:34 +11:00
haseleyi
75277e92e4 Lazy-load the translations for images step of registration 2018-12-05 11:36:27 -08:00
dependabot[bot]
727cc9d578 Bump rspec-rails from 3.7.2 to 3.8.1
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 3.7.2 to 3.8.1.
- [Release notes](https://github.com/rspec/rspec-rails/releases)
- [Changelog](https://github.com/rspec/rspec-rails/blob/master/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v3.7.2...v3.8.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-05 19:19:50 +00:00
dependabot[bot]
ebff8be996 Bump oj from 3.6.10 to 3.7.4
Bumps [oj](https://github.com/ohler55/oj) from 3.6.10 to 3.7.4.
- [Release notes](https://github.com/ohler55/oj/releases)
- [Changelog](https://github.com/ohler55/oj/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ohler55/oj/compare/v3.6.10...v3.7.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-05 19:16:55 +00:00
luisramos0
bbc61b4eda Bump roadie-rails to 1.1.1 2018-12-05 15:11:45 +00:00
Pau Pérez Fabregat
1052d98255 Merge pull request #3175 from haseleyi/patch-1
Fix link to Mac setup guide in Getting Started
2018-12-05 12:52:08 +01:00
Kristina Lim
842a8e3654 Move null option for VO use_producer_settings to JS 2018-12-05 17:40:32 +08:00
Kristina Lim
802e3bb447 Refactor choosing VO on_demand in feature specs
We are still using the Rails view I18n scope for :use_producer_settings.
Angular requires this replacement of the default blank option, which we
use for nil on_demand, to be in the template itself.

If we eventually move this template to a JS template, we can move it to
the same I18n scope as the :yes and :no options.
2018-12-05 17:40:31 +08:00
Kristina Lim
d8908bdf4b Remove unused translation keys js.yes and js.no 2018-12-05 17:40:31 +08:00
Kristina Lim
47d51ca525 Prefer guard clause in updateCountOnHand for VOs 2018-12-05 17:40:31 +08:00
Kristina Lim
34c34b94d1 Describe method countOnHandPlaceholder for VOs 2018-12-05 17:40:30 +08:00
Kristina Lim
cff4eb0005 Improve and simplify VO count on hand suggestions
Set variant override count_on_hand in UI to variant count_on_hand value
if on_demand is changed and both specify limited stock.
2018-12-05 17:40:30 +08:00
Kristina Lim
4f2d96d763 Use correct placeholders for VO count_on_hand 2018-12-05 17:40:29 +08:00
Kristina Lim
f5dc03e118 Style disabled text fields in admin pages 2018-12-05 17:40:29 +08:00
Kristina Lim
09b9f968b7 Make VO count on hand readonly unless limited stock 2018-12-05 17:40:29 +08:00
Kristina Lim
cc003c99d5 Ensure in UI compatible VO count and on demand 2018-12-05 17:40:28 +08:00
Kristina Lim
a32bb0445f Change translation for variant override use_producer_settings 2018-12-05 17:40:28 +08:00
Kristina Lim
7ae555cd9c Translate variant override on_demand yes and no 2018-12-05 17:40:27 +08:00
Kristina Lim
4b3198a2b4 Allow reset of "on demand" for variant overrides
Change the UI control for "on demand" in the Inventory page from a
checkbox to a SELECT field with three options: nil, true, and false.

This resolves the following issues:
* There is no way to tell between nil and false - both are represented
by an unticked checkbox.
* There is no way to go back to nil.
2018-12-05 17:40:24 +08:00
Pau Perez
25567d6bd6 Do not clean DB twice on feature specs
It turns out that we were executing `DatabaseCleaner.clean` on two
`after(:each)` blocks. One for all specs and another one for `js: true`
specs. As a result feature specs were hitting both which slows them down
considerably.

On my machine this changes consistently saves 2sec on
`spec/features/consumer/shops_spec.rb` but chances are it has an
accumulative effect when run on the whole test suite.
2018-12-05 09:58:14 +01:00
Pau Pérez Fabregat
3b56212290 Merge pull request #3151 from coopdevs/remove-frontoffice-enterprises-n+1
Remove frontoffice enterprises n+1
2018-12-05 08:12:19 +01:00
Pau Pérez Fabregat
e5a267f4c2 Merge pull request #2735 from luisramos0/cookies_colors
Moved definition of colors in the cookies modal and banner colors to common darkswarm/base/colors
2018-12-05 08:06:58 +01:00
haseleyi
94d12217de Fix untranslated buttons at image step of registration modal 2018-12-04 21:30:42 -08:00
Isaac Haseley
76e5d281bf Fix link for Mac setup guide 2018-12-04 20:37:23 -08:00
Maikel
609a4fde4d Merge pull request #3173 from openfoodfoundation/transifex
Transifex
2018-12-05 11:55:29 +11:00
Transifex-Openfoodnetwork
18a5f53330 Updating translations for config/locales/fr.yml 2018-12-05 09:17:00 +11:00
haseleyi
e863c3dec8 Fix broken link in register call partial 2018-12-04 10:23:46 -08:00
Pau Pérez Fabregat
24415226bf Merge pull request #3168 from luisramos0/google-maps-comment-specs
Temporarily xit 2 broken specs (shops and producers search by url)
2018-12-04 19:13:40 +01:00
Transifex-Openfoodnetwork
9bedc69df8 Updating translations for config/locales/en_GB.yml 2018-12-05 04:52:44 +11:00
luisramos0
7dc208fb8c Temporarily move 2 broken specs to pending (shops and producers search by url) due to google maps api changes 2018-12-04 13:20:20 +00:00
Maikel Linke
66585e93a8 Update all locales with the latest Transifex translations 2018-12-04 14:48:03 +11:00
Hugo Daniel
24dab58de7 Lazy load translations and add keys 2018-11-30 10:49:36 +01:00
luisramos0
1c5d94472f Make colors.css relative reference to branding.css an absolute reference so that colors can be imported in engines 2018-11-29 18:39:58 +00:00
Pau Pérez Fabregat
08297863be Merge pull request #3047 from mllocs/feature/expand-all-steps-in-checkout-page
Expand all steps in the checkout page by default
2018-11-29 16:28:42 +01:00
Pau Pérez Fabregat
9f17acd63c Merge pull request #3136 from kevinchristianson/dashboard-translation
Add missing translation for 'Has Shopfront' in single-enterprise dashboard
2018-11-29 16:27:05 +01:00
Hugo Daniel
aa948552e1 Import payment_methods edit view and apply overrides 2018-11-29 14:58:14 +01:00
Hugo Daniel
34bc79c7f6 Import payment_methods form partial and apply overrides 2018-11-29 14:58:06 +01:00
Hugo Daniel
29bc4c52a5 Import payment_methods#new view and apply overrides 2018-11-29 14:56:28 +01:00
luisramos0
93e1310deb Fixed bug in cookies css, import colors, not branding 2018-11-29 11:47:51 +00:00
luisramos0
cdc5899791 Moved cookies policy modal and cookies banner colors to darkswarm/base/colors.scss 2018-11-29 11:47:51 +00:00
Pau Pérez Fabregat
949efd88ce Merge pull request #3154 from mkllnk/update-db-schema
Update schema for latest migration
2018-11-29 11:34:43 +01:00
Maikel Linke
285346fcda Update schema for latest migration
I feel embarrased that this is the second follow up of my last
migration: https://github.com/openfoodfoundation/openfoodnetwork/pull/3126

The last migration didn't change any database structure, but the schema
still needs the latest migration version. Otherwise it will display
pending migrations when setting up the database.

This commit allows to run `bundle exec rake db:reset` in development
without the following message:

  Run `rake db:migrate` to update your database then try again.
  You have 1 pending migrations:
    20181123012635 AssociateCustomersToUsers

The next pull request with a migration would have solved this problem as
well.
2018-11-29 10:29:56 +11:00
Pau Pérez Fabregat
3ea7fac25f Merge pull request #3095 from luisramos0/admin-users-transl
In admin/users, convert Spree.t calls to t calls and use lazy lookup
2018-11-28 17:37:42 +01:00
Pau Pérez Fabregat
8df781887a Merge pull request #3111 from kevinchristianson/pay-list-translation
Add translation for 'Back to Payments List' button in new payment form
2018-11-28 17:03:29 +01:00
Pau Pérez Fabregat
64c12c7a65 Merge pull request #2955 from HugsDaniel/import-spree-views-for-orders#edit
Import Spree views for orders#edit in our codebase
2018-11-28 17:02:40 +01:00
Pau Perez
96202ab00d Fix Rubocop violations 2018-11-28 16:23:56 +01:00
Pau Perez
e0f43191e2 Make helper methods private
Otherwise next dev might think these are attributes of the resulting
JSON serialized object.

They just made the refactoring a bit easier.
2018-11-28 16:21:40 +01:00
Pau Perez
c330d931ce Eager load product properties to avoid N+1
This totally removes the following N+1 query from the GET /shops request

```sql
SELECT "spree_properties".* FROM "spree_properties"
  INNER JOIN "spree_product_properties"
    ON "spree_product_properties"."property_id" = "spree_properties"."id"
  INNER JOIN "spree_products"
    ON "spree_products"."id" = "spree_product_properties"."product_id"
  INNER JOIN "enterprises"
    ON "enterprises"."id" = "spree_products"."supplier_id"
  WHERE "spree_products"."supplier_id" = 24;
```

The product properties of the corresponding enterprises are now loaded
in a single query fired from the controller.
2018-11-28 16:21:40 +01:00
Pau Perez
4608c434b4 Eager load producer properties to avoid N+1
This totally removes the following N+1 query from the GET /shops request

```sql
SELECT "spree_properties".* FROM "spree_properties"
  INNER JOIN "producer_properties"
    ON "spree_properties"."id" = "producer_properties"."property_id"
  WHERE "producer_properties"."producer_id" = 17
  ORDER BY producer_properties.position;
```

The producer properties of the corresponding enterprises are now loaded
in a single query fired from the controller.
2018-11-28 16:21:40 +01:00
Pau Perez
e40c1c08ca Refactor spec to not stub the class under test
This also relies on ActiveRecord which will come in handy as we move on
the refactor.
2018-11-28 16:21:40 +01:00
Pau Perez
149fc1ac6f Inline PropertyMerge's #merge into serializer
Now that it has become a plain Ruby #uniq, there's no point on having
the abstraction and indirection.
2018-11-28 16:21:40 +01:00
Pau Perez
faac5f4b2d Refactor PropertyMerge to use Ruby's #uniq instead 2018-11-28 16:21:40 +01:00
Pau Perez
1363a2a17d Improve readability of spec 2018-11-28 16:21:40 +01:00
Pau Perez
8e1f9a1ba3 Refactor #product_properties not to fetch ids 2018-11-28 16:21:40 +01:00
Pau Perez
bc7258d43b Test #supplied_properties helper methods 2018-11-28 16:21:40 +01:00
Pau Perez
23f629cfd6 Autofix all Rubocop violations in serializer 2018-11-28 13:54:42 +01:00
Pau Perez
c6ab5feb81 Move cached & uncached serializers to their files 2018-11-28 13:54:42 +01:00
Pau Perez
41d988176c Pass enterprises to inject method from controller 2018-11-28 13:54:42 +01:00
Pau Perez
5a85d7a77b RSpec3-ize controller spec 2018-11-28 13:54:42 +01:00
Pau Pérez Fabregat
b9dfaea274 Merge pull request #3143 from coopdevs/setup-rack-mini-profiler
Enable rack-mini-profiler in development
2018-11-28 13:54:27 +01:00
Pau Pérez Fabregat
438cff6e6d Merge pull request #3080 from Matt-Yorkley/pi/french_issue
Pi/french issue
2018-11-28 13:39:04 +01:00
Hugo Daniel
69e186f482 Define dynamic classes in variables as a turnaround to HAML bug 2018-11-28 10:31:47 +01:00
Hugo Daniel
65dd3eb5b9 Change line items controller HTML response spec to look for form order_edit class 2018-11-28 10:31:47 +01:00
Hugo Daniel
60214b9a90 Fix failing specs 2018-11-28 10:31:47 +01:00
Hugo Daniel
422a68630f Remove data-hook tags 2018-11-28 10:31:47 +01:00
Hugo Daniel
652191a4c5 Fixing missing variable none 2018-11-28 10:31:47 +01:00
Hugo Daniel
c233ea38cf Import Spree views for orders#edit in our codebase and integrate deface modifications 2018-11-28 10:31:47 +01:00
dependabot[bot]
7b95e3a8d7 Bump i18n-js from 3.0.11 to 3.1.0
Bumps [i18n-js](https://github.com/fnando/i18n-js) from 3.0.11 to 3.1.0.
- [Release notes](https://github.com/fnando/i18n-js/releases)
- [Changelog](https://github.com/fnando/i18n-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fnando/i18n-js/compare/v3.0.11...v3.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-27 19:17:57 +00:00
Pau Pérez Fabregat
5c8a638320 Merge pull request #3055 from HugsDaniel/3051-products-edit-views
[Defacepocalypse] Import products#edit and form partial in our codebase and apply overrides
2018-11-27 17:32:25 +01:00
Pau Pérez Fabregat
869f17256d Merge pull request #3011 from HugsDaniel/3000-api-endpoint-enterprise-fee
Add an API endpoint for EnterpriseFeesController#destroy
2018-11-27 17:28:43 +01:00
Pau Pérez Fabregat
ea6f44e78d Merge pull request #3144 from mkllnk/2841-fix-migration-encoding
Encode records with special chars as well
2018-11-27 17:28:13 +01:00
Pau Pérez Fabregat
04d57f8e6e Merge pull request #3135 from openfoodfoundation/dependabot/bundler/unicorn-rails-2.2.1
Bump unicorn-rails from 1.1.0 to 2.2.1
2018-11-27 17:26:12 +01:00
Pau Pérez Fabregat
d073157424 Merge pull request #3134 from coopdevs/update-skylight
Update Skylight from 1.6.1 to 1.7.1
2018-11-27 08:54:39 +01:00
Maikel
2967fdccf7 Merge pull request #3142 from kristinalim/fix-rubocop_block_length_ignore_describe_context
Ignore `describe` and `context` in Rubocop BlockLength
2018-11-27 14:54:46 +11:00
Maikel Linke
9efa45663c Encode records with special chars as well
Using Marshal.dump on the French production database raised an error:

    Encoding::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8

Replacing Marshal with YAML solves the problem. It is also more reliable
and human readable.

This code was run against the French, Australian and UK production
data successfully.
2018-11-27 14:34:03 +11:00
Pau Perez
b365488653 Enable rack-mini-profiler in development
This will run it always in development mode.
2018-11-26 12:10:49 +01:00
Kristina Lim
5c6ec50dea Ignore describe and context in Rubocop BlockLength 2018-11-26 13:55:55 +08:00
Maikel
c152da8122 Merge pull request #3126 from mkllnk/2841-convert-guest-customer
2841  Associate customers with their user records
2018-11-26 13:56:31 +11:00
haseleyi
691de9199f Add missing translation for 'Has Shopfront' in single-enterprise dashboard 2018-11-23 11:23:28 -08:00
dependabot[bot]
4499c38cfe Bump unicorn-rails from 1.1.0 to 2.2.1
Bumps [unicorn-rails](https://github.com/samuelkadolph/unicorn-rails) from 1.1.0 to 2.2.1.
- [Release notes](https://github.com/samuelkadolph/unicorn-rails/releases)
- [Commits](https://github.com/samuelkadolph/unicorn-rails/compare/v1.1.0...v2.2.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-23 19:14:51 +00:00
Maxim Colls
4b588cbfb0 Removed unused toggle helpers in spec/support 2018-11-23 16:47:55 +00:00
Pau Perez
2abb316bcc Update Skylight from 1.6.1 to 1.7.1
This doesn't bring too many improvements but it's the latest version can
work on our Rails 3.2 version.

You can read the changelog at
https://github.com/skylightio/skylight-ruby/blob/master/CHANGELOG.md#170-april-24-2018.
2018-11-23 17:31:53 +01:00
Pau Perez
453b2a99de Rename redundant #restart_checkout to #call 2018-11-23 12:05:39 +01:00
Pau Perez
88afa70f37 Simplify and speed up service tests 2018-11-23 12:04:42 +01:00
Pau Perez
2c8a1f5e78 Check for value and not object identity in spec 2018-11-23 12:04:42 +01:00
Pau Perez
99463427ce Refactor RestartCheckout service just extracted 2018-11-23 12:04:42 +01:00
Pau Perez
3b681a59ba Move controller tests to service class tests 2018-11-23 12:04:42 +01:00
Pau Perez
a62a2cb52f Extract #restart_checkout to a service 2018-11-23 12:04:42 +01:00
Maikel Linke
f4d5727fb4 Associate customers with their user records
When we introduced the Customer model, we didn't associate any existing
customers with users that have the same email address.
Later we decided to create that association when users sign up. But we didn't
update all the existing customers. We do that now for data consistency and to
solve several bugs.
2018-11-23 15:38:35 +11:00
Maikel Linke
95dbfae757 Use expect syntax 2018-11-22 15:42:56 +11:00
Maikel
be7fea9d14 Merge pull request #3003 from kevinchristianson/getting-started-edits
Getting Started edits
2018-11-22 12:51:16 +11:00
haseleyi
07e246db39 Remove outdated time zone precaution from Getting Started wiki 2018-11-21 15:56:14 -08:00
haseleyi
364a00074b Remove Resources header 2018-11-21 15:56:14 -08:00
Kevin Christianson
7dce6e1180 Remove weird red "for" text in Troubleshooting 2018-11-21 15:56:14 -08:00
Kevin Christianson
1216567be9 Add Troubleshooting section with an alternative database setup 2018-11-21 15:56:13 -08:00
Samuel Nozaki
a7032a8822 Clarify that the time zone should be Melbourne 2018-11-21 15:56:13 -08:00
nozakis
6a73ee86f8 Clarify GETTING_STARTED.md in regards to rspec test failures and time zones 2018-11-21 15:56:13 -08:00
haseleyi
d4b49a662f Add translation for 'Back to Payments List' button in new payment form 2018-11-21 15:33:45 -08:00
Matt-Yorkley
b3a9b502fa Add missing translation key 2018-11-21 19:16:08 +00:00
Matt-Yorkley
a5407d780c Include unexpected validation errors 2018-11-21 19:16:07 +00:00
Pau Pérez Fabregat
ac9cfaa8c3 Merge pull request #3093 from mllocs/fix/factories-ignore-warning
Fixed Factory warning while running tests
2018-11-21 14:44:03 +01:00
Pau Pérez Fabregat
6a1776b84a Merge pull request #3053 from HugsDaniel/3050-products-new-views
[Defacepocalypse] Import products#new view into our codebase and apply overrides
2018-11-21 14:43:22 +01:00
luisramos0
783e0eed3c In admin/users, convert Spree.t calls to t calls using lazy lookup and move translations to ofn's en.yml 2018-11-21 11:46:14 +00:00
luisramos0
0189cefd1c Update all locales with the latest Transifex translations 2018-11-20 22:40:11 +00:00
Maxim Colls
f179bf8c49 Fixed Factory warning while running tests 2018-11-20 18:27:43 +00:00
Pau Pérez Fabregat
398092fa50 Merge pull request #3065 from openfoodfoundation/dependabot/bundler/turbo-sprockets-rails3-0.3.14
Bump turbo-sprockets-rails3 from 0.3.6 to 0.3.14
2018-11-20 12:13:23 +01:00
Pau Pérez Fabregat
4c6dec6203 Merge pull request #3082 from coopdevs/remove-travis-leftovers
Remove all database.travis.yml
2018-11-20 09:35:12 +01:00
Pau Perez
9301c5e1d5 Remove all database.travis.yml
We no longer use this file since we started with Semaphore CI.
2018-11-19 17:16:04 +01:00
Maikel
90e8813ff6 Merge pull request #3054 from coopdevs/fix/incorrect-order-dates
Fix/incorrect order dates
2018-11-19 09:17:11 +11:00
Maxim Colls
884d4d0122 Fixed specs 2018-11-17 19:46:09 +01:00
Maxim Colls
3301b5850a Improved UX in the accordion steps in the checkout page 2018-11-17 18:48:10 +01:00
dependabot[bot]
e655e60b56 Bump turbo-sprockets-rails3 from 0.3.6 to 0.3.14
Bumps [turbo-sprockets-rails3](https://github.com/ndbroadbent/turbo-sprockets-rails3) from 0.3.6 to 0.3.14.
- [Release notes](https://github.com/ndbroadbent/turbo-sprockets-rails3/releases)
- [Commits](https://github.com/ndbroadbent/turbo-sprockets-rails3/compare/v0.3.6...v0.3.14)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-16 19:16:27 +00:00
Maikel
f593a70000 Merge pull request #2967 from openfoodfoundation/dependabot/bundler/unicorn-5.4.1
Bump unicorn from 4.9.0 to 5.4.1
2018-11-16 14:05:47 +11:00
dependabot[bot]
0d93705856 Bump unicorn from 4.9.0 to 5.4.1
Bumps [unicorn](https://bogomips.org/unicorn/) from 4.9.0 to 5.4.1.

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-16 02:00:48 +00:00
Pau Perez
23bda74ecb Match name of filter and db column for consistency 2018-11-15 19:09:17 +01:00
Pau Perez
a4bbe2b696 Query completed_at filtering orders by date range 2018-11-15 19:09:17 +01:00
Pau Perez
c7a1c4b253 Change order date column translation in BOM
This makes it consistent with the order page. In both cases we use the
`completed_at` column underneath.
2018-11-15 19:09:17 +01:00
Hugo Daniel
a50786be34 Remove old do_not_remove_referenced_fees method 2018-11-15 17:59:06 +01:00
Hugo Daniel
0868404e98 Add specs for new Api::EnterpriseFeesController 2018-11-15 17:58:56 +01:00
Hugo Daniel
1309d80f65 Import products#edit and form partial in our codebase and apply overrides 2018-11-15 17:39:36 +01:00
Pau Pérez Fabregat
ee2ace8023 Merge pull request #3022 from HugsDaniel/2756-duplicate-product-with-image
Add specs for cloning a product with image
2018-11-15 17:35:28 +01:00
Hugo Daniel
094d88d03a Import products#new view into our codebase and apply overrides 2018-11-15 16:35:31 +01:00
Hugo Daniel
d060704e86 Change Spree step-6a commit reference in Gemfile 2018-11-15 15:40:44 +01:00
Pau Perez
52e58a1c31 Remove unused @show_only_completed from view
Now there's no difference in behavior. In both cases we sort by
completed_at in the second column of the orders page.
2018-11-15 15:40:13 +01:00
Pau Perez
b7a3255dbe Replace completed_at in orders table w/ created_at 2018-11-15 15:40:13 +01:00
Pau Perez
b1b04b505e Fetch orders sorted by completion date 2018-11-15 15:40:13 +01:00
Pau Perez
e69d297f86 Wrap long and unreadable lines 2018-11-15 14:26:13 +01:00
Hugo Daniel
a162a2c50b Move product distributions check as a before_destroy in EnterpriseFee model 2018-11-15 14:05:15 +01:00
Hugo Daniel
7b33712f7a Add an API endpoint for EnterpriseFeesController#destroy 2018-11-15 14:05:08 +01:00
Hugo Daniel
4e29589be0 Add specs for cloning a product with image 2018-11-15 13:51:40 +01:00
Pau Pérez Fabregat
605f84d30a Merge pull request #3010 from openfoodfoundation/transifex
Transifex
2018-11-14 11:27:01 +01:00
Pau Pérez Fabregat
8ee193dbcf Merge pull request #2984 from Matt-Yorkley/email_https_links2
Specify only email link protocol setting
2018-11-14 11:26:14 +01:00
Pau Pérez Fabregat
e66f406ea6 Merge pull request #2946 from luisramos0/improve_taxons
Sort Product categories alphabetically by name
2018-11-14 11:23:59 +01:00
Transifex-Openfoodnetwork
f9fae06a7a Updating translations for config/locales/en_BE.yml 2018-11-10 07:09:02 +11:00
Maikel
5c208a68c6 Merge pull request #3007 from openfoodfoundation/revert-2859-instagram_pattern
Revert "Instagram pattern"
2018-11-09 14:23:44 +11:00
Maikel
d8d20429aa Revert "Instagram pattern" 2018-11-09 13:33:11 +11:00
Pau Pérez Fabregat
51a94c8194 Merge pull request #2964 from openfoodfoundation/dependabot/bundler/awesome_print-1.8.0
Bump awesome_print from 1.0.2 to 1.8.0
2018-11-07 18:48:32 +00:00
Matt-Yorkley
9011f5d9a2 Rescue ArgumentError and give user feedback 2018-11-07 18:48:08 +00:00
Pau Pérez Fabregat
72a9d39ee1 Merge pull request #2932 from luisramos0/2931-weight-calculator
2931 Refactor and prepare weight calculator for spree 2
2018-11-07 18:40:38 +00:00
Pau Pérez Fabregat
ecc69c2c58 Merge pull request #2948 from pfac/pfac-config-time-zone
Fix default time zone config
2018-11-07 18:39:25 +00:00
Matt-Yorkley
b5c6ecb45a Explicitly use UTF-8 encoding when opening spreadsheet files 2018-11-07 16:50:24 +00:00
Matt-Yorkley
5b16353938 Specify only link protocol setting 2018-11-07 11:22:24 +00:00
luisramos0
b7ffde795a Add migration to update calculator class name of weight calculators 2018-11-07 09:54:53 +00:00
luisramos0
9490da329a Move Calculator::Weight from models/open_food_network/calculator to models/calculator 2018-11-07 09:54:30 +00:00
luisramos0
bf55f50a7e Fix rubocop warnings on weight and weight_spec 2018-11-07 09:54:30 +00:00
luisramos0
275a192270 Convert specs to RSpec 3.7.1 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/models/calculator/weight_spec.rb

* 3 conversions
    from: == expected
      to: eq(expected)

* 3 conversions
    from: obj.should
      to: expect(obj).to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-11-07 09:54:30 +00:00
luisramos0
1ef04354fd Add capacity to weight calculator to calculate based on any object with an order (needed in spree 2 to calculate based on package) 2018-11-07 09:54:30 +00:00
Luis Ramos
0c02e8c15f Merge pull request #2981 from coopdevs/remove-commented-out-code
Remove old commented out code
2018-11-06 16:06:59 +00:00
Luis Ramos
1ceb632b83 Merge pull request #2980 from coopdevs/fix-long-line
Fix long line
2018-11-06 16:05:22 +00:00
Pau Perez
51155bb368 Remove old commented out code
You know, git already keeps old code for us.
2018-11-06 14:23:15 +00:00
Pau Perez
26d95b7250 Fix long lines 2018-11-06 13:59:51 +00:00
Pau Pérez Fabregat
4155f086e0 Merge pull request #2968 from openfoodfoundation/transifex
Transifex
2018-11-05 19:40:33 +01:00
Transifex-Openfoodnetwork
98d79ec939 Updating translations for config/locales/fr_BE.yml 2018-11-05 18:46:40 +11:00
Maikel
4930c9bc06 Merge pull request #2934 from mkllnk/manual-rubocop-todo-config
Add offending files to rubocop config
2018-11-05 10:37:03 +11:00
Maikel Linke
7ad40074a5 Make Code Climate show our real score ans split rubocop config
Our rubocop config hides all current violations. It allows us to have a
passing rubocop run on the current code and improve it gradually. It
detects new violations, but doesn't annoy us with all the existing ones.

Code Climate has its own way of remembering all current violations which
is more sophisticated than ours. The new config for Code Climate doesn't
hide any violations so that Code Climate can give us a realistic score
of code quality and warn us about every new violation.

Splitting the configuration into the main three parts gives a quicker
overview and makes maintaining the parts easier.
2018-11-05 10:19:30 +11:00
Maikel Linke
e798532a2f Add offending files to rubocop config
The file .rubocop_todo.yml is generated automatically and contains a
configuration to make all files pass. For a lot of cops it just lists
the offending files. But for some cops it sets a different metric.

Since we don't want these lax metrics, we override them in our config
file .rubocop.yml. This leads to a lot of offences again. This patch
lists all offending files for each cop to make rubocop pass. We can
improve the code over time and remove items from the list.
2018-11-05 10:11:35 +11:00
Pau Pérez Fabregat
3b85bbe911 Merge pull request #2923 from mkllnk/2882-extract-email-setup-in-specs
Extract email setup in specs for easy upgrade
2018-11-02 15:40:19 +01:00
dependabot[bot]
6416d0e1c3 Bump awesome_print from 1.0.2 to 1.8.0
Bumps [awesome_print](https://github.com/awesome-print/awesome_print) from 1.0.2 to 1.8.0.
- [Release notes](https://github.com/awesome-print/awesome_print/releases)
- [Changelog](https://github.com/awesome-print/awesome_print/blob/master/CHANGELOG.md)
- [Commits](https://github.com/awesome-print/awesome_print/compare/v1.0.2...v1.8.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-01 19:15:40 +00:00
Pedro Costa
1ddbc24a8b Fix default time zone config
Why:

* Starting the environment, even with just `bundle exec rake`, results
  in the following error:
  ```sh
  Value assigned to config.time_zone not recognized.Run "rake -D time"
  for a list of tasks for finding appropriate time zone names.
  ```

This change addresses the issue by:

* Adding the time zone setting to environment specific configurations,
  defaulting to UTC in development, and using Melbourne in tests.
2018-10-30 23:50:23 +00:00
luisramos0
3d106d749b Fix rubocop warnings on load_sample_data task 2018-10-30 18:00:52 +00:00
luisramos0
82befd945b Sort Product categories alphabetically by name and fixsample data by fixing taxons taxonomy id 2018-10-30 18:00:48 +00:00
Maikel Linke
e6adb8a3b9 Extract email setup in specs for easy upgrade
The way we set up email sending completely changes with Spree 2. This
change encapsulates that code in a single method so that it can be
changed easily and doesn't create further merge conflicts while we are
still working on the master branch and the Spree upgrade.
2018-10-25 13:53:22 +11:00
314 changed files with 12752 additions and 3410 deletions

View File

@@ -3,6 +3,8 @@ plugins:
rubocop:
enabled: true
channel: "rubocop-0-57"
config:
file: ".rubocop_styleguide.yml"
scss-lint:
enabled: true
checks:

3
.gitignore vendored
View File

@@ -41,3 +41,6 @@ libpeerconnection.log
node_modules
vendor/bundle/
coverage
/reports/
!/reports/README.md
bin/

View File

@@ -1,202 +1,20 @@
# This is our main Rubocop configuration for developers. It is used when you run:
#
# bundle exec rubocop
#
# The configuration is split into three files. Look into those files for more details.
#
inherit_from:
# The automatically generated todo list to ignore all current violations.
- .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.1
TargetRailsVersion: 3.2
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
# The parser gem fails to parse this file with out current Ruby version.
- 'spec/factories.rb'
# Excluding: inadequate Naming/FileName rule rejects GemFile name with camelcase
- 'engines/web/Gemfile'
# Our Open Food Network style guide. It's used by Code Climate. If you want to see all violations,
# then use only that configuration (like Code Climate):
#
# bundle exec rubocop -c .rubocop_styleguide.yml
#
- .rubocop_styleguide.yml
# OFN SETTINGS
# Cop settings that have been agreed upon by the OFN community
Rails:
Enabled: true
Style/Documentation:
Enabled: false
Style/StringLiterals:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys
Style/Send:
Enabled: true
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
# TEMPORARY/CONTESTED SETTINGS
# These are still to be decided upon, but recommended for inclusion by
# oeoeaio after scrutinising offenses the codebase
# Don't think this is a big issue, mostly picking up RPSEC scope definitions
# with lamdas and RSpec '.to change{}' blocks
Lint/AmbiguousBlockAssociation:
Enabled: false
# Heaps of offences (> 100) in specs, mostly in situations where two or more
# instances of a model are required, but only one is referenced. Difficult to
# fix without making the spec look messy or rewriting it.
# Should definitely fix at some point.
Lint/UselessAssignment:
Exclude:
- spec/**/*
# AFAIK, there is no good alternative to dynamic matchers until we upgrade
# to Rails 4 and can use #find_by. If there is a better approach, let's do it.
Rails/DynamicFindBy:
Enabled: false
# Same as above, #find_by is not available until Rails 4
Rails/FindBy:
Enabled: false
# Same as above, #update! is not available until Rails 4
Rails/ActiveRecordAliases:
Enabled: false
# This should be the programmer's discretion, perhaps we should review all of
# the uses of it an make specific exceptions though.
Rails/SkipsModelValidations:
Enabled: false
# Relaxed.Ruby.Style SETTINGS
# These styles are a starting point for the conversation around conventions
# They should be removed or tweaked and moved above as decisions are made
# NOTE: Cops which did not fail at the time of writing were removed
Layout/DotPosition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledotposition
Layout/SpaceBeforeBlockBraces:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
Layout/SpaceInsideParens:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
Style/Alias:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylealias
Style/BlockDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
Style/CommentAnnotation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylecommentannotation
Style/DoubleNegation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledoublenegation
Style/FormatString:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleformatstring
Style/IfUnlessModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
Style/Lambda:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylelambda
Style/MultilineBlockChain:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
Style/NegatedIf:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedif
Style/NegatedWhile:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
Style/ParallelAssignment:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
Style/PercentLiteralDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
Style/Semicolon:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesemicolon
Style/SingleLineMethods:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
Style/TrailingCommaInArguments:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
Style/TrailingCommaInArrayLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
Style/TrailingCommaInHashLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
Style/WordArray:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewordarray
Style/SymbolArray:
Enabled: false
StyleGuide: https://rubocop.readthedocs.io/en/latest/cops_style/#stylesymbolarray
Lint/AmbiguousRegexpLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
Lint/AssignmentInCondition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
Metrics/AbcSize:
Max: 15
Metrics/BlockNesting:
Max: 3
Metrics/ClassLength:
Max: 100
Metrics/ModuleLength:
Max: 100
Metrics/CyclomaticComplexity:
Max: 6
Metrics/LineLength:
Max: 100
Metrics/MethodLength:
Max: 10
Metrics/ParameterLists:
Max: 5
Metrics/PerceivedComplexity:
Max: 7
# A manually compiled todo list to ignore metrics violations on a file-by-file basis.
- .rubocop_manual_todo.yml

761
.rubocop_manual_todo.yml Normal file
View File

@@ -0,0 +1,761 @@
# A manually compiled todo list to ignore metrics violations on a file-by-file basis.
#
# The file .rubocop_todo.yml is generated automatically and contains a
# configuration to make all files pass. For a lot of cops it just lists
# the offending files. But for metrics cops it sets a different metric.
#
# Since we don't want these lax metrics, we override them in our config
# file .rubocop.yml which results in a lot of offences again. This file
# lists all offending files for each cop to make rubocop pass. We can
# improve the code over time and remove items from the list.
#
# This file was manually created by using the following tools:
#
# rubocop > rubo.log
# # inspect log file to see which cops are failing
# # copy cop configurations and add Exclude parameter
# grep ExampleCop rubo.log | cut -d ":" -f 1 | sort -u >> .rubocop.yml
# # use vim to add `- ` before each line
#
# This process probably doesn't need repeating. Otherwise there is plenty
# of room for improvements and automation.
Metrics/LineLength:
Max: 100
Exclude:
- app/controllers/admin/accounts_and_billing_settings_controller.rb
- app/controllers/admin/bulk_line_items_controller.rb
- app/controllers/admin/business_model_configuration_controller.rb
- app/controllers/admin/cache_settings_controller.rb
- app/controllers/admin/contents_controller.rb
- app/controllers/admin/customers_controller.rb
- app/controllers/admin/enterprise_fees_controller.rb
- app/controllers/admin/enterprise_groups_controller.rb
- app/controllers/admin/enterprise_relationships_controller.rb
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/inventory_items_controller.rb
- app/controllers/admin/manager_invitations_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/product_import_controller.rb
- app/controllers/admin/proxy_orders_controller.rb
- app/controllers/admin/schedules_controller.rb
- app/controllers/admin/subscription_line_items_controller.rb
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/admin/variant_overrides_controller.rb
- app/controllers/api/enterprise_attachment_controller.rb
- app/controllers/api/product_images_controller.rb
- app/controllers/application_controller.rb
- app/controllers/base_controller.rb
- app/controllers/cart_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/shop_controller.rb
- app/controllers/spree/admin/adjustments_controller_decorator.rb
- app/controllers/spree/admin/base_controller_decorator.rb
- app/controllers/spree/admin/line_items_controller_decorator.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/admin/payment_methods_controller_decorator.rb
- app/controllers/spree/admin/products_controller_decorator.rb
- app/controllers/spree/admin/reports_controller_decorator.rb
- app/controllers/spree/admin/shipping_methods_controller_decorator.rb
- app/controllers/spree/api/products_controller_decorator.rb
- app/controllers/spree/credit_cards_controller.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/controllers/spree/paypal_controller_decorator.rb
- app/controllers/stripe/callbacks_controller.rb
- app/controllers/user_confirmations_controller.rb
- app/helpers/admin/account_helper.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/admin/injection_helper.rb
- app/helpers/angular_form_builder.rb
- app/helpers/angular_form_helper.rb
- app/helpers/application_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/enterprises_helper.rb
- app/helpers/footer_links_helper.rb
- app/helpers/injection_helper.rb
- app/helpers/markdown_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/shop_helper.rb
- app/helpers/spree/admin/base_helper_decorator.rb
- app/helpers/spree/admin/navigation_helper_decorator.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/helpers/spree/orders_helper.rb
- app/jobs/finalize_account_invoices.rb
- app/jobs/products_cache_integrity_checker_job.rb
- app/jobs/subscription_confirm_job.rb
- app/jobs/subscription_placement_job.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/mailers/producer_mailer.rb
- app/mailers/spree/order_mailer_decorator.rb
- app/mailers/subscription_mailer.rb
- app/models/billable_period.rb
- app/models/column_preference.rb
- app/models/content_configuration.rb
- app/models/customer.rb
- app/models/enterprise_fee.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb
- app/models/enterprise_role.rb
- app/models/exchange.rb
- app/models/inventory_item.rb
- app/models/order_cycle.rb
- app/models/product_distribution.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- app/models/product_import/product_importer.rb
- app/models/product_import/spreadsheet_data.rb
- app/models/product_import/spreadsheet_entry.rb
- app/models/product_import/unit_converter.rb
- app/models/proxy_order.rb
- app/models/schedule.rb
- app/models/spree/ability_decorator.rb
- app/models/spree/adjustment_decorator.rb
- app/models/spree/calculator/default_tax_decorator.rb
- app/models/spree/calculator/flexi_rate_decorator.rb
- app/models/spree/classification_decorator.rb
- app/models/spree/gateway/stripe_connect.rb
- app/models/spree/line_item_decorator.rb
- app/models/spree/order_decorator.rb
- app/models/spree/payment_decorator.rb
- app/models/spree/payment_method_decorator.rb
- app/models/spree/product_decorator.rb
- app/models/spree/shipment_decorator.rb
- app/models/spree/shipping_method_decorator.rb
- app/models/spree/taxon_decorator.rb
- app/models/spree/user_decorator.rb
- app/models/spree/variant_decorator.rb
- app/models/subscription.rb
- app/models/variant_override.rb
- app/models/variant_override_set.rb
- app/overrides/add_distributor_details_js_to_product.rb
- app/overrides/add_enterprise_fees_to_admin_configurations_menu.rb
- app/overrides/replace_checkout_payment_button.rb
- app/overrides/replace_payment_name_with_description.rb
- app/serializers/api/admin/basic_enterprise_serializer.rb
- app/serializers/api/admin/enterprise_fee_serializer.rb
- app/serializers/api/admin/enterprise_serializer.rb
- app/serializers/api/admin/exchange_serializer.rb
- app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
- app/serializers/api/admin/index_enterprise_serializer.rb
- app/serializers/api/admin/index_order_cycle_serializer.rb
- app/serializers/api/admin/line_item_serializer.rb
- app/serializers/api/admin/order_cycle_serializer.rb
- app/serializers/api/admin/product_serializer.rb
- app/serializers/api/admin/subscription_serializer.rb
- app/serializers/api/admin/tag_rule_serializer.rb
- app/serializers/api/admin/variant_override_serializer.rb
- app/serializers/api/admin/variant_serializer.rb
- app/services/cart_service.rb
- app/services/embedded_page_service.rb
- app/services/line_item_syncer.rb
- app/services/order_cycle_form.rb
- app/services/order_factory.rb
- app/services/order_syncer.rb
- app/services/subscriptions_count.rb
- app/views/json/_groups.rabl
- app/views/json/partials/_enterprise.rabl
- app/views/json/_producer.rabl
- app/views/spree/api/products/bulk_show.v1.rabl
- app/views/spree/api/variants/bulk_show.v1.rabl
- engines/web/app/helpers/web/cookies_policy_helper.rb
- Gemfile
- lib/discourse/single_sign_on.rb
- lib/open_food_network/accounts_and_billing_settings_validator.rb
- lib/open_food_network/available_payment_method_filter.rb
- lib/open_food_network/bill_calculator.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/business_model_configuration_validator.rb
- lib/open_food_network/customers_report.rb
- lib/open_food_network/distribution_change_validator.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/group_buy_report.rb
- lib/open_food_network/lettuce_share_report.rb
- lib/open_food_network/locking.rb
- lib/open_food_network/order_and_distributor_report.rb
- lib/open_food_network/order_cycle_form_applicator.rb
- lib/open_food_network/order_cycle_management_report.rb
- lib/open_food_network/order_cycle_permissions.rb
- lib/open_food_network/order_grouper.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
- lib/open_food_network/payments_report.rb
- lib/open_food_network/permalink_generator.rb
- lib/open_food_network/permissions.rb
- lib/open_food_network/products_and_inventory_report_base.rb
- lib/open_food_network/products_cache.rb
- lib/open_food_network/proxy_order_syncer.rb
- lib/open_food_network/reports/bulk_coop_allocation_report.rb
- lib/open_food_network/reports/line_items.rb
- lib/open_food_network/sales_tax_report.rb
- lib/open_food_network/users_and_enterprises_report.rb
- lib/open_food_network/variant_and_line_item_naming.rb
- lib/open_food_network/xero_invoices_report.rb
- lib/spree/core/calculated_adjustments_decorator.rb
- lib/spree/core/controller_helpers/respond_with_decorator.rb
- lib/spree/localized_number.rb
- lib/spree/product_filters.rb
- lib/stripe/profile_storer.rb
- lib/tasks/cache.rake
- lib/tasks/data.rake
- lib/tasks/dev.rake
- lib/tasks/enterprises.rake
- spec/archive/features/consumer/checkout_spec.rb
- spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb
- spec/controllers/admin/bulk_line_items_controller_spec.rb
- spec/controllers/admin/column_preferences_controller_spec.rb
- spec/controllers/admin/customers_controller_spec.rb
- spec/controllers/admin/enterprises_controller_spec.rb
- spec/controllers/admin/inventory_items_controller_spec.rb
- spec/controllers/admin/manager_invitations_controller_spec.rb
- spec/controllers/admin/order_cycles_controller_spec.rb
- spec/controllers/admin/proxy_orders_controller_spec.rb
- spec/controllers/admin/schedules_controller_spec.rb
- spec/controllers/admin/stripe_accounts_controller_spec.rb
- spec/controllers/admin/stripe_connect_settings_controller_spec.rb
- spec/controllers/admin/subscription_line_items_controller_spec.rb
- spec/controllers/admin/subscriptions_controller_spec.rb
- spec/controllers/admin/variant_overrides_controller_spec.rb
- spec/controllers/api/logos_controller_spec.rb
- spec/controllers/api/order_cycles_controller_spec.rb
- spec/controllers/api/orders_controller_spec.rb
- spec/controllers/api/product_images_controller_spec.rb
- spec/controllers/api/promo_images_controller_spec.rb
- spec/controllers/cart_controller_spec.rb
- spec/controllers/checkout_controller_spec.rb
- spec/controllers/enterprises_controller_spec.rb
- spec/controllers/line_items_controller_spec.rb
- spec/controllers/shop_controller_spec.rb
- spec/controllers/shops_controller_spec.rb
- spec/controllers/spree/admin/adjustments_controller_spec.rb
- spec/controllers/spree/admin/base_controller_spec.rb
- spec/controllers/spree/admin/line_items_controller_spec.rb
- spec/controllers/spree/admin/orders_controller_spec.rb
- spec/controllers/spree/admin/orders/customer_details_controller_spec.rb
- spec/controllers/spree/admin/payment_methods_controller_spec.rb
- spec/controllers/spree/admin/payments_controller_spec.rb
- spec/controllers/spree/admin/reports_controller_spec.rb
- spec/controllers/spree/api/products_controller_spec.rb
- spec/controllers/spree/api/variants_controller_spec.rb
- spec/controllers/spree/credit_cards_controller_spec.rb
- spec/controllers/spree/orders_controller_spec.rb
- spec/controllers/spree/users_controller_spec.rb
- spec/controllers/spree/user_sessions_controller_spec.rb
- spec/controllers/stripe/callbacks_controller_spec.rb
- spec/controllers/stripe/webhooks_controller_spec.rb
- spec/controllers/user_confirmations_controller_spec.rb
- spec/controllers/user_registrations_controller_spec.rb
- spec/features/admin/accounts_and_billing_settings_spec.rb
- spec/features/admin/adjustments_spec.rb
- spec/features/admin/bulk_order_management_spec.rb
- spec/features/admin/bulk_product_update_spec.rb
- spec/features/admin/customers_spec.rb
- spec/features/admin/enterprise_fees_spec.rb
- spec/features/admin/enterprise_relationships_spec.rb
- spec/features/admin/enterprise_roles_spec.rb
- spec/features/admin/enterprises/images_spec.rb
- spec/features/admin/enterprises/index_spec.rb
- spec/features/admin/enterprises_spec.rb
- spec/features/admin/enterprise_user_spec.rb
- spec/features/admin/image_settings_spec.rb
- spec/features/admin/multilingual_spec.rb
- spec/features/admin/order_cycles_spec.rb
- spec/features/admin/orders_spec.rb
- spec/features/admin/overview_spec.rb
- spec/features/admin/payment_method_spec.rb
- spec/features/admin/product_import_spec.rb
- spec/features/admin/products_spec.rb
- spec/features/admin/reports_spec.rb
- spec/features/admin/schedules_spec.rb
- spec/features/admin/shipping_methods_spec.rb
- spec/features/admin/subscriptions_spec.rb
- spec/features/admin/tag_rules_spec.rb
- spec/features/admin/variant_overrides_spec.rb
- spec/features/consumer/account/cards_spec.rb
- spec/features/consumer/account/settings_spec.rb
- spec/features/consumer/account_spec.rb
- spec/features/consumer/authentication_spec.rb
- spec/features/consumer/cookies_spec.rb
- spec/features/consumer/groups_spec.rb
- spec/features/consumer/multilingual_spec.rb
- spec/features/consumer/registration_spec.rb
- spec/features/consumer/shopping/cart_spec.rb
- spec/features/consumer/shopping/checkout_auth_spec.rb
- spec/features/consumer/shopping/checkout_spec.rb
- spec/features/consumer/shopping/embedded_groups_spec.rb
- spec/features/consumer/shopping/embedded_shopfronts_spec.rb
- spec/features/consumer/shopping/orders_spec.rb
- spec/features/consumer/shopping/products_spec.rb
- spec/features/consumer/shopping/shopping_spec.rb
- spec/features/consumer/shopping/variant_overrides_spec.rb
- spec/features/consumer/shops_spec.rb
- spec/helpers/admin/business_model_configuration_helper_spec.rb
- spec/helpers/admin/subscriptions_helper_spec.rb
- spec/helpers/checkout_helper_spec.rb
- spec/helpers/enterprises_helper_spec.rb
- spec/helpers/groups_helper_spec.rb
- spec/helpers/injection_helper_spec.rb
- spec/helpers/order_cycles_helper_spec.rb
- spec/helpers/spree/admin/base_helper_spec.rb
- spec/jobs/confirm_order_job_spec.rb
- spec/jobs/finalize_account_invoices_spec.rb
- spec/jobs/refresh_products_cache_job_spec.rb
- spec/jobs/subscription_confirm_job_spec.rb
- spec/jobs/subscription_placement_job_spec.rb
- spec/jobs/update_account_invoices_spec.rb
- spec/jobs/update_billable_periods_spec.rb
- spec/lib/open_food_network/address_finder_spec.rb
- spec/lib/open_food_network/bulk_coop_report_spec.rb
- spec/lib/open_food_network/cached_products_renderer_spec.rb
- spec/lib/open_food_network/customers_report_spec.rb
- spec/lib/open_food_network/distribution_change_validator_spec.rb
- spec/lib/open_food_network/enterprise_fee_applicator_spec.rb
- spec/lib/open_food_network/enterprise_fee_calculator_spec.rb
- spec/lib/open_food_network/enterprise_injection_data_spec.rb
- spec/lib/open_food_network/group_buy_report_spec.rb
- spec/lib/open_food_network/lettuce_share_report_spec.rb
- spec/lib/open_food_network/option_value_namer_spec.rb
- spec/lib/open_food_network/order_and_distributor_report_spec.rb
- spec/lib/open_food_network/order_cycle_form_applicator_spec.rb
- spec/lib/open_food_network/order_cycle_permissions_spec.rb
- spec/lib/open_food_network/order_grouper_spec.rb
- spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb
- spec/lib/open_food_network/packing_report_spec.rb
- spec/lib/open_food_network/permissions_spec.rb
- spec/lib/open_food_network/products_and_inventory_report_spec.rb
- spec/lib/open_food_network/products_cache_spec.rb
- spec/lib/open_food_network/products_renderer_spec.rb
- spec/lib/open_food_network/proxy_order_syncer_spec.rb
- spec/lib/open_food_network/scope_variant_to_hub_spec.rb
- spec/lib/open_food_network/subscription_payment_updater_spec.rb
- spec/lib/open_food_network/subscription_summarizer_spec.rb
- spec/lib/open_food_network/tag_rule_applicator_spec.rb
- spec/lib/open_food_network/users_and_enterprises_report_spec.rb
- spec/lib/open_food_network/xero_invoices_report_spec.rb
- spec/lib/stripe/account_connector_spec.rb
- spec/lib/stripe/webhook_handler_spec.rb
- spec/mailers/order_mailer_spec.rb
- spec/mailers/producer_mailer_spec.rb
- spec/mailers/subscription_mailer_spec.rb
- spec/models/billable_period_spec.rb
- spec/models/column_preference_spec.rb
- spec/models/customer_spec.rb
- spec/models/enterprise_caching_spec.rb
- spec/models/enterprise_fee_spec.rb
- spec/models/enterprise_group_spec.rb
- spec/models/enterprise_relationship_spec.rb
- spec/models/enterprise_spec.rb
- spec/models/exchange_spec.rb
- spec/models/model_set_spec.rb
- spec/models/order_cycle_spec.rb
- spec/models/producer_property_spec.rb
- spec/models/product_distribution_spec.rb
- spec/models/product_importer_spec.rb
- spec/models/proxy_order_spec.rb
- spec/models/spree/ability_spec.rb
- spec/models/spree/adjustment_spec.rb
- spec/models/spree/calculator/flexi_rate_spec.rb
- spec/models/spree/calculator/price_sack_spec.rb
- spec/models/spree/classification_spec.rb
- spec/models/spree/gateway/stripe_connect_spec.rb
- spec/models/spree/image_spec.rb
- spec/models/spree/line_item_spec.rb
- spec/models/spree/order_spec.rb
- spec/models/spree/payment_method_spec.rb
- spec/models/spree/payment_spec.rb
- spec/models/spree/product_spec.rb
- spec/models/spree/property_spec.rb
- spec/models/spree/shipping_method_spec.rb
- spec/models/spree/taxon_spec.rb
- spec/models/spree/tax_rate_spec.rb
- spec/models/spree/user_spec.rb
- spec/models/spree/variant_spec.rb
- spec/models/stripe_account_spec.rb
- spec/models/tag_rule/discount_order_spec.rb
- spec/models/tag_rule/filter_order_cycles_spec.rb
- 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/variant_override_spec.rb
- spec/performance/orders_controller_spec.rb
- spec/performance/proxy_order_syncer_spec.rb
- spec/performance/shop_controller_spec.rb
- spec/requests/checkout/failed_checkout_spec.rb
- spec/requests/checkout/paypal_spec.rb
- spec/requests/checkout/stripe_connect_spec.rb
- spec/requests/embedded_shopfronts_headers_spec.rb
- spec/requests/shop_spec.rb
- spec/serializers/admin/customer_serializer_spec.rb
- spec/serializers/admin/exchange_serializer_spec.rb
- spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb
- spec/serializers/admin/for_order_cycle/supplied_product_serializer_spec.rb
- spec/serializers/admin/subscription_customer_serializer_spec.rb
- spec/serializers/admin/variant_override_serializer_spec.rb
- spec/serializers/current_order_serializer.rb
- spec/serializers/enterprise_serializer_spec.rb
- spec/serializers/order_serializer_spec.rb
- spec/services/cart_service_spec.rb
- spec/services/embedded_page_service_spec.rb
- spec/services/order_cycle_form_spec.rb
- spec/services/order_factory_spec.rb
- spec/services/order_syncer_spec.rb
- spec/services/subscription_estimator_spec.rb
- spec/services/subscription_form_spec.rb
- spec/services/subscription_validator_spec.rb
- spec/spec_helper.rb
- spec/support/cancan_helper.rb
- spec/support/delayed_job_helper.rb
- spec/support/matchers/delegate_matchers.rb
- spec/support/matchers/select2_matchers.rb
- spec/support/matchers/table_matchers.rb
- spec/support/request/authentication_workflow.rb
- spec/support/request/shop_workflow.rb
- spec/support/request/web_helper.rb
- spec/support/seeds.rb
- spec/support/spree/init.rb
Metrics/AbcSize:
Max: 15
Exclude:
- app/controllers/admin/bulk_line_items_controller.rb
- app/controllers/admin/customers_controller.rb
- app/controllers/admin/enterprise_fees_controller.rb
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/product_import_controller.rb
- app/controllers/admin/schedules_controller.rb
- app/controllers/admin/stripe_accounts_controller.rb
- app/controllers/admin/subscription_line_items_controller.rb
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/api/enterprises_controller.rb
- app/controllers/api/order_cycles_controller.rb
- app/controllers/api/product_images_controller.rb
- app/controllers/base_controller.rb
- app/controllers/cart_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/discourse_sso_controller.rb
- app/controllers/spree/admin/adjustments_controller_decorator.rb
- app/controllers/spree/admin/line_items_controller_decorator.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/admin/overview_controller_decorator.rb
- app/controllers/spree/admin/payment_methods_controller_decorator.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/admin/products_controller_decorator.rb
- app/controllers/spree/admin/reports_controller_decorator.rb
- app/controllers/spree/admin/search_controller_decorator.rb
- app/controllers/spree/admin/shipping_methods_controller_decorator.rb
- app/controllers/spree/api/products_controller_decorator.rb
- app/controllers/spree/credit_cards_controller.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/controllers/spree/user_sessions_controller_decorator.rb
- app/controllers/stripe/callbacks_controller.rb
- app/controllers/user_confirmations_controller.rb
- app/controllers/user_passwords_controller.rb
- app/controllers/user_registrations_controller.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/i18n_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/helpers/spree/orders_helper.rb
- app/jobs/finalize_account_invoices.rb
- app/jobs/subscription_placement_job.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/mailers/producer_mailer.rb
- app/models/billable_period.rb
- app/models/calculator/flat_percent_per_item.rb
- app/models/column_preference.rb
- app/models/enterprise_group.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb
- app/models/model_set.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- app/models/proxy_order.rb
- app/models/spree/ability_decorator.rb
- app/models/spree/adjustment_decorator.rb
- app/models/spree/calculator/default_tax_decorator.rb
- app/models/spree/calculator/flexi_rate_decorator.rb
- app/models/spree/line_item_decorator.rb
- app/models/spree/order_decorator.rb
- app/models/spree/payment_decorator.rb
- app/models/spree/product_decorator.rb
- app/models/spree/product_set.rb
- app/models/spree/taxon_decorator.rb
- app/serializers/api/admin/enterprise_serializer.rb
- app/serializers/api/enterprise_serializer.rb
- app/serializers/api/product_serializer.rb
- app/serializers/api/variant_serializer.rb
- app/services/cart_service.rb
- app/services/create_order_cycle.rb
- app/services/order_syncer.rb
- app/services/subscription_validator.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/bill_calculator.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/customers_report.rb
- lib/open_food_network/enterprise_issue_validator.rb
- lib/open_food_network/group_buy_report.rb
- lib/open_food_network/lettuce_share_report.rb
- lib/open_food_network/option_value_namer.rb
- lib/open_food_network/order_and_distributor_report.rb
- lib/open_food_network/order_cycle_form_applicator.rb
- lib/open_food_network/order_cycle_management_report.rb
- lib/open_food_network/order_cycle_permissions.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
- lib/open_food_network/packing_report.rb
- lib/open_food_network/payments_report.rb
- lib/open_food_network/permissions.rb
- lib/open_food_network/products_and_inventory_report.rb
- lib/open_food_network/reports/line_items.rb
- lib/open_food_network/sales_tax_report.rb
- lib/open_food_network/users_and_enterprises_report.rb
- lib/open_food_network/variant_and_line_item_naming.rb
- lib/open_food_network/xero_invoices_report.rb
- lib/spree/core/controller_helpers/respond_with_decorator.rb
- lib/spree/localized_number.rb
- lib/stripe/account_connector.rb
- lib/tasks/enterprises.rake
- spec/archive/features/consumer/checkout_spec.rb
- spec/controllers/spree/admin/orders_controller_spec.rb
- spec/features/admin/reports_spec.rb
- spec/features/consumer/shopping/checkout_spec.rb
- spec/features/consumer/shopping/variant_overrides_spec.rb
- spec/models/enterprise_spec.rb
- spec/models/product_importer_spec.rb
- spec/support/performance_helper.rb
Metrics/CyclomaticComplexity:
Max: 6
Exclude:
- app/controllers/admin/enterprise_fees_controller.rb
- app/controllers/admin/enterprises_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/i18n_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- app/models/spree/ability_decorator.rb
- app/models/spree/adjustment_decorator.rb
- app/models/spree/payment_decorator.rb
- app/models/spree/product_decorator.rb
- app/models/spree/product_set.rb
- app/models/variant_override_set.rb
- app/services/cart_service.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/bill_calculator.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/enterprise_issue_validator.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
- lib/spree/core/controller_helpers/order_decorator.rb
- lib/spree/core/controller_helpers/respond_with_decorator.rb
- lib/spree/localized_number.rb
- spec/models/product_importer_spec.rb
Metrics/PerceivedComplexity:
Max: 7
Exclude:
- app/controllers/admin/enterprises_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/i18n_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/jobs/update_account_invoices.rb
- app/models/enterprise_relationship.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- app/models/spree/ability_decorator.rb
- app/models/spree/line_item_decorator.rb
- app/models/spree/order_decorator.rb
- app/models/spree/product_decorator.rb
- app/models/spree/product_set.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/enterprise_issue_validator.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
- lib/spree/core/controller_helpers/order_decorator.rb
- lib/spree/core/controller_helpers/respond_with_decorator.rb
- lib/spree/localized_number.rb
- spec/models/product_importer_spec.rb
Metrics/MethodLength:
Max: 10
Exclude:
- app/controllers/admin/customers_controller.rb
- app/controllers/admin/enterprise_fees_controller.rb
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/manager_invitations_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/stripe_accounts_controller.rb
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/base_controller.rb
- app/controllers/cart_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/shop_controller.rb
- app/controllers/spree/admin/line_items_controller_decorator.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/admin/payment_methods_controller_decorator.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/admin/products_controller_decorator.rb
- app/controllers/spree/admin/reports_controller_decorator.rb
- app/controllers/spree/admin/search_controller_decorator.rb
- app/controllers/spree/admin/shipping_methods_controller_decorator.rb
- app/controllers/spree/credit_cards_controller.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/controllers/spree/user_sessions_controller_decorator.rb
- app/controllers/stripe/callbacks_controller.rb
- app/controllers/user_confirmations_controller.rb
- app/controllers/user_passwords_controller.rb
- app/controllers/user_registrations_controller.rb
- app/helpers/checkout_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/jobs/finalize_account_invoices.rb
- app/jobs/subscription_placement_job.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/mailers/producer_mailer.rb
- app/models/billable_period.rb
- app/models/column_preference.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb
- app/models/preference_sections/footer_and_external_links_section.rb
- app/models/preference_sections/main_links_section.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- app/models/product_import/product_importer.rb
- app/models/spree/ability_decorator.rb
- app/models/spree/adjustment_decorator.rb
- app/models/spree/calculator/default_tax_decorator.rb
- app/models/spree/calculator/flexi_rate_decorator.rb
- app/models/spree/line_item_decorator.rb
- app/models/spree/order_decorator.rb
- app/models/spree/payment_decorator.rb
- app/models/spree/payment_method_decorator.rb
- app/models/spree/product_set.rb
- app/models/spree/taxon_decorator.rb
- app/serializers/api/admin/order_cycle_serializer.rb
- app/services/cart_service.rb
- app/services/order_cycle_form.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/cached_products_renderer.rb
- lib/open_food_network/column_preference_defaults.rb
- lib/open_food_network/customers_report.rb
- lib/open_food_network/enterprise_fee_calculator.rb
- lib/open_food_network/group_buy_report.rb
- lib/open_food_network/lettuce_share_report.rb
- lib/open_food_network/option_value_namer.rb
- lib/open_food_network/order_and_distributor_report.rb
- lib/open_food_network/order_cycle_form_applicator.rb
- lib/open_food_network/order_cycle_management_report.rb
- lib/open_food_network/order_cycle_permissions.rb
- lib/open_food_network/order_grouper.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
- lib/open_food_network/packing_report.rb
- lib/open_food_network/payments_report.rb
- lib/open_food_network/permissions.rb
- lib/open_food_network/products_and_inventory_report.rb
- lib/open_food_network/products_renderer.rb
- lib/open_food_network/rack_request_blocker.rb
- lib/open_food_network/reports/bulk_coop_allocation_report.rb
- lib/open_food_network/reports/bulk_coop_supplier_report.rb
- lib/open_food_network/reports/line_items.rb
- lib/open_food_network/sales_tax_report.rb
- lib/open_food_network/users_and_enterprises_report.rb
- lib/open_food_network/xero_invoices_report.rb
- lib/spree/core/controller_helpers/respond_with_decorator.rb
- lib/spree/localized_number.rb
- lib/stripe/profile_storer.rb
- spec/archive/features/consumer/checkout_spec.rb
- spec/features/consumer/shopping/checkout_spec.rb
- spec/features/consumer/shopping/variant_overrides_spec.rb
- spec/models/product_importer_spec.rb
- spec/support/request/authentication_workflow.rb
Metrics/ClassLength:
Max: 100
Exclude:
- app/controllers/admin/enterprises_controller.rb
- app/controllers/admin/order_cycles_controller.rb
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/checkout_controller.rb
- app/models/enterprise.rb
- app/models/order_cycle.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- app/models/product_import/product_importer.rb
- app/models/spree/ability_decorator.rb
- app/serializers/api/enterprise_serializer.rb
- app/services/cart_service.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/enterprise_fee_calculator.rb
- lib/open_food_network/order_cycle_form_applicator.rb
- lib/open_food_network/order_cycle_management_report.rb
- lib/open_food_network/order_cycle_permissions.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
- lib/open_food_network/packing_report.rb
- lib/open_food_network/payments_report.rb
- lib/open_food_network/permissions.rb
- lib/open_food_network/products_cache.rb
- lib/open_food_network/xero_invoices_report.rb
Metrics/ModuleLength:
Max: 100
Exclude:
- lib/open_food_network/column_preference_defaults.rb
- spec/controllers/admin/enterprises_controller_spec.rb
- spec/controllers/admin/order_cycles_controller_spec.rb
- spec/controllers/api/order_cycles_controller_spec.rb
- spec/controllers/api/orders_controller_spec.rb
- spec/controllers/spree/api/products_controller_spec.rb
- spec/lib/open_food_network/address_finder_spec.rb
- spec/lib/open_food_network/customers_report_spec.rb
- spec/lib/open_food_network/enterprise_fee_calculator_spec.rb
- spec/lib/open_food_network/option_value_namer_spec.rb
- spec/lib/open_food_network/order_cycle_form_applicator_spec.rb
- spec/lib/open_food_network/order_cycle_permissions_spec.rb
- spec/lib/open_food_network/order_grouper_spec.rb
- spec/lib/open_food_network/permissions_spec.rb
- spec/lib/open_food_network/products_and_inventory_report_spec.rb
- spec/lib/open_food_network/products_cache_spec.rb
- spec/lib/open_food_network/proxy_order_syncer_spec.rb
- spec/lib/open_food_network/scope_variant_to_hub_spec.rb
- spec/lib/open_food_network/subscription_payment_updater_spec.rb
- spec/lib/open_food_network/tag_rule_applicator_spec.rb
- spec/lib/open_food_network/users_and_enterprises_report_spec.rb
- spec/models/spree/ability_spec.rb
- spec/models/spree/adjustment_spec.rb
- spec/models/spree/line_item_spec.rb
- spec/models/spree/payment_spec.rb
- spec/models/spree/product_spec.rb
- spec/models/spree/variant_spec.rb
- spec/support/request/web_helper.rb
Metrics/ParameterLists:
Max: 5
Exclude:
- app/helpers/angular_form_builder.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
- lib/open_food_network/xero_invoices_report.rb
- spec/features/admin/reports_spec.rb
Metrics/BlockNesting:
Max: 3
Exclude:
- app/controllers/checkout_controller.rb

211
.rubocop_styleguide.yml Normal file
View File

@@ -0,0 +1,211 @@
# Our Open Food Network style guide.
#
# These are the rules we agreed upon and we work towards. Code Climate uses
# these rules to rate our code and detect new violations. But when you run
# rubocop locally, the default configuration file `.rubocop.yml` loads
# our "todo lists" to ignore all current violations.
AllCops:
TargetRubyVersion: 2.1
TargetRailsVersion: 3.2
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
# The parser gem fails to parse this file with out current Ruby version.
- 'spec/factories.rb'
# Excluding: inadequate Naming/FileName rule rejects GemFile name with camelcase
- 'engines/web/Gemfile'
## OFN SETTINGS
#
# Cop settings that have been agreed upon by the OFN community
Rails:
Enabled: true
Style/Documentation:
Enabled: false
Style/StringLiterals:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys
Style/Send:
Enabled: true
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
Metrics/LineLength:
Max: 100
## TEMPORARY/CONTESTED SETTINGS
#
# These are still to be decided upon, but recommended for inclusion by
# oeoeaio after scrutinising offenses the codebase
# Don't think this is a big issue, mostly picking up RPSEC scope definitions
# with lamdas and RSpec '.to change{}' blocks
Lint/AmbiguousBlockAssociation:
Enabled: false
# Heaps of offences (> 100) in specs, mostly in situations where two or more
# instances of a model are required, but only one is referenced. Difficult to
# fix without making the spec look messy or rewriting it.
# Should definitely fix at some point.
Lint/UselessAssignment:
Exclude:
- spec/**/*
# AFAIK, there is no good alternative to dynamic matchers until we upgrade
# to Rails 4 and can use #find_by. If there is a better approach, let's do it.
Rails/DynamicFindBy:
Enabled: false
# Same as above, #find_by is not available until Rails 4
Rails/FindBy:
Enabled: false
# Same as above, #update! is not available until Rails 4
Rails/ActiveRecordAliases:
Enabled: false
# This should be the programmer's discretion, perhaps we should review all of
# the uses of it an make specific exceptions though.
Rails/SkipsModelValidations:
Enabled: false
## Relaxed.Ruby.Style SETTINGS
#
# These styles are a starting point for the conversation around conventions
# They should be removed or tweaked and moved above as decisions are made
# NOTE: Cops which did not fail at the time of writing were removed
Layout/DotPosition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledotposition
Layout/SpaceBeforeBlockBraces:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
Layout/SpaceInsideParens:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
Style/Alias:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylealias
Style/BlockDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
Style/CommentAnnotation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylecommentannotation
Style/DoubleNegation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledoublenegation
Style/FormatString:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleformatstring
Style/IfUnlessModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
Style/Lambda:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylelambda
Style/MultilineBlockChain:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
Style/NegatedIf:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedif
Style/NegatedWhile:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
Style/ParallelAssignment:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
Style/PercentLiteralDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
Style/Semicolon:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesemicolon
Style/SingleLineMethods:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
Style/TrailingCommaInArguments:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
Style/TrailingCommaInArrayLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
Style/TrailingCommaInHashLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
Style/WordArray:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewordarray
Style/SymbolArray:
Enabled: false
StyleGuide: https://rubocop.readthedocs.io/en/latest/cops_style/#stylesymbolarray
Lint/AmbiguousRegexpLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
Lint/AssignmentInCondition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
Metrics/AbcSize:
Max: 15
Metrics/BlockLength:
ExcludedMethods: ["collection", "context", "describe", "it", "member", "namespace", "resource", "resources"]
Metrics/BlockNesting:
Max: 3
Metrics/ClassLength:
Max: 100
Metrics/ModuleLength:
Max: 100
Metrics/CyclomaticComplexity:
Max: 6
Metrics/MethodLength:
Max: 10
Metrics/ParameterLists:
Max: 5
Metrics/PerceivedComplexity:
Max: 7

View File

@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 1400`
# on 2018-10-25 13:57:32 +1100 using RuboCop version 0.57.2.
# on 2019-01-02 13:44:41 +0100 using RuboCop version 0.57.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -23,11 +23,9 @@ Layout/AlignArray:
- 'lib/open_food_network/order_and_distributor_report.rb'
- 'lib/open_food_network/orders_and_fulfillments_report.rb'
- 'lib/open_food_network/packing_report.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/services/cart_service_spec.rb'
# Offense count: 121
# Offense count: 122
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
@@ -56,8 +54,9 @@ Layout/AlignHash:
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/spree/shipping_method_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/models/variant_override_spec.rb'
# Offense count: 60
# Offense count: 49
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
@@ -68,10 +67,8 @@ Layout/AlignParameters:
- 'app/models/enterprise_group.rb'
- 'app/models/enterprise_relationship.rb'
- 'app/serializers/api/address_serializer.rb'
- 'app/serializers/api/enterprise_serializer.rb'
- 'app/serializers/api/shipping_method_serializer.rb'
- 'lib/spree/product_filters.rb'
- 'lib/tasks/dev.rake'
- 'spec/controllers/enterprises_controller_spec.rb'
- 'spec/controllers/shop_controller_spec.rb'
- 'spec/features/admin/enterprise_fees_spec.rb'
@@ -95,11 +92,12 @@ Layout/BlockAlignment:
- 'spec/models/spree/line_item_spec.rb'
- 'spec/models/spree/product_spec.rb'
# Offense count: 1
# Offense count: 2
# Cop supports --auto-correct.
Layout/BlockEndNewline:
Exclude:
- 'spec/features/consumer/shopping/cart_spec.rb'
- 'spec/models/variant_override_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
@@ -125,7 +123,7 @@ Layout/ElseAlignment:
- 'app/serializers/api/admin/order_cycle_serializer.rb'
- 'lib/open_food_network/sales_tax_report.rb'
# Offense count: 197
# Offense count: 187
# Cop supports --auto-correct.
Layout/EmptyLines:
Exclude:
@@ -138,7 +136,6 @@ Layout/EmptyLines:
- 'app/controllers/spree/admin/adjustments_controller_decorator.rb'
- 'app/controllers/spree/admin/base_controller_decorator.rb'
- 'app/controllers/spree/admin/general_settings_controller_decorator.rb'
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'app/controllers/spree/admin/payments_controller_decorator.rb'
- 'app/controllers/spree/admin/products_controller_decorator.rb'
- 'app/controllers/spree/admin/variants_controller_decorator.rb'
@@ -149,14 +146,11 @@ Layout/EmptyLines:
- 'app/jobs/finalize_account_invoices.rb'
- 'app/jobs/products_cache_integrity_checker_job.rb'
- 'app/jobs/refresh_products_cache_job.rb'
- 'app/mailers/producer_mailer.rb'
- 'app/models/coordinator_fee.rb'
- 'app/models/enterprise_fee.rb'
- 'app/models/enterprise_relationship.rb'
- 'app/models/exchange.rb'
- 'app/models/exchange_fee.rb'
- 'app/models/inventory_item.rb'
- 'app/models/open_food_network/calculator/weight.rb'
- 'app/models/order_cycle.rb'
- 'app/models/producer_property.rb'
- 'app/models/product_distribution.rb'
@@ -178,7 +172,6 @@ Layout/EmptyLines:
- 'app/models/spree/shipping_method_decorator.rb'
- 'app/models/spree/tax_rate_decorator.rb'
- 'app/models/spree/taxon_decorator.rb'
- 'app/serializers/api/enterprise_serializer.rb'
- 'lib/open_food_network/cached_products_renderer.rb'
- 'lib/open_food_network/enterprise_fee_applicator.rb'
- 'lib/open_food_network/enterprise_issue_validator.rb'
@@ -190,14 +183,12 @@ Layout/EmptyLines:
- 'lib/open_food_network/products_cache.rb'
- 'lib/open_food_network/products_cache_integrity_checker.rb'
- 'lib/open_food_network/products_renderer.rb'
- 'lib/open_food_network/property_merge.rb'
- 'lib/open_food_network/reports/bulk_coop_report.rb'
- 'lib/open_food_network/sales_tax_report.rb'
- 'lib/open_food_network/scope_product_to_hub.rb'
- 'lib/open_food_network/xero_invoices_report.rb'
- 'lib/spree/core/controller_helpers/order_decorator.rb'
- 'lib/tasks/cache.rake'
- 'lib/tasks/dev.rake'
- 'lib/tasks/enterprises.rake'
- 'spec/archive/features/consumer/checkout_spec.rb'
- 'spec/controllers/admin/column_preferences_controller_spec.rb'
@@ -249,12 +240,10 @@ Layout/EmptyLines:
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/shipping_method_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/models/variant_override_spec.rb'
- 'spec/serializers/admin/exchange_serializer_spec.rb'
- 'spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb'
- 'spec/serializers/admin/for_order_cycle/supplied_product_serializer_spec.rb'
- 'spec/serializers/credit_card_serializer_spec.rb'
- 'spec/services/cart_service_spec.rb'
- 'spec/support/delayed_job_helper.rb'
- 'spec/support/matchers/table_matchers.rb'
@@ -264,15 +253,13 @@ Layout/EmptyLinesAroundArguments:
Exclude:
- 'spec/archive/features/consumer/checkout_spec.rb'
# Offense count: 59
# Offense count: 51
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'app/controllers/spree/api/orders_controller_decorator.rb'
- 'app/controllers/spree/api/products_controller_decorator.rb'
- 'app/controllers/spree/checkout_controller_decorator.rb'
- 'app/models/spree/calculator/default_tax_decorator.rb'
- 'app/models/spree/calculator_decorator.rb'
@@ -280,24 +267,19 @@ Layout/EmptyLinesAroundBlockBody:
- 'app/models/spree/option_value_decorator.rb'
- 'lib/open_food_network/group_buy_report.rb'
- 'lib/spree/money_decorator.rb'
- 'lib/tasks/dev.rake'
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
- 'spec/controllers/admin/tag_rules_controller_spec.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
- 'spec/controllers/spree/admin/reports_controller_spec.rb'
- 'spec/controllers/spree/api/orders_controller_spec.rb'
- 'spec/controllers/spree/orders_controller_spec.rb'
- 'spec/controllers/user_confirmations_controller_spec.rb'
- 'spec/controllers/user_registrations_controller_spec.rb'
- 'spec/features/admin/caching_spec.rb'
- 'spec/features/admin/orders_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/features/consumer/cookies_spec.rb'
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
- 'spec/features/consumer/shopping/embedded_shopfronts_spec.rb'
- 'spec/features/consumer/shopping/shopping_spec.rb'
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/helpers/admin/business_model_configuration_helper_spec.rb'
- 'spec/helpers/shared_helper_spec.rb'
- 'spec/helpers/shop_helper_spec.rb'
@@ -321,7 +303,7 @@ Layout/EmptyLinesAroundBlockBody:
- 'spec/support/matchers/select2_matchers.rb'
- 'spec/support/matchers/table_matchers.rb'
# Offense count: 24
# Offense count: 23
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
@@ -335,7 +317,6 @@ Layout/EmptyLinesAroundClassBody:
- 'app/controllers/api/enterprises_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/home_controller.rb'
- 'app/mailers/producer_mailer.rb'
- 'app/models/coordinator_fee.rb'
- 'app/models/producer_property.rb'
- 'app/models/spree/preferences/file_configuration.rb'
@@ -362,7 +343,7 @@ Layout/EndAlignment:
- 'app/serializers/api/admin/for_order_cycle/supplied_product_serializer.rb'
- 'app/serializers/api/admin/order_cycle_serializer.rb'
# Offense count: 47
# Offense count: 45
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Layout/ExtraSpacing:
@@ -372,7 +353,6 @@ Layout/ExtraSpacing:
- 'app/helpers/admin/injection_helper.rb'
- 'app/models/enterprise.rb'
- 'app/models/spree/classification_decorator.rb'
- 'app/serializers/api/enterprise_serializer.rb'
- 'config.ru'
- 'lib/open_food_network/bulk_coop_report.rb'
- 'lib/open_food_network/option_value_namer.rb'
@@ -457,13 +437,7 @@ Layout/IndentationWidth:
- 'spec/models/enterprise_spec.rb'
- 'spec/models/spree/calculator/flexi_rate_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Layout/LeadingBlankLines:
Exclude:
- 'lib/tasks/dev.rake'
# Offense count: 44
# Offense count: 43
# Cop supports --auto-correct.
Layout/LeadingCommentSpace:
Exclude:
@@ -473,7 +447,6 @@ Layout/LeadingCommentSpace:
- 'app/models/spree/inventory_unit_decorator.rb'
- 'app/models/spree/taxon_decorator.rb'
- 'app/serializers/api/address_serializer.rb'
- 'app/serializers/api/enterprise_serializer.rb'
- 'app/serializers/api/product_serializer.rb'
- 'spec/archive/features/consumer/checkout_spec.rb'
- 'spec/controllers/spree/api/line_items_controller_spec.rb'
@@ -489,7 +462,7 @@ Layout/LeadingCommentSpace:
- 'spec/support/matchers/select2_matchers.rb'
- 'spec/support/request/authentication_workflow.rb'
# Offense count: 44
# Offense count: 45
# Cop supports --auto-correct.
Layout/MultilineBlockLayout:
Exclude:
@@ -509,6 +482,7 @@ Layout/MultilineBlockLayout:
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/models/variant_override_spec.rb'
- 'spec/serializers/enterprise_serializer_spec.rb'
# Offense count: 4
@@ -655,7 +629,7 @@ Layout/SpaceAroundEqualsInParameterDefault:
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 55
# Offense count: 50
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Layout/SpaceAroundOperators:
@@ -666,11 +640,9 @@ Layout/SpaceAroundOperators:
- 'app/overrides/remove_search_bar.rb'
- 'app/overrides/remove_side_bar.rb'
- 'app/overrides/replace_shipping_address_form_with_distributor_details.rb'
- 'app/serializers/api/enterprise_serializer.rb'
- 'lib/open_food_network/xero_invoices_report.rb'
- 'lib/spree/product_filters.rb'
- 'spec/controllers/admin/enterprises_controller_spec.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
- 'spec/features/admin/bulk_product_update_spec.rb'
- 'spec/features/consumer/shopping/checkout_spec.rb'
@@ -679,7 +651,6 @@ Layout/SpaceAroundOperators:
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/stripe/account_connector_spec.rb'
- 'spec/models/calculator/weight_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/cancan_helper.rb'
- 'spec/support/seeds.rb'
@@ -732,7 +703,7 @@ Layout/SpaceInsideArrayLiteralBrackets:
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
- 'spec/models/spree/order_spec.rb'
# Offense count: 194
# Offense count: 192
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
@@ -746,7 +717,6 @@ Layout/SpaceInsideBlockBraces:
- 'app/models/column_preference.rb'
- 'app/models/spree/order_decorator.rb'
- 'lib/spree/product_filters.rb'
- 'lib/tasks/dev.rake'
- 'lib/tasks/karma.rake'
- 'spec/archive/features/consumer/checkout_spec.rb'
- 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb'
@@ -786,7 +756,7 @@ Layout/SpaceInsideBlockBraces:
- 'spec/spec_helper.rb'
- 'spec/support/cancan_helper.rb'
# Offense count: 728
# Offense count: 702
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
@@ -837,7 +807,6 @@ Layout/SpaceInsideHashLiteralBraces:
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
- 'spec/controllers/api/statuses_controller_spec.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/controllers/checkout_controller_spec.rb'
- 'spec/controllers/enterprises_controller_spec.rb'
- 'spec/controllers/shop_controller_spec.rb'
@@ -857,7 +826,6 @@ Layout/SpaceInsideHashLiteralBraces:
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/consumer/shopping/checkout_spec.rb'
- 'spec/helpers/checkout_helper_spec.rb'
- 'spec/helpers/i18n_helper_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/lib/open_food_network/feature_toggle_spec.rb'
@@ -889,7 +857,6 @@ Layout/SpaceInsideHashLiteralBraces:
- 'spec/requests/checkout/failed_checkout_spec.rb'
- 'spec/requests/checkout/stripe_connect_spec.rb'
- 'spec/serializers/enterprise_serializer_spec.rb'
- 'spec/services/cart_service_spec.rb'
- 'spec/services/order_syncer_spec.rb'
- 'spec/services/subscription_form_spec.rb'
- 'spec/spec_helper.rb'
@@ -927,15 +894,7 @@ Layout/Tab:
- 'spec/lib/spree/product_filters_spec.rb'
- 'spec/models/spree/line_item_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: final_newline, final_blank_line
Layout/TrailingBlankLines:
Exclude:
- 'spec/controllers/cart_controller_spec.rb'
# Offense count: 60
# Offense count: 57
# Cop supports --auto-correct.
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
@@ -951,7 +910,6 @@ Layout/TrailingWhitespace:
- 'app/views/json/partials/_producer.rabl'
- 'spec/controllers/admin/column_preferences_controller_spec.rb'
- 'spec/features/admin/customers_spec.rb'
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/features/consumer/cookies_spec.rb'
- 'spec/helpers/enterprises_helper_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
@@ -964,9 +922,10 @@ Layout/TrailingWhitespace:
- 'spec/serializers/enterprise_serializer_spec.rb'
- 'spec/support/request/menu_helper.rb'
# Offense count: 1
# Offense count: 2
Lint/AmbiguousOperator:
Exclude:
- 'spec/controllers/api/enterprise_fees_controller_spec.rb'
- 'spec/controllers/spree/admin/payments_controller_spec.rb'
# Offense count: 4
@@ -975,14 +934,13 @@ Lint/DuplicateMethods:
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/subscription_summary.rb'
# Offense count: 16
# Offense count: 15
Lint/IneffectiveAccessModifier:
Exclude:
- 'app/models/column_preference.rb'
- 'app/models/variant_override.rb'
- 'lib/open_food_network/feature_toggle.rb'
- 'lib/open_food_network/products_cache.rb'
- 'lib/open_food_network/property_merge.rb'
- 'spec/lib/open_food_network/reports/report_spec.rb'
# Offense count: 2
@@ -1082,18 +1040,17 @@ Lint/UnusedMethodArgument:
- 'lib/open_food_network/paperclippable.rb'
- 'lib/open_food_network/rack_request_blocker.rb'
# Offense count: 6
# Offense count: 5
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
- 'app/models/column_preference.rb'
- 'lib/open_food_network/feature_toggle.rb'
- 'lib/open_food_network/products_cache.rb'
- 'lib/open_food_network/property_merge.rb'
- 'lib/open_food_network/reports/bulk_coop_report.rb'
- 'spec/lib/open_food_network/reports/report_spec.rb'
# Offense count: 242
# Offense count: 240
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
@@ -1104,7 +1061,6 @@ Lint/Void:
- 'spec/controllers/enterprises_controller_spec.rb'
- 'spec/controllers/shop_controller_spec.rb'
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
- 'spec/controllers/spree/api/products_controller_spec.rb'
- 'spec/controllers/spree/api/variants_controller_spec.rb'
@@ -1148,53 +1104,26 @@ Lint/Void:
- 'spec/serializers/enterprise_serializer_spec.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 192
Metrics/AbcSize:
Max: 293
# Offense count: 1039
# Offense count: 110
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 787
# Offense count: 1
# Configuration parameters: CountBlocks.
Metrics/BlockNesting:
Max: 4
# Offense count: 23
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 331
Max: 117
# Offense count: 36
Metrics/CyclomaticComplexity:
Max: 23
# Offense count: 2717
# Offense count: 1
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 619
Max: 141
# Offense count: 161
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 95
# Offense count: 27
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 633
# Offense count: 6
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 8
# Offense count: 28
Metrics/PerceivedComplexity:
Max: 21
Max: 14
# Offense count: 7
Naming/AccessorMethodName:
@@ -1249,7 +1178,7 @@ Naming/PredicateName:
- 'lib/open_food_network/packing_report.rb'
- 'lib/tasks/data.rake'
# Offense count: 13
# Offense count: 12
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at
Naming/UncommunicativeMethodParamName:
@@ -1259,7 +1188,6 @@ Naming/UncommunicativeMethodParamName:
- 'app/helpers/spree/base_helper_decorator.rb'
- 'app/models/exchange.rb'
- 'app/services/subscription_validator.rb'
- 'lib/open_food_network/property_merge.rb'
- 'lib/open_food_network/reports/bulk_coop_report.rb'
- 'lib/open_food_network/xero_invoices_report.rb'
- 'spec/lib/open_food_network/reports/report_spec.rb'
@@ -1272,14 +1200,13 @@ Naming/VariableName:
Exclude:
- 'app/helpers/admin/injection_helper.rb'
# Offense count: 16
# Offense count: 10
# Configuration parameters: EnforcedStyle.
# SupportedStyles: snake_case, normalcase, non_integer
Naming/VariableNumber:
Exclude:
- 'spec/archive/features/consumer/checkout_spec.rb'
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
- 'spec/models/calculator/weight_spec.rb'
# Offense count: 1
Performance/Caller:
@@ -1431,7 +1358,7 @@ Rails/HasManyOrHasOneDependent:
- 'app/models/spree/variant_decorator.rb'
- 'app/models/subscription.rb'
# Offense count: 45
# Offense count: 46
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: numeric, symbolic
@@ -1440,16 +1367,15 @@ Rails/HttpStatus:
- 'app/controllers/admin/bulk_line_items_controller.rb'
- 'app/controllers/admin/column_preferences_controller.rb'
- 'app/controllers/admin/customers_controller.rb'
- 'app/controllers/admin/enterprise_fees_controller.rb'
- 'app/controllers/admin/enterprise_relationships_controller.rb'
- 'app/controllers/admin/enterprise_roles_controller.rb'
- 'app/controllers/admin/manager_invitations_controller.rb'
- 'app/controllers/admin/tag_rules_controller.rb'
- 'app/controllers/admin/variant_overrides_controller.rb'
- 'app/controllers/api/customers_controller.rb'
- 'app/controllers/api/enterprise_fees_controller.rb'
- 'app/controllers/api/enterprises_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/cart_controller.rb'
- 'app/controllers/checkout_controller.rb'
- 'app/controllers/enterprises_controller.rb'
- 'app/controllers/line_items_controller.rb'
@@ -1487,12 +1413,11 @@ Rails/Presence:
Exclude:
- 'app/serializers/api/admin/customer_serializer.rb'
# Offense count: 4
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
Rails/Present:
Exclude:
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'app/models/producer_property.rb'
- 'lib/open_food_network/products_and_inventory_report.rb'
@@ -1624,7 +1549,6 @@ Style/BracesAroundHashParameters:
- 'spec/controllers/admin/manager_invitations_controller_spec.rb'
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
- 'spec/controllers/api/order_cycles_controller_spec.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/controllers/enterprises_controller_spec.rb'
- 'spec/controllers/line_items_controller_spec.rb'
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
@@ -1657,7 +1581,6 @@ Style/BracesAroundHashParameters:
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/taxon_spec.rb'
- 'spec/serializers/admin/customer_serializer_spec.rb'
- 'spec/services/cart_service_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/cancan_helper.rb'
- 'spec/support/request/authentication_workflow.rb'
@@ -1669,7 +1592,7 @@ Style/CaseEquality:
- 'app/helpers/angular_form_helper.rb'
- 'spec/models/spree/payment_spec.rb'
# Offense count: 85
# Offense count: 82
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
@@ -1682,7 +1605,6 @@ Style/ClassAndModuleChildren:
- 'app/controllers/spree/store_controller_decorator.rb'
- 'app/helpers/angular_form_helper.rb'
- 'app/models/calculator/flat_percent_per_item.rb'
- 'app/models/open_food_network/calculator/weight.rb'
- 'app/models/spree/gateway/migs.rb'
- 'app/models/spree/gateway/pin.rb'
- 'app/models/spree/preferences/file_configuration.rb'
@@ -1814,7 +1736,7 @@ Style/EmptyLiteral:
- 'app/helpers/checkout_helper.rb'
- 'app/models/spree/order_decorator.rb'
# Offense count: 6
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
@@ -1824,7 +1746,6 @@ Style/EmptyMethod:
- 'app/controllers/home_controller.rb'
- 'app/controllers/map_controller.rb'
- 'app/controllers/producers_controller.rb'
- 'app/controllers/shops_controller.rb'
- 'app/controllers/spree/admin/products_controller_decorator.rb'
# Offense count: 2
@@ -1843,19 +1764,17 @@ Style/FormatStringToken:
- 'lib/open_food_network/sales_tax_report.rb'
- 'spec/models/enterprise_spec.rb'
# Offense count: 80
# Offense count: 76
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/admin/enterprise_fees_controller.rb'
- 'app/controllers/admin/enterprises_controller.rb'
- 'app/controllers/admin/order_cycles_controller.rb'
- 'app/controllers/admin/product_import_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/base_controller.rb'
- 'app/controllers/checkout_controller.rb'
- 'app/controllers/enterprises_controller.rb'
- 'app/controllers/home_controller.rb'
- 'app/controllers/spree/admin/adjustments_controller_decorator.rb'
- 'app/controllers/spree/admin/base_controller_decorator.rb'
@@ -1868,7 +1787,6 @@ Style/GuardClause:
- 'app/jobs/products_cache_integrity_checker_job.rb'
- 'app/jobs/update_account_invoices.rb'
- 'app/jobs/update_billable_periods.rb'
- 'app/mailers/producer_mailer.rb'
- 'app/models/enterprise.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/producer_property.rb'
@@ -1891,7 +1809,7 @@ Style/GuardClause:
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/shop_workflow.rb'
# Offense count: 924
# Offense count: 872
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
@@ -1923,7 +1841,6 @@ Style/HashSyntax:
- 'app/helpers/spree/admin/navigation_helper_decorator.rb'
- 'app/helpers/spree/admin/orders_helper_decorator.rb'
- 'app/mailers/enterprise_mailer.rb'
- 'app/mailers/spree/order_mailer_decorator.rb'
- 'app/mailers/spree/user_mailer_decorator.rb'
- 'app/models/billable_period.rb'
- 'app/models/calculator/flat_percent_per_item.rb'
@@ -1932,7 +1849,6 @@ Style/HashSyntax:
- 'app/models/enterprise_group.rb'
- 'app/models/enterprise_role.rb'
- 'app/models/exchange_variant.rb'
- 'app/models/open_food_network/calculator/weight.rb'
- 'app/models/order_cycle.rb'
- 'app/models/product_distribution.rb'
- 'app/models/spree/adjustment_decorator.rb'
@@ -1963,7 +1879,6 @@ Style/HashSyntax:
- 'app/overrides/set_auth_token_in_frontend.rb'
- 'app/presenters/variant_presenter.rb'
- 'app/serializers/api/admin/enterprise_fee_serializer.rb'
- 'app/serializers/api/enterprise_serializer.rb'
- 'app/views/api/order_cycles/bulk_show.v1.rabl'
- 'app/views/json/_order_cycle.rabl'
- 'app/views/json/partials/_hub.rabl'
@@ -1987,8 +1902,6 @@ Style/HashSyntax:
- 'spec/controllers/admin/stripe_connect_settings_controller_spec.rb'
- 'spec/controllers/api/order_cycles_controller_spec.rb'
- 'spec/controllers/base_controller_spec.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
- 'spec/controllers/spree/admin/payment_methods_controller_spec.rb'
- 'spec/controllers/spree/admin/payments_controller_spec.rb'
- 'spec/controllers/spree/api/products_controller_spec.rb'
@@ -2022,7 +1935,6 @@ Style/HashSyntax:
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/open_food_network/tag_rule_applicator_spec.rb'
- 'spec/mailers/order_mailer_spec.rb'
- 'spec/models/calculator/weight_spec.rb'
- 'spec/models/enterprise_fee_spec.rb'
- 'spec/models/enterprise_spec.rb'
- 'spec/models/exchange_spec.rb'
@@ -2077,7 +1989,6 @@ Style/MethodCallWithoutArgsParentheses:
Exclude:
- 'app/controllers/spree/admin/payment_methods_controller_decorator.rb'
- 'app/views/json/_groups.rabl'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/features/consumer/registration_spec.rb'
- 'spec/models/spree/payment_method_spec.rb'
- 'spec/support/request/ui_component_helper.rb'
@@ -2178,7 +2089,7 @@ Style/NumericLiteralPrefix:
Exclude:
- 'spec/features/admin/order_cycles_spec.rb'
# Offense count: 13
# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: Strict.
Style/NumericLiterals:
@@ -2215,14 +2126,13 @@ Style/ParenthesesAroundCondition:
Exclude:
- 'app/controllers/checkout_controller.rb'
# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: short, verbose
Style/PreferredHashMethods:
Exclude:
- 'app/controllers/spree/orders_controller_decorator.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
# Offense count: 18
# Cop supports --auto-correct.
@@ -2280,7 +2190,7 @@ Style/RedundantReturn:
- 'app/models/spree/classification_decorator.rb'
- 'app/serializers/api/admin/enterprise_serializer.rb'
# Offense count: 96
# Offense count: 95
# Cop supports --auto-correct.
Style/RedundantSelf:
Exclude:
@@ -2288,7 +2198,6 @@ Style/RedundantSelf:
- 'app/models/calculator/flat_percent_per_item.rb'
- 'app/models/enterprise.rb'
- 'app/models/exchange.rb'
- 'app/models/open_food_network/calculator/weight.rb'
- 'app/models/order_cycle.rb'
- 'app/models/producer_property.rb'
- 'app/models/spree/calculator/flat_percent_item_total_decorator.rb'
@@ -2328,15 +2237,14 @@ Style/RegexpLiteral:
- 'spec/mailers/subscription_mailer_spec.rb'
- 'spec/models/content_configuration_spec.rb'
# Offense count: 4
# Offense count: 2
# Cop supports --auto-correct.
Style/RescueModifier:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'lib/tasks/data.rake'
# Offense count: 268
# Offense count: 266
Style/Send:
Exclude:
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
@@ -2412,7 +2320,7 @@ Style/StructInheritance:
Exclude:
- 'lib/open_food_network/enterprise_fee_applicator.rb'
# Offense count: 93
# Offense count: 90
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
# IgnoredMethods: respond_to, define_method
@@ -2436,7 +2344,6 @@ Style/SymbolProc:
- 'lib/open_food_network/reports/bulk_coop_supplier_report.rb'
- 'lib/spree/product_filters.rb'
- 'spec/controllers/api/order_cycles_controller_spec.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
- 'spec/controllers/spree/api/products_controller_spec.rb'
- 'spec/controllers/spree/api/variants_controller_spec.rb'
- 'spec/features/admin/bulk_product_update_spec.rb'

View File

@@ -9,9 +9,6 @@ addons:
# Set the timezone for phantomjs with TZ
# Set the timezone for karma with TIMEZONE
#
# The test cases are roughly split according to their test times.
# It would be better to use https://github.com/ArturT/knapsack.
env:
global:
- TZ="Australia/Melbourne"
@@ -21,7 +18,7 @@ env:
- CI_NODE_INDEX=0
- CI_NODE_INDEX=1
- CI_NODE_INDEX=2
- CI_NODE_INDEX=3
- CI_NODE_INDEX=3 RSPEC_ENGINES="true"
- CI_NODE_INDEX=4 KARMA="true" GITHUB_DEPLOY="true"
before_script:
@@ -42,6 +39,7 @@ before_script:
script:
- 'if [ "$KARMA" = "true" ]; then bundle exec rake karma:run; else echo "Skipping karma run"; fi'
- 'if [ "$RSPEC_ENGINES" = "true" ]; then bundle exec rake ofn:specs:engines:rspec; else echo "Skipping RSpec run in engines"; fi'
- "bundle exec rake 'knapsack:rspec[--format progress --tag ~performance]'"
after_success:

View File

@@ -46,7 +46,7 @@ First, you need to create the database user the app will use by manually typing
$ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"
```
This will create the "ofn" user as superuser and allowing it to create databases.
This will create the "ofn" user as superuser and allowing it to create databases. If this command fails, check the [troubleshooting section](#creating-the-database) for an alternative.
Once done, run `script/setup`. If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
@@ -69,10 +69,18 @@ Tests, both unit and integration, are based on RSpec. To run the test suite, fir
bundle exec rake db:test:prepare
Then the tests can be run with:
Then the main application tests can be run with:
bundle exec rspec spec
The tests of all custom engines can be run with:
bundle exec rake ofn:specs:engines:rspec
Note: If your OS is not explicitly supported in the setup guides then not all tests may pass. However, you may still be able to develop. Get in touch with the [#dev][slack-dev] channel on Slack to troubleshoot issues and determine if they will preclude you from contributing to OFN.
Note: The time zone on your machine should match the one defined in `config/application.yml`.
The project is configured to use [Zeus][zeus] to reduce the pre-test startup time while Rails loads. See the [Zeus GitHub page][zeus] for usage instructions.
Once [npm dependencies are installed][karma], AngularJS tests can be run with:
@@ -93,12 +101,28 @@ You can run rubocop against your changes using:
rubocop
### Troubleshooting
Below are fixes to potential issues that can happen during the installation process. If these don't solve the problem, or it's not listed, feel free to reach out to the [Developer Community][slack-dev] on slack. We usually respond pretty quickly.
#### Creating the database
If the ```$ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"``` command doesn't work, you can run the following commands instead:
```
$ createuser --superuser --pwprompt ofn
Enter password for new role: f00d
Enter it again: f00d
$ createdb open_food_network_dev --owner=ofn
$ createdb open_food_network_test --owner=ofn
```
If these commands succeed, you should be able to [continue the setup process](#get-it-running).
[developer-wiki]: https://github.com/openfoodfoundation/openfoodnetwork/wiki
[sierra]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup:-macOS-(Sierra)
[sierra]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup%3A-macOS-%28Sierra%2C-HighSierra-and-Mojave%29
[el-capitan]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup:-OS-X-(El-Capitan)
[ubuntu]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup:-Ubuntu
[wiki]: https://github.com/openfoodfoundation/openfoodnetwork/wiki
[zeus]: https://github.com/burke/zeus
[rubocop]: https://rubocop.readthedocs.io/en/latest/
[karma]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Karma
[slack-dev]: https://openfoodnetwork.slack.com/messages/C2GQ45KNU

29
Gemfile
View File

@@ -5,7 +5,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'rails', '~> 3.2.22'
gem 'rails-i18n', '~> 3.0.0'
gem 'i18n', '~> 0.6.11'
gem 'i18n-js', '~> 3.0.0'
gem 'i18n-js', '~> 3.1.0'
# Patched version. See http://rubysec.com/advisories/CVE-2015-5312/.
gem 'nokogiri', '>= 1.6.7.1'
@@ -13,7 +13,7 @@ gem 'nokogiri', '>= 1.6.7.1'
gem 'web', path: './engines/web'
gem 'pg'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '69db1c090f3711088d84b524f1b94d25e6d21616'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '41906362d931695e0616194341a68d2c4c85aaaf'
gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable'
gem 'spree_auth_devise', github: 'openfoodfoundation/spree_auth_devise', branch: 'spree-upgrade-intermediate'
@@ -22,13 +22,13 @@ gem 'spree_auth_devise', github: 'openfoodfoundation/spree_auth_devise', branch:
# - Change type of password from string to password to hide it in the form
gem 'spree_paypal_express', github: "openfoodfoundation/better_spree_paypal_express", branch: "spree-upgrade-intermediate"
#gem 'spree_paypal_express', github: "spree-contrib/better_spree_paypal_express", branch: "1-3-stable"
gem 'stripe', '~> 3.3.2'
gem 'stripe', '~> 4.5.0'
# We need at least this version to have Digicert's root certificate
# which is needed for Pin Payments (and possibly others).
gem 'activemerchant', '~> 1.78'
gem 'oauth2', '~> 1.2.0' # Used for Stripe Connect
gem 'jwt', '~> 1.5'
gem 'oauth2', '~> 1.4.1' # Used for Stripe Connect
gem 'jwt', '~> 2.1'
gem 'delayed_job_active_record'
gem 'daemons'
@@ -63,15 +63,16 @@ gem 'spinjs-rails'
gem 'rack-ssl', require: 'rack/ssl'
gem 'rack-rewrite'
gem 'custom_error_message', github: 'jeremydurham/custom-err-msg'
gem 'angularjs-file-upload-rails', '~> 1.1.6'
gem 'roadie-rails', '~> 1.0.3'
gem 'angularjs-file-upload-rails', '~> 2.4.1'
gem 'roadie-rails', '~> 1.1.1'
gem 'figaro'
gem 'blockenspiel'
gem 'acts-as-taggable-on', '~> 3.4'
gem 'paper_trail', '~> 3.0.8'
gem 'paper_trail', '~> 5.2.3'
gem 'diffy'
gem 'skylight', '< 2.0'
gem 'combine_pdf'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
@@ -88,10 +89,7 @@ group :assets do
gem 'compass-rails'
gem 'coffee-rails', '~> 3.2.1'
gem 'mini_racer'
# We found that the following version of libv8 breaks the compilation of mini_racer.
# Nothing else depends on libv8.
gem 'libv8', '!= 6.7.288.46.1'
gem 'therubyracer', '=0.12.0'
gem 'uglifier', '>= 1.0.3'
@@ -120,7 +118,8 @@ group :test, :development do
gem 'awesome_print'
gem 'letter_opener', '>= 1.4.1'
gem 'timecop'
gem 'poltergeist', '>= 1.16.0'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
gem 'rspec-retry'
gem 'json_spec', '~> 1.1.4'
gem 'unicorn-rails'
@@ -145,9 +144,13 @@ group :development do
gem 'guard-rails'
gem 'guard-rspec', '~> 4.7.3'
gem 'rubocop', '>= 0.49.1'
gem 'spring', '1.7.2'
gem 'spring-commands-rspec'
# 1.0.9 fixed openssl issues on macOS https://github.com/eventmachine/eventmachine/issues/602
# While we don't require this gem directly, no dependents forced the upgrade to a version
# greater than 1.0.9, so we just required the latest available version here.
gem 'eventmachine', '>= 1.2.3'
gem 'rack-mini-profiler', '< 1.0.0'
end

View File

@@ -31,8 +31,8 @@ GIT
GIT
remote: https://github.com/openfoodfoundation/spree.git
revision: 69db1c090f3711088d84b524f1b94d25e6d21616
ref: 69db1c090f3711088d84b524f1b94d25e6d21616
revision: 41906362d931695e0616194341a68d2c4c85aaaf
ref: 41906362d931695e0616194341a68d2c4c85aaaf
branch: step-6a
specs:
spree (1.3.99)
@@ -186,14 +186,16 @@ GEM
railties (>= 3.1)
sprockets (~> 2.0)
tilt
angularjs-file-upload-rails (1.1.6)
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
archive-zip (0.7.0)
io-like (~> 0.3.0)
arel (3.0.3)
ast (2.4.0)
atomic (1.1.101)
awesome_nested_set (2.1.5)
activerecord (>= 3.0.0)
awesome_print (1.0.2)
awesome_print (1.8.0)
aws-sdk (1.11.1)
json (~> 1.4)
nokogiri (>= 1.4.4)
@@ -201,7 +203,7 @@ GEM
bcrypt (3.1.11)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
blockenspiel (0.4.5)
blockenspiel (0.5.0)
bugsnag (4.1.0)
builder (3.0.4)
byebug (9.0.6)
@@ -213,10 +215,14 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.1.0)
archive-zip (~> 0.7.0)
nokogiri (~> 1.6)
chronic (0.10.2)
chunky_png (1.3.10)
climate_control (0.1.0)
cliver (0.3.2)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
@@ -228,6 +234,8 @@ GEM
execjs
coffee-script-source (1.10.0)
colorize (0.8.1)
combine_pdf (1.0.15)
ruby-rc4 (>= 0.1.5)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@@ -244,11 +252,12 @@ GEM
compass (~> 1.0.0)
sass-rails (< 5.1)
sprockets (< 4.0)
connection_pool (2.2.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
css_parser (1.3.5)
css_parser (1.6.0)
addressable
daemons (1.2.2)
daemons (1.3.1)
dalli (2.7.2)
database_cleaner (0.7.1)
db2fog (0.9.0)
@@ -256,10 +265,10 @@ GEM
fog (~> 1.0)
rails (>= 3.2.0, < 5.0)
debugger-linecache (1.2.0)
delayed_job (4.1.4)
activesupport (>= 3.0, < 5.2)
delayed_job_active_record (4.1.2)
activerecord (>= 3.0, < 5.2)
delayed_job (4.1.5)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5)
devise (2.2.8)
bcrypt-ruby (~> 3.0)
@@ -269,7 +278,7 @@ GEM
devise-encryptable (0.1.2)
devise (>= 2.1.0)
diff-lcs (1.3)
diffy (3.1.0)
diffy (3.3.0)
docile (1.3.1)
dry-inflector (0.1.2)
em-websocket (0.5.1)
@@ -284,7 +293,7 @@ GEM
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
faraday (0.9.2)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffaker (1.15.0)
ffi (1.9.25)
@@ -444,18 +453,18 @@ GEM
foundation-icons-sass-rails (3.0.0)
railties (>= 3.1.1)
sass-rails (>= 3.1.1)
foundation-rails (5.5.0.0)
foundation-rails (5.5.2.1)
railties (>= 3.1.0)
sass (>= 3.2.0, < 3.4)
sass (>= 3.3.0, < 3.5)
fuubar (2.3.2)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
geocoder (1.1.8)
gmaps4rails (1.5.6)
guard (2.14.1)
guard (2.15.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
@@ -484,10 +493,11 @@ GEM
multi_json (~> 1.0)
multi_xml
i18n (0.6.11)
i18n-js (3.0.11)
i18n-js (3.1.0)
i18n (>= 0.6.6, < 2)
immigrant (0.3.6)
activerecord (>= 3.0)
io-like (0.3.0)
ipaddress (0.8.3)
jaro_winkler (1.5.1)
journey (1.0.4)
@@ -499,33 +509,31 @@ GEM
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (1.5.6)
jwt (2.1.0)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
kgio (2.9.3)
knapsack (1.16.0)
kgio (2.11.2)
knapsack (1.17.1)
rake
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.6.0)
letter_opener (1.7.0)
launchy (~> 2.2)
libv8 (6.3.292.48.1)
libv8 (3.16.14.19)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
lumberjack (1.0.12)
lumberjack (1.0.13)
mail (2.5.5)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.9.0)
method_source (0.9.2)
mime-types (1.25.1)
mini_mime (1.0.1)
mini_portile2 (2.1.0)
mini_racer (0.1.15)
libv8 (~> 6.3)
momentjs-rails (2.5.1)
momentjs-rails (2.20.1)
railties (>= 3.1)
money (5.1.0)
i18n (~> 0.6.0)
@@ -533,22 +541,24 @@ GEM
multi_xml (0.6.0)
multipart-post (2.0.0)
nenv (0.3.0)
net-http-persistent (3.0.0)
connection_pool (~> 2.2)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
oauth2 (1.4.1)
faraday (>= 0.8, < 0.16.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.6.10)
oj (3.7.8)
orm_adapter (0.5.0)
paper_trail (3.0.9)
activerecord (>= 3.0, < 5.0)
activesupport (>= 3.0, < 5.0)
paper_trail (5.2.3)
activerecord (>= 3.0, < 6.0)
request_store (~> 1.1)
paperclip (3.5.4)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
@@ -563,15 +573,11 @@ GEM
paypal-sdk-merchant (1.106.1)
paypal-sdk-core (~> 0.2.3)
pg (0.21.0)
poltergeist (1.18.1)
capybara (>= 2.1, < 4)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.5)
powerpack (0.1.1)
pry (0.11.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.4.3)
@@ -584,6 +590,8 @@ GEM
rack (1.4.7)
rack-cache (1.8.0)
rack (>= 0.4)
rack-mini-profiler (0.10.7)
rack (>= 1.2.0)
rack-rewrite (1.5.1)
rack-ssl (1.3.4)
rack
@@ -608,8 +616,8 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rainbow (3.0.0)
raindrops (0.13.0)
rake (12.3.1)
raindrops (0.19.0)
rake (12.3.2)
ransack (0.7.2)
actionpack (~> 3.0)
activerecord (~> 3.0)
@@ -624,13 +632,16 @@ GEM
trollop (~> 2.1)
rdoc (3.12.2)
json (~> 1.4)
redcarpet (3.2.3)
roadie (3.0.1)
css_parser (~> 1.3.4)
nokogiri (~> 1.6.0)
roadie-rails (1.0.3)
rails (>= 3.0, < 4.2)
roadie (~> 3.0)
redcarpet (3.4.0)
ref (2.0.0)
request_store (1.4.1)
rack (>= 1.4)
roadie (3.4.0)
css_parser (~> 1.4)
nokogiri (~> 1.5)
roadie-rails (1.1.1)
railties (>= 3.0, < 5.1)
roadie (~> 3.1)
roo (2.7.1)
nokogiri (~> 1)
rubyzip (~> 1.1, < 2.0.0)
@@ -638,29 +649,29 @@ GEM
nokogiri
roo (>= 2.0.0beta1, < 3)
spreadsheet (> 0.9.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
rspec-support (~> 3.8.0)
rspec-rails (3.8.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-retry (0.6.1)
rspec-core (> 3.3)
rspec-support (3.7.1)
rspec-support (3.8.0)
rubocop (0.57.2)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
@@ -671,6 +682,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-ole (1.2.12.1)
ruby-progressbar (1.10.0)
ruby-rc4 (0.1.5)
rubyzip (1.2.2)
safe_yaml (1.0.4)
sass (3.3.14)
@@ -680,6 +692,9 @@ GEM
tilt (~> 1.3)
select2-rails (3.5.10)
thor (~> 0.14)
selenium-webdriver (3.12.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
shellany (0.0.1)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
@@ -688,12 +703,15 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
skylight (1.6.1)
skylight (1.7.2)
activesupport (>= 3.0.0)
spinjs-rails (1.3)
rails (>= 3.1)
spreadsheet (1.1.4)
ruby-ole (>= 1.0)
spring (1.7.2)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -701,9 +719,13 @@ GEM
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
stringex (1.3.3)
stripe (3.3.2)
faraday (~> 0.9)
thor (0.20.0)
stripe (4.5.0)
faraday (~> 0.13)
net-http-persistent (~> 3.0)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
thor (0.20.3)
tilt (1.4.1)
timecop (0.9.1)
treetop (1.4.15)
@@ -711,18 +733,17 @@ GEM
polyglot (>= 0.3.1)
trollop (2.9.9)
truncate_html (0.9.2)
turbo-sprockets-rails3 (0.3.6)
turbo-sprockets-rails3 (0.3.14)
railties (> 3.2.8, < 4.0.0)
sprockets (>= 2.0.0)
tzinfo (0.3.54)
uglifier (4.1.19)
sprockets (>= 2.2.0)
tzinfo (0.3.55)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.2)
unicorn (4.9.0)
unicorn (5.4.1)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
unicorn-rails (1.1.0)
unicorn-rails (2.2.1)
rack
unicorn
uuidtools (2.1.5)
@@ -732,18 +753,14 @@ GEM
railties (>= 3.0)
warden (1.2.7)
rack (>= 1.0)
webmock (3.4.2)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
whenever (0.9.2)
activesupport (>= 2.3.4)
whenever (0.10.0)
chronic (>= 0.6.3)
wicked_pdf (1.1.0)
wkhtmltopdf-binary (0.12.3.1)
wkhtmltopdf-binary (0.12.4)
xml-simple (1.1.5)
xpath (2.1.0)
nokogiri (~> 1.3)
@@ -757,7 +774,7 @@ DEPENDENCIES
acts-as-taggable-on (~> 3.4)
andand
angular-rails-templates (~> 0.3.0)
angularjs-file-upload-rails (~> 1.1.6)
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.5.5)
atomic
awesome_print
@@ -766,7 +783,9 @@ DEPENDENCIES
bugsnag
byebug (~> 9.0.0)
capybara (>= 2.15.4)
chromedriver-helper
coffee-rails (~> 3.2.1)
combine_pdf
compass-rails
custom_error_message!
daemons
@@ -793,34 +812,32 @@ DEPENDENCIES
guard-rspec (~> 4.7.3)
haml
i18n (~> 0.6.11)
i18n-js (~> 3.0.0)
i18n-js (~> 3.1.0)
immigrant
jquery-migrate-rails
jquery-rails
json_spec (~> 1.1.4)
jwt (~> 1.5)
jwt (~> 2.1)
knapsack
letter_opener (>= 1.4.1)
libv8 (!= 6.7.288.46.1)
listen (= 3.0.8)
mini_racer
momentjs-rails
nokogiri (>= 1.6.7.1)
oauth2 (~> 1.2.0)
oauth2 (~> 1.4.1)
ofn-qz!
oj
paper_trail (~> 3.0.8)
paper_trail (~> 5.2.3)
paperclip
pg
poltergeist (>= 1.16.0)
pry-byebug (>= 3.4.3)
rabl
rack-mini-profiler (< 1.0.0)
rack-rewrite
rack-ssl
rails (~> 3.2.22)
rails-i18n (~> 3.0.0)
redcarpet
roadie-rails (~> 1.0.3)
roadie-rails (~> 1.1.1)
roo (~> 2.7.0)
roo-xls (~> 1.1.0)
rspec-rails (>= 3.5.2)
@@ -828,6 +845,7 @@ DEPENDENCIES
rubocop (>= 0.49.1)
sass (~> 3.3)
sass-rails (~> 3.2.3)
selenium-webdriver
shoulda-matchers
simple_form!
simplecov
@@ -837,7 +855,10 @@ DEPENDENCIES
spree_auth_devise!
spree_i18n!
spree_paypal_express!
stripe (~> 3.3.2)
spring (= 1.7.2)
spring-commands-rspec
stripe (~> 4.5.0)
therubyracer (= 0.12.0)
timecop
truncate_html
turbo-sprockets-rails3
@@ -854,4 +875,4 @@ RUBY VERSION
ruby 2.1.5p273
BUNDLED WITH
1.16.4
1.17.2

View File

@@ -65,13 +65,6 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
DirtyProducts.clear()
StatusMessage.clear()
# $scope.matchProducer = (product) ->
# for producer in $scope.producers
# if angular.equals(producer.id, product.producer)
# product.producer = producer
# break
$scope.updateOnHand = (product) ->
on_demand_variants = []
if product.variants

View File

@@ -1,7 +1,7 @@
angular.module('admin.enterpriseFees').directive 'spreeDeleteResource', ->
(scope, element, attrs) ->
if scope.enterprise_fee.id
url = '/admin/enterprise_fees/' + scope.enterprise_fee.id
url = '/api/enterprise_fees/' + scope.enterprise_fee.id
html = '<a href="' + url + '" class="delete-resource icon_link icon-trash no-text" data-action="remove" data-confirm="' + t('are_you_sure') + '" url="' + url + '"></a>'
#var html = '<a href="'+url+'" class="delete-resource" data-confirm="Are you sure?"><img alt="Delete" src="/assets/admin/icons/delete.png" /> Delete</a>';
element.append html

View File

@@ -9,4 +9,4 @@ angular.module("admin.indexUtils").factory 'Dereferencer', ->
dereferenceAttr: (array, attr, data)->
if array
for object in array
object[attr] = data[object[attr].id] unless object[attr] == null
object[attr] = data[object[attr].id] if object[attr]

View File

@@ -1,11 +1,12 @@
angular.module("admin.indexUtils").factory 'RequestMonitor', ($q) ->
new class RequestMonitor
loadQueue: $q.when([])
loadId: 0
requestCount: 0
loading: false
load: (promise) ->
loadId = (@loadId += 1)
@requestCount += 1
@loading = true
@loadQueue = $q.all([@loadQueue, promise]).then =>
@loading = false if @loadId == loadId
@requestCount -= 1
@loading = false if @requestCount == 0

View File

@@ -26,8 +26,19 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.startDate = moment(OrderCycles.byID[$scope.orderCycleFilter].orders_open_at).format('YYYY-MM-DD')
$scope.endDate = moment(OrderCycles.byID[$scope.orderCycleFilter].orders_close_at).startOf('day').format('YYYY-MM-DD')
RequestMonitor.load $scope.orders = Orders.index("q[state_not_eq]": "canceled", "q[completed_at_not_null]": "true", "q[completed_at_gteq]": "#{moment($scope.startDate).format()}", "q[completed_at_lt]": "#{moment($scope.endDate).add(1,'day').format()}")
RequestMonitor.load $scope.lineItems = LineItems.index("q[order][state_not_eq]": "canceled", "q[order][completed_at_not_null]": "true", "q[order][completed_at_gteq]": "#{moment($scope.startDate).format()}", "q[order][completed_at_lt]": "#{moment($scope.endDate).add(1,'day').format()}")
RequestMonitor.load $scope.orders = Orders.index(
"q[state_not_eq]": "canceled",
"q[completed_at_not_null]": "true",
"q[completed_at_gteq]": "#{moment($scope.startDate).format()}",
"q[completed_at_lt]": "#{moment($scope.endDate).add(1,'day').format()}"
)
RequestMonitor.load $scope.lineItems = LineItems.index(
"q[order][state_not_eq]": "canceled",
"q[order][completed_at_not_null]": "true",
"q[order][completed_at_gteq]": "#{moment($scope.startDate).format()}",
"q[order][completed_at_lt]": "#{moment($scope.endDate).add(1,'day').format()}"
)
unless $scope.initialized
RequestMonitor.load $scope.distributors = Enterprises.index(action: "visible", ams_prefix: "basic", "q[sells_in][]": ["own", "any"])

View File

@@ -0,0 +1,32 @@
angular.module("admin.orders").controller "bulkInvoiceCtrl", ($scope, $http, $timeout) ->
$scope.createBulkInvoice = ->
$scope.invoice_id = null
$scope.poll = 1
$scope.loading = true
$scope.message = null
$scope.error = null
$scope.poll_wait = 5 # 5 Seconds between each check
$scope.poll_retries = 80 # Maximum checks before stopping
$http.post('/admin/orders/invoices', {order_ids: $scope.selected_orders}).success (data) ->
$scope.invoice_id = data
$scope.pollBulkInvoice()
$scope.pollBulkInvoice = ->
$timeout($scope.nextPoll, $scope.poll_wait * 1000)
$scope.nextPoll = ->
$http.get('/admin/orders/invoices/'+$scope.invoice_id+'/poll').success (data) ->
$scope.loading = false
$scope.message = t('js.admin.orders.index.bulk_invoice_created')
.error (data) ->
$scope.poll++
if $scope.poll > $scope.poll_retries
$scope.loading = false
$scope.error = t('js.admin.orders.index.bulk_invoice_failed')
return
$scope.pollBulkInvoice()

View File

@@ -1,4 +1,4 @@
angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor, Orders, SortOptions) ->
angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor, Orders, SortOptions, $window, $filter) ->
$scope.RequestMonitor = RequestMonitor
$scope.pagination = Orders.pagination
$scope.orders = Orders.all
@@ -8,6 +8,11 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor,
{id: 50, name: t('js.admin.orders.index.per_page', results: 50)},
{id: 100, name: t('js.admin.orders.index.per_page', results: 100)}
]
$scope.selected_orders = []
$scope.checkboxes = {}
$scope.selected = false
$scope.select_all = false
$scope.poll = 0
$scope.initialise = ->
$scope.per_page = 15
@@ -17,24 +22,46 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor,
$scope.fetchResults()
$scope.fetchResults = (page=1) ->
$scope.resetSelected()
Orders.index({
'q[created_at_lt]': $scope['q']['created_at_lt'],
'q[created_at_gt]': $scope['q']['created_at_gt'],
'q[completed_at_lt]': $scope['q']['completed_at_lt'],
'q[completed_at_gt]': $scope['q']['completed_at_gt'],
'q[state_eq]': $scope['q']['state_eq'],
'q[number_cont]': $scope['q']['number_cont'],
'q[email_cont]': $scope['q']['email_cont'],
'q[bill_address_firstname_start]': $scope['q']['bill_address_firstname_start'],
'q[bill_address_lastname_start]': $scope['q']['bill_address_lastname_start'],
'q[completed_at_not_null]': $scope['q']['completed_at_not_null'],
'q[inventory_units_shipment_id_null]': $scope['q']['inventory_units_shipment_id_null'],
# Set default checkbox values to null. See: https://github.com/openfoodfoundation/openfoodnetwork/pull/3076#issuecomment-440010498
'q[completed_at_not_null]': $scope['q']['completed_at_not_null'] || null,
'q[inventory_units_shipment_id_null]': $scope['q']['inventory_units_shipment_id_null'] || null,
'q[distributor_id_in]': $scope['q']['distributor_id_in'],
'q[order_cycle_id_in]': $scope['q']['order_cycle_id_in'],
'q[order_cycle_id_in]': $scope['q']['order_cycle_id_in'],
'q[s]': $scope.sorting || 'id desc',
'q[s]': $scope.sorting || 'completed_at desc',
per_page: $scope.per_page,
page: page
})
$scope.resetSelected = ->
$scope.selected_orders.length = 0
$scope.selected = false
$scope.select_all = false
$scope.checkboxes = {}
$scope.toggleSelection = (id) ->
index = $scope.selected_orders.indexOf(id)
if index == -1
$scope.selected_orders.push(id)
else
$scope.selected_orders.splice(index, 1)
$scope.toggleAll = ->
$scope.selected_orders.length = 0
$scope.orders.forEach (order) ->
$scope.checkboxes[order.id] = $scope.select_all
$scope.selected_orders.push order.id if $scope.select_all
$scope.$watch 'sortOptions', (sort) ->
if sort && sort.predicate != ""
$scope.sorting = sort.predicate + ' desc' if sort.reverse

View File

@@ -0,0 +1,5 @@
angular.module("admin.orders").directive "invoicesModal", ($modal) ->
restrict: 'C'
link: (scope, elem, attrs, ctrl) ->
elem.on "click", (ev) =>
scope.uploadModal = $modal.open(templateUrl: 'admin/modals/bulk_invoice.html', controller: ctrl, scope: scope, windowClass: 'simple-modal')

View File

@@ -1 +1 @@
angular.module("admin.orders", ['admin.indexUtils', 'ngResource'])
angular.module("admin.orders", ['admin.indexUtils', 'ngResource', 'mm.foundation'])

View File

@@ -10,6 +10,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
$scope.updated_ids = []
$scope.update_errors = []
$scope.batchSize = 50
$scope.step = 'settings'
$scope.chunks = 0
$scope.completed = 0
@@ -51,19 +52,28 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
$scope.start = () ->
$scope.started = true
total = ams_data.item_count
size = 50
$scope.chunks = Math.ceil(total / size)
$scope.chunks = Math.ceil(total / $scope.batchSize)
i = 0
# Process only the first batch.
$scope.processBatch($scope.step, 0, $scope.chunks)
while i < $scope.chunks
start = (i*size)+1
end = (i+1)*size
if $scope.step == 'import'
$scope.processImport(start, end)
if $scope.step == 'save'
$scope.processSave(start, end)
i++
$scope.processBatch = (step, batchIndex, batchCount) ->
start = (batchIndex * $scope.batchSize) + 1
end = (batchIndex + 1) * $scope.batchSize
isLastBatch = batchCount == batchIndex + 1
promise = if step == 'import'
$scope.processImport(start, end)
else if step == 'save'
$scope.processSave(start, end)
return if isLastBatch
processNextBatch = ->
$scope.processBatch(step, batchIndex + 1, batchCount)
# Process next batch whether or not processing of the current batch succeeds.
promise.then(processNextBatch, processNextBatch)
$scope.processImport = (start, end) ->
$http(

View File

@@ -2,5 +2,5 @@ angular.module("ofn.admin").directive "imageModal", ($modal, ProductImageService
restrict: 'C'
link: (scope, elem, attrs, ctrl) ->
elem.on "click", (ev) =>
scope.uploadModal = $modal.open(templateUrl: 'admin/modals/image_upload.html', controller: ctrl, scope: scope, windowClass: 'product-image-upload')
scope.uploadModal = $modal.open(templateUrl: 'admin/modals/image_upload.html', controller: ctrl, scope: scope, windowClass: 'simple-modal')
ProductImageService.configure(scope.product)

View File

@@ -6,7 +6,11 @@ angular.module("admin.subscriptions").controller "SubscriptionController", ($sco
$scope.schedules = Schedules.all
$scope.paymentMethods = PaymentMethods.all
$scope.shippingMethods = ShippingMethods.all
$scope.distributor_id = $scope.subscription.shop_id # variant selector requires distributor_id
# Variant selector requires these
$scope.distributor_id = $scope.subscription.shop_id
$scope.eligible_for_subscriptions = true
$scope.view = if $scope.subscription.id? then 'review' else 'details'
$scope.nextCallbacks = {}
$scope.backCallbacks = {}

View File

@@ -22,6 +22,7 @@ angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
q: term
distributor_id: scope.distributor_id
order_cycle_id: scope.order_cycle_id
eligible_for_subscriptions: scope.eligible_for_subscriptions
results: (data, page) ->
results: data
formatResult: (variant) ->

View File

@@ -13,6 +13,11 @@ angular.module("admin.variantOverrides").controller "AdminVariantOverridesCtrl",
$scope.RequestMonitor = RequestMonitor
$scope.selectView = Views.selectView
$scope.currentView = -> Views.currentView
$scope.onDemandOptions = [
{ description: t('js.variant_overrides.on_demand.use_producer_settings'), value: null },
{ description: t('js.variant_overrides.on_demand.yes'), value: true },
{ description: t('js.variant_overrides.on_demand.no'), value: false }
]
$scope.views = Views.setViews
inventory: { name: t('js.variant_overrides.inventory_products'), visible: true }
@@ -105,3 +110,35 @@ angular.module("admin.variantOverrides").controller "AdminVariantOverridesCtrl",
StatusMessage.display 'success', t('js.variant_overrides.stock_reset')
.error (data, status) ->
$timeout -> StatusMessage.display 'failure', $scope.updateError(data, status)
# Variant override count_on_hand field placeholder logic:
# on_demand true -- Show "On Demand"
# on_demand false -- Show empty value to be set by the user
# on_demand nil -- Show producer on_hand value
$scope.countOnHandPlaceholder = (variant, hubId) ->
variantOverride = $scope.variantOverrides[hubId][variant.id]
if variantOverride.on_demand
t('js.variants.on_demand.yes')
else if variantOverride.on_demand == false
''
else
variant.on_hand
# This method should only be used when the variant override on_demand is changed.
#
# Change the count_on_hand value to a suggested value.
$scope.updateCountOnHand = (variant, hubId) ->
variantOverride = $scope.variantOverrides[hubId][variant.id]
suggested = $scope.countOnHandSuggestion(variant, hubId)
return if suggested == variantOverride.count_on_hand
variantOverride.count_on_hand = suggested
DirtyVariantOverrides.set hubId, variant.id, variantOverride.id, 'count_on_hand', suggested
# Suggest producer count_on_hand if variant has limited stock and variant override forces limited
# stock. Otherwise, clear whatever value is set.
$scope.countOnHandSuggestion = (variant, hubId) ->
variantOverride = $scope.variantOverrides[hubId][variant.id]
return null unless !variant.on_demand && variantOverride.on_demand == false
variant.on_hand

View File

@@ -1,4 +1,5 @@
angular.module("admin.variantOverrides").filter "hubPermissions", ($filter) ->
return (products, hubPermissions, hub_id) ->
return [] if !hub_id
return [] if !hubPermissions[hub_id]
return $filter('filter')(products, ((product) -> hubPermissions[hub_id].indexOf(product.producer_id) > -1), true)

View File

@@ -1,25 +1,22 @@
Darkswarm.controller "AccordionCtrl", ($scope, localStorageService, $timeout, $document, CurrentHub) ->
key = "accordion_#{$scope.order.id}#{CurrentHub.hub.id}#{$scope.order.user_id}"
value = if localStorageService.get(key) then {} else { details: true, billing: false, shipping: false, payment: false }
localStorageService.bind $scope, "accordion", value, key
$scope.accordionSections = ["details", "billing", "shipping", "payment"]
# Scrolling is confused by our position:fixed top bar - add an offset to scroll
# to the correct location, plus 5px buffer
offset_height = $("nav.top-bar").height() + 5
$scope.accordion = { details: true, billing: true, shipping: true, payment: true }
$scope.show = (section)->
$scope.show = (section) ->
$scope.accordion[section] = true
# If we call scrollTo() directly after show(), when one of the accordions above the
# scroll location is closed by show(), scrollTo() will scroll to the old location of
# the element. Putting this in a 50 ms timeout is enough delay for the DOM to
# have updated.
$timeout ->
$document.scrollTo($("##{section}"), offset_height, 500)
, 50
$scope.scrollTo = (section) ->
# Scrolling is confused by our position:fixed top bar - add an offset to scroll
# to the correct location, plus 5px buffer
offset_height = $("nav.top-bar").height() + 5
$document.scrollTo($("##{section}"), offset_height, 400)
$scope.$on 'purchaseFormInvalid', (event, form) ->
# Scroll to first invalid section
for section in $scope.accordionSections
if not form[section].$valid
$scope.show section
$timeout ->
$scope.scrollTo(section)
, 50
break

View File

@@ -5,7 +5,7 @@ Darkswarm.controller "BillingCtrl", ($scope, $timeout) ->
$scope.summary = ->
[$scope.order.bill_address.address1,
$scope.order.bill_address.city,
$scope.order.bill_address.city,
$scope.order.bill_address.zipcode]
$timeout $scope.onTimeout
$timeout $scope.onTimeout

View File

@@ -13,11 +13,11 @@ Darkswarm.controller "DetailsCtrl", ($scope, $timeout, $http, CurrentUser, Authe
$scope.summary = ->
[$scope.fullName(),
$scope.order.email,
$scope.order.email,
$scope.order.bill_address.phone]
$scope.fullName = ->
[$scope.order.bill_address.firstname ? null,
[$scope.order.bill_address.firstname ? null,
$scope.order.bill_address.lastname ? null].join(" ").trim()
$timeout $scope.onTimeout
$timeout $scope.onTimeout

View File

@@ -4,7 +4,7 @@ Darkswarm.filter "date_in_words", ->
Darkswarm.filter "sensible_timeframe", (date_in_wordsFilter)->
(date) ->
if moment().add('days', 2) < moment(date)
if moment().add(2, 'days') < moment(date)
t 'orders_open'
else
t('closing') + date_in_wordsFilter(date)

View File

@@ -2,11 +2,11 @@ window.FieldsetMixin = ($scope)->
$scope.next = (event = false)->
event.preventDefault() if event
return unless $scope.nextPanel
$scope.accordion[$scope.name] = false
$scope.show $scope.nextPanel
$scope.onTimeout = ->
if $scope[$scope.name].$valid
$scope.next()
$scope.accordion[$scope.name] = !$scope[$scope.name].$valid
$scope.valid = ->
$scope.form().$valid

View File

@@ -0,0 +1,15 @@
%h4.modal-title
= t('js.admin.orders.index.compiling_invoices')
%p.message{ ng: { show: 'message' } }
{{message}}
%p.error{ ng: { show: 'error' } }
{{error}}
%img.spinner{ src: "/assets/spinning-circles.svg", ng: { show: "loading" } }
%p{ ng: { show: "loading" } }
= t('js.admin.orders.index.please_wait')
%a.button{ target: '_blank', ng: { click: 'showBulkInvoice()', href: '/admin/orders/invoices/{{invoice_id}}', show: "!loading && !error" } }
= t('js.admin.orders.index.view_file')

View File

@@ -17,4 +17,3 @@
@import 'variables';
@import 'components/*';
@import '*';
@import 'pages/*';

View File

@@ -0,0 +1,10 @@
@import '../../darkswarm/branding';
.container {
input {
&[readonly] {
background-color: $disabled-light;
cursor: default;
}
}
}

View File

@@ -1,6 +1,6 @@
@import '../variables';
.reveal-modal.product-image-upload {
.reveal-modal.simple-modal {
width: 300px;
.close-reveal-modal {

View File

@@ -103,3 +103,34 @@ table.index td.actions {
font-size: 1.2em;
}
}
.index-controls {
button {
float: right;
&:disabled {
background-color: $disabled-button;
}
}
}
.simple-modal {
text-align: center;
.modal-title {
margin-bottom: 1.5em;
}
.message, .error {
margin-bottom: 1em;
}
.spinner {
margin-bottom: 1em;
}
.error {
color: $warning-red;
}
}

View File

@@ -0,0 +1,7 @@
@import '../variables';
.admin-subscription-form-subscription-line-items {
.not-in-open-and-upcoming-order-cycles-warning {
color: $warning-red;
}
}

View File

@@ -0,0 +1,7 @@
@import '../variables';
.admin-subscription-review-subscription-line-items {
.not-in-open-and-upcoming-order-cycles-warning {
color: $warning-red;
}
}

View File

@@ -1,86 +0,0 @@
@import typography
.darkswarm
navigation
display: block
background: #f7f7f7
distributor.details
box-sizing: border-box
display: block
min-height: 150px
padding: 30px 0px 20px 0px
select
width: 200px
position: relative
img
display: block
height: 100px
width: 100px
margin-right: 12px
location
@include headingFont
@media all and (max-width: 768px)
location, location + small
display: block
#distributor_title h3
margin-top: 0
@media all and (max-width: 768px)
margin-bottom: 8px
ordercycle
text-align: right
p
max-width: 400px
h4 i
margin-right: 0.3rem
@media all and (max-width: 640px)
float: left
clear: left
text-align: left
padding: 12px 10px
width: 100%
margin-top: 10px
background: #e5e5e5
p
max-width: 100%
float: right
form.custom
text-align: right
& > strong
line-height: 2.5
font-size: 1.29em
padding-right: 14px
@media all and (max-width: 768px)
select
width: inherit
display: inline-block
border-width: 1px
border-color: #999
color: #666
font-size: 1em
margin-bottom: 0
padding: 8px 20px 8px 12px
@media all and (max-width: 768px)
font-size: 0.875em
@media screen and (-webkit-min-device-pixel-ratio:0)
font-size: 16px
closing
@include headingFont
@media all and (max-width: 768px)
font-size: 1.2em
padding-bottom: 10px
color: black
font-size: 1.5em
display: block
padding-bottom: 12px
span
@media all and (max-width: 768px)
font-size: 0.875em

View File

@@ -0,0 +1,103 @@
@import "typography";
.darkswarm navigation {
display: block;
background: #f7f7f7;
distributor.details {
box-sizing: border-box;
display: block;
min-height: 150px;
padding: 30px 0 20px 0;
position: relative;
select {
width: 200px;
}
img {
display: block;
height: 100px;
width: 100px;
margin-right: 12px;
}
location {
@include headingFont;
}
@media all and (max-width: 768px) {
location, location + small {
display: block;
}
}
#distributor_title h3 {
margin-top: 0;
@media all and (max-width: 768px) {
margin-bottom: 8px;
}
}
ordercycle {
text-align: right;
float: right;
p {
max-width: 400px;
}
h4 i {
margin-right: 0.3rem;
}
@media all and (max-width: 640px) {
float: left;
clear: left;
text-align: left;
padding: 12px 10px;
width: 100%;
margin-top: 10px;
background: #e5e5e5;
p {
max-width: 100%;
}
}
form.custom {
text-align: right;
& > strong {
line-height: 2.5;
font-size: 1.29em;
padding-right: 14px;
}
select {
width: inherit;
display: inline-block;
border: 1px #999;
color: #666;
font-size: 1em;
margin-bottom: 0;
padding: 8px 20px 8px 12px;
@media all and (max-width: 768px) {
font-size: 0.875em;
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
font-size: 16px;
}
}
}
closing {
@include headingFont;
color: black;
font-size: 1.5em;
display: block;
padding-bottom: 12px;
@media all and (max-width: 768px) {
font-size: 1.2em;
padding-bottom: 10px;
}
span {
@media all and (max-width: 768px) {
font-size: 0.875em;
}
}
}
}
}
}

View File

@@ -1,4 +1,13 @@
@import 'darkswarm/branding';
$modal-background-color: #efefef;
$modal-content-background-color: #fff;
$modal-alert-link-color: #fff;
$modal-alert-link-hover-color: rgba(255, 255, 255, .7);
$cookies-banner-background-color: $dark-grey;
$cookies-banner-button-background-color: $clr-turquoise;
$cookies-banner-text-color: $white;
$cookies-policy-modal-background-color: $disabled-light;
$cookies-policy-modal-border-bottom-color: $disabled-light;
$cookies-policy-modal-table-tr-even-background-color: $disabled-very-light;

View File

@@ -1,86 +0,0 @@
@import mixins
@import branding
@import animations
.order-summary
background-color: #e1f0f5
padding: 1em
width: 100%
border: none
color: inherit
checkout
display: block
@media all and (max-width: 640px)
&.row .row
margin-left: 0
margin-right: 0
orderdetails
.button, table
width: 100%
@media all and (max-width: 640px)
form.edit_order
border: 1px solid $disabled-bright
margin-bottom: 2rem
#details, #billing, #shipping, #payment
border: 0
margin: 1em 0
padding: 0
.content
border: 1px solid #efefef
h5
margin: 0
padding: 0.65em
background: #f7f7f7
.label
font-size: 1em
padding: 0.3rem 0.35rem 0.275rem
// Logic to turn on & off the alerts for success against each fieldset
label, label.alert, label.success, &.valid label.alert, &.dirty label.success
display: none
&.dirty label.alert
display: inline
&.dirty.valid label.alert
display: none
&.valid label.success
display: inline
h5.dirty
background: #f7ccc5
h5.valid, h5.dirty.valid
background: #bfefd1
orderdetails table tr th
text-align: left
// Logic to swap out up / down accordion icons
//Foundation overrides
dd > a
@include csstrans
background: $disabled-light !important
dd > a:hover
background: $disabled-v-dark !important
color: white
dd
span.accordion-up
display: none
span.accordion-down
display: inline
&.open
span.accordion-up
display: inline
span.accordion-down
display: none
.error
color: #c82020

View File

@@ -0,0 +1,117 @@
@import "mixins";
@import "branding";
@import "animations";
.order-summary {
background-color: #e1f0f5;
padding: 1em;
width: 100%;
border: none;
color: inherit;
}
checkout {
display: block;
@media all and (max-width: 640px) {
&.row .row {
margin-left: 0;
margin-right: 0;
}
}
orderdetails {
.button, table {
width: 100%;
}
@media all and (max-width: 640px) {
form.edit_order {
border: 1px solid $disabled-bright;
margin-bottom: 2rem;
}
}
}
#details, #billing, #shipping, #payment {
border: 0;
margin: 1em 0;
padding: 0;
.content {
border: 1px solid #efefef;
}
}
h5 {
margin: 0;
padding: 0.65em;
background: #f7f7f7;
.label {
font-size: 1em;
padding: 0.3rem 0.35rem 0.275rem;
}
// Logic to turn on & off the alerts for success against each fieldset
label, label.alert, label.success, &.valid label.alert, &.dirty label.success {
display: none;
}
&.dirty label.alert {
display: inline;
}
&.dirty.valid label.alert {
display: none;
}
&.valid label.success {
display: inline;
}
}
h5.dirty {
background: #f7ccc5;
}
h5.valid, h5.dirty.valid {
background: #bfefd1;
}
orderdetails table tr th {
text-align: left;
}
// Logic to swap out up / down accordion icons
//Foundation overrides
dd > a {
@include csstrans;
background: $disabled-light !important;
}
dd > a:hover {
background: $disabled-v-dark !important;
color: white;
}
dd {
span.accordion-up {
display: none;
}
span.accordion-down {
display: inline;
}
&.open {
span.accordion-up {
display: inline;
}
span.accordion-down {
display: none;
}
}
}
.error {
color: #c82020;
}
}

View File

@@ -4,3 +4,11 @@
fieldset {
border: 0;
}
.user-form {
margin-left: auto;
margin-right: auto;
max-width: 1184px;
padding-left: .9375rem;
padding-right: .9375rem;
}

View File

@@ -2,7 +2,6 @@ module Admin
class EnterpriseFeesController < ResourceController
before_filter :load_enterprise_fee_set, :only => :index
before_filter :load_data
before_filter :do_not_destroy_referenced_fees, :only => :destroy
def index
@@ -45,22 +44,6 @@ module Admin
private
def do_not_destroy_referenced_fees
product_distribution = ProductDistribution.where(:enterprise_fee_id => @object).first
if product_distribution
p = product_distribution.product
error = I18n.t(:enterprise_fees_destroy_error, id: p.id, name: p.name)
respond_with(@object) do |format|
format.html do
flash[:error] = error
redirect_to collection_url
end
format.js { render text: error, status: 403 }
end
end
end
def load_enterprise_fee_set
@enterprise_fee_set = EnterpriseFeeSet.new :collection => collection
end

View File

@@ -16,8 +16,7 @@ module Admin
@original_filename = params[:file].try(:original_filename)
@non_updatable_fields = ProductImport::EntryValidator.non_updatable_fields
check_file_errors @importer
check_spreadsheet_has_data @importer
return if contains_errors? @importer
@ams_data = ams_data
end
@@ -63,15 +62,19 @@ module Admin
true
end
def check_file_errors(importer)
def contains_errors?(importer)
if importer.errors.present?
redirect_to '/admin/product_import', notice: @importer.errors.full_messages.to_sentence
return true
end
check_spreadsheet_has_data importer
end
def check_spreadsheet_has_data(importer)
unless importer.item_count
redirect_to '/admin/product_import', notice: I18n.t(:product_import_no_data_in_spreadsheet_notice)
true
end
end

View File

@@ -13,7 +13,8 @@ module Admin
def build
@subscription_line_item.assign_attributes(params[:subscription_line_item])
@subscription_line_item.price_estimate = price_estimate
render json: @subscription_line_item, serializer: Api::Admin::SubscriptionLineItemSerializer
render json: @subscription_line_item, serializer: Api::Admin::SubscriptionLineItemSerializer,
shop: @shop, schedule: @schedule
end
private
@@ -26,7 +27,7 @@ module Admin
@shop = Enterprise.managed_by(spree_current_user).find_by_id(params[:shop_id])
@schedule = permissions.editable_schedules.find_by_id(params[:schedule_id])
@order_cycle = @schedule.andand.current_or_next_order_cycle
@variant = Spree::Variant.stockable_by(@shop).find_by_id(params[:subscription_line_item][:variant_id])
@variant = variant_if_eligible(params[:subscription_line_item][:variant_id]) if @shop.present?
end
def new_actions
@@ -50,5 +51,9 @@ module Admin
OpenFoodNetwork::ScopeVariantToHub.new(@shop).scope(@variant)
@variant.price + fee_calculator.indexed_fees_for(@variant)
end
def variant_if_eligible(variant_id)
SubscriptionVariantsService.eligible_variants(@shop).find_by_id(variant_id)
end
end
end

View File

@@ -0,0 +1,21 @@
module Api
class EnterpriseFeesController < BaseController
respond_to :json
def destroy
authorize! :destroy, enterprise_fee
if enterprise_fee.destroy
render text: I18n.t(:successfully_removed), status: 204
else
render text: enterprise_fee.errors.full_messages.first, status: 403
end
end
private
def enterprise_fee
@enterprise_fee ||= EnterpriseFee.find_by_id params[:id]
end
end
end

View File

@@ -20,28 +20,16 @@ class CartController < BaseController
variant_ids = variant_ids_in(cart_service.variants_h)
render json: { error: false, stock_levels: stock_levels(current_order, variant_ids) },
status: 200
render json: { error: false,
stock_levels: VariantsStockLevels.new.call(current_order, variant_ids) },
status: :ok
else
render json: { error: true }, status: 412
render json: { error: true }, status: :precondition_failed
end
end
populate_variant_attributes
end
# Report the stock levels in the order for all variant ids requested
def stock_levels(order, variant_ids)
stock_levels = li_stock_levels(order)
li_variant_ids = stock_levels.keys
(variant_ids - li_variant_ids).each do |variant_id|
stock_levels[variant_id] = { quantity: 0, max_quantity: 0, on_hand: Spree::Variant.find(variant_id).on_hand }
end
stock_levels
end
def variant_ids_in(variants_h)
variants_h.map { |v| v[:variant_id].to_i }
end
@@ -79,21 +67,4 @@ class CartController < BaseController
max_quantity: max_quantity)
end
end
def li_stock_levels(order)
Hash[
order.line_items.map do |li|
[li.variant.id,
{ quantity: li.quantity,
max_quantity: li.max_quantity,
on_hand: wrap_json_infinity(li.variant.on_hand) }]
end
]
end
# Rails to_json encodes Float::INFINITY as Infinity, which is not valid JSON
# Return it as a large integer (max 32 bit signed int)
def wrap_json_infinity(number)
number == Float::INFINITY ? 2147483647 : number
end
end

View File

@@ -18,7 +18,7 @@ class CheckoutController < Spree::CheckoutController
# This is only required because of spree_paypal_express. If we implement
# a version of paypal that uses this controller, and more specifically
# the #update_failed method, then we can remove this call
restart_checkout
RestartCheckout.new(@order).call
end
def update
@@ -139,7 +139,8 @@ class CheckoutController < Spree::CheckoutController
def update_failed
clear_ship_address
restart_checkout
RestartCheckout.new(@order).call
respond_to do |format|
format.html do
render :edit
@@ -158,15 +159,6 @@ class CheckoutController < Spree::CheckoutController
end
end
def restart_checkout
return if @order.state == 'cart'
@order.restart_checkout! # resets state to 'cart'
@order.update_attributes!(shipping_method_id: nil)
@order.shipments.with_state(:pending).destroy_all
@order.payments.with_state(:checkout).destroy_all
@order.reload
end
def skip_state_validation?
true
end

View File

@@ -7,13 +7,27 @@ class EnterprisesController < BaseController
# These prepended filters are in the reverse order of execution
prepend_before_filter :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop
before_filter :check_stock_levels, :set_noindex_meta_tag, only: :shop
before_filter :clean_permalink, only: :check_permalink
before_filter :enable_embedded_shopfront
respond_to :js, only: :permalink_checker
def shop
return redirect_to spree.cart_path unless enough_stock?
set_noindex_meta_tag
enterprises = current_distributor
.plus_relatives_and_oc_producers(shop_order_cycles)
.activated
.includes(address: :state)
.all
enterprises = inject_json_ams('enterprises', enterprises)
render locals: { enterprises: enterprises }
end
def relatives
set_enterprise
@@ -48,10 +62,8 @@ class EnterprisesController < BaseController
params[:permalink] = params[:permalink].parameterize
end
def check_stock_levels
if current_order(true).insufficient_stock_lines.present?
redirect_to spree.cart_path
end
def enough_stock?
current_order(true).insufficient_stock_lines.blank?
end
def reset_order
@@ -85,7 +97,25 @@ class EnterprisesController < BaseController
order.order_cycle = order_cycle_options.first if order_cycle_options.count == 1
end
def shop_order_cycles
if current_order_cycle
[current_order_cycle]
else
OrderCycle.not_closed.with_distributor(current_distributor)
end
end
def set_noindex_meta_tag
@noindex_meta_tag = true unless current_distributor.visible?
end
def inject_json_ams(name, object)
options = {
each_serializer: Api::EnterpriseSerializer,
data: OpenFoodNetwork::EnterpriseInjectionData.new
}
serializer_instance = ActiveModel::ArraySerializer.new(object, options)
{ name: name, json: serializer_instance.to_json }
end
end

View File

@@ -4,5 +4,11 @@ class ShopsController < BaseController
before_filter :enable_embedded_shopfront
def index
@enterprises = Enterprise
.activated
.includes(address: :state)
.includes(:properties)
.includes(supplied_products: :properties)
.all
end
end

View File

@@ -0,0 +1,32 @@
module Spree
module Admin
class InvoicesController < Spree::Admin::BaseController
respond_to :json
authorize_resource class: false
def create
invoice_service = BulkInvoiceService.new
invoice_service.start_pdf_job(params[:order_ids])
render json: invoice_service.id, status: :ok
end
def show
invoice_id = params[:id]
invoice_pdf = BulkInvoiceService.new.filepath(invoice_id)
send_file(invoice_pdf, type: 'application/pdf', disposition: :inline)
end
def poll
invoice_id = params[:invoice_id]
if BulkInvoiceService.new.invoice_created? invoice_id
render json: { created: true }, status: :ok
else
render json: { created: false }, status: :unprocessable_entity
end
end
end
end
end

View File

@@ -37,8 +37,10 @@ Spree::Admin::OrdersController.class_eval do
end
def invoice
template = if Spree::Config.invoice_style2? then "spree/admin/orders/invoice2" else "spree/admin/orders/invoice" end
pdf = render_to_string pdf: "invoice-#{@order.number}.pdf", template: template, formats: [:html], encoding: "UTF-8"
pdf = render_to_string pdf: "invoice-#{@order.number}.pdf",
template: invoice_template,
formats: [:html], encoding: "UTF-8"
Spree::OrderMailer.invoice_email(@order.id, pdf).deliver
flash[:success] = t('admin.orders.invoice_email_sent')
@@ -46,8 +48,7 @@ Spree::Admin::OrdersController.class_eval do
end
def print
template = if Spree::Config.invoice_style2? then "spree/admin/orders/invoice2" else "spree/admin/orders/invoice" end
render pdf: "invoice-#{@order.number}", template: template, encoding: "UTF-8"
render pdf: "invoice-#{@order.number}", template: invoice_template, encoding: "UTF-8"
end
def print_ticket
@@ -60,6 +61,10 @@ Spree::Admin::OrdersController.class_eval do
private
def invoice_template
Spree::Config.invoice_style2? ? "spree/admin/orders/invoice2" : "spree/admin/orders/invoice"
end
def require_distributor_abn
unless @order.distributor.abn.present?
flash[:error] = t(:must_have_valid_business_number, enterprise_name: @order.distributor.name)

View File

@@ -76,7 +76,11 @@ Spree::Api::ProductsController.class_eval do
end
def render_paged_products(products)
render text: { products: ActiveModel::ArraySerializer.new(products, each_serializer: Api::Admin::ProductSerializer), pages: products.num_pages }.to_json
end
serializer = ActiveModel::ArraySerializer.new(
products,
each_serializer: Api::Admin::ProductSerializer
)
render text: { products: serializer, pages: products.num_pages }.to_json
end
end

View File

@@ -5,25 +5,29 @@ class UserRegistrationsController < Spree::UserRegistrationsController
before_filter :set_checkout_redirect, only: :create
include I18nHelper
before_filter :set_locale
# POST /resource/sign_up
def create
@user = build_resource(params[:spree_user])
if resource.save
session[:spree_user_signup] = true
session[:confirmation_return_url] = params[:return_url]
associate_user
@user.locale = I18n.locale.to_s
unless resource.save
return render_error(@user.errors)
end
respond_to do |format|
format.html do
set_flash_message(:success, :signed_up_but_unconfirmed)
redirect_to after_sign_in_path_for(@user)
end
format.js do
render json: { email: @user.email }
end
session[:spree_user_signup] = true
session[:confirmation_return_url] = params[:return_url]
associate_user
respond_to do |format|
format.html do
set_flash_message(:success, :signed_up_but_unconfirmed)
redirect_to after_sign_in_path_for(@user)
end
format.js do
render json: { email: @user.email }
end
else
render_error(@user.errors)
end
rescue StandardError => error
OpenFoodNetwork::ErrorLogger.notify(error)

View File

@@ -54,7 +54,7 @@ module CheckoutHelper
end
def display_adjustment_tax_rates(adjustment)
tax_rates = adjustment.tax_rates
tax_rates = TaxRateFinder.tax_rates_of(adjustment)
tax_rates.map { |tr| number_to_percentage(tr.amount * 100, :precision => 1) }.join(", ")
end

View File

@@ -55,7 +55,7 @@ module EnterprisesHelper
if enterprise.sells == 'none'
enterprise.producer_profile_only ? I18n.t(:profile) : I18n.t(:supplier_only)
else
"Has Shopfront"
I18n.t(:has_shopfront)
end
end

View File

@@ -1,7 +1,7 @@
module I18nHelper
def set_locale
# Save a given locale
if params[:locale] && Rails.application.config.i18n.available_locales.include?(params[:locale])
if params[:locale] && available_locale?(params[:locale])
spree_current_user.update_attributes!(locale: params[:locale]) if spree_current_user
cookies[:locale] = params[:locale]
end
@@ -13,4 +13,20 @@ module I18nHelper
I18n.locale = spree_current_user.andand.locale || cookies[:locale] || I18n.default_locale
end
def valid_locale(user)
if user.present? &&
user.locale.present? &&
available_locale?(user.locale)
user.locale
else
I18n.default_locale
end
end
private
def available_locale?(locale)
Rails.application.config.i18n.available_locales.include?(locale)
end
end

View File

@@ -1,23 +1,19 @@
require 'open_food_network/enterprise_injection_data'
module InjectionHelper
def inject_enterprises
inject_json_ams "enterprises", Enterprise.activated.includes(address: :state).all, Api::EnterpriseSerializer, enterprise_injection_data
def inject_enterprises(enterprises = Enterprise.activated.includes(address: :state).all)
inject_json_ams(
'enterprises',
enterprises,
Api::EnterpriseSerializer,
enterprise_injection_data
)
end
def inject_enterprise_and_relatives
inject_json_ams "enterprises", current_distributor.relatives_including_self.activated.includes(address: :state).all, Api::EnterpriseSerializer, enterprise_injection_data
end
def inject_shop_enterprises
ocs = if current_order_cycle
[current_order_cycle]
else
OrderCycle.not_closed.with_distributor(current_distributor)
end
inject_json_ams "enterprises", current_distributor.plus_relatives_and_oc_producers(ocs).activated.includes(address: :state).all, Api::EnterpriseSerializer, enterprise_injection_data
end
def inject_group_enterprises
inject_json_ams "group_enterprises", @group.enterprises.activated.all, Api::EnterpriseSerializer, enterprise_injection_data
end

View File

@@ -1,15 +1,18 @@
require 'devise/mailers/helpers'
class EnterpriseMailer < Spree::BaseMailer
include Devise::Mailers::Helpers
include I18nHelper
def welcome(enterprise)
@enterprise = enterprise
subject = t('enterprise_mailer.welcome.subject',
enterprise: @enterprise.name,
sitename: Spree::Config[:site_name])
mail(:to => enterprise.contact.email,
:from => from_address,
:subject => subject)
I18n.with_locale valid_locale(@enterprise.owner) do
subject = t('enterprise_mailer.welcome.subject',
enterprise: @enterprise.name,
sitename: Spree::Config[:site_name])
mail(:to => enterprise.contact.email,
:from => from_address,
:subject => subject)
end
end
def manager_invitation(enterprise, user)
@@ -17,11 +20,12 @@ class EnterpriseMailer < Spree::BaseMailer
@instance = Spree::Config[:site_name]
@instance_email = from_address
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
mail(to: user.email,
from: from_address,
subject: subject)
I18n.with_locale valid_locale(@enterprise.owner) do
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
mail(to: user.email,
from: from_address,
subject: subject)
end
end
private

View File

@@ -1,4 +1,5 @@
class ProducerMailer < Spree::BaseMailer
include I18nHelper
def order_cycle_report(producer, order_cycle)
@producer = producer
@@ -10,9 +11,11 @@ class ProducerMailer < Spree::BaseMailer
@total = total_from_line_items(line_items)
@tax_total = tax_total_from_line_items(line_items)
subject = "[#{Spree::Config.site_name}] #{I18n.t('producer_mailer.order_cycle.subject', producer: producer.name)}"
I18n.with_locale valid_locale(@producer.owner) do
order_cycle_subject = I18n.t('producer_mailer.order_cycle.subject', producer: producer.name)
subject = "[#{Spree::Config.site_name}] #{order_cycle_subject}"
if has_orders?(order_cycle, producer)
return unless has_orders?(order_cycle, producer)
mail(
to: @producer.contact.email,
from: from_address,
@@ -23,7 +26,6 @@ class ProducerMailer < Spree::BaseMailer
end
end
private
def has_orders?(order_cycle, producer)

View File

@@ -2,44 +2,59 @@ Spree::OrderMailer.class_eval do
helper HtmlHelper
helper CheckoutHelper
helper SpreeCurrencyHelper
include I18nHelper
def cancel_email(order, resend = false)
@order = find_order(order)
subject = (resend ? "[#{t(:resend).upcase}] " : '')
subject += "#{Spree::Config[:site_name]} #{t('order_mailer.cancel_email.subject')} ##{order.number}"
mail(to: order.email, from: from_address, subject: subject)
I18n.with_locale valid_locale(@order.user) do
mail(to: order.email,
from: from_address,
subject: mail_subject(t('order_mailer.cancel_email.subject'), resend))
end
end
def confirm_email_for_customer(order, resend = false)
find_order(order) # Finds an order instance from an id
subject = (resend ? "[#{t(:resend).upcase}] " : '')
subject += "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{@order.number}"
mail(:to => @order.email,
:from => from_address,
:subject => subject,
:reply_to => @order.distributor.contact.email)
I18n.with_locale valid_locale(@order.user) do
mail(to: @order.email,
from: from_address,
subject: mail_subject(t('order_mailer.confirm_email.subject'), resend),
reply_to: @order.distributor.contact.email)
end
end
def confirm_email_for_shop(order, resend = false)
find_order(order) # Finds an order instance from an id
subject = (resend ? "[#{t(:resend).upcase}] " : '')
subject += "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{@order.number}"
mail(:to => @order.distributor.contact.email,
:from => from_address,
:subject => subject)
I18n.with_locale valid_locale(@order.user) do
mail(to: @order.distributor.contact.email,
from: from_address,
subject: mail_subject(t('order_mailer.confirm_email.subject'), resend))
end
end
def invoice_email(order, pdf)
find_order(order) # Finds an order instance from an id
attachments["invoice-#{@order.number}.pdf"] = pdf if pdf.present?
subject = "#{Spree::Config[:site_name]} #{t(:invoice)} ##{@order.number}"
mail(:to => @order.email,
:from => from_address,
:subject => subject,
:reply_to => @order.distributor.contact.email)
attach_file("invoice-#{@order.number}.pdf", pdf)
I18n.with_locale valid_locale(@order.user) do
mail(to: @order.email,
from: from_address,
subject: mail_subject(t(:invoice), false),
reply_to: @order.distributor.contact.email)
end
end
def find_order(order)
@order = order.respond_to?(:id) ? order : Spree::Order.find(order)
end
private
def mail_subject(base_subject, resend)
resend_prefix = (resend ? "[#{t(:resend).upcase}] " : '')
"#{resend_prefix}#{Spree::Config[:site_name]} #{base_subject} ##{@order.number}"
end
def attach_file(filename, file)
attachments[filename] = file if file.present?
end
end

View File

@@ -1,8 +1,12 @@
Spree::UserMailer.class_eval do
include I18nHelper
def signup_confirmation(user)
@user = user
mail(:to => user.email, :from => from_address,
:subject => t(:welcome_to) + Spree::Config[:site_name])
I18n.with_locale valid_locale(@user) do
mail(:to => user.email, :from => from_address,
:subject => t(:welcome_to) + Spree::Config[:site_name])
end
end
# Overriding `Spree::UserMailer.confirmation_instructions` which is
@@ -12,10 +16,12 @@ Spree::UserMailer.class_eval do
@instance = Spree::Config[:site_name]
@contact = ContentConfig.footer_email
subject = t('spree.user_mailer.confirmation_instructions.subject')
mail(to: confirmation_email_address,
from: from_address,
subject: subject)
I18n.with_locale valid_locale(@user) do
subject = t('spree.user_mailer.confirmation_instructions.subject')
mail(to: confirmation_email_address,
from: from_address,
subject: subject)
end
end
private

View File

@@ -1,6 +1,7 @@
class SubscriptionMailer < Spree::BaseMailer
helper CheckoutHelper
helper ShopMailHelper
include I18nHelper
def confirmation_email(order)
@type = 'confirmation'
@@ -46,10 +47,13 @@ class SubscriptionMailer < Spree::BaseMailer
private
def send_mail(order)
subject = "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{order.number}"
mail(to: order.email,
from: from_address,
subject: subject,
reply_to: order.distributor.contact.email)
I18n.with_locale valid_locale(order.user) do
confirm_email_subject = t('order_mailer.confirm_email.subject')
subject = "#{Spree::Config[:site_name]} #{confirm_email_subject} ##{order.number}"
mail(to: order.email,
from: from_address,
subject: subject,
reply_to: order.distributor.contact.email)
end
end
end

View File

@@ -0,0 +1,16 @@
module Calculator
class Weight < Spree::Calculator
preference :per_kg, :decimal, default: 0.0
attr_accessible :preferred_per_kg
def self.description
I18n.t('spree.weight')
end
def compute(object)
line_items = line_items_for object
total_weight = line_items.sum { |li| ((li.variant.andand.weight || 0) * li.quantity) }
total_weight * preferred_per_kg
end
end
end

View File

@@ -0,0 +1,41 @@
module StockSettingsOverrideValidation
extend ActiveSupport::Concern
included do
before_validation :require_compatible_on_demand_and_count_on_hand
end
def require_compatible_on_demand_and_count_on_hand
disallow_count_on_hand_if_using_producer_stock_settings
disallow_count_on_hand_if_on_demand
require_count_on_hand_if_limited_stock
end
def disallow_count_on_hand_if_using_producer_stock_settings
return unless on_demand.nil? && count_on_hand.present?
error_message = I18n.t("count_on_hand.using_producer_stock_settings_but_count_on_hand_set",
scope: i18n_scope_for_stock_settings_override_validation_error)
errors.add(:count_on_hand, error_message)
end
def disallow_count_on_hand_if_on_demand
return unless on_demand? && count_on_hand.present?
error_message = I18n.t("count_on_hand.on_demand_but_count_on_hand_set",
scope: i18n_scope_for_stock_settings_override_validation_error)
errors.add(:count_on_hand, error_message)
end
def require_count_on_hand_if_limited_stock
return unless on_demand == false && count_on_hand.blank?
error_message = I18n.t("count_on_hand.limited_stock_but_no_count_on_hand",
scope: i18n_scope_for_stock_settings_override_validation_error)
errors.add(:count_on_hand, error_message)
end
def i18n_scope_for_stock_settings_override_validation_error
"activerecord.errors.models.#{self.class.name.underscore}"
end
end

View File

@@ -80,8 +80,6 @@ class Enterprise < ActiveRecord::Base
before_validation :set_unused_address_fields
after_validation :geocode_address
validates :instagram, format: /\A@[a-zA-Z0-9._]{1,30}\z/, allow_blank: true
after_touch :touch_distributors
after_create :set_default_contact
after_create :relate_to_owners_enterprises
@@ -332,10 +330,6 @@ class Enterprise < ActiveRecord::Base
abn.present?
end
def instagram=(value)
write_attribute(:instagram, value.try(:gsub, instagram_regex, '@\1'))
end
protected
def devise_mailer
@@ -344,10 +338,6 @@ class Enterprise < ActiveRecord::Base
private
def instagram_regex
%r{\A(?:https?://)?(?:www\.)?instagram\.com/([a-zA-Z0-9._]{1,30})/?\z}
end
def name_is_unique
dups = Enterprise.where(name: name)
dups = dups.where('id != ?', id) unless new_record?

View File

@@ -26,6 +26,7 @@ class EnterpriseFee < ActiveRecord::Base
validates_presence_of :name
before_save :ensure_valid_tax_category_settings
before_destroy :ensure_no_product_distributions
scope :for_enterprise, lambda { |enterprise| where(enterprise_id: enterprise) }
scope :for_enterprises, lambda { |enterprises| where(enterprise_id: enterprises) }
@@ -68,6 +69,15 @@ class EnterpriseFee < ActiveRecord::Base
return true
end
def ensure_no_product_distributions
dependent_distribution = ProductDistribution.where(enterprise_fee_id: self).first
return unless dependent_distribution
product = dependent_distribution.product
error = I18n.t(:enterprise_fees_destroy_error, id: product.id, name: product.name)
errors.add(:base, error)
false
end
def refresh_products_cache
OpenFoodNetwork::ProductsCache.enterprise_fee_changed self
end

View File

@@ -1,29 +0,0 @@
module OpenFoodNetwork
class Calculator::Weight < Spree::Calculator
preference :per_kg, :decimal, :default => 0.0
attr_accessible :preferred_per_kg
def self.description
I18n.t('spree.weight')
end
def compute(object)
line_items = line_items_for object
total_weight = line_items.sum { |li| ((li.variant.andand.weight || 0) * li.quantity) }
total_weight * self.preferred_per_kg
end
private
def line_items_for(object)
if object.respond_to? :line_items
object.line_items
elsif object.respond_to?(:variant) && object.respond_to?(:quantity)
[object]
else
raise "Unknown object type: #{object.inspect}"
end
end
end
end

View File

@@ -68,6 +68,18 @@ module ProductImport
private
def find_or_initialize_variant_override(entry, existing_variant)
existing_variant_override = VariantOverride.where(
variant_id: existing_variant.id,
hub_id: entry.enterprise_id
).first
existing_variant_override || VariantOverride.new(
variant_id: existing_variant.id,
hub_id: entry.enterprise_id
)
end
def enterprise_validation(entry)
return if name_presence_error entry
return if enterprise_not_found_error entry
@@ -310,21 +322,12 @@ module ProductImport
end
def create_inventory_item(entry, existing_variant)
existing_variant_override = VariantOverride.where(
variant_id: existing_variant.id,
hub_id: entry.enterprise_id
).first
find_or_initialize_variant_override(entry, existing_variant).tap do |variant_override|
check_variant_override_stock_settings(entry, variant_override)
variant_override = existing_variant_override || VariantOverride.new(
variant_id: existing_variant.id,
hub_id: entry.enterprise_id
)
variant_override.assign_attributes(count_on_hand: entry.on_hand, import_date: @import_time)
check_on_hand_nil(entry, variant_override)
variant_override.assign_attributes(entry.attributes.slice('price', 'on_demand'))
variant_override
variant_override.assign_attributes(import_date: @import_time)
variant_override.assign_attributes(entry.attributes.slice('price', 'on_demand'))
end
end
def mark_as_inventory_item(entry, variant_override)
@@ -355,5 +358,11 @@ module ProductImport
object.count_on_hand = 0 if object.respond_to?(:count_on_hand)
entry.on_hand_nil = true
end
def check_variant_override_stock_settings(entry, object)
object.count_on_hand = entry.on_hand.presence
object.on_demand = object.count_on_hand.blank? if entry.on_demand.blank?
entry.on_hand_nil = object.count_on_hand.blank?
end
end
end

View File

@@ -100,7 +100,8 @@ module ProductImport
entries[entry.line_number] = {
attributes: entry.displayable_attributes,
validates_as: entry.validates_as,
errors: entry.invalid_attributes
errors: entry.invalid_attributes,
product_validations: entry.product_validations
}
end
entries.to_json
@@ -205,7 +206,7 @@ module ProductImport
def open_spreadsheet
if accepted_mimetype
Roo::Spreadsheet.open(@file, extension: accepted_mimetype)
Roo::Spreadsheet.open(@file, extension: accepted_mimetype, encoding: Encoding::UTF_8)
else
errors.add(:importer, I18n.t(:product_importer_spreadsheet_error))
delete_uploaded_file
@@ -226,6 +227,14 @@ module ProductImport
(2..@sheet.last_row).map do |i|
@sheet.row(i)
end
rescue ArgumentError => e
if e.message.include? 'invalid byte sequence'
errors.add(:importer, I18n.t('admin.product_import.model.encoding_error'))
else
errors.add(:importer, I18n.t('admin.product_import.model.unexpected_error',
error_message: e.message))
end
[]
end
def build_entries_in_range

View File

@@ -210,7 +210,10 @@ class AbilityDecorator
# during the order creation process from the admin backend
order.distributor.nil? || user.enterprises.include?(order.distributor) || order.order_cycle.andand.coordinated_by?(user)
end
can [:admin, :bulk_management, :managed], Spree::Order if user.admin? || user.enterprises.any?(&:is_distributor)
can [:admin, :bulk_management, :managed], Spree::Order do
user.admin? || user.enterprises.any?(&:is_distributor)
end
can [:admin, :create, :show, :poll], :invoice
can [:admin, :visible], Enterprise
can [:admin, :index, :create, :update, :destroy], :line_item
can [:admin, :index, :create], Spree::LineItem

View File

@@ -40,33 +40,6 @@ module Spree
included_tax > 0
end
# @return [Array<Spree::TaxRate>]
def tax_rates
case originator
when Spree::TaxRate
[originator]
when EnterpriseFee
case source
when Spree::LineItem
tax_category = originator.inherits_tax_category? ? source.product.tax_category : originator.tax_category
return tax_category ? tax_category.tax_rates.match(source.order) : []
when Spree::Order
return originator.tax_category ? originator.tax_category.tax_rates.match(source) : []
end
else
find_closest_tax_rates_from_included_tax
end
end
# shipping fees and adjustments created from the admin panel have
# taxes set at creation in the included_tax field without relation
# to the corresponding TaxRate, so we look for the closest one
def find_closest_tax_rates_from_included_tax
approximation = (included_tax / (amount - included_tax))
return [] if approximation.infinite? or approximation.zero?
[Spree::TaxRate.order("ABS(amount - #{approximation})").first]
end
def self.without_callbacks
skip_callback :save, :after, :update_adjustable
skip_callback :destroy, :after, :update_adjustable

View File

@@ -1,18 +1,20 @@
module Spree
Calculator.class_eval do
private
# Given an object which might be an Order or a LineItem (amongst
# others), return a collection of line items.
def line_items_for(object)
if object.respond_to? :line_items
if object.is_a?(Spree::LineItem)
[object]
elsif object.respond_to? :line_items
object.line_items
elsif object.order.present?
object.order.line_items
else
[object]
end
end
end
end

View File

@@ -293,7 +293,7 @@ Spree::Order.class_eval do
def tax_adjustment_totals
tax_adjustments.each_with_object(Hash.new) do |adjustment, hash|
tax_rates = adjustment.tax_rates
tax_rates = TaxRateFinder.tax_rates_of(adjustment)
tax_rates_hash = Hash[tax_rates.collect do |tax_rate|
tax_amount = tax_rates.one? ? adjustment.included_tax : tax_rate.compute_tax(adjustment.amount)
[tax_rate, tax_amount]

View File

@@ -26,6 +26,9 @@ module Spree
# When a Property is destroyed, dependent-destroy will destroy all ProductProperties,
# which will take care of refreshing the products cache
def property
self
end
private

View File

@@ -1,5 +1,6 @@
class VariantOverride < ActiveRecord::Base
extend Spree::LocalizedNumber
include StockSettingsOverrideValidation
acts_as_taggable
@@ -82,7 +83,7 @@ class VariantOverride < ActiveRecord::Base
def reset_stock!
if resettable
if default_stock?
self.attributes = { count_on_hand: default_stock }
self.attributes = { on_demand: false, count_on_hand: default_stock }
self.save
else
Bugsnag.notify RuntimeError.new "Attempting to reset stock level for a variant with no default stock level."

View File

@@ -1,3 +0,0 @@
/ insert_before "[data-hook='admin_order_form_buttons']"
= render partial: 'spree/admin/orders/_form/distribution_fields'

View File

@@ -1,2 +0,0 @@
add_to_attributes "table.index, [data-hook='admin_order_form_buttons']"
attributes "ng-show" => "distributionChosen()"

View File

@@ -1,3 +0,0 @@
/ replace "code[erb-loud]:contains('button t(:update)')"
= button t(:update_and_recalculate_fees), 'icon-refresh'

View File

@@ -1,3 +0,0 @@
/ replace 'code[erb-loud]:contains(\'"(#{f.object.variant.options_text})"\')'
= "(#{f.object.full_name})"

View File

@@ -1,3 +0,0 @@
/ replace 'code[erb-loud]:contains(\'f.object.variant.display_amount\')'
= f.object.single_money

View File

@@ -1,6 +0,0 @@
/ insert_after "code[erb-loud]:contains('button_link_to t(:resend)')"
%li.links-dropdown#links-dropdown{ links: order_links(@order).to_json }
:coffee
angular.bootstrap(document.getElementById("links-dropdown"),['admin.dropdown'])

View File

@@ -1,6 +0,0 @@
/ replace "code[erb-loud]:contains(\'error_messages\')"
-# Suppress errors when manually creating a new order - needs to proceed to edit page
-# without having line items (which otherwise gives a validation error)
- unless params["suppress_error_msg"]
= render partial: "spree/shared/error_messages", :locals => { :target => @order }

View File

@@ -1,5 +0,0 @@
/ insert_after "code[erb-loud]:contains(\"render :partial => 'form', :locals => { :f => f }\")"
.one.column &nbsp;
= render :partial => 'spree/admin/shared/hubs_sidebar', :locals => { f: f, klass: :payment_method }
.clear

View File

@@ -1,4 +0,0 @@
/ insert_after "code[erb-silent]:contains('content_for :page_actions do')"
%li
= button_link_to t(:new), spree.new_admin_payment_method_path, :icon => 'icon-plus' %>

View File

@@ -1 +0,0 @@
remove "code[erb-loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")"

View File

@@ -1,5 +0,0 @@
/ insert_after "code[erb-loud]:contains(\"render :partial => 'form', :locals => { :f => f }\")"
.one.column &nbsp;
= render :partial => 'spree/admin/shared/hubs_sidebar', :locals => { f: f, klass: :payment_method }
.clear

View File

@@ -1 +0,0 @@
remove "code[erb-loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")"

View File

@@ -1,3 +0,0 @@
/ replace "[data-hook=admin_product_form_left] code[erb-loud]:contains('f.text_area :description')"
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', 'textangular-strip' => true, 'ta-paste' => "stripFormatting($html)", 'ta-toolbar' => "[['bold','italics','clear']]"}
= sanitize(@product.description)

View File

@@ -1,3 +0,0 @@
/ insert_after "div[class='variant_units_form']"
= render 'spree/admin/products/primary_taxon_form', f: f

View File

@@ -1,6 +0,0 @@
/ insert_before "code[erb-loud]:contains('f.field_container :price')"
= f.field_container :supplier do
= f.label :supplier, t(:spree_admin_supplier)
%br
= f.collection_select(:supplier_id, @producers, :id, :name, {:include_blank => true}, {:class => "select2"})
= f.error_message_on :supplier

View File

@@ -1,17 +0,0 @@
/ insert_top "[data-hook='admin_product_form_right']"
.variant_units_form{ 'ng-app' => 'admin.products', 'ng-controller' => 'editUnitsCtrl' }
= f.field_container :units do
= f.label :variant_unit_with_scale, t(:spree_admin_variant_unit_scale)
%select.select2.fullwidth{ id: 'product_variant_unit_with_scale', 'ng-model' => 'variant_unit_with_scale', 'ng-change' => 'setFields()', 'ng-options' => 'unit[1] as unit[0] for unit in variant_unit_options' }
%option{'value' => ''}
= f.text_field :variant_unit, {'id' => 'variant_unit', 'ng-value' => 'product.variant_unit', 'hidden' => true}
= f.text_field :variant_unit_scale, {'id' => 'variant_unit_scale', 'ng-value' => 'product.variant_unit_scale', 'hidden' => true}
.variant_unit_name{'ng-show' => 'product.variant_unit == "items"'}
= f.field_container :variant_unit_name do
= f.label :variant_unit_name, t(:spree_admin_variant_unit_name)
= f.text_field :variant_unit_name, {placeholder: t('admin.products.unit_name_placeholder')}
= f.error_message_on :variant_unit_name

View File

@@ -1,2 +0,0 @@
remove "code[erb-loud]:contains('f.label :available_on')"
closing_selector("code[erb-loud]:contains('f.text_field :available_on')")

View File

@@ -1,2 +0,0 @@
remove "code[erb-loud]:contains('f.field_container :cost_currency')"
closing_selector("code[erb-silent]:contains('end')")

View File

@@ -1,2 +0,0 @@
remove "code[erb-loud]:contains('f.field_container :cost_price')"
closing_selector("code[erb-silent]:contains('end')")

View File

@@ -1 +0,0 @@
remove "div[data-hook='admin_product_form_meta']"

View File

@@ -1 +0,0 @@
remove "div[class='twelve columns alpha omega']"

View File

@@ -1,2 +0,0 @@
/ replace "[data-hook=admin_product_form_right] code[erb-loud]:contains('f.label :price')"
= f.label :price, raw(t(:price) + content_tag(:span, ' *', :class => 'required'))

Some files were not shown because too many files have changed in this diff Show More