Compare commits

...

1868 Commits

Author SHA1 Message Date
Kristina Lim
d3c2d1859c Update all locales with the latest Transifex translations 2019-03-21 01:56:45 +08:00
Kristina Lim
b942dc1074 Merge pull request #3628 from openfoodfoundation/transifex
Transifex
2019-03-21 01:52:58 +08:00
Transifex-Openfoodnetwork
08894c242c Updating translations for config/locales/en_GB.yml 2019-03-21 04:04:33 +11:00
Transifex-Openfoodnetwork
eeb8f12b4e Updating translations for config/locales/en_GB.yml 2019-03-21 04:01:27 +11:00
Transifex-Openfoodnetwork
79eb89ac0b Updating translations for config/locales/en_GB.yml 2019-03-21 03:58:20 +11:00
Pau Pérez Fabregat
4f82808243 Merge pull request #3617 from luisramos0/edit-variants-specs
Add spec to cover editing on_hand and on_demand values in the variants edit page
2019-03-20 09:13:56 +01:00
Pau Pérez Fabregat
2a3a935c16 Merge pull request #3570 from luisramos0/byebye-prod-distributions
Delete dead feature product distributions
2019-03-20 09:01:23 +01:00
luisramos0
90a14d426b Add spec to cover editing on_hand and on_demand values in the variants edit page 2019-03-18 17:04:59 +00:00
luisramos0
9fff795162 Fix typo in en.yml in key new_shipping_category 2019-03-18 17:04:59 +00:00
Pau Pérez Fabregat
fb29a7c7c2 Merge pull request #3606 from openfoodfoundation/dependabot/bundler/oj-3.7.10
Bump oj from 3.7.9 to 3.7.10
2019-03-18 12:12:13 +01:00
dependabot[bot]
d7b25d63f9 Bump oj from 3.7.9 to 3.7.10
Bumps [oj](https://github.com/ohler55/oj) from 3.7.9 to 3.7.10.
- [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.9...v3.7.10)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-14 19:25:55 +00:00
Pau Pérez Fabregat
75abd4586e Merge pull request #3583 from coopdevs/handle-deleted-oc-refreshing-cache
Handle deleted order cycle when refreshing cache
2019-03-14 20:11:14 +01:00
Pau Pérez Fabregat
33b74bef0e Merge pull request #3599 from coopdevs/add-nl_BE-belgium
Bring in latest nl_BE translations
2019-03-14 18:59:57 +01:00
Pau Pérez Fabregat
baacea9f6a Merge pull request #3595 from coopdevs/instrument-products-cache
Instrument products cache
2019-03-14 18:58:43 +01:00
Pau Perez
e60437c6a2 Refactor test to execute public API instead 2019-03-14 18:53:11 +01:00
Pau Perez
b9636b975a Refactor test to stop using .any_instance
Although might be useful in very particular cases its use is discourage
by RSpec itself. See https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/any-instance
2019-03-14 18:53:11 +01:00
Pau Perez
bc34d04c31 Do not retry when refreshing cache on deleted OC 2019-03-14 18:53:11 +01:00
luisramos0
cb78f8f8c8 Fetch latest nl_BE translations from transifex with correct menu links 2019-03-13 23:29:40 +00:00
Pau Perez
fede58289b Move Cache::Store config to new initializer
I don't know why but `Rails.logger` is still nil when evaluated from
`configure` block in `config/environments/development.rb`. The only way
I found to make ActiveSupport's cache to use the default logger is from
an initializer.

Note that `ActiveSupport::Cache::Store` uses `debug` level and so we
need to set the dev logger in that same level to see its messages. If
you want to debug in staging as well, you'll need to modify the log
level manually.
2019-03-13 19:08:46 +01:00
Pau Perez
15a95a3bf5 Use :file_store cache store in development
:memory_store uses the process' memory and therefore, what the
background job writes is not reachable for the rails server process when
it reads from the cache. See
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Products-cache#development.
2019-03-13 19:08:46 +01:00
Pau Perez
10a79d5a65 Decouple CachedProductsRenderer from the Rails env
This way we don't need to touch the class implementation to enable the
products cache in development. Just change the default value in
`app/models/spree/app_configuration_decorator.rb`.
2019-03-13 19:08:46 +01:00
Pau Pérez Fabregat
13b2115a29 Merge pull request #3581 from coopdevs/cache-stylistic-improvements
Cache stylistic improvements
2019-03-13 19:05:38 +01:00
luisramos0
786ba15174 Remove unused translation 2019-03-13 12:24:40 +00:00
luisramos0
7a2bc384d5 Re-add spec removed in product distributions removal but now adapted to use order cycles 2019-03-13 12:24:40 +00:00
luisramos0
34d7070c6c Delete spec used to test product distributions (removed feature) 2019-03-13 12:24:40 +00:00
luisramos0
b62e350fab Improve reports controller decorator by removing some copy pasted code and deleting some code repeated across data_load and the main action methods 2019-03-13 12:24:40 +00:00
luisramos0
2401b947b9 Make load sample data rake task work without product distributions 2019-03-13 12:24:40 +00:00
luisramos0
05d42d475e Make reports and subscriptions specs work without product.distributors attribute 2019-03-13 12:24:40 +00:00
luisramos0
2de6c46834 Make order.order_cycle required in cart_service. There’s no more exception for that without product_distributions. 2019-03-13 12:24:40 +00:00
luisramos0
4768ca27c7 Remove all dependencies to product distributions including the validation to avoid deleting fees with product distributions 2019-03-13 11:50:35 +00:00
luisramos0
3117dbf624 Remove product distributions from order model 2019-03-13 11:50:35 +00:00
luisramos0
a022cebfc8 Remove product distributions from enterprise model and controller 2019-03-13 11:49:13 +00:00
luisramos0
ed9321e92d Remove product distributions from product model and controller 2019-03-13 11:47:50 +00:00
luisramos0
86f9b3d663 Delete product_distributions: drop table and remove models, controllers and BO edit page 2019-03-13 11:47:50 +00:00
Pau Pérez Fabregat
2dd55770fe Merge pull request #3569 from luisramos0/delete-more-overrides
Delete some more dead overrides and more dead code
2019-03-12 17:48:12 +01:00
Pau Pérez Fabregat
01baba336d Merge pull request #3575 from openfoodfoundation/dependabot/bundler/unicorn-5.5.0
Bump unicorn from 5.4.1 to 5.5.0
2019-03-12 17:30:56 +01:00
Pau Perez
c4fcc25faa Bring in latest nl_BE translations
As we didn't reach 100% translation Transifex does not sync the changes
into the repo. However, the Belgian instance still needs it.
2019-03-12 15:30:52 +01:00
Maikel
6722f21cb0 Merge pull request #3593 from openfoodfoundation/transifex
Transifex
2019-03-12 16:01:28 +11:00
Pau Perez
931cb89a9d Move new class to services and rename it 2019-03-11 18:28:25 +01:00
Transifex-Openfoodnetwork
46f16c060b Updating translations for config/locales/en_US.yml 2019-03-12 00:38:22 +11:00
Transifex-Openfoodnetwork
8afd5e7050 Updating translations for config/locales/nb.yml 2019-03-09 06:33:01 +11:00
Maikel
22bac3daaf Merge pull request #3588 from openfoodfoundation/transifex
Transifex
2019-03-08 11:31:36 +11:00
Maikel
608c322770 Merge pull request #3585 from mkllnk/1829-missing-translation-product-category
1829 missing translation product category
2019-03-08 10:10:09 +11:00
Transifex-Openfoodnetwork
2eb3b7acea Updating translations for config/locales/fr.yml 2019-03-08 04:06:14 +11:00
Transifex-Openfoodnetwork
66d6936452 Updating translations for config/locales/en_GB.yml 2019-03-08 01:36:28 +11:00
Pau Pérez Fabregat
f125686016 Merge pull request #3511 from coopdevs/update-bugsnag-notifier-library
Update Bugsnag from 5.5.0 to 6.11.1
2019-03-07 11:30:04 +01:00
Maikel Linke
972ebb5fc9 Fix missing translation by using AR default
Using the default fixes a missing translation. The text is slightly
changed but should be okay as well:

- "^Tax Category is required"
+ "Tax category can't be blank"
2019-03-07 11:54:04 +11:00
Maikel Linke
5ed13d1539 Fix translation by using ActiveRecord's default
Our translations are not available when decorators are loaded. The
message for a missing product category was missing:
https://github.com/openfoodfoundation/openfoodnetwork/issues/1829

I moved the translation to ActiveRecord's default scope so that it can
be picked up automatically.
2019-03-07 11:37:54 +11:00
Matt-Yorkley
3f6a6f7f33 Merge pull request #3572 from openfoodfoundation/transifex
Transifex
2019-03-07 00:17:49 +00:00
Matt-Yorkley
59fd5ce478 Merge branch 'master' into transifex 2019-03-07 00:17:14 +00:00
Matt-Yorkley
4fe7d276b4 Update all locales with the latest Transifex translations 2019-03-07 00:04:09 +00:00
Maikel Linke
f033cfcc12 Remove obsolete Bugsnag option
It prevents the app from booting with the new Bugsnag version.
2019-03-07 10:04:20 +11:00
Pau Perez
8db6560fe7 Update Bugsnag from 5.5.0 to 6.11.1
This brings lots of fixes and a great dose of enhancements such as
a rewritten `Delayed::Job` integration.
2019-03-07 10:03:43 +11:00
Maikel
4780a2193f Merge pull request #3209 from mkllnk/2072-test-data
2072 New sample data for testing
2019-03-07 08:49:12 +11:00
Pau Pérez Fabregat
e850182f95 Merge pull request #3563 from kristinalim/fix/3562-fix_payment_fee_for_order_based_calculator
3562 Fix error calculating payment fee using order-based calculator
2019-03-06 19:31:49 +01:00
Pau Pérez Fabregat
9f8d90cc0a Merge pull request #3305 from coopdevs/improve-shops-performance-take-2
Improve shops performance take 2
2019-03-06 16:25:28 +01:00
Transifex-Openfoodnetwork
9922ce070e Updating translations for config/locales/es.yml 2019-03-07 02:22:03 +11:00
Pau Perez
347aa3c4ae Replace #valid_products_distributed_by by class 2019-03-06 15:06:00 +01:00
Pau Perez
adb40d6c73 Test just the public method
This one is the one calling the private method that was tested now. It
involves some refactoring of the specs as well.
2019-03-06 13:38:53 +01:00
Pau Perez
7c533c6347 Extract DistributedValidProducts from OrderCycle 2019-03-06 13:35:43 +01:00
luisramos0
9644fcf67c Improve payment method factory in sample data by removing constantize 2019-03-06 10:01:17 +00:00
Pau Perez
2b58aab197 Extract method from cache key generation 2019-03-06 10:49:56 +01:00
Pau Perez
bbfd35c861 Fix CacheSettingsController violations 2019-03-06 10:45:45 +01:00
Transifex-Openfoodnetwork
0e2d303701 Updating translations for config/locales/ca.yml 2019-03-06 20:00:41 +11:00
Pau Pérez Fabregat
7e06807a11 Merge pull request #3539 from Matt-Yorkley/subs/confirmation_email
Don't process proxy_order if the order has been cancelled
2019-03-05 17:38:29 +01:00
Pau Pérez Fabregat
3ddee83be5 Merge pull request #3404 from luisramos0/2-0-disable-cache
[Spree Upgrade] Add checkbox to disable products cache
2019-03-05 14:51:11 +01:00
Pau Pérez Fabregat
30bbc5ee6f Merge pull request #3472 from pacodelaluna/fix-datetime-picker
Fix datetime picker on Order Cycle form
2019-03-05 14:50:34 +01:00
Pau Pérez Fabregat
b330db3b4b Merge pull request #2947 from Matt-Yorkley/pi/submenu_link
Pi/submenu link
2019-03-05 14:49:02 +01:00
Transifex-Openfoodnetwork
03aaea2a08 Updating translations for config/locales/ca.yml 2019-03-05 21:52:24 +11:00
dependabot[bot]
6ecb9cc848 Bump unicorn from 5.4.1 to 5.5.0
Bumps [unicorn](https://bogomips.org/unicorn/) from 5.4.1 to 5.5.0.

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-04 19:18:03 +00:00
Transifex-Openfoodnetwork
5ddb8fb1ae Updating translations for config/locales/nb.yml 2019-03-04 21:22:36 +11:00
Pau Perez
54e120889f Remove useless array wrapping on AR relation 2019-03-04 11:08:34 +01:00
luisramos0
5ab4ae88f5 Remove distribution change in order_spec, order distributor cannot be changed, if distributor or oc is changed, the order is emptied 2019-03-02 13:08:39 +00:00
luisramos0
7ac4a99bc7 Remove product distributions spe that needed distribution_change_validator. Product distributions will be removed soon, see https://github.com/openfoodfoundation/openfoodnetwork/issues/3525 2019-03-02 13:08:39 +00:00
luisramos0
d7bd944af3 Fix distribution_change_validator spec 2019-03-02 13:08:35 +00:00
luisramos0
351555d4e2 Remove unused methods from add_to_cart helper and distribution change validator 2019-03-02 12:55:08 +00:00
luisramos0
93e13742be Delete some more dead overrides. We are not using spree/checkout (except for /checkout/payment) nor spree/products 2019-03-01 23:56:03 +00:00
Pau Pérez Fabregat
6c83f67b86 Merge pull request #3556 from Matt-Yorkley/pi/template
Add description to CSV template
2019-03-01 11:37:58 +01:00
Maikel
a14c785e69 Merge pull request #3435 from Matt-Yorkley/bug/tmpfile
Use Dir::Tmpname.make_tmpname for threadsafe file naming
2019-03-01 10:20:26 +11:00
Maikel
54679f6651 Merge pull request #3535 from luisramos0/translations-for-v2
Move to master all en.yml entries added so far to v2 and add more missing v2 translations
2019-03-01 10:04:13 +11:00
luisramos0
e4edfe0b61 Merge branch 'master' into translations-for-v2 2019-02-28 21:32:34 +00:00
Pau Pérez Fabregat
88e6fa84a2 Merge pull request #3534 from luisramos0/registration_trans_all
Move registration process translations to lazy lookups to better organize the en.yml file
2019-02-28 17:15:09 +01:00
Pau Pérez Fabregat
aa635106ac Merge pull request #3531 from mkllnk/document-stock-validation-rules
Document stock validation of variant overrides
2019-02-28 17:14:45 +01:00
Pau Pérez Fabregat
89708de7c1 Merge pull request #3512 from kristinalim/fix/3478-scope_enterprise_fee_summary_to_eligible
3466,3478 [Enterprise Fee Summary] Scope report to eligible: true and non-zero adjustments
2019-02-28 17:14:15 +01:00
Pau Pérez Fabregat
6f0479c27d Merge pull request #3547 from openfoodfoundation/dependabot/bundler/combine_pdf-1.0.16
Bump combine_pdf from 1.0.15 to 1.0.16
2019-02-28 17:13:50 +01:00
Pau Pérez Fabregat
63312a6d5f Merge pull request #3554 from coopdevs/bring-bugsnag-initializer
Bring in Bugsnag initializer from ofn-install
2019-02-28 16:41:59 +01:00
Kristina Lim
36e4a22b58 Use delegate for Payment#line_items 2019-02-28 09:52:56 +08:00
Kristina Lim
bd58667747 Remove stock check done for payment fees 2019-02-28 09:24:29 +08:00
Maikel Linke
958e98debd Document stock validation of variant overrides 2019-02-28 12:21:26 +11:00
Kristina Lim
ce658e9dfa Fix error computing payment fee when order-based 2019-02-28 12:17:45 +11:00
Kristina Lim
dfc8cc0f9e Add failing test for calculation of payment fee 2019-02-28 12:17:44 +11:00
Maikel
4ed0831e4c Merge pull request #3550 from openfoodfoundation/transifex
Transifex
2019-02-28 11:39:57 +11:00
Maikel
824beba066 Merge pull request #3505 from luisramos0/vo-false
Adapt scope_variant_to_hub to new VO rules where on_demand=nil means use_producer_settings
2019-02-28 10:26:23 +11:00
Maikel
c472d2fbbe Merge pull request #3498 from luisramos0/delete-dead-overrides
Remove dead overrides
2019-02-28 10:25:42 +11:00
luisramos0
03d242c061 Fix typo in sample_data zone creation (zonEable) and added clause to avoid re-adding the same country to the zone 2019-02-27 23:19:39 +00:00
luisramos0
ad5c379771 Make sample data zone read from the environment variable CHECKOUT_ZONE 2019-02-27 09:46:18 +00:00
luisramos0
d418ca1b1f Add mandatory payment method provider to sample data payment methods 2019-02-27 09:45:21 +00:00
Pau Pérez Fabregat
a04de6e3cd Merge pull request #3499 from openfoodfoundation/dependabot/bundler/stripe-4.9.0
Bump stripe from 4.5.0 to 4.9.0
2019-02-27 09:56:32 +01:00
Danni M
5b880f7bfe Update issue templates
Fixed headings on the story template
2019-02-27 10:41:39 +11:00
François Turbelin
82fbcd35a8 Update tests 2019-02-26 22:07:11 +01:00
Matt-Yorkley
9dd5b9dd6c Fix import button specificity in feature spec 2019-02-26 20:06:02 +00:00
Matt-Yorkley
25e2d2adda Update references to product_sub_menu view 2019-02-26 20:06:01 +00:00
Matt-Yorkley
777850259b Apply and delete overrides 2019-02-26 19:42:47 +00:00
Matt-Yorkley
f1e55507c3 Recreate product_sub_menu Spree view 2019-02-26 19:42:47 +00:00
Matt-Yorkley
32470f33ec Add description to CSV template 2019-02-26 19:36:44 +00:00
luisramos0
3f3581cdbc Add more missing translations for v2, remove unnecessary en.order_state and remove duplicated en.spree.payment_states and en.spree.shipment_states 2019-02-26 16:54:48 +00:00
Pau Perez
4d47276810 Bring Bugsnag initializer from ofn-install
This copies ofn-install's `roles/app/templates/bugsnag.rb.j2` to
`config/initializers/bugsnag.rb`. All tasks and templates
regarding Bugsnag can then be 🔥 from ofn-install.

As a result, it'll fix the issue that both Katuma and OFF are facing
where the `config/initializer/bugsnag.rb` symlink to
`shared/config/bugsnag.rb` does not exist thus, nothing gets notified to
Bugsnag since December 3rd (according to customer support).
2019-02-26 17:52:49 +01:00
Pau Perez
a728da4f62 Cover product and producer props. in ctrl. spec 2019-02-26 12:09:26 +01:00
Pau Perez
915b5cf09e Inline also the active product properties query
This makes it easier to spot what are the differences and similarities
between active and non-active, which in turn, it'll help remove the N+1
the "active" branch causes.

Make it look `#distributed_producer_properties` with which seems to
share a lot.
2019-02-26 11:39:43 +01:00
Pau Perez
19cbda4128 Fix Rubocop violation 2019-02-26 11:39:43 +01:00
Pau Perez
24c031b3cd Extract #distributed_product_properties method 2019-02-26 11:39:43 +01:00
Pau Perez
6e9bb640f6 Add spacing between long scopes 2019-02-26 11:36:36 +01:00
Pau Perez
7b2d4f10ee Cover #distributed_properties \w a controller spec
This exercises the controller and the serializer ensuring the
integration works allowing to confidently refactor things further.
2019-02-26 11:36:36 +01:00
Pau Perez
e55fbf80fc Check property presentation attribute only in test
The PropertySerializer contains :id, :name and :presentation attributes
which leads to JSON objects like `{"id": 1, "name": "foo",
"presentation": "foo"}`. Because of this, we don't care about object
identity, just about their presentation attribute.
2019-02-26 11:36:36 +01:00
Pau Perez
d4635bd7cb Fetch Property instead of ProducerProps from query
By not having to treat producer properties differently we can filter and
fetch all properties from DB without having to process it with Ruby and
with a single query.
2019-02-26 11:36:36 +01:00
Pau Perez
92e2ed78d1 Test active distributor as well 2019-02-26 11:36:36 +01:00
Pau Perez
8eb35e491d Don't fetch rows by ids of DISTINCT records
There's no point on fetching the same records again by the resulting ids
of the previous query (nasty way of removing duplicates), when that
query has a DISTINCT.
2019-02-26 11:36:36 +01:00
Pau Perez
328cda66f5 Stop using PropertyMerge in serializer 2019-02-26 11:36:36 +01:00
Pau Perez
47a90e937b Have a duplicate product to test with 2019-02-26 11:36:36 +01:00
Pau Perez
8fef69387e Simplify test setup using factory transient attrs 2019-02-26 11:36:36 +01:00
Pau Perez
0782907f4d Setup a test order cycle with its exchanges 2019-02-26 11:36:36 +01:00
Pau Perez
64fb230297 Make it more obvious we talk about an enterprise 2019-02-26 11:36:36 +01:00
Pau Perez
a5f890cf36 Fix styling on method 2019-02-26 11:36:36 +01:00
Transifex-Openfoodnetwork
539544de28 Updating translations for config/locales/es.yml 2019-02-26 20:49:18 +11:00
Transifex-Openfoodnetwork
595fb75d82 Updating translations for config/locales/es.yml 2019-02-26 20:46:12 +11:00
François Turbelin
e1953c279b Move jquery-ui-timepicker libs to vendor dir 2019-02-25 22:48:30 +01:00
François Turbelin
ab86332949 Tune up config and style 2019-02-25 22:22:27 +01:00
François Turbelin
68fd6de39b Update Jquery datetimepicker lib to v1.6.3 2019-02-25 22:22:27 +01:00
dependabot[bot]
a1647053cb Bump combine_pdf from 1.0.15 to 1.0.16
Bumps [combine_pdf](https://github.com/boazsegev/combine_pdf) from 1.0.15 to 1.0.16.
- [Release notes](https://github.com/boazsegev/combine_pdf/releases)
- [Changelog](https://github.com/boazsegev/combine_pdf/blob/master/CHANGELOG.md)
- [Commits](https://github.com/boazsegev/combine_pdf/compare/v1.0.15...v1.0.16)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-25 19:26:41 +00:00
Pau Pérez Fabregat
df77f6e051 Merge pull request #3536 from Matt-Yorkley/flaky/bom_spec
Wait for angular to load in BOM spec
2019-02-25 13:14:57 +01:00
Pau Pérez Fabregat
6004d09698 Merge pull request #3538 from Matt-Yorkley/flaky/shipping_methods_spec
Adjust expectations in flaky spec
2019-02-25 12:50:48 +01:00
Matt-Yorkley
6e77afbf35 Adjust expectations in flaky spec 2019-02-25 11:08:10 +00:00
Pau Pérez Fabregat
4e180f9f43 Merge pull request #3517 from openfoodfoundation/dependabot/bundler/oj-3.7.9
Bump oj from 3.7.8 to 3.7.9
2019-02-25 11:37:43 +01:00
Pau Pérez Fabregat
59962bbfb1 Merge pull request #3540 from openfoodfoundation/transifex
Transifex
2019-02-25 11:36:56 +01:00
Matt-Yorkley
bbfe71fd27 Improve readability and add code comment 2019-02-25 10:27:34 +00:00
Transifex-Openfoodnetwork
021220514e Updating translations for config/locales/ca.yml 2019-02-25 21:11:12 +11:00
luisramos0
963fddf159 Add missing translations
These translations are missing in v2 but some will also make v1 better
2019-02-24 22:29:44 +00:00
luisramos0
f40ff61f97 Move all en.yml entries added so far to v2 to master so that we can start the translation process now 2019-02-24 22:28:30 +00:00
Matt-Yorkley
627b101be9 Don't process proxy_order if the order has been cancelled 2019-02-24 12:06:58 +00:00
Matt-Yorkley
ea8be0ab95 Fine-tune angular helper 2019-02-23 21:45:33 +00:00
Matt-Yorkley
c4b646c583 Wait for angular to load in BOM spec 2019-02-23 16:12:37 +00:00
luisramos0
ee8fe4b6b4 Move registration process translations to lazy lookups to better organize the en.yml file 2019-02-22 14:37:45 +00:00
luisramos0
0b1ea1beda Rename VariantOverride.use_producer_settings to VariantOverride.use_producer_stock_settings 2019-02-22 09:57:21 +00:00
Pau Pérez Fabregat
632826a192 Merge pull request #3494 from luisramos0/break-oc-specs
Break order_cycle_spec.js in specific files and remove reference to product.count_on_hand in bulk_product_update_spec.js
2019-02-22 08:30:35 +01:00
luisramos0
45e5fed609 Improve scope_variant_to_hub code and spec by testing an invalid data state 2019-02-21 11:25:01 +00:00
Maikel
509e644cf7 Merge pull request #3526 from openfoodfoundation/transifex
Transifex
2019-02-21 16:05:21 +11:00
Transifex-Openfoodnetwork
4b21c9cb70 Updating translations for config/locales/en_CA.yml 2019-02-21 07:32:50 +11:00
Luis Ramos
34acaa4e03 Merge pull request #3425 from mkllnk/2783-product-importer-spec
Apply import defaults to variants of new products in Spree 2
2019-02-20 13:34:57 +00:00
Matt-Yorkley
f73221ed85 Use Dir::Tmpname.make_tmpname for threadsafe file naming 2019-02-20 13:10:47 +00:00
luisramos0
ef786adcfc Make variant_override.stock_overridden? simpler and add comment to explain relationship between count_on_hand and on_demand in a VO 2019-02-20 13:07:21 +00:00
Maikel
ec26948949 Merge pull request #3521 from openfoodfoundation/transifex
Transifex
2019-02-20 19:10:16 +11:00
Transifex-Openfoodnetwork
aba4d742f6 Updating translations for config/locales/fr_CA.yml 2019-02-20 12:55:33 +11:00
Maikel
e7e2d1d870 Merge pull request #3516 from openfoodfoundation/transifex
Transifex
2019-02-20 10:39:55 +11:00
Transifex-Openfoodnetwork
7e59132bb2 Updating translations for config/locales/en_GB.yml 2019-02-20 06:50:52 +11:00
dependabot[bot]
47e154f2ac Bump oj from 3.7.8 to 3.7.9
Bumps [oj](https://github.com/ohler55/oj) from 3.7.8 to 3.7.9.
- [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.8...v3.7.9)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-19 19:21:37 +00:00
Transifex-Openfoodnetwork
9688fe7540 Updating translations for config/locales/fr.yml 2019-02-20 06:15:01 +11:00
Maikel
f0a6f5ae3c Merge pull request #3514 from openfoodfoundation/transifex
Transifex
2019-02-19 15:40:30 +11:00
Transifex-Openfoodnetwork
0a50a74561 Updating translations for config/locales/en_US.yml 2019-02-19 15:23:20 +11:00
Maikel
bb4d42ef9d Merge pull request #3464 from openfoodfoundation/transifex
Transifex
2019-02-19 12:41:16 +11:00
Maikel
1b45033e33 Merge pull request #3506 from Matt-Yorkley/pi/parse_bom
Sanitize non-parsable BOM characters inserted by Excel
2019-02-19 11:24:11 +11:00
Maikel
be59a8ce32 Merge pull request #3434 from Matt-Yorkley/pi/fix_hash_merge
Fix hash merge for recording already created products by name
2019-02-19 11:21:49 +11:00
Maikel
b7abb72ed5 Merge pull request #3462 from luisramos0/delete-api-order-ctrl
Delete empty controller class eval and spec
2019-02-19 11:14:29 +11:00
Maikel
ae4d36b3ed Merge pull request #3451 from Matt-Yorkley/subs/currency
Use localized currency symbols in Subs pages
2019-02-19 09:55:36 +11:00
Matt-Yorkley
9705c249ac Sanitize no-parsable BOM characters inserted by Excel 2019-02-18 13:13:37 +00:00
Kristina Lim
b0a82b0e21 Exclude $0 adjustments from report 2019-02-18 16:53:19 +08:00
Kristina Lim
36fd385f7d Add test showing $0 mandatory adjustments included 2019-02-18 16:53:19 +08:00
Kristina Lim
19f99255fa Exclude non-eligible entries from report 2019-02-18 16:53:18 +08:00
Kristina Lim
8ce7337c9d Add test showing $0 non-mandatory adjustments included 2019-02-18 16:53:18 +08:00
Kristina Lim
ca2c8e6ff2 Add test showing non-"eligible" entries included 2019-02-18 16:53:18 +08:00
Pau Pérez Fabregat
f5df10f5dc Merge pull request #3507 from openfoodfoundation/dependabot/bundler/selenium-webdriver-3.141.0
Bump selenium-webdriver from 3.12.0 to 3.141.0
2019-02-18 09:28:01 +01:00
dependabot[bot]
ed7015ae98 Bump selenium-webdriver from 3.12.0 to 3.141.0
Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 3.12.0 to 3.141.0.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/master/rb/CHANGES)
- [Commits](https://github.com/SeleniumHQ/selenium/compare/selenium-3.12.0...selenium-3.141.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-15 19:20:25 +00:00
luisramos0
75a79717cf Adapt scope_variant_to_hub to new VO rules where on_demand nil is seen as use_producer_settings 2019-02-15 14:05:24 +00:00
Transifex-Openfoodnetwork
9bf5531233 Updating translations for config/locales/nb.yml 2019-02-15 23:47:20 +11:00
Pau Pérez Fabregat
93c6271400 Merge pull request #3500 from openfoodfoundation/dependabot/bundler/bugsnag-5.5.0
Bump bugsnag from 4.1.0 to 5.5.0
2019-02-15 09:26:41 +01:00
Pau Pérez Fabregat
0a391783bc Merge pull request #3470 from kristinalim/fix/3426-intermittent_spec_failures
3426 [Flaky Spec] Address timing issues in enterprise users feature specs
2019-02-15 08:39:39 +01:00
Maikel Linke
6790e8895d Create sample payment methods with current environment 2019-02-15 16:44:55 +11:00
Maikel
d4589cc2f4 Merge pull request #3444 from mkllnk/3437-supplier-name-on-invoice
3437 supplier name on invoice
2019-02-15 16:31:29 +11:00
Matt-Yorkley
0c5cc23415 Fix hash merge for recording already created products by name 2019-02-14 21:38:18 +00:00
dependabot[bot]
7c5e58dd94 Bump bugsnag from 4.1.0 to 5.5.0
Bumps [bugsnag](https://github.com/bugsnag/bugsnag-ruby) from 4.1.0 to 5.5.0.
- [Release notes](https://github.com/bugsnag/bugsnag-ruby/releases)
- [Changelog](https://github.com/bugsnag/bugsnag-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bugsnag/bugsnag-ruby/compare/v4.1.0...v5.5.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-14 19:34:17 +00:00
dependabot[bot]
a369b48bf4 Bump stripe from 4.5.0 to 4.9.0
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 4.5.0 to 4.9.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/v4.5.0...v4.9.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-14 19:30:48 +00:00
Pau Pérez Fabregat
6f2b894cfe Merge pull request #3403 from openfoodfoundation/dependabot/bundler/dalli-2.7.9
Bump dalli from 2.7.2 to 2.7.9
2019-02-14 20:12:06 +01:00
Pau Pérez Fabregat
43fff8f18d Merge pull request #3460 from openfoodfoundation/dependabot/bundler/spinjs-rails-1.4
Bump spinjs-rails from 1.3 to 1.4
2019-02-14 19:42:33 +01:00
luisramos0
4a35b53b43 Remove dead overrides 2019-02-14 18:00:25 +00:00
Pau Pérez Fabregat
34020f7bf6 Merge pull request #3377 from openfoodfoundation/dependabot/bundler/i18n-js-3.2.1
Bump i18n-js from 3.1.0 to 3.2.1
2019-02-14 18:26:49 +01:00
Kristina Lim
af95e3871f Move check for table presence out of helper 2019-02-15 01:15:58 +08:00
luisramos0
bf4ce90f98 Add product.on_hand and product.on_demand positive test, these should be returned if no variants are provided in the input
Also, removed product.count_on_hand negative test (there's no such attriubte in v2) and added product.on_hand, this should not be returned because a variant is provided
2019-02-14 15:58:15 +00:00
luisramos0
bfa0734cc6 Break order_cycle_spec.js in specific files like create controller, edit controller and services
Move bulk_product_update_spec.js to its apropriate place under /admin
2019-02-14 15:57:40 +00:00
Pau Pérez Fabregat
0a885af7a6 Merge pull request #3481 from mkllnk/simplify-stripe-creation-in-specs
Simplify specs with stripe factory
2019-02-14 09:42:05 +01:00
Transifex-Openfoodnetwork
a71c89f70e Updating translations for config/locales/en_GB.yml 2019-02-14 18:01:18 +11:00
Transifex-Openfoodnetwork
19568577f5 Updating translations for config/locales/es.yml 2019-02-14 18:01:18 +11:00
Transifex-Openfoodnetwork
71b24ba314 Updating translations for config/locales/ca.yml 2019-02-14 18:01:17 +11:00
Maikel
9058729a9d Merge pull request #3459 from openfoodfoundation/dependabot/bundler/rspec-rails-3.8.2
Bump rspec-rails from 3.8.1 to 3.8.2
2019-02-14 17:18:07 +11:00
Maikel Linke
87abfcd704 Simplify shopping spec 2019-02-14 11:42:46 +11:00
Maikel Linke
5f5b0aaabf Simplify specs with stripe factory 2019-02-13 18:34:22 +11:00
Maikel Linke
612ea4c781 Simplify spec of invoice creation 2019-02-13 17:55:48 +11:00
Maikel
a36dc13192 Add issue templates for tech debt 2019-02-13 17:26:56 +11:00
Pau Pérez Fabregat
bda5eb1b1f Merge pull request #3337 from kristinalim/feature-enterprise_fees_report-order_based_calculator_bug
3283 [Enterprise Fee Summary] Fix values when calculator is order-based
2019-02-12 20:07:57 +01:00
Kristina Lim
5e8a336e24 Initialize data representation classes with data
There is no more need to pass the summarizer.
2019-02-13 01:51:34 +11:00
Kristina Lim
ddc788ed5d Move data representation translations to class 2019-02-13 01:51:34 +11:00
Kristina Lim
bc95560598 Add descriptions for data representation classes 2019-02-13 01:51:33 +11:00
Kristina Lim
664943a6e5 Include UsingEnterpriseFee instead of inheriting 2019-02-13 01:51:33 +11:00
Kristina Lim
b9c144bb1f Prepare to change AssociatedEnterpriseFee to module
The superclasses will include this module, instead of inheriting the class.
2019-02-13 01:51:32 +11:00
Kristina Lim
373e3e1039 Simplify name of SQL data summarizer class 2019-02-13 01:51:32 +11:00
Kristina Lim
7a76355cfe Separate summarizing of SQL data by source 2019-02-13 01:51:32 +11:00
Kristina Lim
c4801aafd4 Fix Fee Calc on Transfer Through and Tax Category
For exchange fees with calculator that is order-based:

* "Fee Calc on Transfer Through" should show "Entire Orders through
  DISTRIBUTOR_NAME".
* For tax category:
  a. If the enterprise fee itself has a tax category, this is used.
  b. If the enterprise fee inherits the product's tax category, this is
     "Various".
  c. If the enterprise fee has no tax, this is blank.

For coordinator fees:

* "Fee Calc on Transfer Through" should be "All".
* For tax category: Same as abova.
2019-02-13 01:51:31 +11:00
Kristina Lim
8f65beeb0b Clarify method name in report scope 2019-02-13 01:51:31 +11:00
Kristina Lim
e550be9bda Add test for using order-based exchange fees
This is not filling the "Fee Calc on Transfer Through" column. This will
be addressed in another commit.
2019-02-13 01:51:31 +11:00
Kristina Lim
0212454041 Refactor SQL result summarizer for report 2019-02-13 01:51:30 +11:00
Kristina Lim
06ba5182b4 Add flat rate calculator traits to related factories 2019-02-13 01:51:30 +11:00
dependabot[bot]
0fc9ead934 Bump i18n-js from 3.1.0 to 3.2.1
Bumps [i18n-js](https://github.com/fnando/i18n-js) from 3.1.0 to 3.2.1.
- [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.1.0...v3.2.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-12 13:19:50 +00:00
Pau Pérez Fabregat
1f72eb9f68 Merge pull request #3378 from kevinchristianson/active-products-translation-fix
Add missing 'active products' translation on dashboard
2019-02-12 14:15:53 +01:00
Pau Pérez Fabregat
a0c144fd0c Merge pull request #3415 from openfoodfoundation/feature/enterprise_fee_summary
[Enterprise Fee Summary] Merge "Enterprise Fee Summary" report to master
2019-02-12 13:58:47 +01:00
Pau Pérez Fabregat
a6c5e3423f Merge pull request #3474 from Matt-Yorkley/pi/broken_build
Fix broken spec from refactored method
2019-02-12 11:03:28 +01:00
Matt-Yorkley
097ffba323 Fix broken spec from refactored method 2019-02-11 23:57:13 +00:00
Pau Pérez Fabregat
4165ba5cdb Merge pull request #3463 from coopdevs/enable-catalan
Import Catalan translation from Transifex
2019-02-11 18:13:50 +01:00
Pau Perez
990de63728 Merge branch 'master' into active-products-translation-fix
* master: (46 commits)
  Wait for button to disappear before checking flash
  Use flash matcher in shipping method feature specs
  Add RSpec matchers for flash messages
  Do not expect modal open when checking spinner gone
  Update issue templates
  Update all locales with the latest Transifex translations
  Do not show table until first time dereferencing is done
  Remove unused have_no_selector argument in feature test
  Compile row ID with higher priority
  Compile edit link with higher priority
  Support selecting date in next months
  Improve sync between keyword filter and selecting all
  Wait for datepicker to associate and open before selecting date
  Update cancan permissions for second iteration of bulk invoices
  Fix shop accidentally becoming order coordinator
  Match date format in spec with import date filter
  Update name spaces for rake tasks to shorter 'ofn'.
  Refactor checking no preview image in specs
  Refactor checking of preview image path in specs
  Fix race condition in enterprise image feature specs
  ...
2019-02-11 16:12:52 +01:00
Pau Pérez Fabregat
9d065c8a0b Merge pull request #3233 from Matt-Yorkley/pi/inventories
Pi/inventories
2019-02-11 16:10:33 +01:00
Pau Pérez Fabregat
da09c8f86c Merge pull request #3467 from kristinalim/fix/3455-intermittent_spec_failure
3455 [Flaky Spec] Do not expect modal still open when checking that the spinner is gone
2019-02-11 15:58:22 +01:00
Pau Pérez Fabregat
b508d51406 Merge pull request #3469 from kristinalim/fix/3468-intermittent_spec_failures
3468 [Flaky Spec] Check for presence of flash div before trying to get its text
2019-02-11 15:54:33 +01:00
luisramos0
acc99fc9bb Improve readability of cached_product_renderer and respective spec 2019-02-11 11:46:04 +00:00
Kristina Lim
a876c2ab9f Address timing issues in enterprise roles specs 2019-02-11 13:02:40 +08:00
Kristina Lim
0032a237a2 Wait for button to disappear before checking flash 2019-02-10 22:08:18 +08:00
Kristina Lim
175264f41f Use flash matcher in shipping method feature specs 2019-02-10 22:08:18 +08:00
Kristina Lim
e14c60c1c1 Add RSpec matchers for flash messages 2019-02-10 22:08:18 +08:00
Kristina Lim
f143540d0c Do not expect modal open when checking spinner gone
The element referenced in the following might no longer be visible:

  within "div.reveal-modal"
2019-02-09 22:40:40 +08:00
Kristina Lim
b6be8c48d1 Fix layout violation in Spree::Ability decorator 2019-02-08 21:26:39 +00:00
Kristina Lim
de30cf1198 Fix description for feature flag example groups 2019-02-08 21:26:39 +00:00
Kristina Lim
461b5725d1 Hide report link and resource from non-superadmins 2019-02-08 21:26:38 +00:00
Kristina Lim
1d3f4aa28a Add feature flag for enterprise fee summary 2019-02-08 21:26:38 +00:00
Kristina Lim
f59834ddc8 Use receiver as "Fee Calc on Transfer Through" for outgoing exchanges 2019-02-08 21:26:38 +00:00
Kristina Lim
ddf15f1d30 Add scenario test for enterprise fee summary
Add test for more complex scenario where there is a coordinator and
distributor fee for an incoming exchange, and a producer and coordinator
fee for an outgoing exchange.
2019-02-08 21:26:38 +00:00
Kristina Lim
c92d202612 Rename files for factories in spec/factories/
Make these follow the "#{SINGULAR_OBJECT}_factory.rb" convention.
2019-02-08 21:26:38 +00:00
Kristina Lim
625069cb5a Add :per_item factory trait to shipping and payment methods 2019-02-08 21:26:38 +00:00
Kristina Lim
d2e49b8b49 Move variant setup to new factory trait 2019-02-08 21:26:38 +00:00
Kristina Lim
f36d13a736 Rename helper for setting up incomplete order 2019-02-08 21:26:38 +00:00
Kristina Lim
ce030aeb07 Move order setup to new factory traits 2019-02-08 21:26:38 +00:00
Kristina Lim
a3aa594c42 Use enterprise fee factory trait where applicable 2019-02-08 21:26:38 +00:00
Kristina Lim
5dda3b67eb Use factory for tax category in entperprise fee summary tests 2019-02-08 21:26:38 +00:00
Kristina Lim
61ec43f868 Add enterprise fee factory trait for per item rate
We should not presume what is not default for an enterprise fee object.
2019-02-08 21:26:38 +00:00
Kristina Lim
53c458f817 Clean up setup data for enterprise fee summary tests 2019-02-08 21:26:38 +00:00
Kristina Lim
4a73b1d26c Do not include incomplete orders in report 2019-02-08 21:26:38 +00:00
Kristina Lim
eaa7800427 Do not assign I18n translation to constants
The preferred language could change dynamically.
2019-02-08 21:26:38 +00:00
Kristina Lim
6378afdddb Address Rubocop violation 2019-02-08 21:26:38 +00:00
Kristina Lim
c81be75530 Move engine libraries except Engine and Version to services 2019-02-08 21:26:38 +00:00
Kristina Lim
3e499faa7c Do not use ReportData::EnterpriseFeeTypeTotals 2019-02-08 21:26:38 +00:00
Kristina Lim
3f84d0008a Move some in OpenFoodNetwork to engine services
This removes the OpenFoodNetwork namespace from these too.
2019-02-08 21:26:38 +00:00
Kristina Lim
95e3a2f45d Move authorization to the ::Parameters class 2019-02-08 21:26:38 +00:00
Kristina Lim
c61a83faca Move routes for enterprise fee summary to engine 2019-02-08 21:26:38 +00:00
Kristina Lim
9e035efd50 Render enterprise fee report directly in renderer 2019-02-08 21:26:38 +00:00
Kristina Lim
c8b154b12a Separate enterprise fee summary action
Split the previous "index" action into "new" and "create" actions.
2019-02-08 21:26:38 +00:00
Kristina Lim
da914289ea Copy spree/admin/reports#index into application 2019-02-08 21:26:38 +00:00
Kristina Lim
a17fa8013f Clean up I18n scope in feature specs for report 2019-02-08 21:26:38 +00:00
Kristina Lim
c0e6b70131 Rename EnterpriseFeeSummaryReportController
Remove "Report" because this is redundant, and pluralize the resource
name.
2019-02-08 21:26:38 +00:00
Kristina Lim
207b6c7f30 Use shorthand for RSpec expect(subject).to 2019-02-08 21:26:38 +00:00
Kristina Lim
2063752b97 Improve specs for Enterprise Fee Summary
This also addresses a spec that has failed over the rebasing.
2019-02-08 21:26:38 +00:00
Kristina Lim
2bf38b3ea1 Improve code based on Rubocop recommendations 2019-02-08 21:26:38 +00:00
Kristina Lim
552bf1b9f7 Move report list to own class 2019-02-08 21:26:38 +00:00
Kristina Lim
b78e2b4720 Move lib files for enterprise fee summary to engine 2019-02-08 21:26:38 +00:00
Kristina Lim
0cdcd96bb5 Add skeleton for OrderManagement engine 2019-02-08 21:26:38 +00:00
Kristina Lim
dcb1d9fe25 Add feature tests for enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
edf0b0df76 Add navigation item for enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
d3e9a53120 Filter enterprise fee summary for user permissions 2019-02-08 21:26:37 +00:00
Kristina Lim
8ad53055c7 Allow non-admins to see enterprise fee summary
Relax controller permissions for enterprise fee summary. Even non-admin
enterprise users should be able to see these reports.

Filtering of data based on permissions is handled in:

* OrderManagement::Reports::EnterpriseFeeSummary::Authorizer and
* OrderManagement::Reports::EnterpriseFeeSummary::Permissions.
2019-02-08 21:26:37 +00:00
Kristina Lim
f81f4b7e4a Authorize filters before generating enterprise fee report 2019-02-08 21:26:37 +00:00
Kristina Lim
9ce313c7f5 Define filter authorizer for enterprise fee report 2019-02-08 21:26:37 +00:00
Kristina Lim
cd3e258b59 Rename report authorizers to reflect permissions 2019-02-08 21:26:37 +00:00
Kristina Lim
469988856d Define permissions for enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
5fce9d0a7d Add multi-distributor scope to shipping and payment methods 2019-02-08 21:26:37 +00:00
Kristina Lim
24ab2e7fb0 Add filtering to enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
2407531957 Make more code for report tests reusable 2019-02-08 21:26:37 +00:00
Kristina Lim
d573dc5023 Make order builder for enterprise fee summary flexible
This is in preparation for tests for filtering the report.
2019-02-08 21:26:37 +00:00
Kristina Lim
4a00aceba2 Include shipping fees in enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
1273cc085b Include payment fees in enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
7d74ddc85b Add HTML view for enterprise fee summary report 2019-02-08 21:26:37 +00:00
Kristina Lim
418050c1b8 Remove blank strings from array report parameters
Remove the blank strings that Rails multiple selects add by default to
make sure that blank lists are still submitted to the server as arrays
instead of nil.

https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select
2019-02-08 21:26:37 +00:00
Kristina Lim
6e03ab03f5 Extract general behaviour for report parameters 2019-02-08 21:26:37 +00:00
Kristina Lim
34dc16f8c9 Base filter options from initial authorizer object 2019-02-08 21:26:37 +00:00
Kristina Lim
bd2b4c0134 Add enterprise fee summary form without options
The objects will be filled in another commit. This simply sets up the
filters UI for now.
2019-02-08 21:26:37 +00:00
Kristina Lim
ec81e4221f Add basic action for enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
b7439d2574 Fix sort for nil cells in enterprise fee summary 2019-02-08 21:26:37 +00:00
Kristina Lim
5b6bbc3920 Add generation of CSV renderer filename 2019-02-08 21:26:37 +00:00
Kristina Lim
ed2b8e9b9f Add CSV renderer for enterprise fee summary report 2019-02-08 21:26:37 +00:00
Kristina Lim
00e70733b0 Add test data for enterprise fee summary report 2019-02-08 21:26:37 +00:00
Kristina Lim
e7ed625d5a Add processing of enterprise fee summary from DB 2019-02-08 21:26:37 +00:00
Kristina Lim
faf7079780 Specify sort order of enterprise fee totals data 2019-02-08 21:26:37 +00:00
Kristina Lim
3763cb98a3 Add data classes for Enterprise Fee Summary report 2019-02-08 21:26:37 +00:00
Kristina Lim
a097640464 Add basic form object for enterprise fee summary 2019-02-08 21:26:36 +00:00
Kristina Lim
519a7d2ee6 Add datetime and integer array validator matchers 2019-02-08 21:26:36 +00:00
Kristina Lim
f6e8f18d89 Add validator for integer arrays
Example usage:

    validates :related_post_ids, integer_array: true
2019-02-08 21:26:36 +00:00
Kristina Lim
de9cff6fc2 Add validator for datetime string
Example usage:

    validates :start_at, date_time_string: true
2019-02-08 21:26:36 +00:00
Pau Perez
7359789903 Import Catalan translation from Transifex
Although we've started translating to Catalan and focused on it
recently, we never imported the file in the app thus the language menu
showed "English" for the "ca" locale and clicking on it switched to
English as well instead of Catalan.
2019-02-08 15:22:59 +01:00
luisramos0
3dc75c88d2 Delete empty controller class eval and spec. Useless left overs from 0ad2978926 2019-02-08 09:29:58 +00:00
Danni M
8ff5f9055b Update issue templates
I've created 3 types of templates based on those in the wiki and the default (bug) issue template. These can be edited or additional ones added at your leisure.

I also added the OFN software instance and version to the bugs template
2019-02-08 16:58:32 +11:00
Matt-Yorkley
f9ea93933e Use localizeCurrency filter in subscriptions 2019-02-07 22:58:49 +00:00
Matt-Yorkley
5582160e73 Add localizeCurrency filter to admin and inject currencyConfig data 2019-02-07 22:55:08 +00:00
luisramos0
1b4666fc6a Add checkbox to cache settings to disable products cache 2019-02-07 20:06:27 +00:00
dependabot[bot]
72cd0537fb Bump spinjs-rails from 1.3 to 1.4
Bumps [spinjs-rails](https://github.com/dnagir/spinjs-rails) from 1.3 to 1.4.
- [Release notes](https://github.com/dnagir/spinjs-rails/releases)
- [Commits](https://github.com/dnagir/spinjs-rails/compare/v1.3...v1.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-07 19:39:54 +00:00
dependabot[bot]
492b1c905f Bump rspec-rails from 3.8.1 to 3.8.2
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 3.8.1 to 3.8.2.
- [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.8.1...v3.8.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-07 19:39:25 +00:00
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
Maikel Linke
5ee3dbf9f2 Re-use renderer object 2019-02-07 10:12:06 +11:00
Luis Ramos
2d0df7ffdf Update app/controllers/spree/admin/orders_controller_decorator.rb
Co-Authored-By: mkllnk <maikel@email.org.au>
2019-02-07 09:19:19 +11: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 Linke
4a3e5f1d0a Print supplier name on invoice 2019-02-06 15:07:05 +11:00
Maikel Linke
3aea16e9ba Cover alternative invoice template with specs 2019-02-06 15:06:44 +11:00
Maikel Linke
d97fa60c31 Remove code duplication and test PDF creation 2019-02-06 14:53:05 +11:00
Maikel Linke
7c5b430a37 Test execution of BulkInvoiceService#start_pdf_job
The spec just tested if a job was enqueued, but not if the job can
actually be executed. Unfortunately, this test is quite slow.
2019-02-06 11:26:22 +11:00
Maikel Linke
cc46bfd002 Rename namespace to ofn 2019-02-05 16:30:46 +11:00
Maikel Linke
659aa269de Fix creation of sample payment methods on staging
Due to an unknown reason my chosen way of creating calculator and
assigning it to a payment method didn't work in staging environment even
though it was working in development.

Without diving deeper into the cause of this, I decided to change the
record assignments and fix the problem that way.
2019-02-05 16:24:30 +11:00
Maikel Linke
7a723d9061 Use new sample data during setup 2019-02-05 16:24:30 +11:00
Maikel Linke
c6393b6077 Warn about deprecation via ActiveSupport 2019-02-05 16:23:17 +11:00
Maikel Linke
c3029c612a Fix sample product creation and use bang methods
Mistakes like the missing fee when creating product distributions were
hidden, because I didn't use the bang methods to create records.
2019-02-05 16:23:17 +11:00
Maikel Linke
1d07327325 Add descriptions to enterprises 2019-02-05 16:23:17 +11:00
Maikel Linke
4b389ba357 Move sample data factories into their own files 2019-02-05 16:23:17 +11:00
Maikel Linke
3ab02d90df Move sample data address module to own file 2019-02-05 16:23:17 +11:00
Maikel Linke
bec9f5eb2e Move sample data logger to own module 2019-02-05 16:23:17 +11:00
Maikel Linke
fae05ff713 Deprecate old sample data task 2019-02-05 16:23:17 +11:00
Maikel Linke
876e73a989 Rewrite task to generate sample data
https://github.com/openfoodfoundation/openfoodnetwork/issues/2072

We need more and better structured sample data for dev testing and to
bootstrap staging data. This new task aims to replace
openfoodnetwork:dev:sample_data.
2019-02-05 16:23:17 +11: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
Maikel Linke
dbfcbc6db9 Apply import defaults to variants of new products
Spree 2 doesn't have `Product#on_hand=` any more. We actually can't save
stock levels without saving the product first which creates a stock
item.

This hacky solution overwrites the attribute in the entry so that it
gets copied to the variant later on. I think a better solution needs
some refactoring as proposed in:
https://github.com/openfoodfoundation/openfoodnetwork/issues/2783#issuecomment-459601530
2019-02-05 15:41:19 +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
Isaac Haseley
09d3cea830 Lazy-load one more translation 2019-02-01 09:22:26 -06:00
Isaac Haseley
73a58435a8 Adopt one/other pluralization 2019-01-31 21:45:57 -06:00
Isaac Haseley
a18c98191a Better accomodate different sentence structures 2019-01-31 21:45:57 -06:00
Isaac Haseley
8543bb7cfb Add missing 'active products' translation on dashboard 2019-01-31 21:45:57 -06: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
dependabot[bot]
8750310648 Bump dalli from 2.7.2 to 2.7.9
Bumps [dalli](https://github.com/petergoldstein/dalli) from 2.7.2 to 2.7.9.
- [Release notes](https://github.com/petergoldstein/dalli/releases)
- [Changelog](https://github.com/petergoldstein/dalli/blob/master/History.md)
- [Commits](https://github.com/petergoldstein/dalli/compare/v2.7.2...v2.7.9)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-29 19:14:15 +00: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
Matt-Yorkley
a3b9936f37 Improve matching inventory using 'items' unit type 2019-01-17 09:33:39 +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
Matt-Yorkley
79dce01aef Add spec for new on_demand logic 2019-01-16 01:19:01 +00:00
Matt-Yorkley
7dc7ffe1b7 Update inventory template 2019-01-16 01:18:46 +00: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
Matt-Yorkley
3f62d82afc Add more inventory testing for visibility in the inventory UI 2019-01-11 11:26:38 +00: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
Maikel
3259b3ecf1 Merge pull request #2912 from Matt-Yorkley/admin_orders_refactor
Admin orders refactor
2018-11-02 16:57:28 +11:00
Maikel
cbfe1b535d Merge pull request #2871 from openfoodfoundation/dependabot/bundler/figaro-1.1.1
Bump figaro from 0.7.0 to 1.1.1
2018-11-02 12:09:53 +11: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
Maikel
931c1207da Merge pull request #2813 from openfoodfoundation/dependabot/bundler/haml-4.0.7
Bump haml from 4.0.4 to 4.0.7
2018-11-01 16:52:07 +11:00
Maikel
7c4370be69 Merge pull request #2963 from luisramos0/2960_migration
Fix variant_overrides permissions for overrides that belong to the supplier herself
2018-11-01 11:41:51 +11:00
luisramos0
079d4e0bf5 Fix variant_overrides permissions for overrides that belong to the supplier herself 2018-10-31 11:26:15 +00:00
Pau Pérez Fabregat
1fbeb43c3a Merge pull request #2958 from coopdevs/pull-translations
Update all locales with the latest Transifex translations
2018-10-31 10:52:02 +01:00
Pau Pérez Fabregat
fc6a2d4a53 Merge pull request #2959 from coopdevs/fix-name-error-on-migrate
Move default_url_options set up to an initializer
2018-10-31 10:51:06 +01:00
Pau Perez
f16897a0b8 Fix DE translations manually
We don't want 🇩🇪 to have a broken menu.
2018-10-31 08:39:25 +01: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
Pau Perez
2e2c7c56cb Move default_url_options set up to an initializer
For some reason running `bundle exec rake db:migrate RAILS_ENV=staging`
fails with:

```
rake aborted!
NameError: uninitialized constant Spree::Config
```

Running `bundle exec rails server` for instance, does not. There must be
a difference on the way a rake task and the rails commands load the app.

Moving this configuration to an initializer, at the end of the
initialization process, fixes it. The constant `Spree::Config` is
already loaded.

**This is preventing the release v1.22.0 from being staged and tested**
2018-10-30 19:45:04 +01: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
Pau Pérez Fabregat
e4b988c9a2 Merge pull request #2924 from kristinalim/fix-disable_hiding_of_offcanvas_upon_resize
Disable hiding of hamburger menu upon resize <= 1024px width
2018-10-30 19:00:14 +01:00
Pau Pérez Fabregat
b35b24d4ae Merge pull request #2914 from luisramos0/checkout-language-bug
Fix multi lingual issue in cart and checkout: the user language selection was not being used
2018-10-30 17:46:37 +01:00
Pau Pérez Fabregat
7ffa3a2ca1 Merge pull request #2913 from HugsDaniel/2905_password_reset_missing_translations
Add password confirmation, token and expired keys
2018-10-30 17:34:01 +01:00
Pau Pérez Fabregat
3d88199257 Merge pull request #2896 from Matt-Yorkley/email_https_links
Use https on all links in emails in production
2018-10-30 17:33:32 +01:00
Pau Pérez Fabregat
8e602d453b Merge pull request #2876 from luisramos0/subs-states-fix
Fix bug in subscriptions address controller where country states were not correctly returned
2018-10-30 17:32:34 +01:00
Pau Perez
7f177598f2 Update all locales with the latest Transifex translations 2018-10-30 15:13:57 +01:00
Maikel
d63670d675 Merge pull request #2846 from Matt-Yorkley/pi/rename_enterprise_fields
[Product Import] Rename enterprise fields and update template
2018-10-30 15:11:02 +11:00
Maikel
7609496df3 Merge pull request #2859 from albarnaz/instagram_pattern
Instagram pattern
2018-10-30 15:10:27 +11:00
Maikel
ee042f51a4 Merge pull request #2949 from pfac/pfac-fix-new-preferences-migration
Fix new preferences migration
2018-10-30 15:09:35 +11:00
Pau Pérez Fabregat
5fade045f8 Merge pull request #2928 from luisramos0/line_items_controller_spec
Reorganize LineItemsController's destroy line item specs
2018-10-29 16:09:20 +01:00
Pedro Costa
91e4f99c19 Fix new preferences migration
Why:

* In a clean environment, running the new preferences migration fails,
  due to a missing file from Spree core being manually required. This
  file has now been missing since ab707cf.

This change addresses the issue by:

* Copying the missing file from Spree Core 1.3.6.beta into the migration.
  This fixes the issue for now, but also means that a migration merge
  and/or rewrite might be in order for the future.
2018-10-29 14:53:01 +00:00
Matt-Yorkley
443515dae4 Improve comment in index action 2018-10-29 10:34:05 +00:00
Matt-Yorkley
f3124e5472 Explicitly add :host to actionmailer config 2018-10-26 22:42:47 +01:00
Matt-Yorkley
b826beb0d7 Inline hashes in tests 2018-10-26 21:38:57 +01:00
Matt-Yorkley
29492d61f9 Use #allow syntax 2018-10-26 21:38:57 +01:00
Matt-Yorkley
8c19d1afec Move tests from spree/admin/orders_controller_spec to api/orders_controller_spec and tidy up 2018-10-26 21:38:57 +01:00
Matt-Yorkley
033ae4f570 Add basic SearchOrders service spec 2018-10-26 21:38:57 +01:00
Matt-Yorkley
1f8f7b0495 Add new Api::OrdersController spec 2018-10-26 21:38:57 +01:00
Matt-Yorkley
46b1317159 Update orders resource js spec 2018-10-26 21:38:57 +01:00
Matt-Yorkley
334eebeab1 Move json to API and strip index action 2018-10-26 21:38:57 +01:00
Matt-Yorkley
0bd67bd06a Remove unnecessary Spree::Config fallback value 2018-10-26 21:38:57 +01:00
Matt-Yorkley
77251848ee Refactor Spree::Admin::OrdersController 2018-10-26 21:38:57 +01:00
luisramos0
09f8df6340 Reorganize LineItemsController's destroy line item specs to separate contexts with different test orders (completed_with_total and completed_with_fees) 2018-10-25 18:06:48 +01:00
Pau Pérez Fabregat
8a3f621b42 Merge pull request #2893 from luisramos0/deleted_products_break_inventory
Fix bug in inventory management page
2018-10-25 18:20:42 +02:00
Pau Pérez Fabregat
7cac4637fe Merge pull request #2916 from luisramos0/date-transl-fix
Add Portuguese and German to list of momentJS locales
2018-10-25 18:18:53 +02:00
Kristina Lim
2cc594dc98 Proceed to hide off-canvas when resized to >1024px 2018-10-25 20:36:27 +08:00
Kristina Lim
14eaa49204 Disable hiding the off-canvas upon window resize.
In some browsers for mobile devices, the address bar is automatically
hidden when scrolling down the page. This is not workable if the height
of the contents of the off-canvas exceeds the height of the screen,
because the latter portion of the contents stays hidden to the user.

https://github.com/openfoodfoundation/angular-foundation/blob/0.9.0-20180826174721/src/offcanvas/offcanvas.js
2018-10-25 19:29:19 +08:00
Maikel
acb8ec772e Merge pull request #2922 from mkllnk/update-rubocop-todo
Update rubocop todo list
2018-10-25 14:48:51 +11:00
Maikel
3cab3d1798 Merge pull request #2921 from openfoodfoundation/transifex
Transifex
2018-10-25 14:22:10 +11:00
Maikel Linke
cd5c23993a Update rubocop todo list
Since we activated more cops in 0ac16ce096
we had a lot of files missing in the todo list. They are likely from
other pull requests that have been open at the same time. This is a
quick update so that rubocop gives us some useful feedback again.
2018-10-25 14:08:04 +11: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
Maikel
51a1787881 Merge pull request #2908 from Matt-Yorkley/bulk_orders_bug
Fix pagination conflict with LineItemsCtrl requests
2018-10-25 13:18:11 +11:00
Maikel Linke
dc5302ca08 Speed up database queries and make them scale
This commit makes use of three ActiveRecord features:

1. Using `select` instead of `all.map` enables ActiveRecord to nest one
select into the other, resulting in one more efficient query instead of
two.

2. Using `find_each` saves memory by loading records in batches.
https://api.rubyonrails.org/classes/ActiveRecord/Batches.html#method-i-find_each

3. Using `pluck` creates only an array, avoiding loading all the other
columns of the records into objects.

Running this on the current Canadian database, fixes the following
variant overrides:

```
[]
[]
[]
[]
[]
[]
[925, 924, 966, 965]
[]
[]
[]
[]
[462,
 863,
 464,
 822,
 949,
 947,
 944,
 939,
 942,
 946,
 945,
 943,
 438,
 937,
 938,
 941,
 940,
 467,
 952,
 875,
 453,
 953,
 454,
 951,
 487,
 460,
 457,
 528,
 527,
 486,
 459,
 458,
 461,
 529,
 530,
 950,
 642,
 384,
 380,
 643,
 385,
 381,
 644,
 386,
 382,
 960,
 959,
 379,
 640,
 377,
 375,
 532,
 639,
 376,
 374,
 646,
 390,
 389,
 637,
 406,
 408,
 647,
 391,
 393,
 633,
 396,
 400,
 398,
 645,
 388,
 387,
 648,
 394,
 392,
 536,
 632,
 399,
 397,
 395,
 634,
 403,
 401,
 635,
 404,
 402,
 636,
 407,
 405,
 535,
 534,
 638,
 410,
 409,
 948,
 533,
 537,
 531,
 877,
 880,
 894,
 893,
 672,
 671,
 673,
 674,
 703,
 714,
 715,
 716,
 717,
 862,
 864,
 879,
 876,
 865,
 881,
 878,
 463,
 954,
 866,
 823,
 957,
 958,
 955,
 956,
 899,
 897]
[]
[969]
```
2018-10-25 11:33:14 +11:00
Transifex-Openfoodnetwork
c17939631f Updating translations for config/locales/en_US.yml 2018-10-25 09:31:36 +11:00
Pau Pérez Fabregat
ce93c52dfe Merge pull request #2850 from Matt-Yorkley/password_change_logout
Password change logout
2018-10-24 11:43:09 +02:00
Pau Pérez Fabregat
9ef4852bd4 Merge pull request #2818 from nikobozi/refactor-variant-overrides-query
Move query from variant_overrides_controller to its model scope
2018-10-24 11:42:22 +02:00
Pau Pérez Fabregat
7651ee0909 Merge pull request #2798 from as1729/as1729-update-docs-Stripe-publishable_key-for-pr
Better docs for Stripe.publishable_key and Stripe.endpoint_secret.
2018-10-24 11:23:21 +02:00
luisramos0
c9784a5eda Add Portuguese and German to list of moment locales. The main usage is in the order cycle closure time in the shopfront 2018-10-23 17:53:08 +01:00
luisramos0
034d9ef72a Refactor multilingual spec: extract method with repeated assertion 2018-10-23 14:10:52 +01:00
luisramos0
9d9f5d38d7 Fix multi lingual issue in cart and checkout: the user language selection was not being used 2018-10-23 14:10:48 +01:00
Hugo Daniel
c5f6af95c7 Add password confirmation, token and expired keys 2018-10-23 10:40:20 +02:00
Maikel
6f5289c730 Merge pull request #2894 from openfoodfoundation/transifex
Transifex
2018-10-23 16:21:20 +11:00
Matt-Yorkley
42c1584e6f Fix pagination conflict with LineItemsCtrl requests 2018-10-22 18:13:56 +01:00
Pau Pérez Fabregat
a1bbf5328e Merge pull request #2872 from mkllnk/2765-fix-geocoding
2765 Fix geocoding to display enterprises on map
2018-10-22 16:44:30 +02:00
luisramos0
d375bb8c55 Migration: Revoke variant overrides without permissions 2018-10-20 12:32:55 +01:00
luisramos0
9079437284 Add before_destroy to enterprise_relationship so that variant overrides are revoked when permission is deleted 2018-10-20 12:32:51 +01:00
luisramos0
5ae0ad87a7 Refactor EnterpriseRelationship before save hook: some renames and extract methods 2018-10-20 11:52:11 +01:00
Matt-Yorkley
c3cef699ca Use https on all links in emails in production 2018-10-19 17:03:51 +01:00
Transifex-Openfoodnetwork
c911462737 Updating translations for config/locales/en_GB.yml 2018-10-20 02:04:33 +11:00
Maikel Linke
9698fd3c5a Style spec 2018-10-18 11:07:16 +11:00
Maikel Linke
d197c8587f Test address deletion 2018-10-18 11:06:32 +11:00
Maikel Linke
e96cab957a 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/spree/addresses_spec.rb

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

* 2 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 1 conversion
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-10-18 10:52:46 +11:00
luisramos0
fe9f4a1c95 Move countryStates service from ofn.admin to admin.utils to remove bad dependency from admin modules (customers and subscriptions) to main ofn.admin module. Now the dependency admin.utils is used instead 2018-10-17 12:16:33 +01:00
luisramos0
c281927372 Fix subscription address form. It now clears the state selection when a different country is selected 2018-10-16 23:02:26 +01:00
luisramos0
1804bf5a2b Extract countryStates logic from customer_address modal and re-use new CountryStates service 2018-10-16 22:45:38 +01:00
luisramos0
5c5a2194d6 Extract country states logic out of subscriptions address controller into new service CountryStates 2018-10-16 21:58:27 +01:00
luisramos0
feaf16d878 Fix bug in subscriptions address controller where the country id lookup was not exact and states returned were incorrect. Add unit tests to cover different cases 2018-10-16 20:59:34 +01:00
fabricio.albarnaz
419493f153 Move instagram regex to an method to fix codeclimate 2018-10-16 16:09:15 -03:00
fabricio.albarnaz
8e4adbd23a Add more test cases 2018-10-16 15:34:46 -03:00
fabricio.albarnaz
93a051bf5a Regex ajust 2018-10-16 15:33:10 -03:00
Pau Pérez Fabregat
590091c42a Merge pull request #2842 from Matt-Yorkley/pi/missing_variable
Fix missing local variable in EntryProcessor
2018-10-16 13:19:23 +02:00
Maikel Linke
8fb81bb6a7 Configure Geocoder with API key as required by Google 2018-10-16 16:49:52 +11:00
Maikel Linke
61797fff56 Restrict deletion of address explicitely
Enterprises have an `address_id` which must point to a valid
`Spree::Address`. As Rubocop suggested, I restricted the deletion of
addresses when they are still associated to an enterprise.

Without declaring `dependent: :restrict`, trying to delete the address
would raise `ActiveRecord::InvalidForeignKey`. Now it is more specific
and raises `ActiveRecord::DeleteRestrictionError`.

I didn't find code rescuing the InvalidForeignKey when deleting addresses. I
actually think that we never delete addresses. So this change should not
have any impact on the execution.
2018-10-16 15:18:44 +11:00
Maikel Linke
a8705ca179 Simplify address methods 2018-10-16 14:49:36 +11:00
Maikel Linke
5021ed9c69 Simplify by using Rails tools 2018-10-16 14:49:35 +11:00
Maikel Linke
34849c441a Reduce complexity and duplication 2018-10-16 14:48:12 +11:00
Maikel Linke
c4437a6437 Style address decorator 2018-10-16 14:48:12 +11:00
Maikel Linke
b109f6d78c Remove temporary reporting code 2018-10-16 14:48:12 +11:00
fabricio.albarnaz
02bc134c59 Change befor save check to format validation 2018-10-15 17:51:33 -03:00
dependabot[bot]
dc6c8ec455 Bump figaro from 0.7.0 to 1.1.1
Bumps [figaro](https://github.com/laserlemon/figaro) from 0.7.0 to 1.1.1.
- [Release notes](https://github.com/laserlemon/figaro/releases)
- [Changelog](https://github.com/laserlemon/figaro/blob/master/CHANGELOG.md)
- [Commits](https://github.com/laserlemon/figaro/compare/v0.7.0...v1.1.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-15 19:14:26 +00:00
Pau Pérez Fabregat
f8bccda6ab Merge pull request #2847 from Matt-Yorkley/emails/validation
Emails/validation
2018-10-15 15:54:41 +02:00
Pau Pérez Fabregat
8946fe3ce8 Merge pull request #2829 from Matt-Yorkley/bi/results_per_page
Add per_page controls to admin orders index
2018-10-15 12:17:39 +02:00
Pau Pérez Fabregat
0e4a3dbc26 Merge pull request #2845 from coopdevs/fix-invalid-variant-creation
Fix invalid variant creation
2018-10-15 12:16:39 +02:00
Pau Pérez Fabregat
fe149967e4 Merge pull request #2521 from luisramos0/cookies_in_engine
[OFN Domains] Breaking OFN into domains - POC cookies inside an engine
2018-10-15 10:03:30 +02:00
Matt-Yorkley
fcff835922 Update results on dropdown select 2018-10-12 17:06:42 +01:00
Matt-Yorkley
a2828ea305 Use :for_hubs scope 2018-10-12 17:00:19 +01:00
Matt-Yorkley
123d1963ad Remove duplicate method 2018-10-12 17:00:19 +01:00
Matt-Yorkley
3cb43121d5 Refactor long lines for new character limit 2018-10-12 17:00:18 +01:00
Matt-Yorkley
8fcaa54de7 Update CSV templates 2018-10-12 16:57:13 +01:00
Matt-Yorkley
bd4f0507ce Adjustments for new Settings and ResetAbsent classes 2018-10-12 16:57:13 +01:00
Matt-Yorkley
1c85de6f58 Use producer and distributor for field names 2018-10-12 16:57:13 +01:00
Matt-Yorkley
2c9dc8899a Update fields in specs 2018-10-12 16:57:13 +01:00
Matt-Yorkley
5c2b5377bc Assign supplier_id when saving new product to products list 2018-10-12 16:57:13 +01:00
Matt-Yorkley
e7a909e828 Rename supplier to enterprise 2018-10-12 16:57:13 +01:00
Matt-Yorkley
8a0a33deec Merge pull request #2858 from Matt-Yorkley/rubocop_line_limit
Increase rubocop line limit to 100
2018-10-12 16:52:37 +01:00
fabricio.albarnaz
6ad32fb66d Add check for instagram.com 2018-10-11 18:05:18 -03:00
fabricio.albarnaz
e46b3566c3 Remove the check for www.instagram.com 2018-10-11 16:51:43 -03:00
fabricio.albarnaz
48720c835c Add spec to instagram pattern 2018-10-11 16:30:17 -03:00
fabricio.albarnaz
e87075aed7 Add before save to check the instagram link pattern 2018-10-11 15:27:46 -03:00
Matt-Yorkley
57c6530e46 DRY code and use more flexible I18n 2018-10-11 16:38:14 +01:00
Matt-Yorkley
ebb03906cf Increase rubocop line limit to 100 2018-10-11 15:37:38 +01:00
Pau Perez
60d05a941c Fix variants with 'weight' and missing unit_value
This adds a data migration to fix those cases. It defaults to showing
1 unit of the specified weight. That is, if the user chose Kg, it'll
display 1 as unit.

Note that migration logs the process in a log/migrate.log file separate
from the regular Rails log/production.log file.

When you run the migration you'll see something like:

  Fixing variants missing unit_value...

  Processing variant 12...
  Succesfully fixed variant 12

  Done!

This helps auditing the changes applied and debug any possible failure
scenarios. You can delete it once all is ok.
2018-10-11 15:52:40 +02:00
Pau Perez
5bd375d422 Favor early return over dumb else branch 2018-10-11 15:52:40 +02:00
Pau Perez
c8c16f0e8a Use Rails 3.2 validates syntax 2018-10-11 15:52:40 +02:00
Pau Perez
cbac916e66 Validate unit value when updating variant_unit
Variants whose product's variant_unit is weight or volume require
a unit_value.
2018-10-11 15:52:40 +02:00
Pau Perez
a2228d4131 Make ProductSet parseable by humans
Now it's imposible to understand what is really going on. Feels more
like assembler than Ruby.
2018-10-11 15:52:40 +02:00
Pau Perez
575d76e23e Cover variant creation and update with basic tests 2018-10-11 15:52:40 +02:00
Pau Perez
d43726504b Make #update_attributes parseable by humans
As it is this is impossible to follow.
2018-10-11 15:52:40 +02:00
Pau Perez
f54c69cbba Add first test case for ProductSet
This covers creation and update of a product.
2018-10-11 15:52:40 +02:00
Pau Perez
2d60b3180e Wrap and improve comment block readability 2018-10-11 15:52:40 +02:00
Matt-Yorkley
4760ebb80c Use global config 2018-10-11 09:04:37 +01:00
Matt-Yorkley
dafcd0ddc2 Add per_page controls to admin orders index 2018-10-10 18:32:12 +01:00
Pau Pérez Fabregat
1bafa0cb7d Merge pull request #2853 from mkllnk/remove-parallel-tests
Remove parallel tests
2018-10-10 16:01:44 +02:00
Pau Pérez Fabregat
227dd3e399 Merge pull request #2831 from kristinalim/fix-product_import_date_error
Fix product import date error when some but not all variants have import date
2018-10-09 16:37:25 +02:00
Pau Pérez Fabregat
85962158b8 Merge pull request #2821 from nikobozi/oc-clear-filter
Make 'Clear All' button work on order cycle page
2018-10-09 16:35:57 +02:00
Matt-Yorkley
900c65e0fc Merge pull request #2855 from openfoodfoundation/transifex
Transifex
2018-10-09 14:21:14 +01:00
Matt-Yorkley
edca209f67 Merge pull request #2844 from Matt-Yorkley/bi/angular_orders_changing_page
Fix bindings on angular orders data
2018-10-09 14:15:38 +01:00
Transifex-Openfoodnetwork
c2c492cd6b Updating translations for config/locales/es.yml 2018-10-09 21:57:06 +11:00
Matt-Yorkley
55411af3fa Improve user account spec 2018-10-09 10:07:41 +01:00
Maikel Linke
245d900b58 Remove unused CI scripts
We used to have our own CI server, but now we are using Travis and
Semaphore. We don't need these scripts any more. And since
parallel_tests was removed in the previous commit, they are broken
anyway.
2018-10-09 17:06:59 +11:00
Maikel Linke
4cbc449a51 Remove unused parallel_tests gem
Reverts db47c01784
2018-10-09 16:54:08 +11:00
Pau Pérez Fabregat
5606550cd2 Merge pull request #2815 from openfoodfoundation/dependabot/bundler/rspec-retry-0.6.1
Bump rspec-retry from 0.5.6 to 0.6.1
2018-10-09 07:30:25 +02:00
Maikel
68c58dcb68 Merge pull request #2770 from openfoodfoundation/transifex
Transifex
2018-10-09 15:18:17 +11:00
Matt-Yorkley
3e39f3e749 Disable logout on password change 2018-10-08 23:06:54 +01:00
Matt-Yorkley
8f5fd41c8b Update email confirmation address 2018-10-08 21:38:47 +01:00
Matt-Yorkley
3ec8c12899 Update account setting spec for updating email address 2018-10-08 20:41:59 +01:00
Pau Pérez Fabregat
ea6e522775 Merge pull request #2826 from 73VW/master
[README] Updated build status badge
2018-10-08 17:47:52 +02:00
Pau Pérez Fabregat
f5573f419b Merge pull request #2778 from coopdevs/refactor-entry-processor
Refactor entry processor
2018-10-08 17:11:23 +02:00
Matt-Yorkley
37a7cceead Fix bindings on angular orders data 2018-10-08 15:42:46 +01:00
Matt-Yorkley
b78716c283 Fix missing local variable 2018-10-08 14:49:29 +01:00
Transifex-Openfoodnetwork
8b59943256 Updating translations for config/locales/de_DE.yml 2018-10-08 16:58:01 +11:00
luisramos0
574f031020 Fix typo in matomo optout iframe url in cookies_policy_helper 2018-10-05 21:36:03 +01:00
Kristina Lim
da904c908d Fix product import date when not all variants have it 2018-10-06 03:03:22 +08:00
Pau Pérez Fabregat
58a99a7f89 Merge pull request #2692 from Matt-Yorkley/bi/angular_orders
Angularise orders page
2018-10-04 21:10:48 +02:00
73VW
7a1cffb4b5 Updated build status badge 2018-10-04 18:43:30 +02:00
Pau Pérez Fabregat
b139f3839a Merge pull request #2806 from luisramos0/rep
Delete representative_view dependency, not used
2018-10-04 13:02:35 +02:00
niko
f99ed81863 Make 'Clear All' button work on order cycle page 2018-10-04 11:46:38 +02:00
niko
f65d3c2815 fix rubocop issue 2018-10-04 03:30:32 +02:00
niko
3ae38178a3 Move query from variant_overrides_controller to its model scope 2018-10-04 02:43:02 +02:00
dependabot[bot]
8a6da745a3 Bump rspec-retry from 0.5.6 to 0.6.1
Bumps [rspec-retry](https://github.com/noredink/rspec-retry) from 0.5.6 to 0.6.1.
- [Release notes](https://github.com/noredink/rspec-retry/releases)
- [Changelog](https://github.com/NoRedInk/rspec-retry/blob/master/changelog.md)
- [Commits](https://github.com/noredink/rspec-retry/compare/v0.5.6...v0.6.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-02 19:15:12 +00:00
dependabot[bot]
4e1521fd6a Bump haml from 4.0.4 to 4.0.7
Bumps [haml](https://github.com/haml/haml) from 4.0.4 to 4.0.7.
- [Release notes](https://github.com/haml/haml/releases)
- [Changelog](https://github.com/haml/haml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/haml/haml/compare/4.0.4...4.0.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-02 19:13:34 +00:00
luisramos0
daafe73d81 Delete representative_view dependency, not used 2018-10-02 15:11:13 +01:00
Pau Pérez Fabregat
aa78b9e54c Merge pull request #2777 from coopdevs/setup-simplecov
Setup simplecov
2018-10-02 14:39:43 +02:00
Pau Pérez Fabregat
6ddcb01b7c Merge pull request #2736 from openfoodfoundation/dependabot/bundler/oj-3.6.10
Bump oj from 2.1.2 to 3.6.10
2018-10-02 14:38:26 +02:00
Matt-Yorkley
55d7d5d1e4 Rename #capture_path to #payment_capture_path 2018-10-02 11:10:51 +01:00
Matt-Yorkley
017e3d14df Use variable colour assignment 2018-10-02 11:10:21 +01:00
Pau Perez
6a7359a3c5 Pass supplier_ids in strategy #reset instead
This removes the need to expose supplier_ids through #<< and makes both
ResetAbsent and its strategies simpler.

This could be made even simpler if the strategies just implemented
`#relation` as public method and ResetAbsent called `#update_all` on
them. The data to be fetched is the only thing that changes but the
update is the same.
2018-10-01 17:37:49 +02:00
Pau Perez
82654cd1ee Turn delegation to a reader to make it simpler
This makes the solution less smart and as a result ResetAbsent improves
it's consistency and returns always an integer.
2018-10-01 16:40:34 +02:00
Pau Perez
148321f7b7 Make strategies class names more explicit 2018-10-01 16:40:34 +02:00
Pau Perez
af93af1a64 Replace strategy with a more explicit name 2018-10-01 16:40:34 +02:00
Pau Perez
8715fce295 Remove @import_settings in favor of Settings 2018-10-01 13:12:06 +02:00
Pau Perez
fd69c7672d Add specs for ResetAbsent strategies
This also fixes the case where there are no overrides to exclude.
2018-10-01 13:12:06 +02:00
Pau Perez
d527f6265a Remove pointless sum 2018-10-01 13:12:06 +02:00
Pau Perez
5eb10edbfd Inject #updated_ids to strategy
Their values are known beforehand.
2018-10-01 13:12:06 +02:00
Pau Perez
186801a1e2 Remove unused supplier_ids argument 2018-10-01 13:12:06 +02:00
Pau Perez
718f529ede Use nested module in test to improve readability 2018-10-01 13:12:06 +02:00
Pau Perez
f04fa4ed63 Do not treat ResetAbsent as a decorator anymore
This fully encapsulates it's logic and reduces its tight coupling with
EntryProcessor.
2018-10-01 13:12:06 +02:00
Pau Perez
95ae18a1ba Remove method delegation 2018-10-01 13:12:06 +02:00
Pau Perez
54d6bc5443 Don't use importing_into_inventory? in ResetAbsent
This completely decouples ResetAbsent from the particular strategy used.
2018-10-01 13:12:06 +02:00
Pau Perez
a10e58e20a Inject strategy_factory into ResetAbsent 2018-10-01 13:12:06 +02:00
Pau Perez
a9444b8909 Extract InventoryReset and Products strategies
Extract this strategy classes from ResetAbsent and move #reset there.
2018-10-01 13:12:06 +02:00
Pau Perez
8d7a11b0ac Make all steps of the algorithm have 2 branches 2018-10-01 13:12:06 +02:00
Pau Perez
23471346b6 Do not call ResetAbsent when preconditions not met 2018-10-01 13:12:06 +02:00
Pau Perez
a409353d37 Move import_settings query methods to Settings 2018-10-01 13:12:06 +02:00
Pau Perez
fd84bea463 Test that variants or overrides are actually reset 2018-10-01 13:12:06 +02:00
Pau Perez
b940f06238 Return early if reset_all_absent is not set
No need to go through half of the algorithm if the setting is not
enabled. It does not change per enterprise.

This also assumes "Previously we were updating both (products and inventory)
at the same time during one import, but now it's one or the other" in
Matt's words.
2018-10-01 13:12:06 +02:00
Pau Perez
c955e151b7 Pass enterprise ids as strs as current code does 2018-10-01 13:12:06 +02:00
Pau Perez
e04162415a Move code comment to be the method's doc 2018-10-01 13:12:06 +02:00
Pau Perez
5ac3598550 Inject Settings object in ResetAbsent 2018-10-01 13:12:06 +02:00
Pau Perez
b5766a2dd9 Extract common conditional clauses
This also turns local vars into ivars so that the behaviour can be
thoroughly tested. These ivars are meant to be removed once this class
is refactored further. Now there's no other way to ensure its state.
2018-10-01 13:12:06 +02:00
Pau Perez
ed073e9750 Rely on Settings and don't access internal struct. 2018-10-01 13:12:06 +02:00
Aditya Sridhar
372ae8e4aa updated the spacing to be consistent. 2018-09-30 16:10:57 -04:00
Aditya Sridhar
06b28c1ab4 Better docs for Stripe.publishable_key and Stripe.endpoint_secret. 2018-09-30 15:50:33 -04:00
Pau Perez
663db47433 Move products_reset_count to ResetAbsent 2018-09-29 10:57:23 +02:00
Pau Perez
3150741849 Extract ResetAbsent class from EntryProcessor 2018-09-29 10:57:18 +02:00
luisramos0
3cf10020bf Fix bug on slow page loads where banner and policy modal were both loaded
This solution makes the banner aware of the policy modal: the banner doesnt open if the policy modal is enabled
2018-09-27 17:47:36 +01:00
Pau Perez
16badcd1b5 Setup Simplecov to have code coverage analysis
This enables code coverage analysis when running specs in your dev
environment. Simply run them as usual and you'll see a line like the
following at the end of the output:

  Coverage report generated for RSpec to /home/pau/dev/openfoodnetwork/coverage

Simply browse to coverage/index.html and the results in a web UI.

This is a useful tool that helps you decide if the tests you added are
enough or not.
2018-09-27 15:57:02 +02:00
Matt-Yorkley
54b17ac701 Use Spree::Order.pending_payments and remove service 2018-09-27 13:04:56 +01:00
Maikel
d488ae3f44 Merge pull request #2725 from mkllnk/2699-email-confirm-jobs
2699 email confirm jobs
2018-09-27 14:27:43 +10:00
Maikel Linke
f0021be53c Style I18n call 2018-09-27 13:33:09 +10:00
Maikel Linke
af1ac333df Create MailMethod before User when seeding 2018-09-27 13:33:09 +10:00
Maikel Linke
9dcc683dc0 Notify Bugsnag on sign-up errors
This may lead to more error reports than we want to see. A not existing
email address may cause Bugsnag to be notified. If this happens, we can
rescue form these specific errors and only report the rest.
2018-09-27 13:33:09 +10:00
Maikel Linke
17d951f99d Rescue from any sign-up errors
The most common failure would happen when sending the confirmation email
triggered by `user.save`. We rescue any errors here and give feedback to
the user.

This allows for immediate feedback when the user types an email address
that is not accepted by our mail server or the email setup is not
configured properly.
2018-09-27 13:33:08 +10:00
Maikel Linke
3ae073dce5 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/controllers/user_registrations_controller_spec.rb

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

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

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-09-27 13:33:08 +10:00
Maikel Linke
600c8fcd4c Send confirmation emails immediately
Using deferred methods on the user model breaks delayed jobs when the
user is deleted while the job still exists. We could create a proper job
referencing a user id for sending these emails instead. But since the
user has to wait for the confirmation email anyway, we can send it
within the current request. This should be revised if performance
becomes an issue.

Sending the email directly also has the advantage that we can tell the
user if emailing failed. See the following commits.

This change impacts a bunch of specs as we now need a working email
setup to create unconfirmed users. This commit introduces a custom
matcher to unify testing for confirmation emails.
2018-09-27 13:33:08 +10:00
luisramos0
921105301c Move angular-templates route and controller into Web engine
The route and controller were in the main app and the views in the engine, with this commit they stay all inside the engine
This is done to keep it simple and remove the unnecessary dependency between main app and engine
If we use this mechanism in the future for other things in the main app or other engines, we can find a way to extract/abstract this
2018-09-26 12:39:51 +01:00
luisramos0
b1c7e6c091 Fix assets precompilation by including web/all.js and web/all.css in the assets precompilation list in application.rb 2018-09-26 12:30:45 +01:00
luisramos0
a23b1b980d Make Web engine an isolated namespace engine mounted on / (without /web prefix)
This approach is better to separate concerns, see “Isolated Engine” here: https://api.rubyonrails.org/v3.2/classes/Rails/Engine.html
2018-09-26 12:30:06 +01:00
Matt-Yorkley
2dcc8ea4bb Add spec for pending payments service 2018-09-25 10:05:32 +01:00
Matt-Yorkley
e93d46e75a Use .find instead of .select().first 2018-09-25 09:35:05 +01:00
Maikel
51f9a0afa1 Merge pull request #2562 from Matt-Yorkley/pi/product_attributes
[Product Import] Product attributes
2018-09-25 11:36:03 +10:00
Maikel
bf1f2b93c6 Merge pull request #2768 from coopdevs/fire-unused-users-task
Remove no longer used rake task
2018-09-25 11:30:04 +10:00
Transifex-Openfoodnetwork
97775c0bc1 Updating translations for config/locales/fr_CA.yml 2018-09-25 06:12:48 +10:00
Matt-Yorkley
1d9243af19 DRY and clarify serializer and service 2018-09-24 16:58:43 +01:00
Pau Perez
4a7ee9b91e Remove no longer used rake task 2018-09-24 17:17:10 +02:00
Matt-Yorkley
6f2760cf92 Move translations into their namespace and use '.key' format 2018-09-24 15:54:05 +01:00
Pau Perez
f743b5f02f Extract Settings from Product Import processor
This encapsulates the data structure used by the entry processor to
check various settings. It still requires a lot of work to move more
logic to this new class.
2018-09-24 13:55:33 +02:00
Pau Pérez Fabregat
b8417058b4 Merge pull request #2741 from coopdevs/refactor-checkout-process-bits
Refactor checkout process bits
2018-09-24 12:08:19 +02:00
Maikel
9d48ea7b62 Merge pull request #2759 from luisramos0/del_old_spec_helper
Removed deprecated spec helper have_select2_option and fixed its last usage
2018-09-24 11:25:51 +10:00
Matt-Yorkley
9f57b43a13 Move sortble header elements to a partial 2018-09-23 22:14:12 +01:00
Maikel
f0bb927020 Merge pull request #2734 from coopdevs/make-rubocop-useful
Get useful feedback from Rubocop Metrics cops
2018-09-23 19:48:05 +10:00
Maikel
89be54f79e Merge pull request #2750 from openfoodfoundation/transifex
Transifex
2018-09-22 16:05:04 +10:00
Transifex-Openfoodnetwork
7175434910 Updating translations for config/locales/en_US.yml 2018-09-22 01:25:48 +10:00
Maikel
e2fd5a36d8 Merge pull request #2757 from luisramos0/delete_dead_specs
Deleted sample specs and one pending spec
2018-09-21 15:41:49 +10:00
luisramos0
33d2b65d65 Removed deprecated spec helper have_select2_option and fixed its last usage 2018-09-20 23:01:23 +01:00
luisramos0
2a68184c01 Deleted unused test helper for rabl views 2018-09-20 20:09:14 +01:00
Pau Pérez Fabregat
20077c99b5 Merge pull request #2618 from coopdevs/enable-style-send-cop
Favor #public_send over #send using Rubocop's cop
2018-09-20 19:03:40 +02:00
Pau Pérez Fabregat
3dd1fcbc72 Merge pull request #2749 from luisramos0/delete-li-ship-method-name
Drop unused db column line_items.shipping_method_name
2018-09-20 13:26:26 +02:00
Matt-Yorkley
897e43fe0b Remove Spree's Deface data-hooks from new view 2018-09-20 11:33:22 +01:00
Maikel Linke
5763bf0518 Update all translations 2018-09-20 10:33:02 +10:00
luisramos0
0e6b0aa248 Deleted sample specs and one pending spec 2018-09-19 23:45:00 +01:00
Matt-Yorkley
fc68e28e4d Add :description to non-updatable attributes list 2018-09-19 22:30:10 +01:00
Matt-Yorkley
ebb18e9394 Remove unneccesary method 2018-09-19 21:12:30 +01:00
Matt-Yorkley
cc98cc832c Prefer #public_send over #send 2018-09-19 21:12:30 +01:00
Matt-Yorkley
b57c6cf9ac Add errors when attempting to update non-updatable fields 2018-09-19 21:12:29 +01:00
Pau Perez
0ac16ce096 Get useful feedback from Rubocop Metrics cops
One of the biggest pros of linters like Rubocop is to get valuable feedback to
help write better code. The way we have Rubocop configured now we don't prevent
new code from adhere improved code quality and this is specially important when
touching code that already suffers from complexity.

Without all Rubocop's Metrics cops enabled there's no way to get this insights
and write better code. This enables them while regenerating the
`.rubocop_todo.yml` to hide the current violations.

So, next time we touch existing code that we think could be simpler, we should
go to `.rubocop_todo.yml` and remove any occurrences of the file in question.
This way we could Rubocop's feedback right in the editor. This is tremendously
helpful when refactoring. It shows you where to start.
2018-09-19 19:27:40 +02:00
Pau Pérez Fabregat
62bebdb15e Merge pull request #2698 from openfoodfoundation/dependabot/bundler/uglifier-4.1.19
[Security] Bump uglifier from 2.7.1 to 4.1.19
2018-09-19 18:02:06 +02:00
Pau Perez
a2b3d8372e Reduce complexity of OrderUpdater decorator 2018-09-19 16:03:33 +02:00
Transifex-Openfoodnetwork
454cd8bfbf Updating translations for config/locales/nb.yml 2018-09-19 22:30:06 +10:00
HugsDaniel
c4d4b52668 Merge pull request #2742 from openfoodfoundation/transifex
Transifex
2018-09-19 14:18:03 +02:00
Matt-Yorkley
3cbb576b4f Move payment object logic out of order serializer and delete code 2018-09-19 13:00:30 +01:00
Matt-Yorkley
ba254802f8 Move angular_pagination to /views/admin/shared/ 2018-09-19 13:00:30 +01:00
Matt-Yorkley
9ce32e3c14 Add new ordersCtrl spec 2018-09-19 13:00:30 +01:00
Matt-Yorkley
64620c2797 Tidy up response formats for easier testing 2018-09-19 13:00:30 +01:00
Matt-Yorkley
6768055b4d Split orders into 2 angular controllers 2018-09-19 13:00:30 +01:00
Matt-Yorkley
b2551b4e0b Rewrite existing specs 2018-09-19 13:00:30 +01:00
Matt-Yorkley
68f0c80016 Add loading message and spinner 2018-09-19 13:00:30 +01:00
Matt-Yorkley
9da6a5a9b3 Add column sorting to table 2018-09-19 13:00:30 +01:00
Matt-Yorkley
2112f296e4 Angularise filters 2018-09-19 13:00:30 +01:00
Matt-Yorkley
3b9d9db16b Add pagination 2018-09-19 13:00:29 +01:00
luisramos0
524f9af148 Drop unused db column line_items.shipping_method_name 2018-09-19 11:38:19 +01:00
Matt-Yorkley
93d273f94a Convert orders index table to use angular ng-repeat 2018-09-19 09:33:25 +01:00
Transifex-Openfoodnetwork
f0d015be0d Updating translations for config/locales/de_DE.yml 2018-09-19 08:34:42 +10:00
Transifex-Openfoodnetwork
258347bc63 Updating translations for config/locales/fr.yml 2018-09-19 01:45:12 +10:00
Pau Pérez Fabregat
9f7d24934d Merge pull request #2671 from kristinalim/translations-any_enterprise_in_oc_filters
Translate "Any Enterprise" and "Any Schedule" in OC filters
2018-09-18 11:42:19 +02:00
Pau Perez
2a0e0eed73 Move state_machine's additions inside class_eval
And also cover them with tests.
2018-09-18 11:20:32 +02:00
Pau Perez
1fdc578901 Increase readability (a bit) of OrderUpdater 2018-09-18 11:20:32 +02:00
Pau Perez
99cdeca0b1 Remove useless RSpec context block 2018-09-18 11:20:32 +02:00
Pau Perez
13f73b4512 Test :restart_checkout state machine event 2018-09-18 11:20:32 +02:00
Maikel
19df4ff640 Merge pull request #2701 from mkllnk/2700-improve-product-refresh-scheduling
2700 improve product refresh scheduling
2018-09-18 12:09:24 +10:00
dependabot[bot]
ccf7d91487 Bump oj from 2.1.2 to 3.6.10
Bumps [oj](https://github.com/ohler55/oj) from 2.1.2 to 3.6.10.
- [Release notes](https://github.com/ohler55/oj/releases)
- [Changelog](https://github.com/ohler55/oj/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ohler55/oj/commits/v3.6.10)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-09-17 19:16:27 +00:00
luisramos0
c22ac0086b Moved cookies_policy_helper to Web engine and respective spec 2018-09-17 16:05:38 +01:00
luisramos0
95f2f92cf3 Extracted cookies footer links from view to footer links helper 2018-09-17 16:05:38 +01:00
luisramos0
bded530137 Moved web api endpoint from /api to /web/api 2018-09-17 16:05:38 +01:00
luisramos0
dc5eb6448e Change web/all.css from sprockets to SASS and include web/all.css through darkswarm/all.css 2018-09-17 16:05:38 +01:00
luisramos0
d170a4d489 New domain Web (rails engine) with the following features extracted from the main app:
- cookies banner
- cookies policy page
- cookies policy and privacy policy links in the footer
2018-09-17 16:05:32 +01:00
Matt-Yorkley
e577bcb46f Prepare angular controller and serialized data 2018-09-17 14:18:23 +01:00
Pau Pérez Fabregat
0f627cdf39 Merge pull request #2661 from kristinalim/translations-copy_of_order_cycle
Translate "COPY OF" when cloning an OC
2018-09-17 12:38:29 +02:00
Pau Pérez Fabregat
0520f2187c Merge pull request #2540 from luisramos0/delete_dead_store
removed assets related to spree store: dead code
2018-09-17 11:33:56 +02:00
Kristina Lim
798a6ed391 Translate more text in OC filters 2018-09-17 10:09:17 +10:00
Maikel Linke
ac85b90315 Clarify private class method declaration 2018-09-15 10:18:54 +10:00
Maikel
ce7be68fac Merge pull request #2660 from kristinalim/translations-failed_oc_creation
Translate and fix fallback errors when creating or updating OC
2018-09-14 16:58:39 +10:00
dependabot[bot]
05225aaba7 [Security] Bump uglifier from 2.7.1 to 4.1.19
Bumps [uglifier](https://github.com/lautis/uglifier) from 2.7.1 to 4.1.19. **This update includes security fixes.**
- [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/v2.7.1...v4.1.19)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-09-14 06:29:22 +00:00
Maikel
c3f461ad6e Merge pull request #2622 from openfoodfoundation/dependabot/bundler/db2fog-0.9.0
Bump db2fog from 0.8.0 to 0.9.0
2018-09-14 16:26:54 +10:00
Maikel
e836ac0234 Merge pull request #2686 from HugsDaniel/2593_customize_user_guide_link
Enable setting a customized user guide link in general settings
2018-09-14 15:46:05 +10:00
Maikel
beedd933e9 Merge pull request #2512 from kristinalim/feature-remove_enterprise_images
Support removal of enterprise logo and promo image
2018-09-14 15:07:24 +10:00
Maikel
eabb9f4574 Merge pull request #2659 from kristinalim/translations-admin_area_fixes
Simple translation fixes for admin area and profile page
2018-09-14 14:38:25 +10:00
Maikel
da2f278060 Merge pull request #2649 from kristinalim/translations-fix_store_link_in_admin_header
Fix i18n translation for Store link in admin header for `fr`
2018-09-14 14:24:29 +10:00
Maikel
43a3ecff06 Merge pull request #2612 from openfoodfoundation/dependabot/bundler/jwt-1.5.6
Bump jwt from 1.5.4 to 1.5.6
2018-09-14 14:13:02 +10:00
Maikel
514f64c8d0 Merge pull request #2650 from kristinalim/translations-more_admin_header
Add "more" translation key
2018-09-14 13:31:13 +10:00
Maikel
6b56def649 Merge pull request #2697 from mkllnk/2655-fix-admin-payments
2655 fix admin payments
2018-09-14 11:26:20 +10:00
Maikel
1000bd4d24 Merge pull request #2658 from kristinalim/translations-order_and_shipment_emails
Allow fixing and customizing translations for order cancellation and shipment emails
2018-09-14 10:11:56 +10:00
Hugo Daniel
8dd0e01b8e Use explicit syntax for section objects in preference_sections definition 2018-09-13 12:34:06 +02:00
Maikel Linke
ec953e1db0 Style cache refreshment class 2018-09-13 17:22:01 +10:00
Maikel Linke
2e635f94f6 Make job queuing more robust and efficient 2018-09-13 17:20:11 +10:00
dependabot[bot]
b676bfdcc8 Bump jwt from 1.5.4 to 1.5.6
Bumps [jwt](https://github.com/jwt/ruby-jwt) from 1.5.4 to 1.5.6.
- [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.4...v1.5.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-09-13 02:34:11 +00:00
Maikel
065df96872 Merge pull request #2675 from Matt-Yorkley/bi/remake_views
Remake orders index view
2018-09-13 12:29:54 +10:00
Maikel
5e722bf57d Merge pull request #2634 from luisramos0/cookies_matomo_optout
[Cookies] Adds matomo optout iframe to cookies policy page
2018-09-13 12:29:09 +10:00
Maikel
f46c1e8414 Merge pull request #2424 from frank-west-iii/issue-2100-mini-racer
Replace therubyracer with mini_racer
2018-09-13 12:28:03 +10:00
Maikel Linke
81f60aab46 Make PaymentMethod serialisable with fees
https://github.com/openfoodfoundation/openfoodnetwork/issues/2655
2018-09-13 12:01:17 +10:00
Maikel Linke
d7b19750e5 Add spec for GH issue #2655 2018-09-13 12:01:16 +10:00
Maikel Linke
a447fe4f40 Require lib file where needed
We can't always rely on other parts of the code been loaded first. We
need to declare dependencies so that they are always present.

I just ran into this problem in my dev environment.
2018-09-13 12:01:16 +10:00
luisramos0
478dd68072 In cookies policy helper, added string interpolation to variable to avoid variable (Spree::Config entry) to break the concatenation. Added unit test to validate the error case 2018-09-12 18:30:24 +01:00
luisramos0
409f084bd4 Added matomo opt out iframe to cookies policy page 2018-09-12 18:30:24 +01:00
Pau Pérez Fabregat
3f5c799166 Merge pull request #2648 from kristinalim/fix-ask_anonymous_users_to_login_for_order_page
Fix ask anonymous users to login for order page
2018-09-12 16:17:34 +02:00
Hugo Daniel
cc43d789e2 Refacto edit method for content controller and enable custom user guide link 2018-09-12 14:51:53 +02:00
dependabot[bot]
91c0de3f2a Bump db2fog from 0.8.0 to 0.9.0
Bumps [db2fog](https://github.com/itbeaver/db2fog) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/itbeaver/db2fog/releases)
- [Changelog](https://github.com/itbeaver/db2fog/blob/master/CHANGELOG.md)
- [Commits](https://github.com/itbeaver/db2fog/commits/v0.9.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-09-12 11:09:57 +00:00
Pau Pérez Fabregat
e474271698 Merge pull request #2637 from Vadlusk/remove_css_splitter
Remove duplicate css_splitter references, delete split css file.
2018-09-12 13:07:15 +02:00
Pau Pérez Fabregat
64e71a1ee7 Merge pull request #2544 from kristinalim/fix-scrolling_in_modals
Fix top position, height, and scrolling with modals
2018-09-12 13:05:20 +02:00
Matt-Yorkley
4d9ebf0550 Apply submenu override 2018-09-11 12:17:28 +01:00
Matt-Yorkley
f08d6389d8 Apply capture order override 2018-09-11 12:06:58 +01:00
Matt-Yorkley
507f4d0878 OCD tidy up of visually misaligned filter 2018-09-11 11:53:37 +01:00
Matt-Yorkley
afedaea2b5 Apply special instructions override 2018-09-11 11:49:28 +01:00
Matt-Yorkley
8f174b1308 Apply ship shortcut override 2018-09-11 11:43:38 +01:00
Matt-Yorkley
ba0701457e Apply distributor td override 2018-09-11 11:42:08 +01:00
Matt-Yorkley
6389c552ca Apply distributor th override 2018-09-11 11:41:25 +01:00
Matt-Yorkley
1958ac9932 Apply distributor filter inputs override 2018-09-11 11:39:05 +01:00
Matt-Yorkley
c7e2f817ed Apply colgroup override 2018-09-11 11:34:34 +01:00
Matt-Yorkley
5a2491cb47 Apply ng-app override 2018-09-11 11:30:14 +01:00
Matt-Yorkley
980c46c63f Convert Spree view to HAML 2018-09-11 11:22:54 +01:00
Kristina Lim
02a909c1b1 Do not use image_tag for enterprise image previews
If Rails config.assets.compile is false and config.assets.digest is
true, which is the case for staging and production, image_tag fails when
the image file is not found.

We do not need sprockets to ensure presence of the image file for these
tags, because the correct SRC values are assigned through the JS.
Inserting HTML should be sufficient.
2018-09-08 23:23:49 +08:00
Maikel
5e0997d03e Merge pull request #2635 from apoc64/timezone_comments
Adds comments for setting up timezone in application.yml
2018-09-08 15:55:16 +10:00
Kristina Lim
003e65fbed Translate error when failing to create order cycle 2018-09-08 02:15:52 +08:00
Kristina Lim
2c2dd62f6a Translate "COPY OF" when cloning an OC 2018-09-08 02:06:52 +08:00
Kristina Lim
9dcdb67352 Translate inherits_properties label in product form 2018-09-08 01:37:57 +08:00
Kristina Lim
fc79aae17c Translate authorized shops headers in account page 2018-09-08 00:34:47 +08:00
Kristina Lim
c64acf47ab Fix translation key for "involving" in OC filters 2018-09-07 21:38:44 +08:00
Kristina Lim
86f4a118dd Translate placeholder for order cycle name filter 2018-09-07 17:58:34 +08:00
Kristina Lim
40443b19f1 Add translations for headers in enterprise index
This is for the view when logged in as enterprise manager.

The translations added are:

* Producer?
* Package
* Status
2018-09-07 17:51:08 +08:00
Kristina Lim
2cf608ffdf Add translations for shipment emails 2018-09-07 17:08:12 +08:00
Kristina Lim
f1d5088aaa Add translations for order cancellation emails 2018-09-07 17:01:43 +08:00
Maikel
62f5228f1f Merge pull request #2643 from luisramos0/transifex_manual
Fetched latest translations from transifex with tx pull --force
2018-09-07 16:46:24 +10:00
Maikel
3e0c74494d Merge pull request #2604 from Matt-Yorkley/pi/updating_variants_bug
Pi/updating variants bug
2018-09-07 15:10:18 +10:00
Maikel Linke
d6c2a36451 Blacklist libv8 version that breaks mini_racer 2018-09-07 14:11:33 +10:00
Frank West
b9fe1ced16 Replace therubyracer with mini_racer
This is being replaced to increase the reliability and speed of asset
compilation.
2018-09-07 14:11:30 +10:00
Maikel
937da277f7 Merge pull request #2628 from openfoodfoundation/dependabot/bundler/rubyzip-1.2.2
[Security] Bump rubyzip from 1.2.1 to 1.2.2
2018-09-07 10:51:41 +10:00
Kristina Lim
d06bccb832 Change i18n key for Store link in admin header
spree_i18n translates the "store" key in different ways, sometimes like
"shop" and sometimes like "save". This could be because of a clash in
usage between Spree add-ons.

To be more specific, the "Store" link in the admin section now uses the
"admin.header.store" translation key.
2018-09-06 22:03:39 +08:00
Kristina Lim
6d5f8553ef Add "more" translation key
This is used in places such as the adaptive menu in the admin section.

This is actually included in spree_i18n but not correctly translated for
fr.
2018-09-06 18:10:27 +08:00
Kristina Lim
f9533f8fb8 Refactor redirecting back after requiring login 2018-09-06 19:46:17 +10:00
Kristina Lim
cd41498da9 Ask to login when not authenticated for order page
Redirect the user to the login page, instead of responding with HTTP
401.
2018-09-06 16:26:48 +08:00
Kristina Lim
3bf9e95511 Add specs for existing behaviour in order page 2018-09-06 16:26:45 +08:00
Kristina Lim
28d2bb3d47 Wrap controller specs for viewing cart 2018-09-06 15:04:11 +08:00
Kristina Lim
339ea6fa91 Clean up SCSS as suggested by scss-lint 2018-09-06 04:21:35 +10:00
Kristina Lim
9258e8c464 Remove height limit for modals in small screens 2018-09-05 23:58:26 +08:00
Kristina Lim
169aa752d8 Enlarge potential size of modals for large screens
Change modals for large screens from 10% position from top and 80% max
height, to 5% position from top and 90% max height.

This is to accommodate the taller cookies policy modal.

It seems that it is not easy to apply a custom position and height to a
specific modal only. This doesn't seem to be supported by the modal
library currently being used.

Before the recent changes, most modals were rendering at 10px top
position (not the originally planned 10%), so changing this to 5%
doesn't seem to be much of a compromise.
2018-09-05 23:58:26 +08:00
Kristina Lim
f4725198e8 Move some CSS to pages/ subdirectory. 2018-09-05 23:58:26 +08:00
Kristina Lim
f03eb02269 Keep height of modal, dialog within screen height 2018-09-05 23:58:25 +08:00
Kristina Lim
a37e9f1b87 Use v0.9.0-20180826174721 in kristinalim fork of angular-foundation
There is a bug in the handling of % values for the "top" CSS property of
the modals. See details here:

https://github.com/kristinalim/angular-foundation/pull/1

A PR to the original repository has also been submitted, but the project
doesn't seem to be active anymore:

https://github.com/yalabot/angular-foundation/pull/319

And to another fork of the repository:

https://github.com/cwadrupldijjit/angular-foundation/pull/1

The bug was causing the 10% "top" CSS property for the modal to be
treated as 10px.
2018-09-05 23:58:25 +08:00
Kristina Lim
34adf7cf6c Lower the start point for sliding of modals
Occasionally, the page scrolls up while the modal is being opened. This
was causing the final position of the modal to be at the wrong location
relative to the viewport.

This was happening because of a race condition between the animation
that slides the modal from above the viewport to the middle, and focus()
which the modal does:

https://github.com/yalabot/angular-foundation/blob/0.8.0/src/modal/modal.js#L109

The final vertical position of the modal is at 10%, so the animation
which translates the modal -25% vertically was starting -15% above the
viewport. The focus() was then causing vertical scroll.

This lowers the starting point of the animation, so there will no longer
be scrolling.

Additionally, the animation would only happen on large screens. The CSS
property "top" is 0 for smaller screens.
2018-09-05 23:58:25 +08:00
Kristina Lim
6e55e5b1c7 Use maximum of 80% for modals in large screens
When there is enough content in the modal, the height of the modal plus
its top margin could exceed the height of the viewport.

Considering a top position of 10%, a max height of 80% renders a tall
modal vertically centered, with 10% remaining space at the bottom.
2018-09-05 23:58:22 +08:00
luisramos0
138fa41b8d Fetched latest translations from transifex with tx pull --force 2018-09-05 14:02:51 +01:00
Pau Pérez Fabregat
0a05e6944e Merge pull request #2625 from kristinalim/translations-rename_entreprise_keys_to_enterprise
Rename "entreprise" in i18n keys to "enterprise"
2018-09-05 13:23:02 +02:00
Pau Perez
b23cb55525 Fix current violations of Style/Send cop 2018-09-05 12:05:05 +02:00
Maikel
0d2fa3dc40 Merge pull request #2611 from luisramos0/cookies_banner_font_size
[Cookies] Increased cookies banner font size for med/large screens to improve readability
2018-09-04 11:35:32 +10:00
Kristina Lim
ce0758d420 Add confirm dialog for enterprise image removal 2018-09-04 02:08:26 +08:00
Kristina Lim
368612cad6 Allow removal of enterprise logo and promo image 2018-09-04 02:08:25 +08:00
Kristina Lim
c9370672c6 Add JS support for removal of enterprise images 2018-09-04 02:08:12 +08:00
Kristina Lim
9c3bb863da Add endpoints for removing enterprise images 2018-09-04 01:32:39 +08:00
Kristina Lim
01d4b8fb10 Allow custom resource permission for admin controllers 2018-09-04 01:18:48 +08:00
Kristina Lim
f30032eee7 Include image URLs in serialized enterprise for admin 2018-09-04 01:18:45 +08:00
VadLusk
8efbe0e6d2 Delete _split2.css from application.rb assets precompile array. 2018-09-03 11:08:38 -06:00
Pau Pérez Fabregat
7dbbc3e9d8 Merge pull request #2610 from luisramos0/cookies_banner_bug
[Cookies] Added new test to cookies spec to cover bug on cookies banner and fix…
2018-09-03 17:23:17 +02:00
apoc64
fbce828305 Breaks comment into multiple lines 2018-09-03 08:56:42 -06:00
Pau Pérez Fabregat
903d70090e Merge pull request #2636 from luisramos0/heroku_dead_code
Removed old files that were used with, now unsupported, heroku
2018-09-03 12:49:19 +02:00
luisramos0
14d526efc2 removed assets related to spree store: dead code 2018-09-03 09:50:42 +01:00
Maikel
129e2c915e Merge pull request #2579 from openfoodfoundation/dependabot/bundler/angular-rails-templates-0.3.0
Bump angular-rails-templates from 0.2.0 to 0.3.0
2018-09-03 14:39:21 +10:00
Maikel
1b264403e0 Merge pull request #2624 from kristinalim/fix-no_order_link_in_subscription_emails_unless_user
Subscription emails for customer should not link to order page if customer has no user account
2018-09-03 14:38:56 +10:00
Maikel
3fadd06dc7 Merge pull request #2613 from luisramos0/cookies_better_policy_page
[Cookies] Updated cookies policy page text
2018-09-03 11:49:14 +10:00
Maikel
42afd426d5 Merge pull request #2620 from openfoodfoundation/dependabot/bundler/foreigner-1.7.4
Bump foreigner from 1.6.1 to 1.7.4
2018-09-03 11:48:48 +10:00
Maikel
11ab875b9a Merge pull request #2623 from openfoodfoundation/dependabot/bundler/eventmachine-1.2.7
Bump eventmachine from 1.2.3 to 1.2.7
2018-09-03 11:48:34 +10:00
VadLusk
f74a6e47d5 Remove css_splitter references, delete all_split2.css. #1361 #2633 2018-09-03 09:20:26 +10:00
luisramos0
512577768c Removed old files that were used with, now unsuported, heroku 2018-09-02 22:13:42 +01:00
apoc64
e62a755ddb Adds comments for setting up timezone in application.yml 2018-09-02 11:08:27 -06:00
luisramos0
59f8dd4458 Improved cookies spec by keeping global config values as they were before the test 2018-09-01 20:35:07 +01:00
Kristina Lim
f844236b9c Remove order link in non-user order cancellation email 2018-09-01 23:46:12 +08:00
Kristina Lim
5f2c3a1955 Remove order link in non-user failed payment email 2018-09-01 23:46:12 +08:00
Kristina Lim
f8244a400a Custom subscription placement email if non-user
The order link should not be provided if the order does not have an
associated user account.
2018-09-01 23:46:11 +08:00
Kristina Lim
ad8b120e48 Extract format for order cycle closing in emails
Using a helper for this, but this can be changed to look up a
translation key.
2018-09-01 23:46:08 +08:00
Matt-Yorkley
9d05e5c97a Remove duplicate line in spec 2018-09-01 14:09:07 +01:00
Kristina Lim
dc4037474d Test order links in subscription placement emails 2018-09-01 15:40:36 +08:00
Matt-Yorkley
d8bbcdc54b Decrease batch size to reduce chance of timeouts 2018-08-31 22:52:44 +01:00
Matt-Yorkley
4dfbbd60d4 Fix occasional StaleObjectError on variant updates 2018-08-31 19:47:08 +01:00
dependabot[bot]
4557bfbc17 [Security] Bump rubyzip from 1.2.1 to 1.2.2
Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.1 to 1.2.2. **This update includes security fixes.**
- [Release notes](https://github.com/rubyzip/rubyzip/releases)
- [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md)
- [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.1...v1.2.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-31 17:49:12 +00:00
Matt-Yorkley
75a9ea5bfa Prefer .flat_map(&foo) over .map(&foo).flatten 2018-08-31 15:38:38 +01:00
Matt-Yorkley
04d50d4555 Fix filter results bug in validation section 2018-08-31 15:00:29 +01:00
Kristina Lim
f5c44ef0e6 Rename "entreprise" in i18n keys to "enterprise" 2018-08-31 15:26:30 +08:00
Maikel
a9c8c033c7 Merge pull request #2566 from openfoodfoundation/dependabot/bundler/daemons-1.2.6
Bump daemons from 1.2.2 to 1.2.6
2018-08-31 14:54:53 +10:00
Maikel
c30e29051a Merge pull request #2594 from openfoodfoundation/dependabot/bundler/compass-rails-3.1.0
Bump compass-rails from 2.0.4 to 3.1.0
2018-08-31 13:47:22 +10:00
Maikel Linke
13b9ecab21 Fix font issue in mobile menu 2018-08-31 11:23:11 +10:00
luisramos0
1b4e0cd73a Made the menu config default values more user friendly 2018-08-31 11:23:11 +10:00
luisramos0
e573a3fc2b The main menu is now translatable and configurable using Content configuration and translations. Added 7 menu entries to the translations file (each with text and url) and 7 content configuration points to enable/disable these. The mobile menu icons can also be configured. 2018-08-31 11:23:11 +10:00
dependabot[bot]
508643b64e Bump eventmachine from 1.2.3 to 1.2.7
Bumps [eventmachine](https://github.com/eventmachine/eventmachine) from 1.2.3 to 1.2.7.
- [Release notes](https://github.com/eventmachine/eventmachine/releases)
- [Changelog](https://github.com/eventmachine/eventmachine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eventmachine/eventmachine/compare/v1.2.3...v1.2.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-30 19:19:08 +00:00
dependabot[bot]
287b21b0cf Bump foreigner from 1.6.1 to 1.7.4
Bumps [foreigner](https://github.com/matthuhiggins/foreigner) from 1.6.1 to 1.7.4.
- [Release notes](https://github.com/matthuhiggins/foreigner/releases)
- [Changelog](https://github.com/matthuhiggins/foreigner/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matthuhiggins/foreigner/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-30 19:16:41 +00:00
Pau Perez
1de13a5049 Favor #public_send over #send using Rubocop's cop
Devs keep using `#send` although that method does not preserve
private/protected visibility. Watching after this turned out to be quite
time-consuming while doing code review.

Currently, the Style/Send cop doesn't enforce `#public_send` however
(that's what we want). It simply discourages the use of #send. See
https://github.com/rubocop-hq/rubocop/pull/2081#issuecomment-292251650
for details. So a new entry on the Code Conventions doc has been added
to overcome this limitation:
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Code-Conventions#prefer-public_send-over-send
2018-08-30 18:48:45 +02:00
Pau Pérez Fabregat
b4bfa3ff2d Merge pull request #2591 from mkllnk/remove-rack-livereload
Remove gem rack-livereload
2018-08-30 13:50:57 +02:00
Maikel
1b88edea1f Merge pull request #2420 from stveep/stripe-admin-2
Stripe admin 2
2018-08-30 15:48:49 +10:00
Maikel Linke
d1f7828432 Fix pending spec
The link from the enterprise page was missing the enterprise id. So the
bulk edit page for fees was showing fees for all enterprises.
2018-08-30 14:50:41 +10:00
Maikel Linke
429bf132da Test creating a fee, not updating
The spec for creating an enterprise fee didn't actually create a new
fee. Because all enterprise fees are displayed, it changed an existing
fee.
2018-08-30 14:50:41 +10:00
Maikel Linke
297ea830dc Further style spec 2018-08-30 14:50:41 +10:00
Maikel Linke
bc1e8bfde6 Convert specs to RSpec 3.7.0 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/features/admin/enterprise_fees_spec.rb

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

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

* 4 conversions
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-08-30 14:50:41 +10:00
Maikel Linke
a789aeb30a Speed up enterprise fee spec 2018-08-30 14:50:41 +10:00
Maikel Linke
0174b84254 Remove old deactivated code 2018-08-30 14:50:41 +10:00
Maikel
174bc15ac9 Merge pull request #2607 from openfoodfoundation/dependabot/bundler/pg-0.21.0
Bump pg from 0.13.2 to 0.21.0
2018-08-30 13:37:25 +10:00
dependabot[bot]
664db1b0c2 Bump pg from 0.13.2 to 0.21.0
Bumps [pg](https://bitbucket.org/ged/ruby-pg) from 0.13.2 to 0.21.0.
- [Changelog](https://bitbucket.org/ged/ruby-pg/src/master/History.rdoc)
- [Commits](https://bitbucket.org/ged/ruby-pg/branches/compare/v0.21.0..v0.13.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-30 03:19:13 +00:00
Maikel
8a97088bb6 Merge pull request #2606 from openfoodfoundation/dependabot/bundler/poltergeist-1.18.1
Bump poltergeist from 1.16.0 to 1.18.1
2018-08-30 13:16:47 +10:00
Maikel
1c61539119 Merge pull request #2585 from greysteil/bump-ams
Bump active_model_serializer to 0.8.4, and pin it
2018-08-30 10:00:22 +10:00
Maikel
fac29ebb96 Merge pull request #2595 from openfoodfoundation/dependabot/bundler/immigrant-0.3.6
Bump immigrant from 0.1.6 to 0.3.6
2018-08-30 09:56:37 +10:00
luisramos0
02b968b312 Cookies policy page table has a single column now. Also made small updates to the page text, migrated translations to ruby translations and extracted repeated partial from cookies policy page view 2018-08-30 00:27:35 +01:00
luisramos0
53e7fcb019 Imcreased cookies banner font size for med/large screens to improve readability 2018-08-30 00:21:00 +01:00
luisramos0
8dc10ffc6e Added new test to cookies spec to cover bug on cookies banner and fixed it. See issue #2599.
Also, improved readability on cookies spec with some extracted methods.
2018-08-28 23:48:22 +01:00
dependabot[bot]
3d8c4c69a7 Bump poltergeist from 1.16.0 to 1.18.1
Bumps [poltergeist](https://github.com/teampoltergeist/poltergeist) from 1.16.0 to 1.18.1.
- [Release notes](https://github.com/teampoltergeist/poltergeist/releases)
- [Changelog](https://github.com/teampoltergeist/poltergeist/blob/master/CHANGELOG.md)
- [Commits](https://github.com/teampoltergeist/poltergeist/compare/v1.16.0...v1.18.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-28 19:15:06 +00:00
Matt-Yorkley
8de0355dc7 Add spec for multiple stages during import 2018-08-28 14:05:57 +01:00
Matt-Yorkley
f905284f7a Add spec for edge case 2018-08-28 12:45:04 +01:00
Maikel
79f50e0b7b Merge pull request #2353 from luisramos0/customers_admin_country_state
fixed UX problem in the state selector in customers admin
2018-08-28 16:46:00 +10:00
Maikel
b4bea59bb0 Merge pull request #2567 from greysteil/better-feater-matchers
Switch feature matcher style from `to_not have` to `to have_no`
2018-08-28 16:44:57 +10:00
Matt-Yorkley
6b9b8d8b73 Match multiple product names 2018-08-28 03:26:17 +01:00
Grey Baker
562a7936d9 Bump active_model_serializer to 0.8.4 2018-08-28 01:00:06 +01:00
Maikel
c39ac26f57 Merge pull request #2580 from openfoodfoundation/dependabot/bundler/stripe-3.3.2
Bump stripe from 3.3.1 to 3.3.2
2018-08-28 09:42:38 +10:00
Matt-Yorkley
8c2a49a57c Update PI model spec 2018-08-27 23:08:19 +01:00
Matt-Yorkley
1df1ddcf66 Add spec for saving product and variant simultaneously 2018-08-27 23:06:54 +01:00
dependabot[bot]
61097c3bf9 Bump immigrant from 0.1.6 to 0.3.6
Bumps [immigrant](https://github.com/jenseng/immigrant) from 0.1.6 to 0.3.6.
- [Release notes](https://github.com/jenseng/immigrant/releases)
- [Changelog](https://github.com/jenseng/immigrant/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jenseng/immigrant/compare/v0.1.6...v0.3.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-27 19:18:13 +00:00
dependabot[bot]
67802cd4ee Bump compass-rails from 2.0.4 to 3.1.0
Bumps [compass-rails](https://github.com/Compass/compass-rails) from 2.0.4 to 3.1.0.
- [Release notes](https://github.com/Compass/compass-rails/releases)
- [Changelog](https://github.com/Compass/compass-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Compass/compass-rails/compare/2.0.4...3.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-27 19:17:55 +00:00
Maikel Linke
58cbe492d4 Remove gem rack-livereload
I don't think that anybody is using it. I asked on Slack and people
didn't know what it was. I kept guard-livereload which is probably
offering the same, maybe even better.
2018-08-27 16:34:50 +10:00
Maikel
44faa116db Merge pull request #2583 from mkllnk/seed-mail-connection-type
Configure mail TLS or SSL connection when seeding
2018-08-27 09:52:56 +10:00
Kristina Lim
28792fc895 Add tests for adding/updating enterprise images 2018-08-26 03:58:19 +08:00
Maikel
8eee8f96ed Merge pull request #2557 from Matt-Yorkley/pi/class_descriptions
Class descriptions for Product Import
2018-08-24 18:14:12 +10:00
Matt-Yorkley
717f626dfe Refactor enterprise validation 2018-08-24 15:51:37 +10:00
Matt-Yorkley
2b057a26d5 Add primary_producer to index to reduce queries 2018-08-24 15:51:37 +10:00
Matt-Yorkley
666fbf53bf Validate enterprise.is_primary_producer? 2018-08-24 15:51:37 +10:00
Maikel
616b42a14d Merge pull request #2555 from luisramos0/cookie_http_only
Added httponly to cookieConsent cookie, this makes this cookie secure…
2018-08-24 15:50:13 +10:00
Maikel
a37931afda Merge pull request #2542 from luisramos0/add_to_cart
Extract OrderController.populate to new CartController and OrderPopulator to new CartService
2018-08-24 14:43:33 +10:00
Maikel
bf55190136 Merge pull request #2546 from Matt-Yorkley/pi/sku_validation
Remove empty SKU values if empty
2018-08-24 14:32:00 +10:00
Maikel Linke
b158c92998 Configure mail TLS or SSL connection when seeding
This allows to seed the secure connection type of the default mail
method.
2018-08-24 14:03:21 +10:00
Maikel
871e423e12 Merge pull request #2548 from kristinalim/feature-bulk_update_of_order_cycle_name
Make OC name editable from the OC index
2018-08-24 11:38:31 +10:00
Maikel
c4c4547338 Merge pull request #2572 from greysteil/bump-webmock
Bump webmock
2018-08-24 08:49:11 +10:00
dependabot[bot]
358bb3030a Bump stripe from 3.3.1 to 3.3.2
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 3.3.1 to 3.3.2.
- [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.1...v3.3.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-23 19:16:15 +00:00
dependabot[bot]
2e4a8d6318 Bump angular-rails-templates from 0.2.0 to 0.3.0
Bumps [angular-rails-templates](https://github.com/pitr/angular-rails-templates) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/pitr/angular-rails-templates/releases)
- [Changelog](https://github.com/pitr/angular-rails-templates/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pitr/angular-rails-templates/compare/v0.2.0...v0.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-23 19:15:48 +00:00
luisramos0
910297572e Removed unnecessary currency from CartService constructor, using order.currency instead 2018-08-23 12:40:18 +01:00
luisramos0
ec069b1e3e Converted specs to latest rspec syntax 2018-08-23 12:39:58 +01:00
luisramos0
c7b202f932 Fixed CodeClimate warnings on services/cart_services.rb 2018-08-23 12:39:58 +01:00
luisramos0
05bfc098ff /controllers/spree/order_populator_decorator (with a class_eval) is now /services/CartService with no dependency to Spree::OrderPopulator. 2018-08-23 12:39:55 +01:00
luisramos0
6caa361354 Moved Spree::OrderController.populate to new CartController.
This was done to make order populate independent of Spree::OrdersController
2018-08-23 12:37:52 +01:00
Maikel
0312bf93dd Merge pull request #2556 from luisramos0/cookies_failing_tests
Make cookies tests more stable
2018-08-23 13:29:02 +10:00
Maikel Linke
00b8b0a36c Sleep to avoid race conditions in cookie spec
We tried a lot to avoid these sleep commands, but nothing worked. So
it's better to have reliable specs than fast specs.
2018-08-23 13:13:05 +10:00
Maikel
0c35d1bade Merge pull request #2570 from openfoodfoundation/dependabot/bundler/atomic-1.1.101
Bump atomic from 1.1.99 to 1.1.101
2018-08-23 11:05:46 +10:00
Maikel
5dd0aed1c0 Merge pull request #2569 from openfoodfoundation/dependabot/bundler/rack-livereload-0.3.17
Bump rack-livereload from 0.3.16 to 0.3.17
2018-08-23 10:56:00 +10:00
Maikel
bc192dabbc Merge pull request #2564 from openfoodfoundation/dependabot/bundler/fuubar-2.3.2
Bump fuubar from 2.2.0 to 2.3.2
2018-08-23 10:10:07 +10:00
Maikel
7d40e960f4 Merge pull request #2563 from openfoodfoundation/transifex
Transifex
2018-08-23 10:06:16 +10:00
Maikel
92e9392bc5 Merge pull request #2561 from mkllnk/2233-enable-embedded-shopping-spec
Enable embedded shopping spec
2018-08-23 09:23:12 +10:00
Grey Baker
468c29b8c1 Use new basic auth stub style 2018-08-22 21:35:56 +01:00
dependabot[bot]
b459ed7122 Bump webmock from 1.8.11 to 3.4.2
Bumps [webmock](https://github.com/bblimke/webmock) from 1.8.11 to 3.4.2.
- [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/v1.8.11...v3.4.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 21:26:05 +01:00
dependabot[bot]
f35e24d5ce Bump atomic from 1.1.99 to 1.1.101
Bumps [atomic](https://github.com/ruby-concurrency/atomic) from 1.1.99 to 1.1.101.
- [Release notes](https://github.com/ruby-concurrency/atomic/releases)
- [Commits](https://github.com/ruby-concurrency/atomic/compare/1.1.99...1.1.101)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 19:18:33 +00:00
dependabot[bot]
c5b426fded Bump rack-livereload from 0.3.16 to 0.3.17
Bumps [rack-livereload](https://github.com/onesupercoder/rack-livereload) from 0.3.16 to 0.3.17.
- [Release notes](https://github.com/onesupercoder/rack-livereload/releases)
- [Commits](https://github.com/onesupercoder/rack-livereload/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 19:17:49 +00:00
Grey Baker
a747561e77 Switch feature matcher style from to_not have to to have_no 2018-08-22 09:29:48 +01:00
dependabot[bot]
8fb5625f1d Bump daemons from 1.2.2 to 1.2.6
Bumps [daemons](https://github.com/thuehlinger/daemons) from 1.2.2 to 1.2.6.
- [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.2.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 07:48:28 +00:00
dependabot[bot]
ade005bb2c Bump fuubar from 2.2.0 to 2.3.2
Bumps [fuubar](https://github.com/thekompanee/fuubar) from 2.2.0 to 2.3.2.
- [Release notes](https://github.com/thekompanee/fuubar/releases)
- [Changelog](https://github.com/thekompanee/fuubar/blob/master/CHANGELOG.md)
- [Commits](https://github.com/thekompanee/fuubar/compare/releases/v2.2.0...releases/v2.3.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 07:47:04 +00:00
Maikel
4417a8f156 Merge pull request #2539 from luisramos0/delete_dead_cart
removed Cart route, controller, model and specs: dead code
2018-08-22 17:35:58 +10:00
Transifex-Openfoodnetwork
1bbc615496 Updating translations for config/locales/fr_CA.yml 2018-08-22 08:37:41 +10:00
Transifex-Openfoodnetwork
39b3a964dd Updating translations for config/locales/fr.yml 2018-08-22 04:25:59 +10:00
luisramos0
653804d14c Make cookies test more stable 2018-08-20 21:08:09 +01:00
luisramos0
61f69905f8 fixed UX problem in the state selector in customers admin 2018-08-20 20:51:22 +01:00
stveep
17f2ba47ca Add label for card field 2018-08-19 12:00:31 +01:00
stveep
8c6b8d5e84 Move injectors outside Stripe partial to satisfy dependencies 2018-08-19 11:50:34 +01:00
stveep
286101c934 PR changes: switch syntax for mapCC, remove ng-init 2018-08-19 10:43:53 +01:00
stveep
c0f41b6833 PR changes - erb to haml, don't update en_GB translations 2018-08-19 10:43:53 +01:00
stveep
b3da7049c6 Should not hide post code on admin side as no billing address otherwise 2018-08-19 10:43:53 +01:00
stveep
ff7dc811e9 Add translations for messages and remove old placeholder translation 2018-08-19 10:43:53 +01:00
stveep
f9a221e2ff add to manifest, tidy up requirements, hide postcode similar to frontend 2018-08-19 10:43:53 +01:00
stveep
a848b9172e Change name to AdminStripeElements to avoid confusion; add status bar for StatusMessages 2018-08-19 10:43:53 +01:00
stveep
8272aebe29 Add Stripe form and duplicate Stripe Elements in backend Angular app 2018-08-19 10:43:53 +01:00
Matt-Yorkley
fbbbc93aba Class descriptions for Product Import 2018-08-18 11:42:02 +01:00
luisramos0
56879377d5 Added httponly to cookieConsent cookie, this makes this cookie secure, cannot be altered by javascript 2018-08-17 22:57:57 +01:00
Maikel
e0d13010bb Merge pull request #2543 from openfoodfoundation/transifex
Transifex
2018-08-17 17:36:22 +10:00
Maikel Linke
7dccbb5213 Enable embedded shopping spec
It was disabled in
https://github.com/openfoodfoundation/openfoodnetwork/pull/2232, because
it was very unreliable. But it seems stable again since
https://github.com/openfoodfoundation/openfoodnetwork/pull/2468.
2018-08-17 17:00:15 +10:00
Matt-Yorkley
28b1fc076a Remove empty SKU values if empty 2018-08-16 14:29:50 +01:00
Kristina Lim
c14e7ea8d5 Allow bulk update of order cycle name 2018-08-16 21:18:24 +08:00
luisramos0
91e57cb893 Removed Cart table, its dependency on spree orders table and removed some more dead code related to this 2018-08-15 23:29:28 +01:00
Transifex-Openfoodnetwork
d76112e072 Updating translations for config/locales/de_DE.yml 2018-08-14 17:18:51 +10:00
Maikel Linke
c9862535f8 Import required colour definitions in SCSS
This avoids asset compile errors like this one:

  Sass::SyntaxError: Undefined variable: "$disabled-light".
2018-08-14 10:01:48 +10:00
luisramos0
8681618490 Fixed CodeClimate scss feedback on cookies banner and policy page css 2018-08-14 10:01:48 +10:00
luisramos0
ccd5147b11 Added angular templates route and controller to serve angular templates from the server, instead of precompiled assets. This was used to fix a problem with the cookies policy page template that was using a Spree configuration 2018-08-14 10:01:48 +10:00
luisramos0
1c20967ca4 Added a button to close the cookies policy page at the bottom of the page to improve UX on mobile 2018-08-14 10:01:48 +10:00
luisramos0
bff5581a42 Added functional tests for cookies related features: cookies policy page, cookies banner and privacy policy link 2018-08-14 10:01:48 +10:00
luisramos0
4b64369ddb Added GA and Matomo toggle in Legal Settings in the global settings in the BO and added GA and Matomo cookies details to the cookies policy page (according to what is configured in the BO) 2018-08-14 10:01:48 +10:00
luisramos0
ca35c59e52 Moved the footer TOS URL from the content settings to the new section legal settings in the global settings 2018-08-14 10:01:48 +10:00
luisramos0
d920c32376 Added cookies banner toggle and privacy URL to a new section called Legal Settings in the global settings in the BO 2018-08-14 10:01:48 +10:00
luisramos0
92f9cbd00a Added new cookies banner (with link to cookie policy page and the accept cookies button) 2018-08-14 10:01:48 +10:00
luisramos0
08c5d8f3ab Added new cookies policy page and added a link to it in the footer (cookies policy link) 2018-08-14 10:01:48 +10:00
luisramos0
362ed8ed08 Changed modals max height from 120% to 100% so that the content in the modal is never outside the viewport 2018-08-14 10:01:48 +10:00
Transifex-Openfoodnetwork
4f751eb3e3 Updating translations for config/locales/nb.yml 2018-08-13 17:08:33 +10:00
Maikel
910c1d437d Merge pull request #2536 from openfoodfoundation/transifex
Transifex
2018-08-13 15:48:11 +10:00
luisramos0
0b9061df28 removed Cart route, controller, model and specs: dead code 2018-08-11 22:17:12 +01:00
Transifex-Openfoodnetwork
6c306aa1dd Updating translations for config/locales/fr.yml 2018-08-10 21:09:21 +10:00
luisramos0
3b1bd53d3a Added basic integration with Matomo
Added matomo script and added a new matomo settings menu entry under configuration. Improved organization of en.yml by grouping configuration screens.
2018-08-10 16:12:58 +10:00
Kristina Lim
6251c72921 Add divider between admin enterprise index actions 2018-08-10 12:17:31 +10:00
Kristina Lim
17978f58c7 Rename edit link in admin enterprise index
Change "Edit Profile" link to "Settings".
2018-08-10 12:17:31 +10:00
Kristina Lim
295604b689 Change heading for edit enterprise page
Change the start of the heading from "Editing:" to "Settings:".
2018-08-10 12:17:31 +10:00
Kristina Lim
0b4fcf8a14 Change enterprise "Manage" button to "Settings" 2018-08-10 12:17:30 +10:00
Kristina Lim
b91019ad64 Split translation key for enterprise manage button
The ".manage" key is still used by the column header for the "Manage"
buttons.
2018-08-10 12:12:26 +10:00
Maikel Linke
9dcbd9076e Override in_stock? to prepare for Spree 2.0 2018-08-09 14:22:43 +10:00
Maikel Linke
b84e524f2d Prepare inventory report for Spree upgrade
This change could impact the performance of the report. But therefore it
takes VariantOverrides into consideration. The old code ignored the
distributor for this filter. It also ignored the `on_demand` flag.
2018-08-09 14:22:43 +10:00
Maikel Linke
289d0b937f Style ScopeVariantToHub 2018-08-09 14:22:43 +10:00
Maikel Linke
27ddb712c1 Remove unused scope Spree::Variant.in_stock
Our added scope is not used anywhere and conflicts with the Spree
upgrade.

https://github.com/openfoodfoundation/openfoodnetwork/issues/2014
2018-08-09 14:22:43 +10:00
Maikel
33f6dc21e7 Merge pull request #2516 from kristinalim/cleanup-move_admin_and_spree_from_routes
Separate admin and Spree routes from main file
2018-08-09 10:10:49 +10:00
Maikel
f93ed0de85 Merge pull request #2519 from mkllnk/more-efficient-login-in-specs
More efficient login in specs
2018-08-09 10:05:54 +10:00
Maikel
03468efa7e Merge pull request #2346 from oeoeaio/subs-totals
Subs: totals in backend are consistent and include fee breakdown
2018-08-07 18:17:13 +10:00
Maikel Linke
9aff9fbce2 Remove empty spec 2018-08-07 16:01:38 +10:00
Maikel Linke
b628ead525 Speed up shipping methods spec 2018-08-07 16:01:38 +10:00
Maikel Linke
54552f2be7 Speed up admin schedules spec 2018-08-07 16:01:37 +10:00
Maikel Linke
819a173167 Speed up reports spec 2018-08-07 16:01:37 +10:00
Maikel Linke
aa677a117b Speed up admin products spec 2018-08-07 16:01:37 +10:00
Maikel Linke
eb550505ae Speed up admin payment method spec 2018-08-07 16:01:37 +10:00
Maikel Linke
9023b16395 Speed up admin orders spec
From 80s to 74s.
2018-08-07 16:01:37 +10:00
Maikel Linke
71a381e48e Speed up order cycles spec
From 68 to 63 seconds.
2018-08-07 16:01:37 +10:00
Maikel Linke
f4cd5a7e4b Speed up admin enterprise spec
From 40s to 36s.
2018-08-07 16:01:37 +10:00
Maikel Linke
121bc51feb Speed up admin enterprises spec
From 6.5s to 5.3s.
2018-08-07 16:01:37 +10:00
Maikel Linke
f0da823445 Speed up enterprise user spec
From 1.9s to 1.7s.
2018-08-07 12:41:07 +10:00
Maikel Linke
e4ebeb8a29 Remove dead spec code
The code has been inactive since 2015 and was probably obsolete anyway.
2018-08-07 12:37:49 +10:00
Maikel Linke
0b39054954 Speed up relationships spec
From 18s to 12s: 33% speed up
2018-08-07 12:33:26 +10:00
Maikel Linke
126f312c6b Make spec more robust not relying on order
Enterprises can be in different order. Using `with_options` doesn't
care about the order.
2018-08-07 12:30:59 +10:00
Maikel Linke
edb32218b0 Use quick login to speed up product edit spec
From 48s to 44s: 8% speed up
2018-08-07 12:11:15 +10:00
Maikel Linke
0edf393c12 Use quick login to speed up spec
We don't need to visit the admin dashboard before each spec.
On my machine:

  54 seconds before
  47 seconds after
  speed up by 13%
2018-08-07 10:56:42 +10:00
Maikel Linke
30fad228c5 Remove code duplication in spec helper 2018-08-07 09:24:31 +10:00
Maikel
32846af230 Merge pull request #2517 from kristinalim/cleanup-disable_rubocop_cop_rails_activerecordaliases
Disable rubocop cop "Rails/ActiveRecordAliases"
2018-08-07 09:11:00 +10:00
Kristina Lim
d77a94335b Update .rubocop_todo.yml 2018-08-06 18:45:52 +08:00
Kristina Lim
a494fb274e Disable rubocop cop Rails/ActiveRecordAliases
The methods :update! and :update (to replace :update_attributes! and
:update_attributes) were not added until Rails 4.

See this for more information:
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/ActiveRecordAliases
2018-08-06 18:12:43 +08:00
Kristina Lim
b67c8cc9f1 Improve requiring of additional routes
This is more appropriate, and allows changes the separate route files to
be loaded automatically in the development environment.
2018-08-06 17:04:03 +08:00
Kristina Lim
4d34693c05 Move Spree route customizations from main file 2018-08-06 09:57:29 +08:00
Kristina Lim
72036a4993 Move admin routes from main file 2018-08-06 09:57:24 +08:00
Maikel Linke
f0be8ff290 Style proxy order serializer 2018-08-03 15:07:22 +10:00
Maikel Linke
b736560d63 Inform about inaccurate subscription totals
https://github.com/openfoodfoundation/openfoodnetwork/pull/2346#issuecomment-409822038
2018-08-03 14:59:27 +10:00
Matt-Yorkley
c8397024e4 Streamline Product Import UX flow 2018-08-03 14:33:35 +10:00
Maikel Linke
d5fdda1c46 Fix typo translating Enterprises 2018-08-03 12:15:50 +10:00
Maikel Linke
c48889f368 Remove duplicate translation key 2018-08-03 12:15:50 +10:00
Rob Harrington
cead905d05 Use estimated subscription total for proxy orders if order has not been initialized 2018-08-03 12:14:25 +10:00
Rob Harrington
fb93351386 Show fee breakdown in line items panel if present 2018-08-03 12:14:25 +10:00
Maikel
d726b0a851 Merge pull request #2509 from coopdevs/update-spree-fork-version
Update Spree's fork revision in Gemfile
2018-07-31 09:26:00 +10:00
Pau Perez
c4b23b62d0 Update Spree's fork revision in Gemfile 2018-07-30 18:11:02 +10:00
Maikel
915531acc4 Add section about documentation updates
This should prevent issues like https://github.com/openfoodfoundation/openfoodnetwork/issues/2427.

Also converted comments into HTML syntax so that you don't have to delete them when creating a PR.
2018-07-30 14:44:07 +10:00
Maikel
8ecc786b99 Include bug severity in issue template
And formatted for easier reading and writing.
2018-07-30 14:28:01 +10:00
Rob H
7f26b1494b Fix syntax error in GETTING_STARTED.md 2018-07-27 12:49:18 +10:00
Rob H
eb89b74022 Fix syntax error in README.md 2018-07-27 12:48:37 +10:00
Maikel
933ff63de2 Merge pull request #2389 from luisramos0/bulk_prod_edit_fix
admin page fetcher is now synchronously fetching all pages before reso…
2018-07-26 14:09:21 +10:00
Maikel
3f91850301 Merge pull request #2499 from mkllnk/update-com-links-in-readme
Add communications links to README
2018-07-26 11:39:29 +10:00
Rob Harrington
a16058f52a Fix link syntax errors in REAME.md and GETTING_STARTED.md 2018-07-26 11:38:39 +10:00
Maikel
02331221ef Merge pull request #2471 from Matt-Yorkley/pi/post_save
PI: post-save UI changes
2018-07-26 11:26:51 +10:00
Maikel Linke
2ceb969925 Style recently merged code
We enabled more Rubocop checks and code that was merged around the same
time, didn't comply with the new checks.
2018-07-26 10:52:56 +10:00
Maikel Linke
f0f9662957 Update gem i18n-js to pick up locale changes
We had some problems recently with changes in en.yml not being picked up
by i18n-js to be included in all.js. There have been some patches for
the current version that have an impact on that:

578555f57e
db3cdf82aa
a88b206644

Trying it out locally, the updated i18n-js gem works while the old
version doesn't update the Javascript translations when new keys are
added. To reproduce the issue, you can add a new key in `en.yml` and
reference it from an Angular template in `app/assets/javascripts/`. The
old version complained about a missing translation until you ran:
```
bundle exec rake tmp:cache:clear
```

We don't need to do that any more.
2018-07-26 10:45:35 +10:00
Pau Pérez Fabregat
97e61dc6f9 Merge pull request #2498 from Matt-Yorkley/embedded_mobile
Fix embedded shopfront menu responsiveness
2018-07-25 15:10:46 +02:00
Matt-Yorkley
ae5fd864d1 Fix embedded shopfront menu responsiveness 2018-07-25 17:41:26 +10:00
Maikel Linke
5db5bc65c0 Add communications links to README
This was originally proposed by Kirsten in:
https://github.com/openfoodfoundation/openfoodnetwork/pull/2478
2018-07-24 11:18:54 +10:00
Maikel
ffd3d28889 Merge pull request #2474 from Matt-Yorkley/pi/import_options
PI: import options UI
2018-07-24 10:34:14 +10:00
Maikel
30be40ebd9 Merge pull request #2441 from kristinalim/fix-scoping_issue_in_sorting_of_tables
Fix front-end sorting in "Customers" index and "Bulk Order Management" page
2018-07-24 10:31:13 +10:00
Pau Pérez Fabregat
26d6ca4a54 Merge pull request #2487 from coopdevs/stricter-code-climate
Make CodeClimate config more strict
2018-07-23 12:42:06 +02:00
Pau Pérez Fabregat
687d7c5f38 Merge pull request #2483 from coopdevs/fix-setup-script
Fix script/setup by making it less clever
2018-07-23 12:31:50 +02:00
Pau Pérez Fabregat
b60bada542 Merge pull request #2495 from mkllnk/remove-newrelic
Remove unused gem newrelic-rpm
2018-07-23 11:19:27 +02:00
Pau Perez
14480b920e Fix script/setup by making it less clever
Now we ask the dev to create the "ofn" user as precondition. This is
way easier than developing a script that fits all possible setups.

It also stops requiring a particlar Postgres version. Although in
production we use 9.5 it is very unlikely we will use any
version-specific feature in the near future. This should make it a bit
easier for new devs to set up their environment.
2018-07-23 10:59:32 +02:00
Matt-Yorkley
67767f86eb Change import and reset logic to work with first page 2018-07-23 02:07:00 +01:00
Matt-Yorkley
bd200c885b Move options to first page 2018-07-23 01:46:32 +01:00
Kristina Lim
89ac558f37 Fix wrong sort predicates in customer index 2018-07-23 10:33:40 +10:00
Kristina Lim
47608525c6 Reset reverse when clicking another column to sort 2018-07-23 10:33:40 +10:00
Kristina Lim
5179f7fd63 Move logic for toggling by column into SortOptions 2018-07-23 10:33:40 +10:00
Kristina Lim
55d0b1dfc5 Generalize sorting through SortOptions service 2018-07-23 10:33:40 +10:00
Kristina Lim
8b6b694244 Remove unused sorting preferences in ColumnsCtrl 2018-07-23 10:33:40 +10:00
Kristina Lim
2bba72c5a9 Fix frontend sorting in "Bulk Order Management" 2018-07-23 10:33:40 +10:00
Kristina Lim
822b2c929a Fix frontend sorting in "Customers" index
The scope for customersCtrl did not have access to the sorting
preferences stored in the nested ColumnsCtrl scope. To address this,
the page has been changed to use a new set of sorting preferences
declared in the customersCtrl scope itself.

Also, these sorting preferences are now stored in an object. This
enables the parent scope to see changes to the sorting preferences which
are done via the nested ColumnsCtrl scope,

The "Bulk Order Management" page is also affected by the same scoping
issue. Once this page is fixed, we can remove remnants of the sorting
preferences initialized in ColumnsCtrl.
2018-07-23 10:33:39 +10:00
Kristina Lim
9f09861d8b Change sorting to be done in ascending order first
Currently, we always toggle "reverse" when triggering a sort.

If "reverse" is initially set to false, triggering a sort for the first
time then toggles this to true. The effect is that, the first time that
sorting is done, the rows are sorted in reverse order.

This is not intuitive - they should be sorted in ascending order first.
2018-07-23 10:33:39 +10:00
Kristina Lim
745390dcd5 Wrap rows in customer index with TBODY tag 2018-07-23 10:33:39 +10:00
Maikel
12838ba61e Merge pull request #2468 from mkllnk/improve-testing-embedded-pages
Improve testing embedded pages
2018-07-23 08:59:11 +10:00
Maikel
add250b30f Merge pull request #2473 from Matt-Yorkley/pi/stop_if_invalid
PI: Don't allow save if invalid entries are present
2018-07-23 08:54:01 +10:00
Maikel
df29d4d611 Merge pull request #2472 from lilwillifo/logo-sizing-to-css
Logo sizing to css
2018-07-23 08:47:45 +10:00
Pau Perez
7d790a7d59 Update .rubocop_todo.yml 2018-07-20 18:58:37 +02:00
Pau Perez
44fe3de732 Make CodeClimate config more strict
There's no point of using Code Climate if most of its checks are
disabled. Now it scores our codebase with an A and reports just 2 code
smells, 64 duplications and 14 other issues. That couldn't farther from
reality. If we care about the architecture and maintainability of our
app, this is a must.

To transition towards enabling all default checks, I started with
scss-lint, duplication and method-complexity. This doesn't mean will
have to fix them all straight away as we'll add the current violations
to the `.rubocop_todo.yml` but it'll point us the parts where we should
focus our efforts.
2018-07-20 09:08:03 +02:00
Maikel Linke
5f4115fbd9 Remove unused gem newrelic-rpm 2018-07-20 16:56:12 +10:00
Margaret Williford
512e974672 move width setting for tagline logo image from HTML to CSS 2018-07-20 14:00:06 +10:00
Margaret Williford
d952276e2a move footer logo sizing from html to css 2018-07-20 14:00:06 +10:00
Maikel
23964b2542 Merge pull request #2422 from luisramos0/1667_email_validation_fix
1667 manage validations emails
2018-07-20 12:19:23 +10:00
Maikel
1b571e9835 Merge pull request #2379 from Matt-Yorkley/uk/guest_label
Add guest label to admin customers index
2018-07-20 08:53:26 +10:00
Maikel Linke
962c54b606 Remove unnecessary expectation
The `iframe` is rendered in pure HTML and should always be there.
2018-07-19 10:45:33 +10:00
Maikel Linke
8a3a617870 DRY specs with new EmbeddedPagesHelper 2018-07-19 10:44:43 +10:00
luisramos0
8246893652 Added notice for unexpected mail in confirmation instructions mail (HugsDaniel) 2018-07-19 09:26:29 +10:00
Maikel
1dbd265b30 Merge pull request #2384 from luisramos0/open_new_tab
added directive to make links open in new tab by default in textangul…
2018-07-19 09:17:09 +10:00
Matt-Yorkley
e3162b0a14 Change import method to fix missing variable error on asset precompilation 2018-07-18 23:00:50 +01:00
Matt-Yorkley
456e05d5d2 Include subfolders in scss import 2018-07-18 22:56:10 +01:00
Matt-Yorkley
24ff5555be Create admin SCSS colour palette 2018-07-18 22:56:10 +01:00
Matt-Yorkley
75e52a7a91 CSS tweaks fo guest flag 2018-07-18 22:56:10 +01:00
Matt-Yorkley
583f16b38d Add guest label to admin customers index 2018-07-18 22:56:10 +01:00
Pau Pérez Fabregat
4fe1e1fc9f Merge pull request #2482 from Matt-Yorkley/uk/mail_config
Allow preferred_mails_from and preferred_mail_bcc to be set from configs
2018-07-18 19:20:55 +02:00
Pau Pérez Fabregat
4f215da735 Merge pull request #2467 from mkllnk/ci-output-test
Use progress formatter on Travis to avoid timeout
2018-07-18 19:19:40 +02:00
Pau Pérez Fabregat
37e2d76a39 Merge pull request #2477 from mkllnk/2465-use-right-subscriptions-translation
Reference existing translation: closed order cycle
2018-07-18 16:47:35 +02:00
Pau Pérez Fabregat
fac8e26d8b Merge pull request #2475 from Matt-Yorkley/pi/landing_page
PI: landing page
2018-07-18 16:47:17 +02:00
Matt-Yorkley
23cbcda0c3 Allow preferred_mails_from and preferred_mail_bcc to be set from configs 2018-07-18 15:43:02 +01:00
Matt-Yorkley
5e142205bd Use relative translation keys 2018-07-18 13:35:23 +01:00
Matt-Yorkley
5737c9803d Add unit_type field to inventory template 2018-07-18 12:59:52 +01:00
Matt-Yorkley
c7deae4253 Remove category field from inventory specs 2018-07-18 12:59:19 +01:00
Matt-Yorkley
b37bea35fa Use relative translation keys 2018-07-18 11:43:31 +01:00
Matt-Yorkley
18206c9369 Remove old view file 2018-07-18 11:42:07 +01:00
Pau Pérez Fabregat
8ae5d5f52e Merge pull request #2415 from oeoeaio/update-readme
Update README.md and add GETTING_STARTED.md
2018-07-18 11:19:33 +02:00
Pau Pérez Fabregat
d56698e4a6 Merge branch 'master' into update-readme 2018-07-18 10:59:20 +02:00
Pau Pérez Fabregat
7bf27ec6b3 Merge pull request #2409 from mkllnk/2013-remove-scope-active_distributors
2013 Remove dead code for Spree upgrade
2018-07-18 10:38:19 +02:00
Pau Pérez Fabregat
bd05af5a29 Merge pull request #2442 from kristinalim/translations-enterprise_relationships_to_enterprise_permissions
Change "Enterprise Relationships" to "Enterprise Permissions"
2018-07-17 14:48:08 +02:00
Kristina Lim
c16f4203f9 Rename enterprise "Relationships" to "Permissions"
This only updates en* translations, and does not affect URLs and other
back-end references.
2018-07-17 16:03:48 +10:00
Pau Pérez Fabregat
0fd57ee7bd Merge pull request #2390 from luisramos0/buk_prod_edit_rounding_issue
fixed number rounding issue in product bulk edit
2018-07-16 16:44:59 +02:00
luisramos0
4a44454210 fixed number rounding issue in product bulk edit 2018-07-16 13:13:58 +10:00
Maikel Linke
4d68723fe3 Reference existing translation: closed order cycle
https://github.com/openfoodfoundation/openfoodnetwork/issues/2465

Viewing a customers subscription could display a translation missing
error.
2018-07-16 09:24:32 +10:00
Matt-Yorkley
c4af50e95c Add sidebar to Import index page 2018-07-15 23:12:26 +01:00
Matt-Yorkley
632b991952 Add downloadable templates 2018-07-15 21:25:42 +01:00
Matt-Yorkley
f344b7893d Remove Product Import guide page 2018-07-15 20:49:55 +01:00
Matt-Yorkley
8aed78b0e6 Don't allow save if invalid entries are present 2018-07-15 10:21:36 +01:00
Matt-Yorkley
a4210a1cab PI post-save UI changes 2018-07-15 00:27:21 +01:00
Pau Pérez Fabregat
da344adbcd Merge pull request #2466 from kristinalim/doc-notes_about_i18n_in_contributing
Add section about internationalisation to CONTRIBUTING.md
2018-07-13 19:43:52 +02:00
Pau Pérez Fabregat
c2d9b094d3 Merge pull request #2419 from frank-west-iii/issue-2412-duplicate-menu
Remove spree product navigation override
2018-07-13 19:43:07 +02:00
Maikel Linke
622517501c Make spec robust on slow computers
This spec just failed in an unrelated pull request.
https://travis-ci.org/openfoodfoundation/openfoodnetwork/jobs/403435522

This change should fix it even on very slow computers.
2018-07-13 19:10:06 +10:00
Frank West
e3b7e050a0 Remove spree product navigation override
This was here to override the original spree products navigation link,
but since moving back to the index action this had the side effect of
adding an additional navigation item instead. We can simply remove this
override to get rid of the additional menu item.
2018-07-13 16:58:57 +10:00
Maikel Linke
8e90488117 Use progress formatter on Travis to avoid timeout
We had a few Travis builds lately that timed out, because no output was
received. Even though our standard formatter Fuubar should detect Travis
and print the right output, nothing was visible in our builds.
https://github.com/travis-ci/travis-ci/issues/1337

In this patch, I tell Travis to use Rspec's default formatter to print
dots for every passed test.
2018-07-13 16:51:56 +10:00
Maikel Linke
599f1a966b Use embedded shops example for tests 2018-07-13 16:36:19 +10:00
Kristina Lim
4ebcf4e3c3 Add internationalisation info to CONTRIBUTING.md 2018-07-13 14:26:27 +08:00
Maikel Linke
66980b247a Fix test of opening shops in new windows
The test case had some hard-coded enterprise name that didn't match
anything. It then confirmed that all found links (none) would open a new
window. So it wasn't confirming anything.
2018-07-13 15:37:19 +10:00
Maikel Linke
6f737d8d1e Unclutter spec setup 2018-07-13 15:37:19 +10:00
Maikel Linke
ed747ec612 Use embedded groups example for tests 2018-07-13 15:37:19 +10:00
Maikel Linke
185cf9a312 Remove code duplication 2018-07-13 15:37:18 +10:00
luisramos0
dfb510debe admin page fetcher is now receiving a onLastPageComplete function that is used to show "no results" messages only after the last page is fetched 2018-07-13 15:01:43 +10:00
Maikel Linke
d5d1eae715 Improve spec description 2018-07-13 09:04:42 +10:00
Maikel Linke
43883d1ab4 Simplify email confirmation directive
Making better use of Angular features.
Adding a spec for this functionality.
2018-07-13 09:04:42 +10:00
Maikel Linke
fbe2f7ab4c Remove unused variable from mailer
The second variable passed by Devise is actually a hash, not a token.
2018-07-13 09:04:41 +10:00
Maikel Linke
a531135804 Remove unused data-hooks 2018-07-13 09:04:41 +10:00
Maikel Linke
e37213f6a5 Remove redundant edit action 2018-07-13 09:04:41 +10:00
Maikel Linke
28c2ad7160 Move override into view 2018-07-13 09:04:41 +10:00
Maikel Linke
a347837044 Move override into view 2018-07-13 09:04:41 +10:00
Maikel Linke
ab9975cb6c Move override into view 2018-07-13 09:04:41 +10:00
Maikel Linke
339b04a044 Convert spree admin user list to haml 2018-07-13 09:04:41 +10:00
Maikel Linke
9020e7ddd9 Import admin user list from Spree 2018-07-13 09:04:41 +10:00
Maikel Linke
60b66540df Add resend email button to admin user form
Fixes https://github.com/openfoodfoundation/openfoodnetwork/issues/1589
2018-07-13 09:04:41 +10:00
Maikel Linke
6a58deb436 Add message about unconfirmed email to user form 2018-07-13 09:04:41 +10:00
Maikel Linke
8157897f76 Remove unused data hooks 2018-07-13 09:04:41 +10:00
Maikel Linke
9050a52cc2 Move admin user form override into view 2018-07-13 09:04:41 +10:00
Maikel Linke
2032ed6328 Convert admin user edit form to haml 2018-07-13 09:04:41 +10:00
Maikel Linke
cb1dc6e657 Import admin user edit form from spree_auth_devise 2018-07-13 09:04:41 +10:00
Maikel Linke
23dd09a8fa Convert Spree view from erb to haml 2018-07-13 09:04:41 +10:00
Maikel Linke
652cc6e677 Import admin user edit view from spree_auth_devise
We would like to do some customisations and importing the whole file is
simpler and less error prone than using Spree's overrides.
2018-07-13 09:04:40 +10:00
Maikel Linke
97d1b5d7fe Add spec for creating users 2018-07-13 09:04:40 +10:00
Maikel
b65578fdc5 Merge pull request #2408 from mkllnk/cleanup-route
Remove impossible route
2018-07-13 09:01:33 +10:00
Maikel
0bd40f498a Merge pull request #2447 from mkllnk/update-translation-documentation
Move i18n locale doc to wiki and reference that
2018-07-12 10:07:39 +10:00
Maikel Linke
86f2d7a344 Remove impossible route
Hash fragments are not part of the http request and not sent to the
server. So the routes will never see a hash fragment which means that
this route is never used.
2018-07-12 10:05:08 +10:00
luisramos0
b302a1d03d added Enterprise registration exit message and moved step TYPE translations to a new structure on en.yml (test if transifex picks up the existing translations) 2018-07-12 08:53:06 +10:00
Pau Pérez Fabregat
8cec9d5723 Merge pull request #2451 from Matt-Yorkley/pr_categories
Add changelog category to PR template
2018-07-11 22:40:52 +02:00
Matt-Yorkley
056df62359 Add changelog category to PR template 2018-07-11 18:03:45 +01:00
Pau Pérez Fabregat
79b86a4885 Merge pull request #2448 from kristinalim/fix-broken_great_pr_link_in_contributing
Fix broken "making a great pull request" link in CONTRIBUTING.md
2018-07-11 13:19:17 +02:00
Kristina Lim
5508c6741f Fix broken "great-pr" link in CONTRIBUTING.md 2018-07-11 14:10:20 +08:00
Maikel Linke
24f77184cf Move i18n locale doc to wiki and reference that 2018-07-11 11:31:27 +10:00
Pau Pérez Fabregat
deb04c3075 Merge pull request #2444 from openfoodfoundation/transifex
Transifex
2018-07-10 12:12:05 +02:00
Maikel Linke
459057a7db Revert accidental copy and paste 2018-07-10 10:31:51 +10:00
Maikel
26c23887e2 Merge pull request #2276 from oeoeaio/subs-use-default-card
Subs: Use Default Card for Subscriptions
2018-07-10 10:22:58 +10:00
Maikel Linke
f9a3338755 Simplify serialiser with delegate 2018-07-10 10:01:18 +10:00
Maikel Linke
b478ef9fd0 Make admin serialiser specs runnable on their own 2018-07-10 09:59:00 +10:00
Transifex-Openfoodnetwork
15db5e1d50 Updating translations for config/locales/en_GB.yml 2018-07-09 20:23:01 +10:00
Rob Harrington
3dacd06b6b Reload order before sending emails to ensure state is up to date 2018-07-05 19:26:12 +10:00
Rob Harrington
0afa9fae8e Check authorisation before attempting to charge credit cards on order cycle close 2018-07-05 19:26:12 +10:00
Rob Harrington
4fd333bbaf Remove obsolete reference to credit_card from subscription serializer 2018-07-05 19:26:12 +10:00
Rob Harrington
a902af42a3 Update attribute that errors are added to from credit_card to payment_method 2018-07-05 19:26:12 +10:00
Rob Harrington
edde929ced Replace uses of #stub with #allow in Admin::CustomersController 2018-07-05 19:26:12 +10:00
Rob Harrington
4863f2b5b4 Remove unrequired credit_card_id field from subscriptions table 2018-07-05 19:26:12 +10:00
Rob Harrington
21c3f7d21c Remove unrequired #cards and #addresses actions from Admin::CustomerController 2018-07-05 19:26:12 +10:00
Rob Harrington
e0d46aa105 Add new serializer to allow search for customer addresses 2018-07-05 19:26:12 +10:00
Rob Harrington
c71a5ec0df Update subscription form to use new card validations for Stripe payment method 2018-07-05 19:26:11 +10:00
Rob Harrington
a03dd1e10c Serialize default card auth and presence for Customers 2018-07-05 19:26:11 +10:00
Rob Harrington
21c24eb69b Validate presence and auth of default card for customer 2018-07-05 19:26:11 +10:00
Rob Harrington
cf8ca1f8c1 Add show action to Admin::CustomersController 2018-07-05 19:26:11 +10:00
Rob Harrington
45895e9924 Use the user's default card to pay for subcriptions 2018-07-05 19:26:11 +10:00
Rob Harrington
fc2844a3d5 Add default_card method to user model 2018-07-05 19:26:11 +10:00
Frank West
09534b41e9 Remove taxon when primary taxon is changed
We are adding taxons to the product as you change the primary taxon.
However we never remove the previous primary taxon so it forces the user
to update the taxons manually. This can be a big problem if you are bulk
updating products.

We now remove the taxon that matches the previously set primary taxon.
2018-07-04 09:16:50 +10:00
Rob Harrington
82e3016a26 Add comment to StripeGateway wrapper methods indicating that they are named by Spree 2018-07-03 14:21:58 +10:00
Rob Harrington
2da6234362 Add spec for StripeGateway#refund 2018-07-03 14:21:58 +10:00
Rob Harrington
c496d0f14d Allow credit owed on payments made via stripe to be refunded via the admin section 2018-07-03 14:21:58 +10:00
Rob Harrington
108c4a7abb Add GETTING_STARTED.md and update README.md 2018-06-28 22:11:33 +10:00
Maikel
687612dba8 Merge pull request #2403 from luisramos0/hide-stripe-postcode
Hide postcode - not necessary as passed from billing address and wrec…
2018-06-28 08:55:42 +10:00
Maikel Linke
b7de80dd7f Remove unused count_on_hand setting from spec
This spec doesn't need to set the product's `count_on_hand`. The product
comes with a count of 3, but what matters is the count of variants.
2018-06-27 11:41:55 +10:00
Maikel Linke
306bfa1944 Remove unused method enterprise method
`Enterprise.has_supplied_products_on_hand?` is not used anywhere.
2018-06-27 11:25:44 +10:00
Maikel Linke
792701297b Remove unused scope Enterprise.active_distributors
Working on the Spree upgrade, we found that this scope is using the soon
obsolete column `spree_products.count_on_hand`. Trying to measure the
impact of changing this scope, I couldn't find any use of it.

There is a variable called `active_distributors` used when serialising
enterprises, but that variable is initialised with
`Enterprise.distributors_with_active_order_cycles.ready_for_checkout`,
not using the `active_distributors` scope.

See also:
https://github.com/openfoodfoundation/openfoodnetwork/issues/2013
2018-06-27 11:12:54 +10:00
Maikel
eb9064f5be Merge pull request #2383 from frank-west-iii/issue-2271-prepend-load
Fix NoMethodError in order cycles index
2018-06-27 09:12:18 +10:00
Maikel
f5346289c7 Merge pull request #2388 from Matt-Yorkley/uk/pi_available_on
Add available_on notes to PI guide
2018-06-26 17:58:39 +10:00
Maikel
3f334855d1 Merge pull request #2360 from oeoeaio/faster-stats
Rewrite user stat query for improved performance of homepage
2018-06-26 17:58:23 +10:00
Maikel
e9fad741e6 Merge pull request #2387 from Matt-Yorkley/embedded_referrers
Embedded response headers
2018-06-26 17:57:48 +10:00
Rob Harrington
ddb9ae1140 Load all shops that a user is associated with as a customer
Regardless of the presence of an order
2018-06-24 16:28:47 +10:00
luisramos0
0d9b03b066 Hide postcode - not necessary as passed from billing address and wrecks mobile UX 2018-06-22 11:42:50 +01:00
Rob Harrington
5e6291bce3 Don't request customers if list is already populated 2018-06-22 15:39:47 +10:00
Rob Harrington
d1d9c5a092 Add help button to saved cards list on account page
Describes the purpose of the default card
2018-06-22 15:39:47 +10:00
Rob Harrington
7db7084008 Use help-modal to display help text for authorised shops
Also updated the text slightly to make it more clear when the purpose of authorised shops are
2018-06-22 15:39:47 +10:00
Rob Harrington
32622c77bc Add basic help modal directive
Useful for showing help text that is too long for a tool tip
2018-06-22 15:39:47 +10:00
Rob Harrington
6457a17fde Add basic view allowing customers to authorise shop use of their credit cards 2018-06-22 15:39:47 +10:00
Rob Harrington
ffa8a8c7d6 Create Api::BaseController to allow use of ActiveModelSerializers
Also add index action to Api::CustomersController
2018-06-22 15:39:47 +10:00
Rob Harrington
29922d4be9 Add allow_charges field to Customer model 2018-06-22 15:39:46 +10:00
Rob Harrington
6e76fd8164 Add Api::CustomersController with update action 2018-06-22 15:39:46 +10:00
Rob Harrington
e25574790b Split out float: right css from .help-btn.tiny selector 2018-06-22 15:39:46 +10:00
Keir Osborn
bd7e072938 embedded groups layout changes 2018-06-22 14:03:00 +10:00
Keir Osborn
f626a21c5e embedded groups initial test 2018-06-22 14:03:00 +10:00
Buildkite
964059f25b Merge remote-tracking branch 'origin/master' into HEAD 2018-06-22 02:41:15 +00:00
Buildkite
57dbf2e770 Merge remote-tracking branch 'origin/master' into HEAD 2018-06-22 00:59:28 +00:00
Rob Harrington
cf9f8edcce Allow html requests for OrderCycleController#update
This is still used from the Advanced Settings page, to update the order_cycle
2018-06-22 09:46:08 +10:00
Rob Harrington
25525ae30b Move applicator calls to OrderCycleForm 2018-06-22 09:46:08 +10:00
Rob Harrington
f88f4a5791 Refactor OrderCycleForm to make logic clearer 2018-06-22 09:46:08 +10:00
Rob Harrington
d9830749f1 Extract schedule syncing logic into OrderCycleForm 2018-06-22 09:46:08 +10:00
Rob Harrington
21bd9d2e10 Add basic specs for OrderCyclesController#create 2018-06-22 09:46:08 +10:00
Rob Harrington
ab9c06837b Add basic OrderCycleForm to handle create/update logic 2018-06-22 09:46:08 +10:00
Rob Harrington
3f5b6be5b6 Remove unnecessary respond_to blocks from OrderCyclesController 2018-06-22 09:46:08 +10:00
Matt-Yorkley
172fa168ea Change layout attribute to method with question mark 2018-06-21 15:19:40 +01:00
Matt-Yorkley
aaba6da162 Add available_on notes to PI guide 2018-06-21 14:20:59 +10:00
Matt-Yorkley
d9623176fb Include admin users as managers on new enterprises 2018-06-21 13:21:08 +10:00
Maikel Linke
d510df5236 Remove obsolete goWithoutHashFragments
It was introduced, because `Navigation.go` perserved hash fragments. We
actually don't need that behaviour and it has been corrected.

`goWithoutHashFragments` also didn't deal with absolute URLs. And it used
`location.origin` which is not supported by Internet Explorer. That is
fixed by our use of Modernizr though.
2018-06-21 10:29:32 +10:00
Maikel Linke
fb02bdd25a Simplify Navigation.go, not preserving hash fragments
I looked through the history and it looks like this function was a bit
flawed (preserving hash fragments) from the beginning. It has been
patched a few times without addressing the underlying issue that we want
more than just replacing the pathname. We want to go somewhere else.
2018-06-21 10:29:32 +10:00
Pau Pérez Fabregat
6cf09c936b Merge pull request #2345 from luisramos0/do-not-upcase-state
removed uppercase from state on shops and producers lists in the frontoffice
2018-06-20 21:30:10 +02:00
Matt-Yorkley
6e81871459 Specs for new EmbeddedPageService 2018-06-20 15:14:56 +01:00
Maikel
3399eba428 Merge pull request #2367 from frank-west-iii/issue-2297-edit-product-cancel
Move product bulk edit to product index route
2018-06-20 17:53:57 +10:00
Rob Harrington
a29a1bd047 Only show change warning for open order cycles 2018-06-20 16:28:36 +10:00
Rob Harrington
7af11da901 Use a SubscriptionsCount query object to provide counts to IndexOrderCycleSerializer 2018-06-20 13:06:06 +10:00
Rob Harrington
d5b1041481 Preload subscription counts for serialization in order cycle collection actions 2018-06-20 13:06:06 +10:00
Rob Harrington
8770122eae Request the subscription count for change warning each time, don't cache 2018-06-20 13:06:05 +10:00
Rob Harrington
86d7453d26 Ask user to confirm oc date change for open order cycles with subsciptions 2018-06-20 13:06:05 +10:00
Maikel Linke
bbe21b7804 Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into issue-2297-edit-product-cancel 2018-06-20 10:31:17 +10:00
Matt-Yorkley
ff0e0d9f3d Move logic from ApplicationController to service and improve clarity 2018-06-20 01:28:35 +01:00
Matt-Yorkley
e73b378201 Adjust embedded response headers 2018-06-20 01:28:35 +01:00
luisramos0
b8f1571282 added directive to make links open in new tab by default in textangular text areas in enterprise description, enterprise group description and in shopfront open and closed messages 2018-06-19 16:53:21 +01:00
Pau Pérez Fabregat
8da8a5a086 Merge pull request #2392 from openfoodfoundation/transifex
Transifex
2018-06-19 13:37:38 +02:00
Pau Pérez Fabregat
20c25cd030 Merge pull request #2368 from Matt-Yorkley/uk/admin_orders
Uk/admin orders
2018-06-19 11:00:35 +02:00
Frank West
3821b9e0da Fix ordering of Gemfile.lock
When we run bundle the gems are being reordered to be alphabetical.

Seems to have been committed on 26/05/2018 here:

7a64ad1cc1
2018-06-19 17:51:24 +10:00
Frank West
f7848b025f Add rack-rewrite to handle redirects
We are moving bulk edit to a different route and we want to be able to
handle redirects on this route. Handling this at the rack level before
the rails stack is the most performant way outside of rewrites on the
web server itself.
2018-06-19 17:51:23 +10:00
Frank West
8324b00999 Renames product bulk edit action to index
When a user hit cancel while editing a product it took them to the spree
products index page instead of the bulk edit page. The button was part
of a shared view for all resources so changing it's actions were not
readily available.

It was suggested that instead of carrying our own separate controller
action we could just override the index action of the products
controller with the bulk edit functionality instead. This has the
advantage of removing some overrides and allows us to not add
additional overrides in the future.
2018-06-19 17:51:23 +10:00
Pau Pérez Fabregat
3484996dbd Merge pull request #2335 from luisramos0/issue2334
Fixed missing translations on shops filter - delivery option
2018-06-19 09:34:13 +02:00
Pau Pérez Fabregat
236920d28f Merge pull request #2357 from luisramos0/enterprises_country_state
changed the country and state selectors to angular on enterprises admin
2018-06-19 09:30:24 +02:00
Pau Pérez Fabregat
b1bccb07f2 Merge pull request #2369 from coopdevs/product-import-for-superadmins-only
Show product import's UI only to superadmins
2018-06-19 09:23:58 +02:00
Transifex-Openfoodnetwork
55e619af8d Updating translations for config/locales/de_DE.yml 2018-06-19 10:59:37 +10:00
Rob Harrington
dabef16606 Use ofn-select2 directive for country and state selectors on enterprise forms 2018-06-19 10:34:02 +10:00
luisramos0
d1019fcc5e changed the country and state selectors to angular on enterprises admin (new and edit screens) so that states are dynamically updated when country is changed 2018-06-19 10:34:02 +10:00
Maikel
2bfb635bcc Merge pull request #2341 from luisramos0/checkout_country_state
fixed country_state selectors on checkout
2018-06-19 09:34:21 +10:00
Transifex-Openfoodnetwork
fe39d96e7f Updating translations for config/locales/fr_CA.yml 2018-06-19 05:48:59 +10:00
Frank West
f2e1caabff Fix NoMethodError in order cycles index
When a user's session has timed out and they try to load new data on the
order cycles page by changing filters, the application throws a
`NoMethodError` because we are prepending the load data method before
checking the user's session.

We can fix this by removing the prepend on this action.
2018-06-18 06:36:55 -07:00
Maikel
f272a7b604 Merge pull request #2361 from mkllnk/2356-report-search-hint
2356 report search hint
2018-06-18 14:51:48 +10:00
luisramos0
ea9ea83fee improved checkout country and state selectors code 2018-06-18 14:50:03 +10:00
luisramos0
3cb0b76d21 fixed checkout tests by replacing state abbr with name in address selector boxes 2018-06-18 14:50:03 +10:00
luisramos0
836a5836d9 fixed country_state selectors on checkout 2018-06-18 14:50:03 +10:00
Maikel Linke
b7770510a7 Use CSS for layout 2018-06-18 11:08:58 +10:00
Maikel Linke
67c2574b0b Show report search instructions
Solves: https://github.com/openfoodfoundation/openfoodnetwork/issues/2356
2018-06-18 11:08:58 +10:00
Maikel Linke
7a2218fe26 Style the reports controller 2018-06-18 11:08:58 +10:00
Maikel Linke
6243640bca Unify sales tax report rendering with others 2018-06-18 11:08:58 +10:00
Maikel Linke
66567fd9e6 Unify report table rendering
There is a lot of code duplication in the report views and we would like
to change that code. So we move it into one file first.
2018-06-18 11:08:58 +10:00
Maikel
86ff24b43c Merge pull request #2386 from frank-west-iii/fix-ssl-errors-specs
Set the SSL protocol for secure connections
2018-06-18 08:45:31 +10:00
Frank West
0d7352813c Set the SSL protocol for secure connections
There are ssl errors when using stripe through phantom js. This allows
other SSL protocols now.
2018-06-15 11:43:26 -07:00
Rob H
61f303ced2 Merge pull request #2373 from oeoeaio/fix-import-date-filter
Reimplement import date filter as an actual Filter
2018-06-15 16:53:22 +10:00
Rob Harrington
d0f8e9fba6 Reimplement import date filter as an actual Filter 2018-06-15 11:31:47 +10:00
Maikel
46f5f5061a Merge pull request #2377 from mkllnk/2376-fix-paypal-redirects
Pass on redirect path instead of URL
2018-06-15 10:16:31 +10:00
Maikel Linke
561a73e911 Pass on redirect path instead of URL
Fixes https://github.com/openfoodfoundation/openfoodnetwork/issues/2376

The checkout doesn't deal with absolute URLs since
fc2cc09ea5.
2018-06-14 16:49:52 +10:00
Pau Pérez Fabregat
24c6b940f6 Merge pull request #2370 from openfoodfoundation/transifex
Transifex
2018-06-13 12:03:34 +02:00
Rob Harrington
c72a2fda91 Use placed_at state to determine whether to remove orphaned proxy orders 2018-06-13 13:46:11 +10:00
Rob Harrington
d9ddad554e Prevent proxy_orders for active or complete order cycles from being removed automatically by ProxyOrderSyncer 2018-06-13 13:46:11 +10:00
Rob Harrington
ac309ffaf5 Rename obsolete_proxy_orders to orphaned_proxy_orders 2018-06-13 13:46:11 +10:00
Maikel
51bbf64b10 Merge pull request #2363 from oeoeaio/update-contributors
Update contributors list in the README
2018-06-13 11:11:29 +10:00
Matt-Yorkley
ea0d24a5bf Re-word test names for clarity 2018-06-12 13:20:00 +01:00
Transifex-Openfoodnetwork
644c2e8788 Updating translations for config/locales/nb.yml 2018-06-12 20:33:43 +10:00
Transifex-Openfoodnetwork
03fb5e7ccf Updating translations for config/locales/fr.yml 2018-06-12 20:03:03 +10:00
Transifex-Openfoodnetwork
6908635822 Updating translations for config/locales/pt.yml 2018-06-12 19:36:28 +10:00
Pau Perez
78e59d059a Show product import's UI only to superadmins
We still need to iterate on its implementation and it's too early to
make it publicly available.
2018-06-11 19:50:53 +02:00
Rob Harrington
56040685a0 Add Matt, Pau and Enrico to the contributors list on the README 2018-06-10 18:26:50 +10:00
Matt-Yorkley
c7f7541e2d Admin order customer details spec 2018-06-10 02:32:59 +01:00
Matt-Yorkley
d90e362e6f Remove guest checkout radio buttons from admin order view 2018-06-09 02:43:42 +01:00
Matt-Yorkley
7bef474efd Admin Order guest checkout status 2018-06-09 02:43:42 +01:00
Pau Pérez Fabregat
4c9dd4e8a1 Merge pull request #2349 from robotscissors/issue-2278-add-missing-image
Add image back into server for background
2018-06-08 19:12:01 +02:00
luisramos0
9e0732ceae removed uppercase from state on shops and producers lists in the frontoffice 2018-06-08 14:11:53 +01:00
Pau Pérez Fabregat
bb3ae976c6 Merge pull request #2364 from coopdevs/update-template
Ask devs to tell whether we should test on mobile
2018-06-08 14:37:16 +02:00
Pau Perez
fed60cf961 Ask devs to tell whether we should test on mobile 2018-06-08 10:01:04 +02:00
Pau Pérez Fabregat
b77091f87d Merge pull request #1969 from coopdevs/feature/do-not-upcase-state-abbr
Do not upcase State abbreviation
2018-06-08 08:36:55 +02:00
Rob Harrington
5cbc4cbf30 Use scoped keys for table headers in saved card partial 2018-06-08 15:30:08 +10:00
Rob Harrington
18c211e97c Ensure that savedCreditCards always exists 2018-06-08 15:30:08 +10:00
Rob Harrington
6a202d9446 Use more descriptive name for after_save callback method: :ensure_single_default_card 2018-06-08 15:30:08 +10:00
Rob Harrington
5dbf98f39b Use exists? method to avoid unnecesary loading of credit card array 2018-06-08 15:30:07 +10:00
Rob Harrington
05e4d9007e Update card spec to make the initial roles of cards clearer 2018-06-08 15:30:07 +10:00
Rob Harrington
254f0db97c Automatically select the customer's default card in the checkout 2018-06-08 15:30:07 +10:00
Rob Harrington
e88e963b4c Alter cards interface to allow updating of default card 2018-06-08 15:30:07 +10:00
Rob Harrington
1327b9dc2c Add update method to CreditCardsController 2018-06-08 15:30:07 +10:00
Rob Harrington
d146d3714f Add callbacks to ensure a user always has a default credit card
(if any exist)
2018-06-08 15:30:01 +10:00
robotscissors
5c25e85d92 Create dark background on load 2018-06-07 21:53:17 -07:00
Rob Harrington
3619ec0dc8 Add is_default attribute to Spree::CreditCard model 2018-06-08 12:01:10 +10:00
Pau Pérez Fabregat
d4e0d14fe1 Merge pull request #2342 from openfoodfoundation/transifex
Transifex
2018-06-06 09:05:29 +02:00
Rob Harrington
4fa09639cb Rewrite user stat query for improved performance of homepage 2018-06-06 16:27:23 +10:00
Pau Pérez Fabregat
7ff7fe4891 Merge pull request #2122 from oeoeaio/subs-unplaced-fees
Subs: prevent fees from displaying in email when subscription order cannot be fulfilled
2018-06-06 07:57:18 +02:00
Maikel
9d2c1976e0 Merge pull request #2343 from mkllnk/2212-remove-report-default-filters
2212 remove report default filters
2018-06-06 12:19:47 +10:00
Maikel
494aeb9a14 Merge pull request #2348 from oeoeaio/fix-tabs
Provide specific tab widths for shop tabs when screen width > medium
2018-06-05 15:27:40 +10:00
Pau Pérez Fabregat
3283c5158b Merge pull request #1492 from Matt-Yorkley/uk/import2
Uk/import2
2018-06-04 09:56:36 +02:00
Pau Pérez Fabregat
cf77bb439a Merge pull request #2337 from Matt-Yorkley/uk/modal_fix
Fix guest checkout login modal
2018-06-04 09:56:00 +02:00
Pau Pérez Fabregat
ed116867d4 Merge pull request #2322 from luisramos0/issue1913
Fixed issue #1913 with expand/collapse of list of producers of a shop
2018-06-04 09:55:40 +02:00
Rob Harrington
fed0a81159 Add an optional link to Skylight dashboard to footer 2018-06-02 11:55:28 +10:00
Rob Harrington
e3ea60fda5 Process proxy orders even if underlying subscription has been paused or cancelled 2018-06-01 16:57:56 +10:00
robotscissors
65e13c2a2d add image back into server for background 2018-05-30 20:42:31 -07:00
Rob Harrington
8201da9fab Prodide specific tab widths for shop tabs when screen width > medium 2018-05-30 17:05:31 +10:00
Rob Harrington
184bf9ce36 Allow super admin users to enable subscriptions for enterprises 2018-05-30 09:42:03 +10:00
Rob Harrington
16211da5f6 Reimplement tabs on shopfront using our custom tab directive 2018-05-30 08:35:21 +10:00
Maikel
cb19643b3a Merge pull request #2332 from oeoeaio/1938-oc-switch
Correct 'Next Order Closing' text in shopfront when switching OCs
2018-05-30 08:28:23 +10:00
Maikel
cee2f76406 Merge pull request #2299 from frank-west-iii/issue-1832-phone-shopfront
Add phone number to shopfront contact info
2018-05-30 08:27:07 +10:00
Maikel
32ef507221 Merge pull request #2318 from luisramos0/issue2307
Fixed broken translation keys in "new order cycle" screen
2018-05-29 17:38:04 +10:00
Maikel
603c88a93c Merge pull request #2317 from luisramos0/issue2308
Added missing translation key for no results in admin orders page
2018-05-29 17:37:26 +10:00
Maikel
307132d1f7 Merge pull request #2298 from frank-west-iii/issue-953-ent-description-formatting
Fix enterprise description display formatting
2018-05-29 17:36:47 +10:00
Maikel Linke
e6ef43c91d Give a spec some style 2018-05-29 16:55:30 +10:00
Maikel Linke
54bdcf7679 Convert specs to RSpec 3.7.0 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/lib/open_food_network/xero_invoices_report_spec.rb

* 15 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

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

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

* 3 conversions
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-05-29 16:53:18 +10:00
Maikel Linke
72ae6f2af6 Add spec helper to make spec run on its own 2018-05-29 16:49:00 +10:00
Maikel Linke
02c4795640 Remove default dates from reports
Closes https://github.com/openfoodfoundation/openfoodnetwork/issues/2212
2018-05-29 16:47:23 +10:00
Transifex-Openfoodnetwork
6d450aeae2 Updating translations for config/locales/pt.yml 2018-05-29 14:53:01 +10:00
Transifex-Openfoodnetwork
d1e9d52acd Updating translations for config/locales/fr.yml 2018-05-29 14:51:07 +10:00
Matt-Yorkley
b440d05205 Tidy up unnecessary PI code 2018-05-26 19:34:20 +01:00
Matt-Yorkley
a4a2bc438a Import settings spec 2018-05-26 19:34:20 +01:00
Matt-Yorkley
a503b5e2d0 Add not_master scope to Spree::Variant 2018-05-26 19:34:20 +01:00
Matt-Yorkley
91521dc2b0 Improve import_date queries 2018-05-26 19:34:20 +01:00
Matt-Yorkley
6f6db9384f Tidy up SCSS and coffeescript 2018-05-26 19:34:20 +01:00
Matt-Yorkley
d9c720e89a Tidy up import_date 2018-05-26 19:34:20 +01:00
Matt-Yorkley
73f7bc3db0 Remove use of before_filter 2018-05-26 19:34:20 +01:00
Matt-Yorkley
e65bdf35fa Change wording on default import settings text 2018-05-26 19:34:20 +01:00
Matt-Yorkley
c5b7cec19f Change checkbox confirmation behaviour 2018-05-26 19:34:20 +01:00
Matt-Yorkley
58e9f0266a User guide check 2018-05-26 19:34:20 +01:00
Matt-Yorkley
b42e3eb2c9 Product Import Guide WIP 2018-05-26 19:34:20 +01:00
Matt-Yorkley
7da97be7d2 Create separate angular module 2018-05-26 19:34:20 +01:00
Matt-Yorkley
c2c42e1d9a Product Import refactor 2018-05-26 19:34:20 +01:00
Matt-Yorkley
11908f125e Fix flaky spec 2018-05-26 19:34:20 +01:00
Matt-Yorkley
1ed49d397e Refactor PI 2018-05-26 19:34:20 +01:00
Matt-Yorkley
1ff39b8df5 Fix altered translation key 2018-05-26 19:34:20 +01:00
Matt-Yorkley
7a64ad1cc1 Fix roo-xls version in Gemfile 2018-05-26 19:34:20 +01:00
Matt-Yorkley
3a6f316ede Codeclimate refactor 2018-05-26 19:34:20 +01:00
Matt-Yorkley
7c283d90db Spec adjustments 2018-05-26 19:34:19 +01:00
Matt-Yorkley
1c34ce6162 PI exception handling 2018-05-26 19:34:19 +01:00
Matt-Yorkley
b26bec45d6 Expanding PI specs
squash
2018-05-26 19:34:19 +01:00
Matt-Yorkley
6efd167400 PI inventories UX
Minor tweaks
2018-05-26 19:34:19 +01:00
Matt-Yorkley
678a2a365d Fix spec date to string issue 2018-05-26 19:34:19 +01:00
Matt-Yorkley
2ef63efe28 Tax and Shipping adjustments 2018-05-26 19:34:19 +01:00
Matt-Yorkley
fe01e8ede3 PI human-readable unit fields
Enhanced unit specs
2018-05-26 19:34:19 +01:00
Matt-Yorkley
02661d5c23 PI unit_value typecasting 2018-05-26 19:34:19 +01:00
Matt-Yorkley
e848957712 Clean up PI controller
Remove assignment

Tweak
2018-05-26 19:34:19 +01:00
Matt-Yorkley
b3c906b3a4 Product Import v3 with asynchronous processing
Fixed spec

Quick spec tweak
2018-05-26 19:34:19 +01:00
Matt-Yorkley
3a650dd8b3 Add roo-xls gem for Excel support 2018-05-26 19:34:19 +01:00
Matt-Yorkley
684b493fb3 PI translations 2018-05-26 19:34:19 +01:00
Matt-Yorkley
6e2de0d6ac PI refactoring 2018-05-26 19:34:19 +01:00
Matt-Yorkley
e76a818fde Update PI spec 2018-05-26 19:34:19 +01:00
Matt-Yorkley
ffbb67d480 PI inventories additions 2018-05-26 19:34:19 +01:00
Matt-Yorkley
4e97445655 PI inventories timestamps 2018-05-26 19:34:19 +01:00
Matt-Yorkley
a2a65a8900 PI inventories and overhaul 2018-05-26 19:34:19 +01:00
Matt-Yorkley
e362c2d867 PI timestamps 2018-05-26 19:34:19 +01:00
Matt-Yorkley
fc2cc09ea5 checkout redirect excludes angular path variables 2018-05-26 18:13:35 +01:00
luisramos0
533ae77234 Fixed missing translations on shops filter - delivery option 2018-05-25 23:46:44 +01:00
Pau Pérez Fabregat
e04141d797 Merge pull request #2291 from coopdevs/remove-producers-tab-from-dashboard
Remove producers tab from dashboard
2018-05-25 19:24:29 +02:00
Rob Harrington
17259b3269 Overwrite cached value for current_order_cycle when updating it
This ensures that the correct order cycle is rendered in the json response
2018-05-25 17:28:54 +10:00
Pau Pérez Fabregat
9d57beb33f Merge pull request #2305 from Matt-Yorkley/uk/domain_headers
Ensure domain in SSL header matches request with or without www prefix
2018-05-23 20:08:56 +02:00
luisramos0
d821664ee3 Fixed issue #1913 with expand/collapse of list of producers of a shop 2018-05-23 17:32:38 +01:00
luisramos0
a59d9cb670 Fixed broken translation keys in new order cycle screen 2018-05-23 13:12:56 +01:00
Luis Ramos
12232f552c Added missing translation key for no results in admin orders page 2018-05-22 21:00:03 +01:00
Pau Perez
2a3772dba0 Do not show icons for producer-enterprises
Payment and shipping methods don't apply to them.
2018-05-22 16:50:27 +02:00
Pau Perez
208e3bbadd Ensure non-distributors are listed in dashboard
We want to show all enterprises in a single list regardless of their
type.
2018-05-22 10:21:35 +02:00
Pau Perez
bd34f27ace Inline partials into enterprises view
Now there are no tabs in the dashboard so is pointless to refer to them
and to split in multiple partials.
2018-05-22 10:21:35 +02:00
Pau Perez
889199a525 Refactor Overview Controller to make it more clear
Assigns meaningful names to the boolean conditions to make it easier
to understand, breaks down the big and nested if/else and converts the
specs to RSpec 3.

Note the check `!spree_current_user.admin?` has been removed because
in admin/base_controller_decorator.rb `#authorize_admin` is already
called.
2018-05-22 10:21:35 +02:00
Pau Perez
51f3542a92 Remove no longer used Angular controller
There are no tabs to keep track of now.
2018-05-22 10:21:35 +02:00
Pau Perez
5a182e8e88 Remove enterprises producers tab from dashboard 2018-05-22 10:21:35 +02:00
Matt-Yorkley
c2934d3570 Ensure domain in SSL header matches request with or without www prefix 2018-05-21 17:50:34 +01:00
Frank West
f995a04ebf Add phone number to shopfront contact info 2018-05-18 14:05:28 -07:00
Frank West
b05b9747b8 Fix enterprise description display formatting
Removes `text-small` class from container and change container to `div`
instead of `p` for semantic differentiation.
2018-05-18 07:20:56 -07:00
Maikel Linke
d218a51d96 Test public instead of private method
Refactoring and styling the whole thing, possibly causing conflicts with
other pull requests.
2018-05-18 11:27:48 +10:00
Maikel Linke
57dd984512 Convert specs to RSpec 3.7.0 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/lib/open_food_network/order_and_distributor_report_spec.rb

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

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

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-05-18 11:27:48 +10:00
Maikel Linke
7f8f935017 Shorten module referencing 2018-05-18 11:27:48 +10:00
Maikel Linke
0fa9ca653e Move duplicate code into its own module 2018-05-18 11:27:48 +10:00
Maikel Linke
40b0a0bd5a Determine searching state by params, not request
We may want to use GET for searching or POST to display a certain report
type.
2018-05-18 11:27:48 +10:00
Maikel Linke
8a1a540f3d Clarify creating objects for test context 2018-05-18 11:27:48 +10:00
Maikel Linke
acee5da31b Remove unnecessary whitespace 2018-05-18 11:27:48 +10:00
Maikel Linke
8a4457e8e4 Give better names 2018-05-18 11:27:48 +10:00
Maikel Linke
63799b2cb1 Remove outdated comment 2018-05-18 11:27:48 +10:00
Maikel Linke
8e2aee71da Compile Order Cycle Management only on search 2018-05-18 11:27:48 +10:00
Maikel Linke
7a546087b2 Compile Packing report data only on search 2018-05-18 11:27:47 +10:00
Maikel Linke
1e80487afc Compile Order And Distributors only on search
And move most logic into the report class like the others.
2018-05-18 11:27:47 +10:00
Maikel Linke
53436024e2 Compile Orders & Fulfillment report only on search 2018-05-18 11:27:47 +10:00
Maikel Linke
feb33c3ca5 Compile Payments report only on search 2018-05-18 11:27:47 +10:00
Maikel Linke
bf74282e5f Compile Bulk Co-Op report only on search 2018-05-18 11:27:47 +10:00
Maikel Linke
5f9d239f19 Compile Products & Inventory report only on search 2018-05-18 11:27:47 +10:00
Maikel Linke
d464216027 Don't compile Sales Tax report data before search 2018-05-18 11:27:47 +10:00
Maikel Linke
983e128d90 Half test run time by loading less data
On my computer it took 3 seconds to load all four orders with all the
attached order cycles and enterprises.

Runtime before: 56.38 seconds
Runtime after:  25.14 seconds

This really speeds up developing reports.
2018-05-18 11:27:47 +10:00
Maikel Linke
b8ca37e9d2 Don't compile xero report data before search 2018-05-18 11:27:47 +10:00
Maikel Linke
14e7cdd138 Don't compile customers report data before search
Distributors, suppliers and order cycles are still loaded for the search
form.
2018-05-18 11:27:47 +10:00
Maikel Linke
8393b1d4c0 Don't compile user-enterprises report before search 2018-05-18 11:27:47 +10:00
Maikel Linke
fcd41c67fa Add logic for showing empty reports initially 2018-05-18 11:27:47 +10:00
Maikel Linke
031c4d417e Simplify report rendering 2018-05-18 11:27:47 +10:00
Maikel Linke
41bb5e4e96 Unify report rendering 2018-05-18 11:27:47 +10:00
Maikel Linke
28d66ad3e0 Activate dormant specs
It looks like a typo prevented a bunch of specs from being run.
2018-05-18 11:27:47 +10:00
Maikel Linke
5aef7031d2 Convert specs to RSpec 3.7.0 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/features/admin/reports_spec.rb

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

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

* 3 conversions
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-05-18 11:27:46 +10:00
Maikel Linke
682b92e617 Avoid deprication warning for using stub 2018-05-18 11:27:46 +10:00
Maikel Linke
99a6afd9cd Convert specs to RSpec 3.7.0 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/controllers/spree/admin/reports_controller_spec.rb

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

* 14 conversions
    from: obj.should_not
      to: expect(obj).not_to

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

* 4 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 2 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-05-18 11:27:46 +10:00
Maikel Linke
f3d542a3ec Fix style and spelling 2018-05-18 11:27:46 +10:00
Maikel Linke
36b5f0eea7 Render only displayed report options 2018-05-18 11:27:46 +10:00
Maikel Linke
742e9d2a5f Remove more code duplication 2018-05-18 11:27:46 +10:00
Maikel Linke
6a52ca8113 Remove code duplication 2018-05-18 11:27:46 +10:00
Maikel
4df9a0afa2 Merge pull request #2272 from rtrunkhill/620-error-message-tweak
changed error message in en.yml line 2207
2018-05-18 11:19:45 +10:00
Maikel
48b9536621 Merge pull request #2268 from stveep/1213-back-empties-cart
Set response headers to disable cache - to avoid back button emptying…
2018-05-18 10:54:05 +10:00
stveep
6efc0ab802 Set response headers to disable cache - to avoid back button emptying cart (#1213) 2018-05-18 09:57:32 +10:00
Maikel
b15f4de921 Merge pull request #2270 from mkllnk/2265-update-active-merchant
Update activemerchant to v1.78 with new root cert
2018-05-18 09:54:15 +10:00
Rory Trunkhill
5706cecf26 modify enterprise eror name message #620 2018-05-17 18:10:35 +00:00
Pau Pérez Fabregat
e356d712c4 Merge pull request #2288 from frank-west-iii/issue-2182-confirm-first-user
Confirm first user when seeding database
2018-05-16 08:51:12 +02:00
Maikel Linke
585bba0e23 Update activemerchant to v1.78 with new root cert
Fixes https://github.com/openfoodfoundation/openfoodnetwork/issues/2265.

Most changes are in gateways we don't use, I believe. There has been a
change in Stripe, but we use another implementation, I guess.
2018-05-15 16:48:03 +10:00
Pau Pérez Fabregat
a28fa441c5 Merge pull request #2282 from openfoodfoundation/transifex
Transifex
2018-05-15 08:24:39 +02:00
Maikel
1b371e6388 Merge pull request #2249 from mkllnk/upgrade-rubocop-config
Upgrade Rubocop config to be compatible with 0.55
2018-05-15 16:19:38 +10:00
Maikel Linke
7c68ac9d0c Wait for dialog to appear before using it
Travis was failing a few times. This should make the spec more robust.
2018-05-15 15:00:18 +10:00
Frank West
91351c3f78 Confirm first user when seeding database
Currently the first user is not confirmed until running the task
`openfoodnetwork:dev:load_sample_data`. This task does not need to be
run on a minimum implementation of a new server or development setup.

We now confirm the first user during seeding. This could be the default
email address or the user entered email address entered during seeding.
2018-05-14 15:30:04 -07:00
Buildkite
f2e07419a8 Merge remote-tracking branch 'origin/master' into HEAD 2018-05-11 03:37:13 +00:00
Matt-Yorkley
495f932069 Authentication service class description 2018-05-11 12:05:27 +10:00
Matt-Yorkley
74689afb8a Unregistered user checkout issue 2018-05-11 12:05:27 +10:00
Matt-Yorkley
d3344973b7 checkout_controller clarity 2018-05-11 12:05:27 +10:00
Matt-Yorkley
9841f27f92 Add missing key for devise message 2018-05-11 12:05:27 +10:00
Matt-Yorkley
0741b5fa58 Ensure checkout modal opens at correct height 2018-05-11 12:05:27 +10:00
Maikel Linke
45fc42723c Simplify query for existing email
It should be easier to read and more efficient now.
2018-05-11 12:05:27 +10:00
Maikel Linke
fe979b801f Improve readability by grouping depending logic 2018-05-11 12:05:27 +10:00
Matt-Yorkley
358edb4727 Disable guest checkout in model 2018-05-11 12:05:27 +10:00
Matt-Yorkley
6b2c4de20f Tidy up checkout spec 2018-05-11 12:05:27 +10:00
Matt-Yorkley
94b90b4a73 Registered user controller method spec 2018-05-11 12:05:27 +10:00
Matt-Yorkley
598677be3f Disable guest checkout for registered users 2018-05-11 12:05:26 +10:00
Daniel Dominguez
4551fa60c5 Lowercase tag when adding a tag to the array, as they are lowercased after at the database level,
there is no point to display them with uppercase letters on the view.
2018-05-11 11:16:58 +10:00
Maikel Linke
7caf166768 Updates pulled from Transifex 2018-05-10 09:42:34 +10:00
Transifex-Openfoodnetwork
48217a54b9 Updating translations for config/locales/es.yml 2018-05-09 22:58:59 +10:00
Maikel Linke
8a3244513f Run Codeclimate with new rubocop 2018-05-08 15:29:04 +10:00
Maikel Linke
fcb9d1411f Exclude file that rubocop fails to parse 2018-05-08 15:19:44 +10:00
Maikel Linke
21b96c63af Update cop naming 2018-05-08 14:52:13 +10:00
Maikel Linke
10d3abeaac Upgrade Rubocop to the latest version 2018-05-08 14:46:57 +10:00
Steven Lawson
fd3e0d885b Closes issue 1926, Changed package screen text from choose your starting point to choose your package 2018-05-07 17:15:55 -06:00
Pau Pérez Fabregat
98985d7211 Merge pull request #2266 from dan1d/upgrade-to-factory-bot
Switched gem FactoryGirl to FactoryBot as FactoryGirl is deprecated.
2018-05-07 15:22:12 +02:00
Daniel Dominguez
9d9a974295 Switched gem FactoryGirl to FactoryBot as FactoryGirl is deprecated.
- Change FactoryGirl to FactoryBot everywhere on code.
2018-05-04 11:52:08 -03:00
Pau Pérez Fabregat
501ad8107d Merge pull request #2264 from coopdevs/exclude-js-libs-from-codeclimate
Exclude shared JS libs from CodeClimate
2018-05-03 16:53:45 +02:00
Pau Pérez Fabregat
8713bacfab Merge pull request #2260 from coopdevs/improve-report
Improve order_and_distributor report's readability
2018-05-03 16:52:16 +02:00
Pau Perez
dd14915209 Exclude shared JS libs from CodeClimate
CodeClimate is raising issues from code that we don't own and won't
touch thus, causing false negatives.
2018-05-03 13:56:19 +02:00
Pau Perez
5da9b55cdd Improve order_and_distributor report's readability 2018-05-02 12:26:42 +02:00
Pau Pérez Fabregat
21ebb5849c Merge pull request #2258 from mkllnk/2254-invite-manager-flow
Fix initial password setting
2018-05-02 08:48:36 +02:00
Pau Pérez Fabregat
b2301190af Merge pull request #2259 from mkllnk/remove-heroku
Remove Heroku references since nobody is using it
2018-05-02 08:43:51 +02:00
Maikel Linke
c597b3c377 Speed-up spec 2018-05-01 14:40:05 +10:00
Maikel Linke
7b06abd4c2 Fix initial password setting 2018-05-01 14:18:56 +10:00
Maikel Linke
de5124f90c Remove Heroku references since nobody is using it 2018-05-01 10:20:21 +10:00
Pau Pérez Fabregat
d238aedb21 Merge pull request #2224 from coopdevs/minor-upgrade-rails
Upgrade Rails to 3.2.22.5 to get security fixes
2018-04-27 12:46:26 +02:00
Matt-Yorkley
a08b095547 Extract json render from :user_confirmed? method 2018-04-27 12:37:42 +10:00
Matt-Yorkley
1c57f0f241 Update :return_url value when re-sending email confirmations 2018-04-27 12:37:42 +10:00
Matt-Yorkley
1f23402912 Disable password reset for unconfirmed users 2018-04-27 12:37:42 +10:00
Matt-Yorkley
1782a8c700 manager invite permissions spec 2018-04-27 10:13:54 +10:00
Matt-Yorkley
b431a7417a Add cancan permissions for Admin::ManagerInvitationsController 2018-04-27 10:13:54 +10:00
Enrico Stano
6ae1780180 Merge pull request #2248 from coopdevs/upgrade-rubyzip
Update rubyzip to fix security issue
2018-04-26 14:50:10 +02:00
Pau Pérez Fabregat
1abf56efd5 Merge pull request #2246 from coopdevs/autofix-comment-indentation
Autofix comment indentation
2018-04-25 15:39:34 +02:00
Pau Perez
c12ac91371 Update rubyzip to fix security issue
Github reported us about CVE-2017-5946 which is a high severity issue.

This gem is used by Roo which already supports the Rubyzip version that
contains the fix (version 1.2.1). Check
872bb3a0b6
for further details.

Rubyzip's changelog for the version 1.2.1 can be found in
https://github.com/rubyzip/rubyzip/blob/master/Changelog.md#121.
2018-04-24 16:08:34 +02:00
Pau Perez
25ad9b22aa Update .rubocop_todo.yml 2018-04-23 13:03:05 +02:00
Pau Perez
11081ab1d6 Autocorrect Rubocop's Layout/CommentIndentation cop 2018-04-23 12:51:09 +02:00
Maikel Linke
3fc49d5935 Simplify code 2018-04-23 12:55:49 +10:00
Matt-Yorkley
cd4268d219 Add manager dropdown UX 2018-04-23 12:55:49 +10:00
Rob Harrington
c77a01815c Copy datepicker directive to utils module
Ensures that datepicker is available for subscriptions
2018-04-23 11:05:22 +10:00
Pau Pérez Fabregat
386716088a Merge pull request #2190 from Matt-Yorkley/uk/bep_images_modal
Use angular translation filter on image upload modal
2018-04-20 16:22:53 +02:00
Pau Pérez Fabregat
9a75728b6e Merge pull request #2231 from coopdevs/add-image-for-wiki
Add image to be used in Spree upgrade wiki page
2018-04-20 09:26:17 +02:00
Pau Perez
ef3ef2d4f3 Upgrade Rails to 3.2.22.5 to get security fixes
This will fix reported vulnerabilities CVE-2015-7576, CVE-2016-2098
(reported as high severity), CVE-2016-0751 and CVE-2015-7577.
2018-04-17 20:56:51 +02:00
Pau Perez
cd9d13cb2a Add images to be used in Spree upgrade wiki page 2018-04-17 20:55:42 +02:00
Pau Pérez Fabregat
89bc9380eb Merge pull request #2232 from coopdevs/skip-feature-spec-until-fixed
Disable totally unreliable feature test
2018-04-17 20:54:20 +02:00
Pau Perez
9f06d1f809 Disable totally unreliable feature
We need to investigate why it fails so many times fix it and then enable it
back. As it is, it brings cons than pros preventing even PRs that don't
touch code from being merged.
2018-04-17 19:22:03 +02:00
Pau Pérez Fabregat
ac37b0fc7e Merge pull request #2221 from Matt-Yorkley/uk/bep_images_ux
Close modal when image updated successfully
2018-04-17 18:05:20 +02:00
Pau Pérez Fabregat
1abfe2ab8c Merge pull request #2199 from coopdevs/auto-correct-cops
Auto correct cops
2018-04-16 14:58:28 +02:00
Pau Pérez Fabregat
b1fc15f242 Merge pull request #2223 from openfoodfoundation/transifex
Transifex
2018-04-16 13:43:40 +02:00
Pau Pérez Fabregat
fc7dd5d081 Merge pull request #2222 from coopdevs/upgrade-skylight
Upgrade to latest Skylight from 1.6.0 to 1.6.1
2018-04-16 11:38:23 +02:00
Pau Perez
2aea612f10 Upgrade to latest Skylight from 1.6.0 to 1.6.1 2018-04-16 10:52:15 +02:00
Pau Perez
147a74f005 Fix Rubocop violations reported by Code Climate 2018-04-16 10:27:44 +02:00
Rob Harrington
6a71aafce1 Update totals for empty order before sending email 2018-04-16 17:07:07 +10:00
Rob Harrington
f5e77cdcec Ensure order total for uplaced subscription orders is zero 2018-04-16 17:07:07 +10:00
Rob Harrington
50ffd7ca01 Clear adjustments on subs orders when no items are able to be fulfilled
This prevents shipping and payment fees from being displayed in the notification email
2018-04-16 17:07:07 +10:00
Matt-Yorkley
37ba1e6c83 Close modal when image updated successfully 2018-04-15 20:52:25 +01:00
Matt-Yorkley
5777d04821 Use angular translation filter on image upload modal 2018-04-15 17:08:16 +01:00
Pau Pérez Fabregat
514ad5d898 Merge pull request #2208 from coopdevs/performance-monitoring-badge
Add Skylight's performance monitoring badge
2018-04-13 08:45:30 +02:00
Pau Perez
5822e60a66 Add Skylight's performance monitoring badge
Adding the badge, which points now to Katuma's performance monitoring
information, is required for Skylight to showcase OFN on their website.
2018-04-12 09:29:40 +02:00
Transifex-Openfoodnetwork
ce2a7a510f Updating translations for config/locales/en_US.yml 2018-04-11 00:06:55 +10:00
Pau Perez
394fb91dd5 Auto correct Rubocop's Layout/MultilineArrayBraceLayout cop 2018-04-09 18:47:18 +02:00
Pau Perez
1640d5ad0b Auto correct Rubocop's Layout/IndentHeredoc cop 2018-04-09 18:47:18 +02:00
Pau Perez
76fe1c7ee9 Auto correct Rubocop's Layout/IndentAssignment cop 2018-04-09 18:47:18 +02:00
Pau Perez
33ea2c0b07 Auto correct Rubocop's Layout/FirstParameterIndentation cop 2018-04-09 18:47:18 +02:00
Pau Perez
f5a5d735fd Auto correct Rubocop's Layout/EmptyLinesAroundModuleBody cop 2018-04-09 18:47:18 +02:00
Pau Perez
6593dea4f6 Auto correct Rubocop's Layout/EmptyLinesAroundMethodBody cop 2018-04-09 18:47:17 +02:00
Pau Perez
3161fa3801 Auto correct Rubocop's Layout/EmptyLinesAroundExceptionHandlingKeywords cop 2018-04-09 18:47:17 +02:00
Pau Perez
746fcd5802 Auto correct Rubocop's Layout/EmptyLinesAroundAccessModifier cop 2018-04-09 18:47:17 +02:00
Pau Perez
9da33b4e82 Auto correct Rubocop's Layout/EmptyLinesAroundAccessModifier cop
This also `script/rubocop_autocorrect` to automate the process of fixing
a cop and comitting the changes.
2018-04-09 18:46:11 +02:00
Pau Perez
e876ef7df1 Auto correct Rubocop's Layout/ClosingParenthesisIndentation cop 2018-04-09 17:22:52 +02:00
Pau Perez
e4c86df7b2 Auto correct Rubocop's Layout/CaseIndentation cop 2018-04-09 17:19:47 +02:00
Transifex-Openfoodnetwork
15945fa1e0 Updating translations for config/locales/fr.yml 2018-04-05 04:48:54 +10:00
Transifex-Openfoodnetwork
ad898848f8 Updating translations for config/locales/pt.yml 2018-04-05 04:29:49 +10:00
Rob Harrington
236ba9328d Order cycles in specs comply with new date validations 2018-04-04 17:18:33 +10:00
Rob Harrington
ce56e667a4 Use union operator instead of concatenate to load order cycle collection 2018-04-04 17:18:33 +10:00
Rob Harrington
b17d8c2fe3 Add validation of open and close dates for order cycles 2018-04-04 17:18:32 +10:00
Rob Harrington
b14f27f956 Return an error if no order_cycle_set params are submitted to #bulk_update action 2018-04-04 17:17:36 +10:00
Rob Harrington
18f7ec992d Refactor loading of OrderCycleSet in OrderCyclesController
This should result in a significant speed bump in saving order cycles in bulk, because only referenced OCs are loaded into the set, rather than OrderCycle.all
2018-04-04 17:17:36 +10:00
stveep
46d2d6cb8a Include option text in dropdown cart even if the variant and product have the same name 2018-04-04 16:40:18 +10:00
Maikel Linke
a2e4c33922 Remove old and useless sentence from welcome email
The sentence made assumptions of the availability of FAQs and support
forums without linking to them. So it didn't really help. It also
promised that someone would monitor the support page in the forum which
nobody seems to do.
2018-04-04 16:21:39 +10:00
Matt-Yorkley
101269a487 Adjust wording on manager invite email 2018-04-04 15:49:04 +10:00
Maikel
61fbdfcefc Merge pull request #2178 from HugsDaniel/2172_flexi_rate_miscalculated
Fixing flexible rate miscalculation
2018-04-04 15:47:33 +10:00
Hugo Daniel
2a942da160 Use rspec context 2018-04-04 14:58:48 +10:00
Hugo Daniel
bd97d08653 Remove stub after test and create two distinct calculators 2018-04-04 14:58:47 +10:00
Hugo Daniel
68ca352510 Use rspec expect syntax 2018-04-04 14:58:47 +10:00
Hugo Daniel
a71b650f89 Added tests 2018-04-04 14:58:47 +10:00
Hugo Daniel
f40bd9cfcb Fixing wrong incrementation 2018-04-04 14:58:47 +10:00
Hugo Daniel
843bca9ea3 Updated calculation for flexible rate 2018-04-04 14:58:46 +10:00
Maikel Linke
80da0d5330 Set enterprise form dirty on any change
Commit 4953c69123 introduced a bug that
the save button is not activated when changing enterprise fields.
https://github.com/openfoodfoundation/openfoodnetwork/issues/2195

This is reverting the change and fixes #2195.
Sadly, it re-opens
https://github.com/openfoodfoundation/openfoodnetwork/issues/1216.
But that one is not as severe as the current bug.
2018-04-04 13:36:03 +10:00
Hugo Daniel
5ec89dde42 Update test sentences to fit new PriceSack behavior 2018-04-04 11:25:26 +10:00
Hugo Daniel
213456f4d9 Moved PriceSack tests from per item list to per order 2018-04-04 11:25:26 +10:00
Hugo Daniel
14ea591c7d Removed redundant self 2018-04-04 11:25:25 +10:00
Hugo Daniel
28009afbea Calculate price sack fees and tests 2018-04-04 11:25:25 +10:00
Matt-Yorkley
357ff5fb7d Improve associating customer specs 2018-04-04 10:14:55 +10:00
Matt-Yorkley
5f2e72e3d4 Private shop spec 2018-04-04 10:14:55 +10:00
Em-AK
3b5c3f41a2 Ensure created users are associated with customers
When a user is created with the same email as existing customers
Then the user is associated with these customers

So that the user can access the private shops where he has been invited
to before signup
2018-04-04 10:14:55 +10:00
Rob Harrington
a83bdf16c9 Add error message for case when schedule cannot be deleted 2018-04-04 09:21:52 +10:00
Maikel
f9dbf61afc Merge pull request #2176 from HugsDaniel/2002_calculator_options_not_translated
Overwrites spree_i18n translations for calculator's options
2018-04-04 08:17:18 +10:00
Pau Pérez Fabregat
15bd0de971 Merge pull request #2194 from wrycoder/spec-deprecation-fix
Replacing deprecated #ignore with #transient
2018-04-03 18:53:04 +02:00
Pau Pérez Fabregat
87329ad729 Merge pull request #2092 from ltrls/fix-tax-admin-order-show
Fix incorrect tax on Admin Order Show
2018-04-03 08:36:10 +02:00
Hugo Daniel
6731dd0b64 Overwrites spree_i18n translations for entreprise fees calculator's options 2018-04-03 08:38:00 +10:00
Michael Toulouse
0519269a53 Replacing deprecated #ignore with #transient 2018-04-02 06:40:12 -04:00
Pau Pérez Fabregat
1357c7c3b5 Merge pull request #2185 from coopdevs/remove-in-stock-dead-scope
Remove in_stock dead scope
2018-03-28 13:16:02 +02:00
Pau Perez
0cbd967007 Remove in_stock dead scope
This makes the upgrade to Spree 2.0 a bit easier.
`spree_variants.count_on_hand` is removed in that version and this
column was used in the `in_stock` scope that we no longer use.
2018-03-28 12:13:34 +02:00
Pau Pérez Fabregat
7fbaff71c7 Merge pull request #2179 from coopdevs/ignore-vendor-bundle
Ignore Bundler's vendor/bundle
2018-03-28 11:29:56 +02:00
Pau Pérez Fabregat
9f6b3498bd Merge pull request #2177 from coopdevs/upgrade-delayed-job
Upgrade delayed_job_active_record from 4.0.2 to 4.1.2
2018-03-27 17:45:33 +02:00
Pau Pérez Fabregat
0b9881b9d3 Merge pull request #2168 from openfoodfoundation/transifex
Update translations with current Transifex version
2018-03-27 17:16:10 +02:00
Transifex-Openfoodnetwork
348364814d Updating translations for config/locales/es.yml 2018-03-28 02:11:09 +11:00
Pau Perez
e8d8d5b0e6 Ignore Bundler's vendor/bundle 2018-03-27 16:56:58 +02:00
Pau Pérez Fabregat
dbf647f700 Merge pull request #1981 from Duende13/su_issue_1936
Added 'meta_keywords' to search of products
2018-03-27 14:27:40 +02:00
Hugo Daniel
ef2b0b8383 Added tooltips and locale 2018-03-27 15:21:12 +11:00
duende13
f75b865be8 Made changes requested by reviewer, in labels and tests. 2018-03-27 15:21:11 +11:00
duende13
7670d01c6d Changing SEO tab to 'Search' tab 2018-03-27 15:21:11 +11:00
duende13
61300a62c2 Added 'meta_keywords' to search of products in shop page. Changed labels
on SEO tab and SEO form (edit product Screen) and added in en.yml file.
2018-03-27 15:21:11 +11:00
Transifex-Openfoodnetwork
a3fa6db5a9 Updating translations for config/locales/de_DE.yml 2018-03-26 21:38:21 +11:00
Pau Perez
dae883c68d Upgrade dj_active_record from 4.0.2 to 4.1.2
This brings few styling improvements on dlayed_job_active_record but
also upgrades delayed_job from 4.0.4 to 4.1.4, which includes some fixes
and improved error messages.
2018-03-26 12:32:25 +02:00
Pau Pérez Fabregat
808f7b12c7 Merge pull request #2175 from coopdevs/upgrade-skylight
Upgrade Skylight from 1.5.1 to 1.6.0
2018-03-26 12:12:46 +02:00
Pau Perez
82c9cdd874 Upgrade Skylight from 1.5.1 to 1.6.0 2018-03-26 11:13:29 +02:00
Transifex-Openfoodnetwork
a257febc79 Updating translations for config/locales/fr.yml 2018-03-26 20:06:24 +11:00
Pau Pérez Fabregat
17b129ff4f Merge pull request #2079 from mjal/424cart-page-shouldnt-show-admin-handling-if-it-is-zero
Cart page shouldnt show admin handling if it is zero
2018-03-23 18:01:09 +01:00
Pau Pérez Fabregat
6ce552727b Merge pull request #2118 from oeoeaio/payment-summary-for-emails
Show payment summary in confirmation email regardless of payment method
2018-03-23 15:30:44 +01:00
Pau Pérez Fabregat
dadc02fb11 Merge pull request #2030 from lin-d-hop/uk/1663variant-order-emails
Uk/1663variant order emails
2018-03-23 15:29:05 +01:00
Pau Pérez Fabregat
bbd2427493 Merge pull request #2075 from mjal/2001translations-missing-in-order-management-pages
i18n for admin/orders
2018-03-23 15:27:55 +01:00
Pau Pérez Fabregat
82457d2b63 Merge pull request #2138 from Matt-Yorkley/email/manager_invite
Email/manager invite
2018-03-23 15:27:14 +01:00
Pau Pérez Fabregat
9e14186431 Merge pull request #2149 from oeoeaio/subs-remove-fields
Subs: Remove obsolete subscription fields from order cycles table
2018-03-23 15:12:32 +01:00
Pau Pérez Fabregat
d422283b76 Merge pull request #2128 from mkllnk/2113-i18n-config
2113 Display only selected languages in switcher
2018-03-23 15:06:47 +01:00
Pau Pérez Fabregat
13115d4a2d Merge branch 'master' into email/manager_invite 2018-03-23 12:56:10 +01:00
Pau Pérez Fabregat
1005c299a2 Merge pull request #1464 from Matt-Yorkley/uk/bep_images
Uk/bep_images
2018-03-23 12:40:16 +01:00
Pau Pérez Fabregat
3788ec590f Merge pull request #2166 from coopdevs/configure-mails-from
Configure mails_from
2018-03-23 12:19:31 +01:00
Pau Pérez Fabregat
7dd23d20c8 Merge pull request #2160 from coopdevs/fix-enterprise-filter-in-customers
Fix enterprise filter in customers
2018-03-23 08:25:21 +01:00
stveep
231dd7b6a2 Add some rubocop spaces 2018-03-23 17:37:50 +11:00
stveep
8a783bbb7d PR changes: extract SQL in methods to scopes, add case insensitivity to test for sorting 2018-03-23 17:37:50 +11:00
stveep
9375318c4b Codeclimate: remove empty line 2018-03-23 17:37:50 +11:00
stveep
dc76b3922b Add sorting to query for producer mailer 2018-03-23 17:37:50 +11:00
stveep
40506685ef Adding extra sort step for variant name; ignore case in sorting line items by name 2018-03-23 17:37:50 +11:00
Duende13
f5ad950bc3 Change Syntax from :variant => :product to variant: :product 2018-03-23 17:37:50 +11:00
Duende13
ba37db7ccc Refactoring test to adopt most Rspec syntax (expect instead of should) 2018-03-23 17:37:50 +11:00
Duende13
401052be68 Fix Robcop issues (blank spaces and indentation) 2018-03-23 17:37:50 +11:00
Duende13
330e7d71af Sort line items by name and unit_value for confirmation email and summary screen 2018-03-23 17:37:50 +11:00
Maikel Linke
94cc8bb980 Update translations with current Transifex version
Since our Transifex integration has a few flaws, there are many
translations that are not in the code yet. This imports everything, even
translation files that are not at 100%.
2018-03-23 12:55:29 +11:00
Pau Perez
2c588847df Pick from_address from MailMethod as in Spree
Spree::Config[] picks it up from AppConfiguration rather than MailMethod
and so, gets a value different from the one configured.
2018-03-22 18:36:41 +01:00
Pau Perez
3c36d2d1a6 Remove failing mails_from default
As example.com is not a verified domain, Mandrill rejects the email
giving "reject_reason": "unsigned". Also, the mails_from setting is
already defined as a MailMethod preference.
2018-03-22 13:02:57 +01:00
Pau Pérez Fabregat
fa9d61c7fd Merge pull request #2165 from coopdevs/upgrade-skylight
Upgrade Skylight from 1.5.0 to 1.5.1
2018-03-22 09:56:35 +01:00
Pau Pérez Fabregat
92b5f9a313 Merge pull request #2127 from mkllnk/fix-scss
Remove typo from SCSS
2018-03-22 09:41:11 +01:00
Maikel Linke
9588138eb0 Remove typo
Accidentally introduced in febe66b7b0.
2018-03-22 14:18:55 +11:00
Pau Perez
d8dd84e64e Fix enterprise filter in customers page
Angular's filter function uses a pattern object to filter specific
properties on objects contained by the array. We want an exact match
instead, which has to be done by means of a function.
2018-03-21 19:16:14 +01:00
Pau Perez
ae1831241b Upgrade SKylight from 1.5.0 to 1.5.1 2018-03-21 18:41:21 +01:00
Pau Pérez Fabregat
91f30d5427 Merge pull request #2148 from coopdevs/sample-mail-method
Setup mail method automatically
2018-03-21 15:10:56 +01:00
Enrico Stano
3ce7bc54e3 Merge pull request #2143 from Matt-Yorkley/email/enterprise_user_ui
Fix enterprise user unsaved changes
2018-03-20 16:43:40 +01:00
Pierre de Lacroix
28bb15f4a9 Fix old rspec syntax 2018-03-20 12:21:27 +01:00
Pierre de Lacroix
e0b12b1332 Remove dependency on model method in feature test 2018-03-20 12:18:54 +01:00
Pierre de Lacroix
2ceecc3d6e Test Order#tax_adjustment_totals with taxed adjustment on order 2018-03-20 12:18:51 +01:00
Pierre de Lacroix
03de6c690c Fix incorrect tax amount on Admin Order #show
by calling Order#tax_adjustment_totals from
Order#price_adjustment_totals
2018-03-20 12:18:09 +01:00
Pau Perez
977c8f6203 Stick to setup+execution+assertion order in tests 2018-03-20 12:07:10 +01:00
Matt-Yorkley
1600067383 Redirect to set password page after invite 2018-03-16 17:32:40 +00:00
Matt-Yorkley
3fad51d271 Clearer angular method naming 2018-03-16 17:32:40 +00:00
Matt-Yorkley
5f0075f8b7 Refactor to use new REST resource 2018-03-16 17:32:38 +00:00
Pau Perez
716e952117 Add mail setting's env vars for development 2018-03-16 13:33:55 +01:00
Pau Perez
092122969c Make mail env vars mandatory 2018-03-16 13:33:21 +01:00
Pau Perez
f27a624687 Create the mail method from db:seed
As opposed the to sample users and enterprises that ease testing and
development, the mail method is needed for the app to function in any
environment.
2018-03-16 13:33:21 +01:00
Pau Perez
7afc999689 Differentiate MAIL_DOMAIN from plain DOMAIN
This way we can have katuma.org as the mail domain and
staging.katuma.org as web domain.
2018-03-16 13:33:20 +01:00
Pau Perez
4fc66356cb Create always a mail method from sample_data
This sets the email config so that mails can be sent right away.
2018-03-16 13:33:20 +01:00
Pau Perez
a7f1ed660b Add service to create a mail method
This will make loading sample data into staging environments easier.
2018-03-16 13:33:20 +01:00
Rob Harrington
9840467b8a Remove obsolete subscription fields from order cycles table 2018-03-16 14:55:22 +11:00
Maxime Lalisse
fa68dd0bcc refactor spec and check price 2018-03-16 01:18:21 +01:00
Rob Harrington
4d757dde78 Show payment summary in confirmation email regardless of payment method 2018-03-16 10:55:56 +11:00
Matt-Yorkley
f3f18d8338 Cleaner routes.rb entry 2018-03-15 18:48:47 +00:00
Matt-Yorkley
128ca3b1ef Invite manager specs 2018-03-15 18:48:47 +00:00
Matt-Yorkley
b64327fbb3 Invite enterprise manager functionality 2018-03-15 18:48:47 +00:00
Matt-Yorkley
5c6624e1d1 Tidy up setDirty() calls in enterprise_controller.js 2018-03-15 12:58:05 +00:00
Matt-Yorkley
4953c69123 Fix enterprise user unsaved changes 2018-03-14 23:04:54 +00:00
Maikel Linke
01dc51c84b Consistent reference of the source locale 2018-03-13 10:25:31 +11:00
Maikel Linke
64063f305b Describe methods of I18nConfig 2018-03-13 10:24:42 +11:00
Maikel Linke
db61a2bb17 Parse available language string more relaxed
Splitting the string with any whitespace makes it more likely the code
knows what the human meant. It also makes `strip` obsolete, since there
can't be any whitespace within the splitted strings.
2018-03-09 19:41:49 +11:00
Maikel Linke
8017921e89 Use I18nConfig in views 2018-03-09 17:45:04 +11:00
Maikel Linke
3743cf1bc3 Use I18nConfig for application defaults 2018-03-09 17:45:03 +11:00
Maikel Linke
7a34c6e3f0 Introduce I18nConfig as single point of truth
It will be used in application.rb and views.
See https://github.com/openfoodfoundation/openfoodnetwork/issues/2113
2018-03-09 17:45:03 +11:00
Matt-Yorkley
fdc14ab44e Add controller specs 2018-02-14 15:37:22 +00:00
Matt-Yorkley
8a11dc3c33 Decouple image upload from Spree 2018-02-14 13:46:05 +00:00
Matt-Yorkley
23deb37876 Save/Update product image test 2018-02-14 13:46:05 +00:00
Matt-Yorkley
526317c373 BEP Image upload specs 2018-02-14 13:46:05 +00:00
Matt-Yorkley
7d27d1325e Bulk Edit image upload
Image Upload Translations

Squashme

Squashme

Squashme

Code review tweaks
2018-02-14 13:46:05 +00:00
Matt-Yorkley
24dca5e51f Add image column to product bulk edit 2018-02-14 13:46:05 +00:00
jtruong2
689aed7080 Add spec for admin & handling 2018-02-12 15:53:28 +01:00
jtruong2
6c92fdf167 fixes issue if admin and handling == 0 then do not render row 2018-02-12 15:53:19 +01:00
Maxime Lalisse
aef73aef38 Add translation keys 2018-02-09 22:15:02 +01:00
Maxime Lalisse
11eda94949 Add i18n for admin/orders 2018-02-09 17:40:31 +01:00
Maxim Colls
5db1559f28 Fixed spec to use unuppercased states 2018-02-07 13:35:50 +11:00
Maxim Colls
09f98307f4 Do not upcase State abbreviation 2018-02-07 13:35:50 +11:00
1133 changed files with 60633 additions and 19171 deletions

View File

@@ -2,9 +2,16 @@ version: "2"
plugins:
rubocop:
enabled: true
channel: "rubocop-0-48"
channel: "rubocop-0-57"
config:
file: ".rubocop_styleguide.yml"
scss-lint:
enabled: false
enabled: true
checks:
ImportantRule:
enabled: false
VendorPrefix:
enabled: false
duplication:
enabled: true
exclude_patterns:
@@ -14,7 +21,7 @@ checks:
argument-count:
enabled: false
complex-logic:
enabled: true
enabled: false
file-lines:
enabled: false
method-complexity:
@@ -24,13 +31,15 @@ checks:
method-lines:
enabled: false
nested-control-flow:
enabled: true
enabled: false
return-statements:
enabled: true
enabled: false
similar-code:
enabled: true
enabled: false
identical-code:
enabled: true
enabled: false
exclude_patterns:
- "spec/**/*"
- "vendor/**/*"
- "app/assets/javascripts/shared/*"
- "app/assets/javascripts/jquery-migrate-1.0.0.js"

View File

@@ -1,21 +1,28 @@
<!--- If what you want to file is not a bug, please use the [Feature
template](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-template)
instead -->
<!-- Provide a general summary of the issue in the Title above.
<!--- Provide a general summary of the issue in the Title above -->
If your issue is not a bug, please use the Feature template instead:
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-template
-->
## Description
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
<!-- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
## Expected Behavior
<!--- Tell us what should happen -->
<!-- Tell us what should happen -->
## Actual Behavior
<!--- Tell us what happens instead -->
<!-- Tell us what happens instead -->
## Steps to Reproduce
<!--- Provide an unambiguous set of steps to reproduce this bug -->
<!--- Include code to reproduce, if relevant -->
<!-- Provide an unambiguous set of steps to reproduce this bug -->
<!-- Include code to reproduce if relevant -->
1.
2.
3.
@@ -25,18 +32,35 @@ instead -->
<!-- Provide a screenshot or brief animated gif reproducing the bug. Linux users can use
[Peek](https://github.com/phw/peek#ubuntu) while Mac users can use [Recordit](http://recordit.co/) -->
## Context
<!--- How has this bug affected you? What were you trying to accomplish? -->
<!-- How has this bug affected you? What were you trying to accomplish? -->
## Severity
<!--- Use the [Bug severity
guideline](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity) to assign one to this bug -->
<!-- Assign a label and explain the impact.
bug-s1: a critical feature is broken: checkout, payments, signup, login
bug-s2: a non-critical feature is broken, no workaround
bug-s3: a feature is broken but there is a workaround
bug-s4: it's annoying, but you can use it
bug-s5: we can live with it, only a few users impacted
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity
-->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
<!-- Include relevant details about the environment you experienced the bug in -->
* Version used:
* Browser name and version:
* Operating System and version (desktop or mobile):
## Possible Fix
<!--- Not obligatory, but suggest a fix or reason for the bug -->
<!-- Not obligatory, but suggest a fix or reason for the bug -->

61
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,61 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
## Description
<!-- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
## Expected Behavior
<!-- Tell us what should happen -->
## Actual Behaviour
<!-- Tell us what happens instead -->
## Steps to Reproduce
<!-- Provide an unambiguous set of steps to reproduce this bug -->
<!-- Include code to reproduce if relevant -->
1.
2.
3.
4.
## Animated Gif/Screenshot
<!-- Provide a screenshot or brief animated gif reproducing the bug. Linux users can use
[Peek](https://github.com/phw/peek#ubuntu) while Mac users can use [Recordit](http://recordit.co/) -->
## Context
<!-- How has this bug affected you? What were you trying to accomplish? -->
## Severity
<!-- Assign a label and explain the impact.
bug-s1: a critical feature is broken: checkout, payments, signup, login
bug-s2: a non-critical feature is broken, no workaround
bug-s3: a feature is broken but there is a workaround
bug-s4: it's annoying, but you can use it
bug-s5: we can live with it, only a few users impacted
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity
-->
## Your Environment
<!-- Include relevant details about the environment you experienced the bug in -->
* Version used:
* Browser name and version:
* Operating System and version (desktop or mobile):
* OFN Platform instance where you discovered the bug, and which version of the software they are using.
## Possible Fix
<!-- Not obligatory, but suggest a fix or reason for the bug -->

View File

@@ -0,0 +1,35 @@
---
name: Feature template
about: Create feature epics that detail the larger feature or functionality to be
delivered.
title: ''
labels: ''
assignees: ''
---
## What is the problem we are solving
<!-- Describe the problem this feature is supposed to solve. Should be described in the icebox item (in Discourse). -->
## Success factors = expected outcome
<!-- Describe what is the expected outcome: when the feature is released, what would it look like? What will make you say "the problem is solved"? Can be metrics like "Platform has less than 1% service interruption", or yes/no statements like "People can checkout on mobiles. -->
## Useful information for inception
<!-- List here any information that can be useful for the inception stage. -->
## Link to the "Product Development - Backlog" item in Discourse
<!-- Put the link here, and put this epic link in the Discourse item as well for cross-referencing. -->
Add a custom footer
Pages 70
Home
Development environment setup
macOS (Sierra, HighSierra and Mojave)
OS X (El Capitan)
OS X (Mavericks)
Ubuntu
On Heroku
Rubocop
General guidelines
Spree Commerce customisation

View File

@@ -0,0 +1,18 @@
---
name: Story template
about: Create stories that are small chunks of work that devs will pick up and deliver
title: ''
labels: ''
assignees: ''
---
## Description
<!-- Describe the story in detail:
**- As a:** (enterprise user, super admin, user...)
**- On page:** (provide url of the page you want to modify. If not provide where will be created the new url and the name we want to give it)
**- I want to be able to do:** (specify the desired behavior)
(Link to others issues or resources to provide context > only if really necessary). -->
## Acceptance Criteria
<!-- Document the outcomes that need to be achieved before this component can be considered complete. -->

View File

@@ -0,0 +1,21 @@
---
name: Tech debt template
about: File a refactoring task that aids future development
title: ''
labels: tech debt
assignees: ''
---
### What we should change and why (this is tech debt)
<!-- The use of X changed and part y is now redundant. We can remove it and... -->
### Context
<!-- This came up in PR #3451#issuecomment-461616636. -->
### Impact and timeline
<!-- Example: This simplifies the upgrade to Spree 3 and should be done after upgrading to Spree 2. -->

View File

@@ -2,29 +2,46 @@
Closes #[the issue number this PR is related to]
[Explain why is this change needed and the solution you propose. Provide
context for others to understand it]
<!-- Explain why this change is needed and the solution you propose.
Provide context for others to understand it. -->
#### What should we test?
<!-- List which features should be tested and how. -->
[List which features should be tested and how]
#### Release notes
<!-- Write a line or two to be included in the release notes.
Everything is worth mentioning, because you did it for a reason. -->
[In case this should be present in the release notes, please write them or
remove this section otherwise]
<!-- Please assign one category to your PR and delete the others.
The categories are based on https://keepachangelog.com/en/1.0.0/. -->
Changelog Category: Added | Changed | Deprecated | Removed | Fixed | Security
#### How is this related to the Spree upgrade?
<!-- Any known conflicts with the Spree Upgrade?
Explain them or remove this section. -->
[Any known conflicts with the Spree Upgrade? explain them or remove this section
otherwise]
#### Discourse thread
<!-- Is there a discussion about this in Discourse?
Add the link or remove this section. -->
[Is there a discussion about this in Discourse? add the link if so or remove
this section otherwise]
#### Dependencies
<!-- Does this PR depend on another one?
Add the link or remove this section. -->
#### Documentation updates
<!-- Are their any wiki pages that need updating after merging this PR?
List them here or remove this section. -->
[Does this PR depend on another one? add the link of so or remove this section
otherwise]

7
.gitignore vendored
View File

@@ -32,8 +32,6 @@ public/stylesheets
public/images
public/spree
config/abr.yml
config/heroku_env.rb
config/newrelic.yml
config/initializers/feature_toggle.rb
config/initializers/db2fog.rb
NERD_tree*
@@ -41,3 +39,8 @@ coverage
libpeerconnection.log
/config/application.yml
node_modules
vendor/bundle/
coverage
/reports/
!/reports/README.md
bin/

View File

@@ -1,4 +0,0 @@
--format Fuubar
--format ParallelTests::RSpec::SummaryLogger --out tmp/spec_summary.log
--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log
--tag ~performance

View File

@@ -1,191 +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
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
- !ruby/regexp /old_and_unused\.rb$/
# 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
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
# 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/TrailingCommaInLiteral:
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:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
# A manually compiled todo list to ignore metrics violations on a file-by-file basis.
- .rubocop_manual_todo.yml

757
.rubocop_manual_todo.yml Normal file
View File

@@ -0,0 +1,757 @@
# 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/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_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_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
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

215
.rubocop_styleguide.yml Normal file
View File

@@ -0,0 +1,215 @@
# 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
Exclude:
- engines/order_management/app/services/order_management/reports/enterprise_fee_summary/scope.rb
Metrics/ModuleLength:
Max: 100
Metrics/CyclomaticComplexity:
Max: 6
Metrics/MethodLength:
Max: 10
Exclude:
- engines/order_management/app/services/order_management/reports/enterprise_fee_summary/scope.rb
Metrics/ParameterLists:
Max: 5
Metrics/PerceivedComplexity:
Max: 7

File diff suppressed because it is too large Load Diff

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,7 +39,8 @@ before_script:
script:
- 'if [ "$KARMA" = "true" ]; then bundle exec rake karma:run; else echo "Skipping karma run"; fi'
- "bundle exec rake 'knapsack:rspec[--tag ~performance]'"
- '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

@@ -1,28 +1,17 @@
# Contributing
We love pull requests from everyone. Any contribution is valuable, but there are two issue streams that we especially love people to work on:
1) Our delivery backlog, is managed via a ZenHub board (ZenHub extensions are available for most major browsers). We use a Kanban-style approach, whereby devs pick issues from the top of the backlog which has been organised according to current priorities. If you have some time and are interested in working on some issues from the backlog, please make yourself known on the [#dev](https://openfoodnetwork.slack.com/messages/C2GQ45KNU) channel on Slack and we can direct you to the most appropriate issue to pick up.
1) Our delivery backlog, is managed via a ZenHub board (ZenHub extensions are available for most major browsers). We use a Kanban-style approach, whereby devs pick issues from the top of the backlog which has been organised according to current priorities. If you have some time and are interested in working on some issues from the backlog, please make yourself known on the [#dev][slack-dev] channel on Slack and we can direct you to the most appropriate issue to pick up.
2) Our list of bugs and other self-contained issues that we consider to be a good starting point for new contributors, or devs who arent able to commit to seeing a whole feature through. These issues are marked with the `# good first issue` label.
## Set up
Set up your local development environment by following the appropriate guide from the `Development environment setup` section in the [developer wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
Please follow the [GETTING_STARTED](GETTING_STARTED.md) guide to set up your local dev environment.
Add an `upstream` remote that points to the main repo:
This guide assumes that the git remote name of the main repo is `upstream` and that your fork is named `origin`.
cd ~/location-of-your-local-ofn-repo
git remote add upstream https://github.com/openfoodfoundation/openfoodnetwork
If you haven't already done so, fork this repo using the `Fork` button in the top-right corner of this screen. Then ensure that your fork is listed as the `origin` remote on your local machine.
git remote set-url origin https://github.com/your-username/openfoodnetwork
Fetch the latest version of `master` from `upstream` (ie. the main repo):
git fetch upstream master
Create a new branch on your local machine for (based on `upstream/master`):
Create a new branch on your local machine to make your changes against (based on `upstream/master`):
git checkout -b branch-name-here --no-track upstream/master
@@ -30,6 +19,10 @@ If you want to run the whole test suite, we recommend using a free CI service to
bundle exec rspec spec
## Internationalisation (i18n)
The locale `en` is maintained in the source code, but other locales are managed at [Transifex][ofn-transifex]. Read more about [internationalisation][i18n] in the developer wiki.
## Making a change
Make your changes to the codebase. We recommend using TDD. Add a test, make changes and get the test suite back to green.
@@ -47,7 +40,7 @@ Push your changes to a branch on your fork:
## Submitting a Pull Request
Use the GitHub UI to submit a [new pull request][pr] against upstream/master. To increase the chances that your pull request is swiftly accepted please have a look at our guide to [[making a great pull request]].
Use the GitHub UI to submit a [new pull request][pr] against upstream/master. To increase the chances that your pull request is swiftly accepted please have a look at our guide to [making a great pull request][great-pr].
TL;DR:
* Write tests
@@ -66,3 +59,6 @@ From here, your pull request will progress through the [Review, Test, Merge & De
[rebase]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing/workflow-walkthrough
[travis]: https://travis-ci.org/
[semaphore]: https://semaphoreci.com/
[slack-dev]: https://openfoodnetwork.slack.com/messages/C2GQ45KNU
[ofn-transifex]: https://www.transifex.com/open-food-foundation/open-food-network/
[i18n]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/i18n

128
GETTING_STARTED.md Normal file
View File

@@ -0,0 +1,128 @@
### Getting Started
This is a general guide to setting up an Open Food Network development environment on your local machine.
The following guides are located in the wiki and provide more OS-specific step-by-step instructions:
- [Ubuntu Setup Guide][ubuntu]
- [macOS Sierra Setup Guide][sierra]
- [OSX El Capitan Setup Guide][el-capitan]
### Dependencies
* Rails 3.2.x
* Ruby 2.1.5
* PostgreSQL database
* PhantomJS (for testing)
* See Gemfile for a list of gems required
If you are likely to need to manage multiple version of ruby on your local machine, we recommend version managers such as [rbenv](https://github.com/rbenv/rbenv) or [RVM](https://rvm.io/).
For those new to Rails, the following tutorial will help get you up to speed with configuring a [Rails environment](http://guides.rubyonrails.org/getting_started.html).
### Get it
If you're planning on contributing code to the project (which we [LOVE](CONTRIBUTING.md)), it is a good idea to begin by forking this repo using the `Fork` button in the top-right corner of this screen. You should then be able to use `git clone` to copy your fork onto your local machine.
git clone https://github.com/YOUR_GITHUB_USERNAME_HERE/openfoodnetwork
Jump into your new local copy of the Open Food Network:
cd openfoodnetwork
And then add an `upstream` remote that points to the main repo:
git remote add upstream https://github.com/openfoodfoundation/openfoodnetwork
Fetch the latest version of `master` from `upstream` (ie. the main repo):
git fetch upstream master
### Get it running
First, you need to create the database user the app will use by manually typing the following in your terminal:
```sh
$ 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. 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.
If you run into any other issues getting your local environment up and running please consult [the wiki][wiki].
If still you get stuck do not hesitate to open an issue reporting the full output of the script.
Now, your dreams of spinning up a development server can be realised:
bundle exec rails server
To login as Spree default user, use:
email: spree@example.com
password: spree123
### Testing
Tests, both unit and integration, are based on RSpec. To run the test suite, first prepare the test database:
bundle exec rake db:test:prepare
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:
./script/karma run
If you want karma to automatically rerun the tests on file modification, use:
./script/karma start
### Multilingual
Do not forget to run `rake tmp:cache:clear` after locales are updated to reload I18n js translations.
### Rubocop
The project is configured to use [rubocop][rubocop] to automatically check for style and syntax errors.
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%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

55
Gemfile
View File

@@ -2,16 +2,19 @@ source 'https://rubygems.org'
ruby "2.1.5"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'rails', '3.2.21'
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.2.1'
# Patched version. See http://rubysec.com/advisories/CVE-2015-5312/.
gem 'nokogiri', '>= 1.6.7.1'
gem "order_management", path: "./engines/order_management"
gem 'web', path: './engines/web'
gem 'pg'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '86bf87f1b1e1b299edc8cd10a2486e44ba0a3987'
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'
@@ -20,11 +23,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.1'
gem 'activemerchant', '~> 1.71.0'
gem 'stripe', '~> 4.9.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'
@@ -36,7 +41,6 @@ gem 'simple_form', github: 'RohanM/simple_form'
gem 'unicorn'
gem 'angularjs-rails', '1.5.5'
gem 'bugsnag'
gem 'newrelic_rpm'
gem 'haml'
gem 'sass', "~> 3.3"
gem 'sass-rails', '~> 3.2.3', groups: [:default, :assets]
@@ -45,9 +49,11 @@ gem 'aws-sdk'
gem 'db2fog'
gem 'andand'
gem 'truncate_html'
gem 'representative_view'
gem 'rabl'
gem "active_model_serializers"
# AMS is pinned to 0.8.4 because 0.9.x is a complete re-write, as is 0.10.x
# Once Rails is updated to 5.x we should bump directly to 0.10.x
gem "active_model_serializers", "0.8.4"
gem 'oj'
gem 'deface', github: 'spree/deface', ref: '1110a13'
gem 'paperclip'
@@ -56,22 +62,25 @@ gem 'geocoder'
gem 'gmaps4rails'
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'
gem 'foreigner'
gem 'immigrant'
gem 'roo', '~> 2.7.0'
gem 'roo-xls', '~> 1.1.0'
gem 'whenever', require: false
@@ -81,15 +90,14 @@ group :assets do
gem 'compass-rails'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer'
gem 'therubyracer', '=0.12.0'
gem 'uglifier', '>= 1.0.3'
gem 'turbo-sprockets-rails3'
gem 'foundation-icons-sass-rails'
gem 'momentjs-rails'
gem 'angular-rails-templates', '~> 0.2.0'
gem 'angular-rails-templates', '~> 0.3.0'
end
gem "foundation-rails"
@@ -97,22 +105,22 @@ gem 'foundation_rails_helper', github: 'willrjmarshall/foundation_rails_helper',
gem 'jquery-rails'
gem 'jquery-migrate-rails'
gem 'css_splitter'
gem 'ofn-qz', github: 'openfoodfoundation/ofn-qz', ref: '60da2ae4c44cbb4c8d602f59fb5fff8d0f21db3c'
group :test, :development do
# Pretty printed test output
gem 'fuubar', '~> 2.2.0'
gem 'fuubar', '~> 2.3.2'
gem 'rspec-rails', ">= 3.5.2"
gem 'shoulda-matchers'
gem 'factory_girl_rails', require: false
gem "factory_bot_rails", require: false
gem 'capybara', '>= 2.15.4'
gem 'database_cleaner', '0.7.1', require: false
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'
@@ -122,6 +130,7 @@ end
group :test do
gem 'webmock'
gem 'simplecov', require: false
# See spec/spec_helper.rb for instructions
#gem 'perftools.rb'
end
@@ -133,14 +142,16 @@ group :development do
gem 'guard'
gem 'listen', '3.0.8' # 3.1.0 requires ruby 2.2
gem 'guard-livereload'
gem 'rack-livereload'
gem 'guard-rails'
gem 'guard-rspec', '~> 4.7.3'
gem 'parallel_tests'
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: 86bf87f1b1e1b299edc8cd10a2486e44ba0a3987
ref: 86bf87f1b1e1b299edc8cd10a2486e44ba0a3987
revision: 41906362d931695e0616194341a68d2c4c85aaaf
ref: 41906362d931695e0616194341a68d2c4c85aaaf
branch: step-6a
specs:
spree (1.3.99)
@@ -133,16 +133,26 @@ GIT
activemodel (>= 3.0)
railties (>= 3.0)
PATH
remote: engines/order_management
specs:
order_management (0.0.1)
PATH
remote: engines/web
specs:
web (0.0.1)
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.2)
actionmailer (3.2.21)
actionpack (= 3.2.21)
CFPropertyList (2.3.6)
actionmailer (3.2.22.5)
actionpack (= 3.2.22.5)
mail (~> 2.5.4)
actionpack (3.2.21)
activemodel (= 3.2.21)
activesupport (= 3.2.21)
actionpack (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -150,25 +160,25 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
active_model_serializers (0.8.3)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
activemerchant (1.71.0)
activemerchant (1.78.0)
activesupport (>= 3.2.14, < 6.x)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
activemodel (3.2.21)
activesupport (= 3.2.21)
activemodel (3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
activerecord (3.2.21)
activemodel (= 3.2.21)
activesupport (= 3.2.21)
activerecord (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.21)
activemodel (= 3.2.21)
activesupport (= 3.2.21)
activesupport (3.2.21)
activeresource (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
acts-as-taggable-on (3.5.0)
@@ -177,18 +187,20 @@ GEM
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
andand (1.3.3)
angular-rails-templates (0.2.0)
angular-rails-templates (0.3.0)
railties (>= 3.1)
sprockets (~> 2)
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.3.0)
atomic (1.1.99)
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)
@@ -196,8 +208,9 @@ GEM
bcrypt (3.1.11)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
blockenspiel (0.4.5)
bugsnag (4.1.0)
blockenspiel (0.5.0)
bugsnag (6.11.1)
concurrent-ruby (~> 1.0)
builder (3.0.4)
byebug (9.0.6)
cancan (1.6.8)
@@ -208,10 +221,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.4)
climate_control (0.1.0)
cliver (0.3.2)
chunky_png (1.3.10)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
@@ -223,6 +240,8 @@ GEM
execjs
coffee-script-source (1.10.0)
colorize (0.8.1)
combine_pdf (1.0.16)
ruby-rc4 (>= 0.1.5)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@@ -235,29 +254,29 @@ GEM
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
compass-rails (2.0.4)
compass-rails (3.1.0)
compass (~> 1.0.0)
sass-rails (<= 5.0.1)
sprockets (< 2.13)
sass-rails (< 5.1)
sprockets (< 4.0)
concurrent-ruby (1.1.4)
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
css_splitter (0.4.5)
sprockets (>= 2.0.0)
daemons (1.2.2)
dalli (2.7.2)
daemons (1.3.1)
dalli (2.7.9)
database_cleaner (0.7.1)
db2fog (0.8.0)
activerecord (~> 3.0)
db2fog (0.9.0)
activerecord (>= 3.2.0, < 5.0)
fog (~> 1.0)
rails (~> 3.0)
rails (>= 3.2.0, < 5.0)
debugger-linecache (1.2.0)
delayed_job (4.0.4)
activesupport (>= 3.0, < 4.2)
delayed_job_active_record (4.0.2)
activerecord (>= 3.0, < 4.2)
delayed_job (>= 3.0, < 4.1)
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)
orm_adapter (~> 0.1)
@@ -266,41 +285,49 @@ 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)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.2.3)
excon (0.45.4)
execjs (2.6.0)
factory_girl (4.9.0)
eventmachine (1.2.7)
excon (0.62.0)
execjs (2.7.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
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.18)
figaro (0.7.0)
bundler (~> 1.0)
rails (>= 3, < 5)
ffi (1.10.0)
figaro (1.1.1)
thor (~> 0.14)
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (1.36.0)
fog (1.41.0)
fog-aliyun (>= 0.1.0)
fog-atmos
fog-aws (>= 0.6.0)
fog-brightbox (~> 0.4)
fog-core (~> 1.32)
fog-cloudatcost (~> 0.1.0)
fog-core (~> 1.45)
fog-digitalocean (>= 0.3.0)
fog-dnsimple (~> 1.0)
fog-dynect (~> 0.0.2)
fog-ecloud (~> 0.1)
fog-google (<= 0.1.0)
fog-internet-archive
fog-joyent
fog-json
fog-local
fog-openstack
fog-powerdns (>= 0.1.1)
fog-profitbricks
fog-rackspace
fog-radosgw (>= 0.0.2)
fog-riakcs
fog-sakuracloud (>= 0.0.4)
@@ -310,32 +337,47 @@ GEM
fog-terremark
fog-vmfusion
fog-voxel
fog-vsphere (>= 0.4.0)
fog-xenserver
fog-xml (~> 0.1.1)
ipaddress (~> 0.5)
nokogiri (~> 1.5, >= 1.5.11)
fog-aliyun (0.1.0)
fog-core (~> 1.27)
fog-json (~> 1.0)
json (>= 1.8, < 2.0)
fog-aliyun (0.3.2)
fog-core
fog-json
ipaddress (~> 0.8)
xml-simple (~> 1.1)
fog-atmos (0.1.0)
fog-core
fog-xml
fog-aws (0.7.6)
fog-core (~> 1.27)
fog-aws (2.0.1)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-brightbox (0.9.0)
fog-core (~> 1.22)
fog-brightbox (0.16.1)
dry-inflector
fog-core
fog-json
inflecto (~> 0.0.2)
fog-core (1.35.0)
mime-types
fog-cloudatcost (0.1.2)
fog-core (~> 1.36)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-core (1.45.0)
builder
excon (~> 0.45)
excon (~> 0.58)
formatador (~> 0.2)
fog-dynect (0.0.2)
fog-digitalocean (0.4.0)
fog-core
fog-json
fog-xml
ipaddress (>= 0.5)
fog-dnsimple (1.0.0)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-dynect (0.0.3)
fog-core
fog-json
fog-xml
@@ -346,20 +388,35 @@ GEM
fog-core
fog-json
fog-xml
fog-json (1.0.2)
fog-core (~> 1.0)
multi_json (~> 1.10)
fog-local (0.2.1)
fog-core (~> 1.27)
fog-powerdns (0.1.1)
fog-core (~> 1.27)
fog-json (~> 1.0)
fog-xml (~> 0.1)
fog-profitbricks (0.0.5)
fog-internet-archive (0.0.1)
fog-core
fog-json
fog-xml
nokogiri
fog-radosgw (0.0.4)
fog-joyent (0.0.1)
fog-core (~> 1.42)
fog-json (>= 1.0)
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.6.0)
fog-core (>= 1.27, < 3.0)
fog-openstack (0.1.25)
fog-core (~> 1.40)
fog-json (>= 1.0)
ipaddress (>= 0.8)
fog-powerdns (0.2.0)
fog-core
fog-json
fog-xml
fog-profitbricks (4.1.1)
fog-core (~> 1.42)
fog-json (~> 1.0)
fog-rackspace (0.1.6)
fog-core (>= 1.35)
fog-json (>= 1.0)
fog-xml (>= 0.1)
ipaddress (>= 0.8)
fog-radosgw (0.0.5)
fog-core (>= 1.21.0)
fog-json
fog-xml (>= 0.0.1)
@@ -367,13 +424,13 @@ GEM
fog-core
fog-json
fog-xml
fog-sakuracloud (1.4.0)
fog-sakuracloud (1.7.5)
fog-core
fog-json
fog-serverlove (0.1.2)
fog-core
fog-json
fog-softlayer (1.0.2)
fog-softlayer (1.1.4)
fog-core
fog-json
fog-storm_on_demand (0.1.1)
@@ -388,30 +445,33 @@ GEM
fog-voxel (0.1.0)
fog-core
fog-xml
fog-xenserver (0.2.2)
fog-vsphere (2.3.0)
fog-core
rbvmomi (~> 1.9)
fog-xenserver (0.3.0)
fog-core
fog-xml
fog-xml (0.1.2)
fog-xml (0.1.3)
fog-core
nokogiri (~> 1.5, >= 1.5.11)
foreigner (1.6.1)
nokogiri (>= 1.5.11, < 2.0.0)
foreigner (1.7.4)
activerecord (>= 3.0.0)
formatador (0.2.5)
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)
fuubar (2.2.0)
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)
@@ -430,8 +490,9 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
haml (4.0.4)
haml (4.0.7)
tilt
hashdiff (0.3.7)
highline (1.6.15)
hike (1.2.3)
http_parser.rb (0.6.0)
@@ -439,13 +500,13 @@ GEM
multi_json (~> 1.0)
multi_xml
i18n (0.6.11)
i18n-js (3.0.0)
i18n (~> 0.6, >= 0.6.6)
immigrant (0.1.6)
i18n-js (3.2.1)
i18n (>= 0.6.6)
immigrant (0.3.6)
activerecord (>= 3.0)
foreigner (>= 1.2.1)
inflecto (0.0.2)
ipaddress (0.8.0)
io-like (0.3.0)
ipaddress (0.8.3)
jaro_winkler (1.5.1)
journey (1.0.4)
jquery-migrate-rails (1.2.1)
jquery-rails (2.2.2)
@@ -455,180 +516,181 @@ GEM
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (1.5.4)
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 (3.16.14.11)
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)
mail (2.5.4)
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 (0.1.4)
mini_mime (1.0.1)
mini_portile2 (2.1.0)
momentjs-rails (2.5.1)
momentjs-rails (2.20.1)
railties (>= 3.1)
money (5.1.0)
i18n (~> 0.6.0)
multi_json (1.12.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nenv (0.3.0)
newrelic_rpm (3.12.0.288)
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 (2.1.2)
oj (3.7.10)
orm_adapter (0.5.0)
paper_trail (3.0.8)
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)
cocaine (~> 0.5.3)
mime-types
parallel (1.11.2)
parallel_tests (2.14.1)
parallel
parser (2.4.0.0)
ast (~> 2.2)
parser (2.5.1.0)
ast (~> 2.4.0)
paypal-sdk-core (0.2.10)
multi_json (~> 1.0)
xml-simple
paypal-sdk-merchant (1.106.1)
paypal-sdk-core (~> 0.2.3)
pg (0.13.2)
poltergeist (1.16.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
pg (0.21.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)
byebug (>= 9.0, < 9.1)
pry (~> 0.10)
public_suffix (3.0.0)
public_suffix (3.0.3)
rabl (0.7.2)
activesupport (>= 2.3.14)
multi_json (~> 1.0)
rack (1.4.7)
rack-cache (1.7.0)
rack-cache (1.8.0)
rack (>= 0.4)
rack-livereload (0.3.16)
rack
rack-mini-profiler (0.10.7)
rack (>= 1.2.0)
rack-rewrite (1.5.1)
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.21)
actionmailer (= 3.2.21)
actionpack (= 3.2.21)
activerecord (= 3.2.21)
activeresource (= 3.2.21)
activesupport (= 3.2.21)
rails (3.2.22.5)
actionmailer (= 3.2.22.5)
actionpack (= 3.2.22.5)
activerecord (= 3.2.22.5)
activeresource (= 3.2.22.5)
activesupport (= 3.2.22.5)
bundler (~> 1.0)
railties (= 3.2.21)
railties (= 3.2.22.5)
rails-i18n (3.0.1)
i18n (~> 0.5)
rails (>= 3.0.0, < 4.0.0)
railties (3.2.21)
actionpack (= 3.2.21)
activesupport (= 3.2.21)
railties (3.2.22.5)
actionpack (= 3.2.22.5)
activesupport (= 3.2.22.5)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rainbow (2.2.2)
rake
raindrops (0.13.0)
rake (10.5.0)
rainbow (3.0.0)
raindrops (0.19.0)
rake (12.3.2)
ransack (0.7.2)
actionpack (~> 3.0)
activerecord (~> 3.0)
polyamorous (~> 0.5.0)
rb-fsevent (0.10.2)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rbvmomi (1.13.0)
builder (~> 3.0)
json (>= 1.8)
nokogiri (~> 1.5)
trollop (~> 2.1)
rdoc (3.12.2)
json (~> 1.4)
redcarpet (3.2.3)
ref (1.0.5)
representative (1.0.5)
activesupport (>= 2.2.2)
builder (>= 2.1.2)
i18n (>= 0.4.1)
nokogiri (>= 1.4.2)
representative_view (1.2.2)
actionpack (> 2.3.0, < 4.0.0)
representative (~> 1.0.2)
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)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
roo-xls (1.1.0)
nokogiri
roo (>= 2.0.0beta1, < 3)
spreadsheet (> 0.9.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.2)
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-retry (0.5.6)
rspec-core (> 3.3, < 3.8)
rspec-support (3.7.0)
rubocop (0.49.1)
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.8.0)
rubocop (0.57.2)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rubyzip (1.2.0)
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)
sass-rails (3.2.6)
@@ -637,13 +699,26 @@ GEM
tilt (~> 1.3)
select2-rails (3.5.10)
thor (~> 0.14)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
shellany (0.0.1)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
skylight (1.5.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
skylight (1.7.2)
activesupport (>= 3.0.0)
spinjs-rails (1.3)
spinjs-rails (1.4)
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)
@@ -651,31 +726,31 @@ GEM
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
stringex (1.3.3)
stripe (3.3.1)
faraday (~> 0.9)
stripe (4.9.0)
faraday (~> 0.13)
net-http-persistent (~> 3.0)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
thor (0.20.0)
thor (0.20.3)
tilt (1.4.1)
timecop (0.9.1)
treetop (1.4.15)
polyglot
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.53)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicode-display_width (1.3.0)
unicorn (4.9.0)
sprockets (>= 2.2.0)
tzinfo (0.3.55)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.2)
unicorn (5.5.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
unicorn-rails (1.1.0)
unicorn-rails (2.2.1)
rack
unicorn
uuidtools (2.1.5)
@@ -685,17 +760,14 @@ GEM
railties (>= 3.0)
warden (1.2.7)
rack (>= 1.0)
webmock (1.8.11)
addressable (>= 2.2.7)
crack (>= 0.1.7)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.9.2)
activesupport (>= 2.3.4)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
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)
@@ -704,12 +776,12 @@ PLATFORMS
ruby
DEPENDENCIES
active_model_serializers
activemerchant (~> 1.71.0)
active_model_serializers (= 0.8.4)
activemerchant (~> 1.78)
acts-as-taggable-on (~> 3.4)
andand
angular-rails-templates (~> 0.2.0)
angularjs-file-upload-rails (~> 1.1.6)
angular-rails-templates (~> 0.3.0)
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.5.5)
atomic
awesome_print
@@ -718,9 +790,10 @@ DEPENDENCIES
bugsnag
byebug (~> 9.0.0)
capybara (>= 2.15.4)
chromedriver-helper
coffee-rails (~> 3.2.1)
combine_pdf
compass-rails
css_splitter
custom_error_message!
daemons
dalli
@@ -731,13 +804,13 @@ DEPENDENCIES
delayed_job_active_record
diffy
eventmachine (>= 1.2.3)
factory_girl_rails
factory_bot_rails
figaro
foreigner
foundation-icons-sass-rails
foundation-rails
foundation_rails_helper!
fuubar (~> 2.2.0)
fuubar (~> 2.3.2)
geocoder
gmaps4rails
guard
@@ -746,57 +819,61 @@ DEPENDENCIES
guard-rspec (~> 4.7.3)
haml
i18n (~> 0.6.11)
i18n-js (~> 3.0.0)
i18n-js (~> 3.2.1)
immigrant
jquery-migrate-rails
jquery-rails
json_spec (~> 1.1.4)
jwt (~> 1.5)
jwt (~> 2.1)
knapsack
letter_opener (>= 1.4.1)
listen (= 3.0.8)
momentjs-rails
newrelic_rpm
nokogiri (>= 1.6.7.1)
oauth2 (~> 1.2.0)
oauth2 (~> 1.4.1)
ofn-qz!
oj
paper_trail (~> 3.0.8)
order_management!
paper_trail (~> 5.2.3)
paperclip
parallel_tests
pg
poltergeist (>= 1.16.0)
pry-byebug (>= 3.4.3)
rabl
rack-livereload
rack-mini-profiler (< 1.0.0)
rack-rewrite
rack-ssl
rails (= 3.2.21)
rails (~> 3.2.22)
rails-i18n (~> 3.0.0)
redcarpet
representative_view
roadie-rails (~> 1.0.3)
roadie-rails (~> 1.1.1)
roo (~> 2.7.0)
roo-xls (~> 1.1.0)
rspec-rails (>= 3.5.2)
rspec-retry
rubocop (>= 0.49.1)
sass (~> 3.3)
sass-rails (~> 3.2.3)
selenium-webdriver
shoulda-matchers
simple_form!
simplecov
skylight (< 2.0)
spinjs-rails
spree!
spree_auth_devise!
spree_i18n!
spree_paypal_express!
stripe (~> 3.3.1)
therubyracer
spring (= 1.7.2)
spring-commands-rspec
stripe (~> 4.9.0)
therubyracer (= 0.12.0)
timecop
truncate_html
turbo-sprockets-rails3
uglifier (>= 1.0.3)
unicorn
unicorn-rails
web!
webmock
whenever
wicked_pdf
@@ -806,4 +883,4 @@ RUBY VERSION
ruby 2.1.5p273
BUNDLED WITH
1.16.1
1.17.2

View File

@@ -5,45 +5,7 @@ guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
#watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
end
#guard 'rails' do
#watch('Gemfile.lock')
#watch(%r{^(config|lib)/.*})
#end
#guard 'zeus' do
## uses the .rspec file
## --colour --fail-fast --format documentation --tag ~slow
#watch(%r{^spec/.+_spec\.rb$})
#watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
#watch(%r{^app/(.+)\.haml$}) { |m| "spec/#{m[1]}.haml_spec.rb" }
#watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
#watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
#end
#guard :rspec do
#watch(%r{^spec/.+_spec\.rb$})
#watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
#watch('spec/spec_helper.rb') { "spec" }
## Rails example
#watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
#watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
#watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
#watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
#watch('config/routes.rb') { "spec/routing" }
#watch('app/controllers/application_controller.rb') { "spec/controllers" }
## Capybara features specs
#watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
## Turnip features and steps
#watch(%r{^spec/acceptance/(.+)\.feature$})
#watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
#end

View File

@@ -1 +0,0 @@
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

View File

@@ -1,93 +1,33 @@
[![Build Status](https://travis-ci.org/openfoodfoundation/openfoodnetwork.svg?branch=master)](https://travis-ci.org/openfoodfoundation/openfoodnetwork)
[![Build Status](https://semaphoreci.com/api/v1/openfoodfoundation/openfoodnetwork-2/branches/master/badge.svg)](https://semaphoreci.com/openfoodfoundation/openfoodnetwork-2)
[![Code Climate](https://codeclimate.com/github/openfoodfoundation/openfoodnetwork.png)](https://codeclimate.com/github/openfoodfoundation/openfoodnetwork)
[![View performance data on Skylight](https://badges.skylight.io/status/EiXQ6sSKij8y.svg)](https://oss.skylight.io/app/applications/EiXQ6sSKij8y)
# Open Food Network
The Open Food Network is an online marketplace for local food. It enables a network of independent online food stores that connect farmers and food hubs (including coops, online farmers' markets, independent food businesses etc); with individuals and local businesses. It gives farmers and food hubs an easier and fairer way to distribute their food.
Supported by the Open Food Foundation, we are proudly open source and not-for-profit - we're trying to seriously disrupt the concentration of power in global agri-food systems, and we need as many smart people working together on this as possible.
Supported by the Open Food Foundation and a network of global affiliates, we are proudly open source and not-for-profit - we're trying to seriously disrupt the concentration of power in global agri-food systems, and we need as many smart people working together on this as possible.
We're part of global movement - get involved!
* Fill in this short survey to tell us who you are and what you want to do with OFN: https://docs.google.com/a/eaterprises.com.au/forms/d/1zxR5vSiU9CigJ9cEaC8-eJLgYid8CR8er7PPH9Mc-30/edit#
* Find out more and join in the conversation - http://openfoodnetwork.org
* Fill in this [short survey][survey] to tell us who you are and what you want to do with OFN.
* Join the conversation [on Slack][slack-invite]. Make sure you introduce yourself in the #general channel
* Head to [https://openfoodnetwork.org](https://openfoodnetwork.org) for more information about the global OFN project.
* Check out the [User Guide](https://guide.openfoodnetwork.org/) for a list of features and tutorials.
* Join our [discussion forum](https://community.openfoodnetwork.org).
## Contributing
## Getting started
If you are interested in contributing to the OFN in any capacity, please introducing yourself [on Slack][slack-invite], and have a look through our [Contributor Guide][contributor-guide]
Below are instructions for setting up a development environment for Open Food Network. More information is in the [developer wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
Our [GETTING_STARTED](GETTING_STARTED.md) and [CONTRIBUTING](CONTRIBUTING.md) guides are the best place to start for developers looking to set up a development environment and make contributions to the codebase.
If you're interested in provisioning a server, see [the project's Ansible playbooks](https://github.com/openfoodfoundation/ofn_deployment).
## Provisioning
If you're interested in provisioning a server, see [ofn-install][ofn-install] for the project's Ansible playbooks.
### Dependencies
We also have a [Super Admin Guide][super-admin-guide] to help with configuration of new servers.
* Rails 3.2.x
* Ruby 2.1.5
* PostgreSQL database
* PhantomJS (for testing)
* See Gemfile for a list of gems required
### Get it
The source code is managed with Git (a version control system) and
hosted at GitHub.
You can view the code at:
https://github.com/openfoodfoundation/openfoodnetwork
You can download the source with the command:
git clone https://github.com/openfoodfoundation/openfoodnetwork.git
### Get it running
For those new to Rails, the following tutorial will help get you up to speed with configuring a [Rails environment](http://guides.rubyonrails.org/getting_started.html).
When ready, 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.
If you run into any other issues getting your local environment up and running please consult [the wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
If still you get stuck do not hesitate to open an issue reporting the full output of the script.
Now, your dreams of spinning up a development server can be realised:
```
bundle exec rails server
```
To login as Spree default user, use:
```
email: spree@example.com
password: spree123
```
### Testing
Tests, both unit and integration, are based on RSpec. To run the test suite, first prepare the test database:
bundle exec rake db:test:prepare
Then the tests can be run with:
bundle exec rspec spec
The site is configured to use
[Zeus](https://github.com/burke/zeus) to reduce the pre-test
startup time while Rails loads. See the Zeus github page for
usage instructions.
Once [npm dependencies are
installed](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Karma), AngularJS tests can be run with:
./script/karma run
If you want karma to automatically rerun the tests on file modification, use:
./script/karma start
### Multilingual
Do not forget to run `rake tmp:cache:clear` after locales are updated to reload I18n js translations.
## Credits
@@ -102,8 +42,17 @@ Do not forget to run `rake tmp:cache:clear` after locales are updated to reload
* Lynne Davis (https://github.com/lin-d-hop)
* Paul Mackay (https://github.com/pmackay)
* Steve Pettitt (https://github.com/stveep)
* Matt Yorkley (https://github.com/Matt-Yorkley)
* Pau Pérez (https://github.com/sauloperez)
* Enrico Stano (https://github.com/enricostano)
## Licence
Copyright (c) 2012 - 2015 Open Food Foundation, released under the AGPL licence.
Copyright (c) 2012 - 2018 Open Food Foundation, released under the AGPL licence.
[survey]: https://docs.google.com/a/eaterprises.com.au/forms/d/1zxR5vSiU9CigJ9cEaC8-eJLgYid8CR8er7PPH9Mc-30/edit#
[slack-invite]: https://openfoodnetwork.org/slack-invite
[contributor-guide]: https://ofn-user-guide.gitbook.io/ofn-contributor-guide/who-are-we
[ofn-install]: https://github.com/openfoodfoundation/ofn-install
[super-admin-guide]: https://ofn-user-guide.gitbook.io/ofn-super-admin-guide

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

View File

@@ -1,3 +1,14 @@
angular.module("ofn.admin", ["ngResource", "ngAnimate", "admin.utils", "admin.indexUtils", "admin.dropdown", "admin.products", "admin.taxons", "infinite-scroll"]).config ($httpProvider) ->
angular.module("ofn.admin", [
"ngResource",
"mm.foundation",
"angularFileUpload",
"ngAnimate",
"admin.utils",
"admin.indexUtils",
"admin.dropdown",
"admin.products",
"admin.taxons",
"infinite-scroll"
]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content")
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"

View File

@@ -9,7 +9,7 @@
//= require jquery-migrate-min
//= require jquery_ujs
//= require jquery-ui
//= require shared/jquery-ui-timepicker-addon
//= require jquery-ui-timepicker-addon
//= require angular
//= require angular-resource
//= require angular-animate
@@ -36,6 +36,8 @@
//= require ./orders/orders
//= require ./order_cycles/order_cycles
//= require ./payment_methods/payment_methods
//= require ./payments/payments
//= require ./product_import/product_import
//= require ./products/products
//= require ./resources/resources
//= require ./shipping_methods/shipping_methods
@@ -51,14 +53,17 @@
//= require textAngular.min.js
//= require i18n/translations
//= require darkswarm/i18n.translate.js
//
//= require moment
//= require moment/de.js
//= require moment/en-gb.js
//= require moment/es.js
//= require moment/fr.js
//= require moment/it.js
//= require moment/nb.js
//= require moment/pt-br.js
//= require moment/pt.js
//= require moment/sv.js
//= require ../shared/mm-foundation-tpls-0.9.0-20180826174721.min.js
//= require angularjs-file-upload
//= require_tree .

View File

@@ -1,5 +1,6 @@
angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout, $http, $window, BulkProducts, DisplayProperties, dataFetcher, DirtyProducts, VariantUnitManager, StatusMessage, producers, Taxons, SpreeApiAuth, Columns, tax_categories) ->
$scope.loading = true
$scope.loadingAllPages = true
$scope.StatusMessage = StatusMessage
@@ -28,6 +29,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
$scope.filterTaxons = [{id: "0", name: ""}].concat $scope.taxons
$scope.producerFilter = "0"
$scope.categoryFilter = "0"
$scope.importDateFilter = "0"
$scope.products = BulkProducts.products
$scope.filteredProducts = []
$scope.currentFilters = []
@@ -43,27 +45,26 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
.catch (message) ->
$scope.api_error_msg = message
$scope.$watchCollection '[query, producerFilter, categoryFilter]', ->
$scope.$watchCollection '[query, producerFilter, categoryFilter, importDateFilter]', ->
$scope.limit = 15 # Reset limit whenever searching
$scope.fetchProducts = ->
$scope.loading = true
BulkProducts.fetch($scope.currentFilters).then ->
$scope.loadingAllPages = true
BulkProducts.fetch($scope.currentFilters, ->
$scope.loadingAllPages = false
).then ->
$scope.resetProducts()
$scope.loading = false
$timeout ->
if $scope.showLatestImport
$scope.importDateFilter = $scope.importDates[1].id
$scope.resetProducts = ->
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
@@ -91,6 +92,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
$scope.query = ""
$scope.producerFilter = "0"
$scope.categoryFilter = "0"
$scope.importDateFilter = "0"
$scope.editWarn = (product, variant) ->
if (DirtyProducts.count() > 0 and confirm(t("unsaved_changes_confirmation"))) or (DirtyProducts.count() == 0)

View File

@@ -1,2 +0,0 @@
angular.module("ofn.admin").controller "enterprisesDashboardCtrl", ($scope) ->
$scope.activeTab = "hubs"

View File

@@ -1,4 +1,4 @@
angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filter, Customers, TagRuleResource, CurrentShop, RequestMonitor, Columns, pendingChanges, shops, availableCountries) ->
angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filter, Customers, TagRuleResource, CurrentShop, RequestMonitor, Columns, SortOptions, pendingChanges, shops, availableCountries) ->
$scope.shops = shops
$scope.availableCountries = availableCountries
$scope.RequestMonitor = RequestMonitor
@@ -6,13 +6,14 @@ angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filt
$scope.customerLimit = 20
$scope.customers = Customers.all
$scope.columns = Columns.columns
$scope.sorting = SortOptions
$scope.confirmRefresh = (event) ->
event.preventDefault() unless pendingChanges.unsavedCount() == 0 || confirm(t("unsaved_changes_warning"))
$scope.$watch "shop_id", ->
if $scope.shop_id?
CurrentShop.shop = $filter('filter')($scope.shops, {id: $scope.shop_id})[0]
CurrentShop.shop = $filter('filter')($scope.shops, {id: parseInt($scope.shop_id)}, true)[0]
Customers.index({enterprise_id: $scope.shop_id}).then (data) ->
pendingChanges.removeAll()
$scope.customers_form.$setPristine()

View File

@@ -1,19 +1,22 @@
angular.module("admin.customers").directive 'editAddressDialog', ($compile, $templateCache, $filter, DialogDefaults, Customers, StatusMessage) ->
angular.module("admin.customers").directive 'editAddressDialog', ($compile, $templateCache, DialogDefaults, Customers, StatusMessage, CountryStates) ->
restrict: 'A'
scope: true
link: (scope, element, attr) ->
template = null
scope.errors = []
scope.$watch 'address.country_id', (newVal) ->
if newVal
scope.states = scope.filter_states(newVal)
scope.$watch 'address.country_id', (newCountryID) ->
return unless newCountryID
scope.states = CountryStates.statesFor(scope.availableCountries, newCountryID)
unless CountryStates.addressStateMatchesCountryStates(scope.states, scope.address.state_id)
scope.address.state_id = ""
scope.updateAddress = ->
scope.edit_address_form.$setPristine()
if scope.edit_address_form.$valid
Customers.update(scope.address, scope.customer, scope.addressType).$promise.then (data) ->
scope.customer = data
scope.errors = []
template.dialog('close')
StatusMessage.display('success', t('admin.customers.index.update_address_success'))
else
@@ -25,13 +28,9 @@ angular.module("admin.customers").directive 'editAddressDialog', ($compile, $tem
else
scope.addressType = 'ship_address'
scope.address = scope.customer[scope.addressType]
scope.states = scope.filter_states(scope.address?.country_id)
scope.states = CountryStates.statesFor(scope.availableCountries, scope.address?.country_id)
template = $compile($templateCache.get('admin/edit_address_dialog.html'))(scope)
template.dialog(DialogDefaults)
template.dialog('open')
scope.$apply()
scope.filter_states = (countryID) ->
return [] unless countryID
$filter('filter')(scope.availableCountries, {id: parseInt(countryID)}, true)[0].states

View File

@@ -0,0 +1,6 @@
angular.module("ofn.admin").directive "select2NoSearch", ($timeout) ->
restrict: 'CA'
link: (scope, element, attrs) ->
$timeout ->
element.select2
minimumResultsForSearch: Infinity

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

@@ -8,8 +8,8 @@ angular.module("admin.enterprise_groups")
{ name: 'users', label: t('users'), icon_class: "icon-user" }
{ name: 'about', label: t('about'), icon_class: "icon-pencil" }
{ name: 'images', label: t('images'), icon_class: "icon-picture" }
{ name: 'contact', label: t('admin_entreprise_groups_contact'), icon_class: "icon-phone" }
{ name: 'web', label: t('admin_entreprise_groups_web'), icon_class: "icon-globe" }
{ name: 'contact', label: t('admin_enterprise_groups_contact'), icon_class: "icon-phone" }
{ name: 'web', label: t('admin_enterprise_groups_web'), icon_class: "icon-globe" }
]
$scope.select(0)

View File

@@ -0,0 +1,18 @@
# Used in enterprise new and edit forms to reset the state when the country is changed
angular.module("admin.enterprises").controller 'countryCtrl', ($scope, availableCountries) ->
$scope.countries = availableCountries
$scope.countriesById = $scope.countries.reduce (obj, country) ->
obj[country.id] = country
obj
, {}
$scope.$watch 'Enterprise.address.country_id', (newID, oldID) ->
$scope.clearState() unless $scope.addressStateMatchesCountry()
$scope.clearState = ->
$scope.Enterprise.address.state_id = null
$scope.addressStateMatchesCountry = ->
$scope.countriesById[$scope.Enterprise.address.country_id].states.some (state) ->
state.id == $scope.Enterprise.address.state_id

View File

@@ -1,16 +1,19 @@
angular.module("admin.enterprises")
.controller "enterpriseCtrl", ($scope, $window, NavigationCheck, enterprise, EnterprisePaymentMethods, EnterpriseShippingMethods, SideMenu, StatusMessage) ->
.controller "enterpriseCtrl", ($scope, $http, $window, NavigationCheck, enterprise, Enterprises, EnterprisePaymentMethods, EnterpriseShippingMethods, SideMenu, StatusMessage) ->
$scope.Enterprise = enterprise
$scope.PaymentMethods = EnterprisePaymentMethods.paymentMethods
$scope.ShippingMethods = EnterpriseShippingMethods.shippingMethods
$scope.navClear = NavigationCheck.clear
$scope.menu = SideMenu
$scope.newManager = { id: '', email: (t('add_manager')) }
$scope.newManager = { id: null, email: (t('add_manager')) }
$scope.StatusMessage = StatusMessage
$scope.$watch 'enterprise_form.$dirty', (newValue) ->
StatusMessage.display 'notice', t('admin.unsaved_changes') if newValue
$scope.$watch 'newManager', (newValue) ->
$scope.addManager($scope.newManager) if newValue
$scope.setFormDirty = ->
$scope.$apply ->
$scope.enterprise_form.$setDirty()
@@ -26,7 +29,7 @@ angular.module("admin.enterprises")
# from a directive "nav-check" in the page - if we pass it here it will be called in the test suite,
# and on all new uses of this contoller, and we might not want that.
enterpriseNavCallback = ->
if $scope.enterprise_form.$dirty
if $scope.enterprise_form != undefined && $scope.enterprise_form.$dirty
t('admin.unsaved_confirm_leave')
# Register the NavigationCheck callback
@@ -38,16 +41,53 @@ angular.module("admin.enterprises")
return
for i, user of $scope.Enterprise.users when user.id == manager.id
$scope.Enterprise.users.splice i, 1
if $scope.enterprise_form?
$scope.enterprise_form.$setDirty()
$scope.enterprise_form?.$setDirty()
$scope.addManager = (manager) ->
if manager.id? and manager.email?
if manager.id? and angular.isNumber(manager.id) and manager.email?
manager =
id: manager.id
email: manager.email
confirmed: manager.confirmed
if (user for user in $scope.Enterprise.users when user.id == manager.id).length == 0
$scope.Enterprise.users.push manager
$scope.Enterprise.users.unshift(manager)
$scope.enterprise_form?.$setDirty()
else
alert ("#{manager.email}" + " " + t("is_already_manager"))
$scope.inviteManager = ->
$scope.invite_errors = $scope.invite_success = null
email = $scope.newUser
$http.post("/admin/manager_invitations", {email: email, enterprise_id: $scope.Enterprise.id}).success (data)->
$scope.addManager({id: data.user, email: email})
$scope.invite_success = t('user_invited', email: email)
.error (data) ->
$scope.invite_errors = data.errors
$scope.resetModal = ->
$scope.newUser = $scope.invite_errors = $scope.invite_success = null
$scope.removeLogo = ->
return unless confirm(t("admin.enterprises.remove_logo.immediate_removal_warning"))
Enterprises.removeLogo($scope.Enterprise).then (data) ->
$scope.Enterprise = angular.copy(data)
$scope.$emit("enterprise:updated", $scope.Enterprise)
StatusMessage.display("success", t("admin.enterprises.remove_logo.removed_successfully"))
, (response) ->
if response.data.error?
StatusMessage.display("failure", response.data.error)
$scope.removePromoImage = ->
return unless confirm(t("admin.enterprises.remove_promo_image.immediate_removal_warning"))
Enterprises.removePromoImage($scope.Enterprise).then (data) ->
$scope.Enterprise = angular.copy(data)
$scope.$emit("enterprise:updated", $scope.Enterprise)
StatusMessage.display("success", t("admin.enterprises.remove_promo_image.removed_successfully"))
, (response) ->
if response.data.error?
StatusMessage.display("failure", response.data.error)

View File

@@ -0,0 +1,5 @@
angular.module("admin.enterprises").controller 'NewEnterpriseController', ($scope, defaultCountryID) ->
$scope.Enterprise =
address:
country_id: defaultCountryID
state_id: null

View File

@@ -0,0 +1,4 @@
angular.module("ofn.admin").filter "importDate", ($filter) ->
return (products, importDate) ->
return products if importDate == "0"
$filter('filter')( products, { import_date: importDate } )

View File

@@ -1,4 +1,2 @@
angular.module("admin.indexUtils").controller "ColumnsCtrl", ($scope, Columns) ->
$scope.columns = Columns.columns
$scope.predicate = ""
$scope.reverse = false

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

@@ -3,14 +3,18 @@ angular.module("admin.indexUtils").factory "PagedFetcher", (dataFetcher) ->
# Given a URL like http://example.com/foo?page=::page::&per_page=20
# And the response includes an attribute pages with the number of pages to fetch
# Fetch each page async, and call the processData callback with the resulting data
fetch: (url, processData) ->
fetch: (url, processData, onLastPageComplete) ->
dataFetcher(@urlForPage(url, 1)).then (data) =>
processData data
if data.pages > 1
for page in [2..data.pages]
dataFetcher(@urlForPage(url, page)).then (data) ->
lastPromise = dataFetcher(@urlForPage(url, page)).then (data) ->
processData data
onLastPageComplete && lastPromise.then onLastPageComplete
return
else
onLastPageComplete && onLastPageComplete()
urlForPage: (url, page) ->
url.replace("::page::", page)

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

@@ -0,0 +1,8 @@
angular.module("admin.indexUtils").factory 'SortOptions', ->
new class SortOptions
predicate: ""
reverse: true
toggle: (predicate) ->
@reverse = (@predicate == predicate) && !@reverse
@predicate = predicate

View File

@@ -1,4 +1,4 @@
angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $http, $q, StatusMessage, Columns, Dereferencer, Orders, LineItems, Enterprises, OrderCycles, VariantUnitManager, RequestMonitor) ->
angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $http, $q, StatusMessage, Columns, SortOptions, Dereferencer, Orders, LineItems, Enterprises, OrderCycles, VariantUnitManager, RequestMonitor) ->
$scope.initialized = false
$scope.RequestMonitor = RequestMonitor
$scope.filteredLineItems = []
@@ -10,6 +10,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.selectedUnitsVariant = {}
$scope.sharedResource = false
$scope.columns = Columns.columns
$scope.sorting = SortOptions
$scope.confirmRefresh = ->
LineItems.allSaved() || confirm(t("unsaved_changes_warning"))
@@ -25,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

@@ -3,8 +3,12 @@ angular.module("admin.orderCycles").controller "OrderCyclesCtrl", ($scope, $q, C
$scope.columns = Columns.columns
$scope.saveAll = -> OrderCycles.saveChanges($scope.order_cycles_form)
$scope.ordersCloseAtLimit = -31 # days
$scope.involvingFilter = 0
$scope.scheduleFilter = 0
$scope.resetSelectFilters = ->
$scope.scheduleFilter = 0
$scope.involvingFilter = 0
$scope.query = ''
$scope.resetSelectFilters()
compileData = ->
for schedule in $scope.schedules

View File

@@ -0,0 +1,23 @@
angular.module("admin.orderCycles").directive "changeWarning", (ConfirmDialog) ->
restrict: "A"
scope:
orderCycle: '=changeWarning'
link: (scope, element, attrs) ->
acknowledged = false
cancel = 'admin.order_cycles.date_warning.cancel'
proceed = 'admin.order_cycles.date_warning.proceed'
msg = 'admin.order_cycles.date_warning.msg'
options = { cancel: t(cancel), confirm: t(proceed) }
isOpen = (orderCycle) ->
moment(orderCycle.orders_open_at, "YYYY-MM-DD HH:mm:SS Z").isBefore() &&
moment(orderCycle.orders_close_at, "YYYY-MM-DD HH:mm:SS Z").isAfter()
element.focus ->
count = scope.orderCycle.subscriptions_count
return if acknowledged
return unless isOpen(scope.orderCycle)
return if count < 1
ConfirmDialog.open('info', t(msg, n: count), options).then ->
acknowledged = true
element.siblings('img').trigger('click')

View File

@@ -31,6 +31,13 @@ angular.module("admin.orderCycles").directive 'scheduleDialog', ($window, $compi
if confirm(t('are_you_sure'))
Schedules.remove(scope.schedule).$promise.then (data) ->
scope.close()
, (response) ->
errors = response.data.errors
if errors?
scope.errors.push errors[0]
else
scope.errors.push "Could not delete schedule: #{scope.schedule.name}"
scope.loadMore = ->
scope.showMore().then ->

View File

@@ -10,17 +10,19 @@ angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.e
# using $parse instead of scope[attrs.datetimepicker] for cases
# where attrs.datetimepicker is 'foo.bar.lol'
$(element).datetimepicker
dateFormat: 'yy-mm-dd'
timeFormat: 'HH:mm:ss'
showOn: "button"
buttonImage: "<%= asset_path 'datepicker/cal.gif' %>"
buttonImageOnly: true
stepMinute: 15
onSelect: (dateText, inst) ->
scope.$apply(->
dateFormat: 'yy-mm-dd'
timeFormat: 'HH:mm'
showOn: 'button'
controlType: 'select'
oneLine: true
buttonImage: "<%= asset_path 'datepicker/cal.gif' %>"
buttonImageOnly: true
stepMinute: 15
onSelect: (dateText, inst) ->
scope.$apply(->
element.val(dateText)
parsed = $parse(attrs.datetimepicker)
parsed.assign(scope, dateText)
parsed = $parse(attrs.datetimepicker)
parsed.assign(scope, dateText)
)

View File

@@ -151,23 +151,28 @@ angular.module('admin.orderCycles').factory 'OrderCycle', ($resource, $window, S
return unless @confirmNoDistributors()
oc = new OrderCycleResource({order_cycle: this.dataForSubmit()})
oc.$create (data) ->
if data['success']
$window.location = destination
$window.location = destination
, (response) ->
if response.data.errors?
StatusMessage.display('failure', response.data.errors[0])
else
console.log('Failed to create order cycle')
StatusMessage.display('failure', t('js.order_cycles.create_failure'))
update: (destination, form) ->
return unless @confirmNoDistributors()
oc = new OrderCycleResource({order_cycle: this.dataForSubmit()})
oc.$update {order_cycle_id: this.order_cycle.id, reloading: (if destination? then 1 else 0)}, (data) =>
if data['success']
form.$setPristine() if form
if destination?
$window.location = destination
else
StatusMessage.display 'success', t('js.order_cycles.update_success')
form.$setPristine() if form
if destination?
$window.location = destination
else
console.log('Failed to update order cycle')
StatusMessage.display 'success', t('js.order_cycles.update_success')
, (response) ->
if response.data.errors?
StatusMessage.display('failure', response.data.errors[0])
else
StatusMessage.display('failure', t('js.order_cycles.update_failure'))
confirmNoDistributors: ->
if @order_cycle.outgoing_exchanges.length == 0
@@ -204,6 +209,7 @@ angular.module('admin.orderCycles').factory 'OrderCycle', ($resource, $window, S
delete order_cycle.editable_variants_for_incoming_exchanges
delete order_cycle.editable_variants_for_outgoing_exchanges
delete order_cycle.visible_variants_for_outgoing_exchanges
delete order_cycle.subscriptions_count
order_cycle
removeInactiveExchanges: (order_cycle) ->

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

@@ -0,0 +1,26 @@
angular.module("admin.orders").controller "orderCtrl", ($scope, shops, orderCycles, $compile, $attrs, Orders) ->
$scope.$compile = $compile
$scope.shops = shops
$scope.orderCycles = orderCycles
$scope.distributor_id = parseInt($attrs.ofnDistributorId)
$scope.order_cycle_id = parseInt($attrs.ofnOrderCycleId)
$scope.validOrderCycle = (oc) ->
$scope.orderCycleHasDistributor oc, parseInt($scope.distributor_id)
$scope.distributorHasOrderCycles = (distributor) ->
(oc for oc in $scope.orderCycles when @orderCycleHasDistributor(oc, distributor.id)).length > 0
$scope.orderCycleHasDistributor = (oc, distributor_id) ->
distributor_ids = (d.id for d in oc.distributors)
distributor_ids.indexOf(distributor_id) != -1
$scope.distributionChosen = ->
$scope.distributor_id && $scope.order_cycle_id
for oc in $scope.orderCycles
oc.name_and_status = "#{oc.name} (#{oc.status})"
for shop in $scope.shops
shop.disabled = !$scope.distributorHasOrderCycles(shop)

View File

@@ -1,26 +1,74 @@
angular.module("admin.orders").controller "ordersCtrl", ($scope, $compile, $attrs, shops, orderCycles) ->
$scope.$compile = $compile
$scope.shops = shops
$scope.orderCycles = orderCycles
angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor, Orders, SortOptions, $window, $filter) ->
$scope.RequestMonitor = RequestMonitor
$scope.pagination = Orders.pagination
$scope.orders = Orders.all
$scope.sortOptions = SortOptions
$scope.per_page_options = [
{id: 15, name: t('js.admin.orders.index.per_page', results: 15)},
{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.distributor_id = parseInt($attrs.ofnDistributorId)
$scope.order_cycle_id = parseInt($attrs.ofnOrderCycleId)
$scope.initialise = ->
$scope.per_page = 15
$scope.q = {
completed_at_not_null: true
}
$scope.fetchResults()
$scope.validOrderCycle = (oc) ->
$scope.orderCycleHasDistributor oc, parseInt($scope.distributor_id)
$scope.fetchResults = (page=1) ->
$scope.resetSelected()
Orders.index({
'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'],
# 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 || 'completed_at desc',
per_page: $scope.per_page,
page: page
})
$scope.distributorHasOrderCycles = (distributor) ->
(oc for oc in orderCycles when @orderCycleHasDistributor(oc, distributor.id)).length > 0
$scope.resetSelected = ->
$scope.selected_orders.length = 0
$scope.selected = false
$scope.select_all = false
$scope.checkboxes = {}
$scope.orderCycleHasDistributor = (oc, distributor_id) ->
distributor_ids = (d.id for d in oc.distributors)
distributor_ids.indexOf(distributor_id) != -1
$scope.toggleSelection = (id) ->
index = $scope.selected_orders.indexOf(id)
$scope.distributionChosen = ->
$scope.distributor_id && $scope.order_cycle_id
if index == -1
$scope.selected_orders.push(id)
else
$scope.selected_orders.splice(index, 1)
for oc in $scope.orderCycles
oc.name_and_status = "#{oc.name} (#{oc.status})"
$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
for shop in $scope.shops
shop.disabled = !$scope.distributorHasOrderCycles(shop)
$scope.$watch 'sortOptions', (sort) ->
if sort && sort.predicate != ""
$scope.sorting = sort.predicate + ' desc' if sort.reverse
$scope.sorting = sort.predicate + ' asc' if !sort.reverse
$scope.fetchResults()
, true
$scope.changePage = (newPage) ->
$scope.page = newPage
$scope.fetchResults(newPage)

View File

@@ -56,7 +56,4 @@ angular.module("admin.orders").directive 'customerSearchOverride', ->
return
$('#order_email').val customer.email
$('#user_id').val customer.user_id # modified
$('#guest_checkout_true').prop 'checked', false
$('#guest_checkout_false').prop 'checked', true
$('#guest_checkout_false').prop 'disabled', false
customer.email

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

@@ -0,0 +1,10 @@
angular.module("admin.payments").controller "PaymentCtrl", ($scope, Payment, StatusMessage) ->
$scope.form_data = Payment.form_data
$scope.submitted = false
$scope.StatusMessage = StatusMessage
$scope.submitPayment = () ->
return false if $scope.submitted
$scope.submitted = true
StatusMessage.display 'progress', t("spree.admin.payments.source_forms.stripe.submitting_payment")
Payment.purchase()

View File

@@ -0,0 +1,36 @@
angular.module('admin.payments').directive "stripeElements", ($injector, AdminStripeElements) ->
restrict: 'E'
template: "<label for='card-element'>\
<div id='card-element'></div>\
<div id='card-errors' class='error'></div>\
</label>"
link: (scope, elem, attr)->
if $injector.has('stripeObject')
stripe = $injector.get('stripeObject')
card = stripe.elements().create 'card',
hidePostalCode: false
style:
base:
fontFamily: "Roboto, Arial, sans-serif"
fontSize: '16px'
color: '#5c5c5c'
'::placeholder':
color: '#6c6c6c'
card.mount('#card-element')
# Elements validates user input as it is typed. To help your customers
# catch mistakes, you should listen to change events on the card Element
# and display any errors:
card.addEventListener 'change', (event) ->
displayError = document.getElementById('card-errors')
if event.error
displayError.textContent = event.error.message
else
displayError.textContent = ''
return
AdminStripeElements.stripe = stripe
AdminStripeElements.card = card

View File

@@ -0,0 +1 @@
angular.module("admin.payments", ['ofn.admin'])

View File

@@ -0,0 +1,47 @@
angular.module('admin.payments').factory 'Payment', (AdminStripeElements, currentOrderNumber, paymentMethods, PaymentMethods, PaymentResource, StatusMessage, $window)->
new class Payment
order: currentOrderNumber
form_data: {}
paymentMethodType: ->
PaymentMethods.byID[@form_data.payment_method].method_type
preprocess: ->
munged_payment = {}
munged_payment["payment"] = {payment_method_id: @form_data.payment_method, amount: @form_data.amount}
munged_payment["order_id"] = @order
# Not tested with Gateway other than Stripe. Could fall back to Rails for this?
# Works ok without extra source_attrs for Cash, Bank Transfer etc.
switch @paymentMethodType()
when 'gateway'
angular.extend munged_payment.payment, {
source_attributes:
number: @form_data.card_number
month: @form_data.card_month
year: @form_data.card_year
verification_value: @form_data.card_verification_value
}
when 'stripe'
angular.extend munged_payment.payment, {
source_attributes:
gateway_payment_profile_id: @form_data.token
cc_type: @form_data.cc_type
last_digits: @form_data.card.last4
month: @form_data.card.exp_month
year: @form_data.card.exp_year
}
munged_payment
purchase: ->
if @paymentMethodType() == 'stripe'
AdminStripeElements.requestToken(@form_data, @submit)
else
@submit()
submit: =>
munged = @preprocess()
PaymentResource.create({order_id: munged.order_id}, munged, (response, headers, status)=>
$window.location.pathname = "/admin/orders/" + munged.order_id + "/payments"
, (response) ->
StatusMessage.display 'error', t("spree.admin.payments.source_forms.stripe.error_saving_payment")
)

View File

@@ -0,0 +1,38 @@
angular.module("admin.payments").factory 'AdminStripeElements', ($rootScope, StatusMessage) ->
new class AdminStripeElements
# These are both set from the AdminStripeElements directive
stripe: null
card: null
# New Stripe Elements method
requestToken: (secrets, submit) ->
return unless @stripe? && @card?
cardData = @makeCardData(secrets)
@stripe.createToken(@card, cardData).then (response) =>
if(response.error)
StatusMessage.display 'error', response.error.message
else
secrets.token = response.token.id
secrets.cc_type = @mapCC(response.token.card.brand)
secrets.card = response.token.card
submit()
# Maps the brand returned by Stripe to that required by activemerchant
mapCC: (ccType) ->
switch ccType
when 'MasterCard' then return 'master'
when 'Visa' then return 'visa'
when 'American Express' then return 'american_express'
when 'Discover' then return 'discover'
when 'JCB' then return 'jcb'
when 'Diners Club' then return 'diners_club'
# It doesn't matter if any of these are nil, all are optional.
makeCardData: (secrets) ->
{'name': secrets.name,
'address1': secrets.address1,
'city': secrets.city,
'zipcode': secrets.zipcode}

View File

@@ -1,4 +1,4 @@
angular.module("ofn.admin").controller "DropdownPanelsCtrl", ($scope) ->
angular.module("admin.productImport").controller "DropdownPanelsCtrl", ($scope) ->
$scope.active = false
$scope.togglePanel = ->

View File

@@ -0,0 +1,12 @@
angular.module("admin.productImport").controller "ImportFeedbackCtrl", ($scope) ->
$scope.count = (items) ->
total = 0
angular.forEach items, (item) ->
total++
total
$scope.attribute_invalid = (attribute, line_number) ->
$scope.entries[line_number]['errors'][attribute] != undefined
$scope.ignore_fields = ['variant_unit', 'variant_unit_scale', 'unit_description']

View File

@@ -0,0 +1,168 @@
angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $http, $filter, ProductImportService, ams_data, $timeout) ->
$scope.entries = {}
$scope.update_counts = {}
$scope.reset_counts = {}
$scope.enterprise_product_counts = ams_data.enterprise_product_counts
$scope.updates = {}
$scope.updated_total = 0
$scope.updated_ids = []
$scope.update_errors = []
$scope.batchSize = 50
$scope.step = 'settings'
$scope.chunks = 0
$scope.completed = 0
$scope.percentage = {
import: "0%",
save: "0%"
}
$scope.countResettable = () ->
angular.forEach $scope.enterprise_product_counts, (value, key) ->
$scope.reset_counts[key] = value
if $scope.update_counts[key]
$scope.reset_counts[key] -= $scope.update_counts[key]
$scope.resetProgress = () ->
$scope.chunks = 0
$scope.completed = 0
$scope.started = false
$scope.finished = false
$scope.step = 'settings'
$scope.confirmSettings = () ->
$scope.step = 'import'
$scope.start()
$scope.viewResults = () ->
$scope.countResettable()
$scope.step = 'results'
$scope.acceptResults = () ->
$scope.resetProgress()
$scope.step = 'save'
$scope.start()
$scope.finalResults = () ->
$scope.step = 'complete'
$scope.start = () ->
$scope.started = true
total = ams_data.item_count
$scope.chunks = Math.ceil(total / $scope.batchSize)
# Process only the first batch.
$scope.processBatch($scope.step, 0, $scope.chunks)
$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(
url: ams_data.import_url
method: 'POST'
data:
'start': start
'end': end
'filepath': ams_data.filepath
'settings': ams_data.importSettings
).success((data, status) ->
angular.merge($scope.entries, angular.fromJson(data['entries']))
$scope.sortUpdates(data['reset_counts'])
$scope.updateProgress()
).error((data, status) ->
$scope.exception = data
console.error(data)
)
$scope.sortUpdates = (data) ->
angular.forEach data, (value, key) ->
if (key in $scope.update_counts)
$scope.update_counts[key] += value['updates_count']
else
$scope.update_counts[key] = value['updates_count']
$scope.processSave = (start, end) ->
$http(
url: ams_data.save_url
method: 'POST'
data:
'start': start
'end': end
'filepath': ams_data.filepath
'settings': ams_data.importSettings
).success((data, status) ->
$scope.sortResults(data['results'])
angular.forEach data['updated_ids'], (id) ->
$scope.updated_ids.push(id)
angular.forEach data['errors'], (error) ->
$scope.update_errors.push(error)
$scope.updateProgress()
).error((data, status) ->
$scope.exception = data
console.error(data)
)
$scope.sortResults = (results) ->
angular.forEach results, (value, key) ->
if ($scope.updates[key] != undefined)
$scope.updates[key] += value
else
$scope.updates[key] = value
$scope.updated_total += value
$scope.resetAbsent = () ->
return unless ams_data.importSettings['reset_all_absent']
enterprises_to_reset = []
angular.forEach $scope.reset_counts, (count, enterprise_id) ->
enterprises_to_reset.push(enterprise_id)
if enterprises_to_reset.length && $scope.updated_ids.length
$http(
url: ams_data.reset_url
method: 'POST'
data:
'filepath': ams_data.filepath
'settings': ams_data.importSettings
'reset_absent': true,
'updated_ids': $scope.updated_ids,
'enterprises_to_reset': enterprises_to_reset
).success((data, status) ->
$scope.updates.products_reset = data
).error((data, status) ->
console.error(data)
)
$scope.updateProgress = () ->
$scope.completed++
$scope.percentage[$scope.step] = String(Math.round(($scope.completed / $scope.chunks) * 100)) + '%'
if $scope.completed == $scope.chunks
$timeout($scope.viewResults, 1000) if $scope.step == 'import'
$timeout($scope.finalResults, 1000) if $scope.step == 'save'
$scope.resetAbsent() if $scope.step == 'save'

View File

@@ -1,12 +1,25 @@
angular.module("ofn.admin").controller "ImportOptionsFormCtrl", ($scope, $rootScope, ProductImportService) ->
angular.module("admin.productImport").controller "ImportOptionsFormCtrl", ($scope, $rootScope, ProductImportService) ->
$scope.toggleResetAbsent = () ->
confirmed = confirm t('js.product_import.confirmation') if $scope.resetAbsent
$scope.initForm = () ->
$scope.settings = {} if $scope.settings == undefined
$scope.settings = {
import_into: 'product_list',
reset_all_absent: false
}
$scope.import_into = 'product_list'
if confirmed or !$scope.resetAbsent
ProductImportService.updateResetAbsent($scope.supplierId, $scope.resetCount, $scope.resetAbsent)
$scope.$watch 'settings', (updated) ->
ProductImportService.updateSettings(updated)
, true
$scope.toggleResetAbsent = ->
checked = $scope.settings['reset_all_absent']
confirmed = confirm t('js.product_import.confirmation') if checked
if confirmed or !checked
ProductImportService.updateResetAbsent($scope.enterpriseId, $scope.reset_counts[$scope.enterpriseId], checked)
else
$scope.resetAbsent = false
$scope.settings['reset_all_absent'] = false
$scope.resetTotal = ProductImportService.resetTotal

View File

@@ -0,0 +1,32 @@
angular.module("admin.productImport").filter 'entriesFilterValid', ->
(entries, type) ->
if type == 'all'
return entries
filtered = {}
angular.forEach entries, (entry, line_number) ->
validates_as = entry.validates_as
if type == 'valid' and validates_as != '' \
or type == 'invalid' and validates_as == '' \
or type == 'create_product' and (validates_as == 'new_product' or validates_as == 'new_variant') \
or type == 'update_product' and validates_as == 'existing_variant' \
or type == 'create_inventory' and validates_as == 'new_inventory_item' \
or type == 'update_inventory' and validates_as == 'existing_inventory_item'
filtered[line_number] = entry
filtered
angular.module("admin.productImport").filter 'entriesFilterEnterprise', ->
(entries, enterprise) ->
if enterprise == 'all'
return entries
filtered = {}
angular.forEach entries, (entry, line_number) ->
if enterprise == entry.attributes['enterprise']
filtered[line_number] = entry
filtered

View File

@@ -0,0 +1,3 @@
angular.module("admin.productImport", ["ngResource"]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content")
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"

View File

@@ -1,15 +1,21 @@
angular.module("ofn.admin").factory "ProductImportService", ($rootScope) ->
angular.module("admin.productImport").factory "ProductImportService", ($rootScope) ->
new class ProductImportService
suppliers: {}
enterprises: {}
resetTotal: 0
settings: {}
updateResetAbsent: (supplierId, resetCount, resetAbsent) ->
updateResetAbsent: (enterpriseId, resetCount, resetAbsent) ->
if resetAbsent
@suppliers[supplierId] = resetCount
@enterprises[enterpriseId] = resetCount
@resetTotal += resetCount
else
@suppliers[supplierId] = null
@enterprises[enterpriseId] = null
@resetTotal -= resetCount
$rootScope.resetTotal = @resetTotal
updateSettings: (updated) ->
angular.merge(@settings, updated)
getSettings: () ->
@settings

View File

@@ -0,0 +1,8 @@
angular.module("ofn.admin").controller "ProductImageCtrl", ($scope, ProductImageService) ->
$scope.imageUploader = ProductImageService.imageUploader
$scope.imagePreview = ProductImageService.imagePreview
$scope.$watch 'product.image_url', (newValue, oldValue) ->
if newValue != oldValue
$scope.imagePreview = newValue
$scope.uploadModal.close()

View File

@@ -0,0 +1,6 @@
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: 'simple-modal')
ProductImageService.configure(scope.product)

View File

@@ -0,0 +1,15 @@
angular.module("ofn.admin").factory "ProductImageService", (FileUploader, SpreeApiKey) ->
new class ProductImageService
imagePreview: null
imageUploader: new FileUploader
headers:
'X-Spree-Token': SpreeApiKey
autoUpload: true
configure: (product) =>
@imageUploader.url = "/api/product_images/#{product.id}"
@imagePreview = product.image_url
@imageUploader.onSuccessItem = (image, response) =>
product.thumb_url = response.thumb_url
product.image_url = response.image_url

View File

@@ -8,4 +8,10 @@ angular.module("admin.resources").factory 'EnterpriseResource', ($resource) ->
isArray: true
'update':
method: 'PUT'
'removeLogo':
url: '/api/enterprises/:id/logo.json'
method: 'DELETE'
'removePromoImage':
url: '/api/enterprises/:id/promo_image.json'
method: 'DELETE'
})

View File

@@ -1,8 +1,8 @@
angular.module("admin.resources").factory 'OrderResource', ($resource) ->
$resource('/admin/orders/:id/:action.json', {}, {
'index':
url: '/api/orders.json'
method: 'GET'
isArray: true
'update':
method: 'PUT'
})

View File

@@ -0,0 +1,5 @@
angular.module("admin.resources").factory 'PaymentResource', ($resource) ->
$resource('/admin/orders/:order_id/payments.json', {order_id: "@order_id"}, {
'create':
method: 'POST'
})

View File

@@ -38,3 +38,17 @@ angular.module("admin.resources").factory 'Enterprises', ($q, EnterpriseResource
resetAttribute: (enterprise, attribute) ->
enterprise[attribute] = @pristineByID[enterprise.id][attribute]
performActionOnEnterpriseResource = (resourceAction) ->
(enterprise) ->
deferred = $q.defer()
resourceAction({id: enterprise.permalink}, ((data) =>
@pristineByID[enterprise.id] = angular.copy(data)
deferred.resolve(data)
), ((response) ->
deferred.reject(response)
))
deferred.promise
removeLogo: performActionOnEnterpriseResource(EnterpriseResource.removeLogo)
removePromoImage: performActionOnEnterpriseResource(EnterpriseResource.removePromoImage)

View File

@@ -45,7 +45,10 @@ angular.module("admin.resources").factory 'OrderCycles', ($q, $injector, OrderCy
form.$setPristine() if form?
StatusMessage.display('success', "Order cycles have been updated.")
, (response) =>
StatusMessage.display('failure', "Oh no! I was unable to save your changes.")
if response.data.errors?
StatusMessage.display('failure', response.data.errors[0])
else
StatusMessage.display('failure', "Oh no! I was unable to save your changes.")
saved: (order_cycle) ->
@diff(order_cycle).length == 0
@@ -63,7 +66,7 @@ angular.module("admin.resources").factory 'OrderCycles', ($q, $injector, OrderCy
changes
attrsToSave: ->
['orders_open_at','orders_close_at']
['name', 'orders_open_at','orders_close_at']
resetAttribute: (order_cycle, attribute) ->
order_cycle[attribute] = @pristineByID[order_cycle.id][attribute]

View File

@@ -1,18 +1,30 @@
angular.module("admin.resources").factory 'Orders', ($q, OrderResource) ->
angular.module("admin.resources").factory 'Orders', ($q, OrderResource, RequestMonitor) ->
new class Orders
all: []
byID: {}
pristineByID: {}
pagination: {}
index: (params={}, callback=null) ->
OrderResource.index params, (data) =>
request = OrderResource.index params, (data) =>
@load(data)
(callback || angular.noop)(data)
RequestMonitor.load(request.$promise)
@all
load: (orders) ->
for order in orders
load: (data) ->
angular.extend(@pagination, data.pagination)
@clearData()
for order in data.orders
@all.push order
@byID[order.id] = order
@pristineByID[order.id] = angular.copy(order)
clearData: ->
@all.length = 0
@byID = {}
@pristineByID = {}
save: (order) ->
deferred = $q.defer()
order.$update({id: order.number})

View File

@@ -39,12 +39,6 @@ angular.module("admin.resources").factory "Schedules", ($q, $injector, RequestMo
orderCycle.schedules.splice(i, 1) for s, i in orderCycle.schedules by -1 when s.id == schedule.id
delete @byID[schedule.id]
StatusMessage.display 'success', "#{t('admin.order_cycles.index.deleted_schedule')}: '#{schedule.name}'"
, (response) =>
errors = response.data.errors
if errors?
InfoDialog.open 'error', errors[0]
else
InfoDialog.open 'error', "Could not delete schedule: #{schedule.name}"
index: ->
request = ScheduleResource.index (data) => @load(data)

View File

@@ -8,7 +8,8 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher,
, ""
url = "/api/products/bulk_products?page=::page::;per_page=20;#{queryString}"
PagedFetcher.fetch url, (data) => @addProducts data.products
processData = (data) => @addProducts data.products
PagedFetcher.fetch url, processData, onComplete
cloneProduct: (product) ->
$http.post("/api/products/" + product.id + "/clone").success (data) =>
@@ -66,8 +67,13 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher,
variantUnitValue: (product, variant) ->
if variant.unit_value?
if product.variant_unit_scale
variant.unit_value / product.variant_unit_scale
@divideAsInteger variant.unit_value, product.variant_unit_scale
else
variant.unit_value
else
null
# forces integer division to avoid javascript floating point imprecision
# using one billion as the multiplier so that it works for numbers with up to 9 decimal places
divideAsInteger: (a, b) ->
(a * 1000000000) / (b * 1000000000)

View File

@@ -1,10 +1,20 @@
angular.module("admin.subscriptions").controller "AddressController", ($scope, $filter, StatusMessage, availableCountries) ->
angular.module("admin.subscriptions").controller "AddressController", ($scope, StatusMessage, availableCountries, CountryStates) ->
$scope.countries = availableCountries
$scope.statesFor = (country_id) ->
return [] unless country_id
$filter('filter')(availableCountries, {id: country_id})[0].states
$scope.billStates = $scope.statesFor($scope.subscription.bill_address.country_id)
$scope.shipStates = $scope.statesFor($scope.subscription.ship_address.country_id)
$scope.billStates = CountryStates.statesFor(availableCountries, $scope.subscription.bill_address.country_id)
$scope.shipStates = CountryStates.statesFor(availableCountries, $scope.subscription.ship_address.country_id)
$scope.$watch 'subscription.bill_address.country_id', (newCountryID) ->
return unless newCountryID
$scope.billStates = CountryStates.statesFor(availableCountries, newCountryID)
unless CountryStates.addressStateMatchesCountryStates($scope.billStates, $scope.subscription.bill_address.state_id)
$scope.subscription.bill_address.state_id = ""
$scope.$watch 'subscription.ship_address.country_id', (newCountryID) ->
return unless newCountryID
$scope.shipStates = CountryStates.statesFor(availableCountries, newCountryID)
unless CountryStates.addressStateMatchesCountryStates($scope.shipStates, $scope.subscription.ship_address.state_id)
$scope.subscription.ship_address.state_id = ""
$scope.registerNextCallback 'address', ->
$scope.subscription_form.$submitted = true
@@ -18,9 +28,3 @@ angular.module("admin.subscriptions").controller "AddressController", ($scope, $
$scope.registerBackCallback 'address', ->
StatusMessage.clear()
$scope.setView('details')
$scope.$watch 'subscription.bill_address.country_id', (newValue, oldValue) ->
$scope.billStates = $scope.statesFor(newValue) if newValue?
$scope.$watch 'subscription.ship_address.country_id', (newValue, oldValue) ->
$scope.shipStates = $scope.statesFor(newValue) if newValue?

View File

@@ -1,38 +1,43 @@
angular.module("admin.subscriptions").controller "DetailsController", ($scope, $http, CreditCardResource, StatusMessage) ->
angular.module("admin.subscriptions").controller "DetailsController", ($scope, $http, CustomerResource, StatusMessage) ->
$scope.cardRequired = false
$scope.registerNextCallback 'details', ->
$scope.subscription_form.$submitted = true
if $scope.subscription_details_form.$valid
$scope.subscription_form.$setPristine()
StatusMessage.clear()
$scope.setView('address')
else
StatusMessage.display 'failure', t('admin.subscriptions.details.invalid_error')
return unless $scope.validate()
$scope.subscription_form.$setPristine()
StatusMessage.clear()
$scope.setView('address')
$scope.$watch "subscription.customer_id", (newValue, oldValue) ->
return if !newValue?
$scope.loadAddresses(newValue) unless $scope.subscription.id?
$scope.loadCreditCards(newValue)
$scope.loadCustomer(newValue) unless $scope.subscription.id?
$scope.$watch "subscription.payment_method_id", (newValue, oldValue) ->
return if !newValue?
paymentMethod = ($scope.paymentMethods.filter (pm) -> pm.id == newValue)[0]
return unless paymentMethod?
if paymentMethod.type == "Spree::Gateway::StripeConnect"
$scope.cardRequired = true
else
$scope.cardRequired = false
$scope.subscription.credit_card_id = null
$scope.cardRequired = (paymentMethod.type == "Spree::Gateway::StripeConnect")
$scope.loadCustomer() if $scope.cardRequired && !$scope.customer
$scope.loadAddresses = (customer_id) ->
$http.get("/admin/customers/#{customer_id}/addresses")
.success (response) =>
delete response.bill_address.id
delete response.ship_address.id
angular.extend($scope.subscription.bill_address, response.bill_address)
angular.extend($scope.subscription.ship_address, response.ship_address)
$scope.shipAddressFromBilling() unless response.ship_address.address1?
$scope.loadCustomer = ->
params = { id: $scope.subscription.customer_id }
params.ams_prefix = 'subscription' unless $scope.subscription.id
$scope.customer = CustomerResource.get params, (response) ->
for address in ['bill_address','ship_address']
return unless response[address]
delete response[address].id
return if $scope.subscription[address].address1?
angular.extend($scope.subscription[address], response[address])
$scope.shipAddressFromBilling() unless response.ship_address?.address1?
$scope.loadCreditCards = (customer_id) ->
$scope.creditCards = CreditCardResource.index(customer_id: customer_id)
$scope.validate = ->
return true if $scope.subscription_details_form.$valid && $scope.creditCardOk()
StatusMessage.display 'failure', t('admin.subscriptions.details.invalid_error')
false
$scope.creditCardOk = ->
return true unless $scope.cardRequired
return false unless $scope.customer
return false unless $scope.customer.allow_charges
return false unless $scope.customer.default_card_present
true

View File

@@ -16,7 +16,7 @@ angular.module("admin.subscriptions").controller "OrdersPanelController", ($scop
oc = OrderCycles.byID[id]
return t('js.subscriptions.close_date_not_set') unless oc?.orders_close_at?
closes_at = moment(oc.orders_close_at)
text = if closes_at > moment() then t('js.subscriptions.closes') else t('js.subscription.closed')
text = if closes_at > moment() then t('js.subscriptions.closes') else t('js.subscriptions.closed')
"#{text} #{closes_at.fromNow()}"
$scope.stateText = (state) -> t("spree.order_state.#{state}")

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

@@ -1,5 +0,0 @@
angular.module("admin.subscriptions").factory 'CreditCardResource', ($resource) ->
resource = $resource '/admin/customers/:customer_id/cards.json', {},
'index':
method: 'GET'
isArray: true

View File

@@ -0,0 +1,2 @@
angular.module("admin.subscriptions").factory 'CustomerResource', ($resource) ->
$resource '/admin/customers/:id.json'

View File

@@ -1 +1 @@
angular.module("admin.subscriptions", ['ngResource','admin.indexUtils','admin.dropdown'])
angular.module("admin.subscriptions", ['ngResource','admin.indexUtils','admin.dropdown', 'admin.utils'])

View File

@@ -0,0 +1,17 @@
angular.module("admin.users").directive "resendUserEmailConfirmation", ($http) ->
template: "{{ 'js.admin.resend_user_email_confirmation.' + status | t }}"
scope:
email: "@resendUserEmailConfirmation"
link: (scope, element, attrs) ->
sent = false
scope.status = "resend"
element.bind "click", ->
return if sent
scope.status = "sending"
$http.post("/user/spree_user/confirmation", {spree_user: {email: scope.email}}).success (data) ->
sent = true
element.addClass "action--disabled"
scope.status = "done"
.error (data) ->
scope.status = "failed"

View File

@@ -1,12 +1,15 @@
$(document).ready(function() {
$('.datetimepicker').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:mm',
dayNames: Spree.translations.abbr_day_names,
dayNamesMin: Spree.translations.abbr_day_names,
monthNames: Spree.translations.month_names,
prevText: Spree.translations.previous,
nextText: Spree.translations.next,
showOn: "button",
showOn: 'button',
controlType: 'select',
oneLine: true,
buttonImage: "<%= asset_path 'datepicker/cal.gif' %>",
buttonImageOnly: true,
stepMinute: 15

View File

@@ -0,0 +1,9 @@
angular.module("admin.utils").directive "datepicker", ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
element.datepicker
dateFormat: "yy-mm-dd"
onSelect: (dateText, inst) ->
scope.$apply (scope) ->
# Fires ngModel.$parsers
ngModel.$setViewValue dateText

View File

@@ -25,7 +25,8 @@ angular.module("admin.utils").directive "tagsWithTranslation", ($timeout) ->
scope.object[scope.tagsAttr] ||= []
compileTagList()
scope.tagAdded = ->
scope.tagAdded = (tag)->
tag.text = tag.text.toLowerCase()
scope.onTagAdded()
compileTagList()

View File

@@ -0,0 +1,6 @@
angular.module("admin.utils").directive "textangularLinksTargetBlank", () ->
restrict: 'CA'
link: (scope, element, attrs) ->
setTimeout ->
element.find(".ta-editor").scope().defaultTagAttributes.a.target = '_blank'
, 500

View File

@@ -12,7 +12,7 @@ angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
if Spree.routes
element.parent().children(".options_placeholder").attr "id", element.parent().data("index")
element.select2
placeholder: "Select a variant"
placeholder: t('admin.orders.select_variant')
minimumInputLength: 3
quietMillis: 300
ajax:
@@ -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

@@ -0,0 +1,14 @@
angular.module("admin.utils").filter "localizeCurrency", (currencyConfig)->
# Convert number to string currency using injected currency configuration.
(amount) ->
# Set country code (eg. "US").
currency_code = if currencyConfig.display_currency then " " + currencyConfig.currency else ""
# Set decimal points, 2 or 0 if hide_cents.
decimals = if currencyConfig.hide_cents == "true" then 0 else 2
# Set format if the currency symbol should come after the number, otherwise (default) use the locale setting.
format = if currencyConfig.symbol_position == "after" then "%n %u" else undefined
# We need to use parseFloat as the amount should come in as a string.
amount = parseFloat(amount)
# Build the final price string.
I18n.toCurrency(amount, {precision: decimals, unit: currencyConfig.symbol, format: format}) + currency_code

View File

@@ -0,0 +1,11 @@
angular.module("admin.utils").factory "CountryStates", ($filter) ->
new class CountryStates
statesFor: (countries, country_id) ->
return [] unless country_id
country = $filter('filter')(countries, {id: parseInt(country_id)}, true)[0]
return [] unless country
country.states
addressStateMatchesCountryStates: (countryStates, stateId) ->
countryStates.some (state) -> state.id == stateId

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 }
@@ -25,6 +30,7 @@ angular.module("admin.variantOverrides").controller "AdminVariantOverridesCtrl",
$scope.resetSelectFilters = ->
$scope.producerFilter = 0
$scope.importDateFilter = '0'
$scope.query = ''
$scope.resetSelectFilters()
@@ -104,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

@@ -0,0 +1,12 @@
angular.module("admin.variantOverrides").filter "importDate", ($filter, variantOverrides) ->
return (products, hub_id, date) ->
return [] if !hub_id
return $filter('filter')(products, (product) ->
return true if date == 0 or date == undefined or date == '0' or date == ''
angular.forEach product.variants (variant) ->
angular.forEach variantOverrides (vo) ->
if vo.variant_id == variant.id and vo.import_date == date
return true
false
, true)

View File

@@ -1 +1 @@
angular.module("admin.variantOverrides", ["admin.indexUtils", "admin.utils", "admin.dropdown", "admin.inventoryItems", 'ngTagsInput'])
angular.module("admin.variantOverrides", ["ofn.admin", "admin.indexUtils", "admin.utils", "admin.dropdown", "admin.inventoryItems", 'ngTagsInput'])

View File

@@ -11,7 +11,7 @@
#= require lodash.underscore.js
#= require angular-scroll.min.js
#= require angular-google-maps.min.js
#= require ../shared/mm-foundation-tpls-0.8.0.min.js
#= require ../shared/mm-foundation-tpls-0.9.0-20180826174721.min.js
#= require ../shared/ng-infinite-scroll.min.js
#= require ../shared/angular-local-storage.js
#= require ../shared/angular-slideables.js
@@ -25,12 +25,14 @@
#= require angular-flash.min.js
#
#= require moment
#= require moment/de.js
#= require moment/en-gb.js
#= require moment/es.js
#= require moment/fr.js
#= require moment/it.js
#= require moment/nb.js
#= require moment/pt-br.js
#= require moment/pt.js
#= require moment/sv.js
#
#= require modernizr

View File

@@ -6,7 +6,14 @@ Darkswarm.controller "ForgotCtrl", ($scope, $http, $location, AuthenticationServ
if $scope.spree_user.email != null
$http.post("/user/spree_user/password", {spree_user: $scope.spree_user}).success (data)->
$scope.sent = true
.error (data) ->
$scope.errors = t 'email_not_found'
.error (data, status) ->
$scope.errors = data.error
$scope.user_unconfirmed = (status == 401)
else
$scope.errors = t 'email_required'
$scope.resend_confirmation = ->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).success (data)->
$scope.messages = t('devise.confirmations.send_instructions')
.error (data) ->
$scope.errors = t('devise.confirmations.failed_to_send')

View File

@@ -1,6 +1,13 @@
Darkswarm.controller "LoginCtrl", ($scope, $timeout, $location, $http, $window, AuthenticationService, Redirections, Loading) ->
$scope.path = "/login"
$scope.modalMessage = null
$scope.$watch (->
AuthenticationService.modalMessage
), (newValue) ->
$scope.errors = newValue
$scope.submit = ->
Loading.message = t 'logging_in'
$http.post("/user/spree_user/sign_in", {spree_user: $scope.spree_user}).success (data)->
@@ -14,7 +21,7 @@ Darkswarm.controller "LoginCtrl", ($scope, $timeout, $location, $http, $window,
$scope.user_unconfirmed = (data.error == t('devise.failure.unconfirmed'))
$scope.resend_confirmation = ->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user}).success (data)->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).success (data)->
$scope.messages = t('devise.confirmations.send_instructions')
.error (data) ->
$scope.errors = t('devise.confirmations.failed_to_send')

View File

@@ -0,0 +1,3 @@
angular.module("Darkswarm").controller "AuthorisedShopsCtrl", ($scope, Customers, Shops) ->
$scope.customers = Customers.index()
$scope.shopsByID = Shops.byID

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

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