Compare commits

...

892 Commits
v1.8.2 ... v1.9

Author SHA1 Message Date
Rob Harrington
f3322dd82e Transfer responsibility for checking for orphaned PayPal payments from Payment model to Spree::PayPalController 2017-09-23 14:26:03 +10:00
Rob Harrington
d2d07f0362 Update translation scope for PayPal checkout cancellation message 2017-09-23 14:26:03 +10:00
Rob Harrington
131d9384c2 Use flash.notice instead of flash.success to display order confirmation message
This way it overwrites any message that is set from spree, rather than displaying duplicate messages
2017-09-23 14:25:55 +10:00
Rob Harrington
7beb6e624c Darkswarm flash loader works with :notice flash messages 2017-09-23 14:09:13 +10:00
Maikel Linke
73041e9263 Show shop profiles without closed shops
The filter for closed shops was filtering profiles as well. That made it
impossible to show profiles without showing closed shops as well.

Replacing the filter for closed shops fixes the "show profiles" feature.

Fixes https://github.com/openfoodfoundation/openfoodnetwork/issues/1718
2017-09-22 12:53:21 +10:00
Maikel Linke
e600621883 Spec issue 1718 2017-09-22 12:53:21 +10:00
Maikel Linke
0f1fb68ee8 Simplify specs 2017-09-22 12:53:21 +10:00
Maikel Linke
20b2e831e9 Convert specs to RSpec 2.14.4 syntax with Transpec
This conversion is done by Transpec 3.3.0 with the following command:
    transpec spec/features/consumer/shops_spec.rb

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

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

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2017-09-22 12:53:21 +10:00
Rob Harrington
11ccb9a6d2 Revert "Fix for #1826, ensure that adjustment states are initialized prior to validation"
This reverts commit d7de7d462f.

No longer required after we pulled in the correct migrations from Spree
2017-09-22 11:16:29 +10:00
Rob Harrington
074018d2a6 Copy and run adjustment states migration from updated version of spree
Note: this migration took 28.7571s to run against Aus production data on my local machine
2017-09-22 11:16:29 +10:00
Rob Harrington
386972db3b Update spree gem reference 2017-09-22 11:15:59 +10:00
Continuous Integration
4cec7213b5 Merge remote-tracking branch 'origin/master' into HEAD 2017-09-22 10:07:55 +10:00
Rob Harrington
3f3085c66b Add detailed explanation of why #destroy_orphaned_paypal_payments is required 2017-09-21 12:11:46 +10:00
Rob Harrington
f4b1c5de9c Remove orphaned PayPalExpress payments when processing actual PayPalExpress payment
Fixes both #1074 and #1837
2017-09-21 12:11:39 +10:00
Maikel Linke
ca677a3ccd Reset I18n.locale to not affect other specs
Otherwise spec/models/enterprise_spec.rb fails if run after this.
2017-09-20 13:23:16 +10:00
Maikel Linke
4cdd0831e8 Spec the I18n helper on its own 2017-09-20 13:23:16 +10:00
Maikel Linke
39dc765c63 Add/replace comments and remove useless 2017-09-20 13:23:16 +10:00
Julius Pabrinkis
1fe20eba45 Add backend to be able to switch language by param and persist in cookies and user db 2017-09-20 13:23:15 +10:00
Pierre de Lacroix
72d264fab9 Make "on demand" columns visible by default
on admin "bulk product edit" and "inventory" (variant overrides) tables
2017-09-15 16:09:26 +10:00
Pau Perez
f50e745826 Change title when navigating to new product page
We navigate to it by replacing the content of the page through an ajax
call, so we also need change the section title with JS.
2017-09-15 10:09:25 +10:00
Maikel
949faa7fde Merge pull request #1789 from coopdevs/missing-translations-order-cycle-page
Missing translations order cycle page
2017-09-14 18:12:28 +10:00
Pau Perez
96e31235da Replace hardcoded strings with i18n keys 2017-09-14 17:31:52 +10:00
Pau Perez
e217f96454 Use Rails lazy lookup for translation keys
See "lazy" lookup in
http://guides.rubyonrails.org/i18n.html#abstracting-localized-code
2017-09-14 17:31:52 +10:00
Rob Harrington
3aa50ed38f Attempt to fix intermittent fail in product_import_spec 2017-09-14 14:02:09 +10:00
Rob Harrington
d7de7d462f Fix for #1826, ensure that adjustment states are initialized prior to validation 2017-09-14 13:39:22 +10:00
Rob Harrington
4c238748c6 Prevent accordion controllers from showing missing nextPanel
Resolves this issue:
https://travis-ci.org/oeoeaio/openfoodnetwork/jobs/273323915
2017-09-11 11:07:31 +10:00
Rob Harrington
2c65218ce3 Bumping spree version to remove kaminari duplicate from gemspec 2017-09-09 00:40:15 +10:00
Pau Perez
613016a6cf Refactor spec using expect_any_instance 2017-09-08 23:55:51 +10:00
Pau Perez
1899e2fa98 Fix rubocop failures 2017-09-08 23:55:51 +10:00
Pau Perez
c7608c6f44 Fix flaky integration test
This removes a pointless expectation in a before block and refactors the
test in expect-style.
2017-09-08 23:55:51 +10:00
Pau Perez
0349e2026b Upgrade spree sha 2017-09-08 23:55:51 +10:00
Pau Perez
a763c24f3c Doc what with_lock does 2017-09-08 23:55:51 +10:00
Pau Perez
1faa1579f3 Update enterprise fees while locking the order 2017-09-08 23:55:51 +10:00
Pau Perez
630e61ee5a Go back to the Spree's branch we use for step6
The fix introduced with https://github.com/coopdevs/spree/pull/2 was
already merged so we can point back to the `spree-upgrade-step-6`
branch.
2017-09-08 23:55:51 +10:00
Pau Perez
47468df2a5 Fix js unit tests 2017-09-08 23:55:51 +10:00
Pau Perez
5b1947429e Fix odd-even background by relying on Spree
This removes unnecessary duplication of #destroy. We can make it work by
adding a simple fix in Spree.
2017-09-08 23:55:50 +10:00
Pau Perez
8db1fa4e77 Move JSON line items responses to a new controller
Extracts the JSON response from the admin's line item controller which
are only used by the bulk management feature into its own controller.

This decouples spree from an OFN-only feature and allows to remove
unnecessary code. Furthermore, Admin::LineItemsController is gone in
Spree 2.4.0.beta. See: https://github.com/spree/spree/pull/5280
2017-09-08 23:55:50 +10:00
Pau Perez
b3c94fd688 Revert "Load order also on open and close adjustments"
This reverts commit d77588431aa26422e2956fd3510a20b35dab1b1c.
2017-09-08 23:55:50 +10:00
Enrico Stano
7a33b9cea7 Backport latest Spree changes from coopdevs/spree 2017-09-08 23:55:50 +10:00
Pau Perez
4d94b65d25 Load order also on open and close adjustments
@order is not loaded by Spree because we overrode the :before_filter in
spree/admin/orders_controller_decorator.rb. We need to also specify so in the
decorator.
2017-09-08 23:55:50 +10:00
Enrico Stano
d27b8f8fcb Add spree_auth_devise initializer 2017-09-08 23:55:50 +10:00
Enrico Stano
fe7d3b0d58 Revert "Use older spree_auth_devise"
This reverts commit 2f63fb16f36c96c793d5aba1889a274315ccdf00.
2017-09-08 23:55:50 +10:00
Enrico Stano
318f89f9a2 Use older spree_auth_devise 2017-09-08 23:55:50 +10:00
Pau Perez
7e5e167215 Create a mail method when inserting seed data 2017-09-08 23:55:50 +10:00
Enrico Stano
665acdef8f Backport fix for hidden input tag
https://github.com/coopdevs/spree/pull/1
2017-09-08 23:55:50 +10:00
Enrico Stano
d8e17231ec Revert "Order email translation keys"
This reverts commit dc30e0b1042602ed8f03fe97444ccce8526e51b3.
2017-09-08 23:55:50 +10:00
Enrico Stano
ff2b2e17d9 Order email translation keys 2017-09-08 23:55:50 +10:00
Rob Harrington
4b89a1d736 Fix Layout/EmptyLinesAroundClassBody offence in ResetOrderService 2017-09-08 23:55:50 +10:00
Rob Harrington
595d7b5594 Remove conditional assignment from PaymentsController#fire decorator 2017-09-08 23:55:50 +10:00
Enrico Stano
bc62ad5797 Fix spec 2017-09-08 23:55:50 +10:00
Enrico Stano
3b8cab9392 Revert "Fix removal of producer properties - remove href attr so Spree doesn't attempt an XHR"
This reverts commit 8126161df2b96f9cec5c34ffaefa093fe5aed858.
2017-09-08 23:55:50 +10:00
Enrico Stano
9aca5459b7 Revert "Fix removal of product properties"
This reverts commit 3b94e12f8db0d4d2b2e48c085fab8231ec8e86e8.
2017-09-08 23:55:50 +10:00
Enrico Stano
819a003f26 Backport Spree fix for product properties delete icon
fea76b907b
2017-09-08 23:55:50 +10:00
Pau Perez
3a9b71bd1f Add doc to methods and classes [skip ci] 2017-09-08 23:55:50 +10:00
Enrico Stano
62c5ccf904 Address CodeClimate complains 2017-09-08 23:55:50 +10:00
Enrico Stano
2f3f20e433 Remove html_safe and add spec 2017-09-08 23:55:50 +10:00
Pau Perez
85fefcd946 Replace helper with service object 2017-09-08 23:55:50 +10:00
Pau Perez
e087a008c2 Reduce coupling from controller 2017-09-08 23:55:50 +10:00
Pau Perez
4c4969e86b Do not couple with controller's ivar and session 2017-09-08 23:55:50 +10:00
Pau Perez
f6c8a11b7b Move ResetOrderService to new app/services 2017-09-08 23:55:50 +10:00
Pau Perez
1ef4bf5da0 Refactor tests and remove duplicated ones 2017-09-08 23:55:50 +10:00
Pau Perez
a18bf4b666 Add unit tests for service object 2017-09-08 23:55:50 +10:00
Pau Perez
bdfd718c51 Use service object directly from controller 2017-09-08 23:55:50 +10:00
Pau Perez
3c73282d57 Manually reset the order once completed
Spree does not call after_<order.state> methods any more as of
https://github.com/spree/spree/pull/2557, so our #after_complete method
is never triggered and thus the order never reset.

This makes the condition:

```ruby
if current_order.andand.distributor == @order.distributor
```

in app/views/spree/orders/form/_update_buttons.html.haml return false
and as a result the "Back To Cart" button is not shown.

This commit resets the order (emptying the session[:order_id] and
creating a new order, aka. cart) right from the
CheckoutController#update rather than relying on infernal callbacks (of
what the Spree core team itself was unhappy about since long ago
https://github.com/spree/spree/issues/2488). There is the first place
where we know the order has been successfully completed.
2017-09-08 23:55:50 +10:00
Enrico Stano
d09e0cd44a Deal with both JS and JSON format 2017-09-08 23:55:50 +10:00
Enrico Stano
d581fc4863 Fix specs to contemplate XHR requests and more coverage 2017-09-08 23:55:50 +10:00
Enrico Stano
790bc5b187 Use JS format for #update 2017-09-08 23:55:50 +10:00
Pau Perez
f0e2d426c3 Fix getting HTML when deleting line item in admin
In the step 6 of the spree upgrade, when deleting an order's line item
from /admin we get an HTML response (the whole edit form) that gets
inserted into the flash error.

It's not 100% clear why we added a respond_to block for JSON but since
juery-rails sends ajax requests with application/javascript, */* in
the ACCEPTS request header, Rails falls back to the first specified respond_to
block, which is HTML. We don't hit the JSON block.

In order for this to work, this commit replaces the JSON respond_to
block with one for JS with the exact same behaviour; returning a 204.
This is also the format the spree controller action we duplicated originally
has besides HTML.
2017-09-08 23:55:50 +10:00
Pau Perez
8c56bd23fc Add missing translation 2017-09-08 23:55:50 +10:00
Enrico Stano
6254dfde11 Backport Spree commit to fix PaymentMethodsController #create 2017-09-08 23:55:50 +10:00
Enrico Stano
49d96206e1 Add missing email i18n key 2017-09-08 23:55:50 +10:00
Enrico Stano
ce562889a9 Update js and css assets 2017-09-08 23:55:50 +10:00
Enrico Stano
5a2c3f5c5c Set Spree configuration related to locales before the promo environment gets initialized 2017-09-08 23:55:50 +10:00
Enrico Stano
7874d96003 Set MailMethod for test environment when needed 2017-09-08 23:55:50 +10:00
Enrico Stano
8e5b94b5ca Fixing orders controller issue by setting data up correctly 2017-09-08 23:55:49 +10:00
Enrico Stano
4a989f705b No more order.payment 2017-09-08 23:55:49 +10:00
Rob Harrington
3e6e3173ee Fixing line item controller issue by setting data up correctly 2017-09-08 23:55:49 +10:00
Enrico Stano
72292b1dd3 Use new state API instead of locked
be554fde9f
2017-09-08 23:55:49 +10:00
enricostano
6816061915 Fix confirmation email subject
c38537173f
2017-09-08 23:55:49 +10:00
enricostano
23585e6ea8 Initialize custom calculators using Spree API
Freely inspired by https://github.com/coopdevs/spree/blob/2-0-stable/core/lib/spree/core/engine.rb#L78
2017-09-08 23:55:49 +10:00
enricostano
cf4bd8d755 WIP Preparing to get rid of MailMethod model
Please give a look at the following links:
 - http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#mailmethod-model-no-longer-exists
 - https://github.com/spree/spree/pull/2643
2017-09-08 23:55:49 +10:00
enricostano
22b5431279 Start spree upgrade step 6 2017-09-08 23:55:49 +10:00
enricostano
4e35c0448b Use the state machine API to add state transition callbacks
See the following links for more context:
http://guides.spreecommerce.org/release_notes/spree_2_0_0.html#removal-of-checkoutcontrollerstatecallback
1d9581c884
2017-09-08 23:55:49 +10:00
enricostano
fd259e0a63 Use cherry-picked commit in spree fork from the future 🚀
2aee282d6d
2017-09-08 23:55:49 +10:00
enricostano
e7ecdcc251 Import schema migration for spree gem upgrade step 5 2017-09-08 23:55:49 +10:00
Em-AK
a70cdaadb6 Start spree upgrade step 5 2017-09-08 23:55:49 +10:00
enricostano
d8c227c43f Import data migration from latest spree_paypal_express gem 2017-09-08 23:55:49 +10:00
enricostano
a87c89c83d Require authentication for API endpoints
Authentication and authorization layers (cancan) should not be mixed
c594d6111b
2017-09-08 23:55:49 +10:00
Em-AK
6817ac0d79 Regenerate knapsack report on my slow machine 2017-09-08 23:55:49 +10:00
enricostano
c439a23ef9 Adapt CheckoutController to new Spree changes
Freely inspired by ad5551bf84
2017-09-08 23:55:49 +10:00
enricostano
a80d75e7e2 Fix Spree taxons route reference 2017-09-08 23:55:49 +10:00
enricostano
d2b6a47ae4 Use new #available_to_order API 2017-09-08 23:55:49 +10:00
enricostano
5ad0f8bb2e Fix module namespace 2017-09-08 23:55:49 +10:00
enricostano
a9966f48af Use new product_search method 2017-09-08 23:55:49 +10:00
Em-AK
b5bac722ca Fix: make rspec run 2017-09-08 23:55:49 +10:00
Em-AK
8a42b606eb Start spree upgrade step 4 2017-09-08 23:55:49 +10:00
Em-AK
31f2551116 Update the JS unit spec to the new endpoint 2017-09-08 23:55:49 +10:00
enricostano
c992095959 Use new /clone JSON endpoint 2017-09-08 23:55:49 +10:00
enricostano
513330cfff Add JSON api for products clone 2017-09-08 23:55:49 +10:00
Em-AK
1136cb40a9 Revert to OFN spree fork
This reverts commit 92f50d96803f9d0f302be51aad085c9a68ec4c32.
And bundle update to the last commit of openfoodfoundation/spree, branch: spree-upgrade-step-3
2017-09-08 23:55:49 +10:00
Em-AK
e73330d597 Fix removal of product properties
Prevent spree to make a post request on deletion of a property
The data should be updated on the server by clicking on the Update
button
2017-09-08 23:55:49 +10:00
Em-AK
f22a12d657 Revert later: depend on our spree fork 2017-09-08 23:55:49 +10:00
Em-AK
d68104cecb Update a dependency to run the specs 2017-09-08 23:55:49 +10:00
Em-AK
5eb42eac3c Delete the override of a deleted field
https://github.com/openfoodfoundation/spree/compare/spree-upgrade-step1c...spree-upgrade-step-3#diff-a63d9d7f4c1375ca141931651f799956
2017-09-08 23:55:49 +10:00
Rohan Mitchell
ac8cfe24e6 Fix removal of producer properties - remove href attr so Spree doesn't attempt an XHR 2017-09-08 23:55:49 +10:00
Rohan Mitchell
bfaaf16030 Fix spree adjustments fix that maybe never worked? 2017-09-08 23:55:49 +10:00
Rohan Mitchell
c47af55bb9 Fix: When a user fires an event (eg. capture payment), take them back to where they came from 2017-09-08 23:55:49 +10:00
Rohan Mitchell
3ff051f238 Restore route for variant search. Fixes admin order product selection. 2017-09-08 23:55:49 +10:00
Rohan Mitchell
0a8e8dfbbb Add specs and fix line items HTML response 2017-09-08 23:55:49 +10:00
Rohan Mitchell
1170897587 Add our own JSON handling actions for update and delete. Spree no longer does this for us. 2017-09-08 23:55:48 +10:00
Rohan Mitchell
73abb93737 Update Spree: Bring forward simplified version of Spree.t for spree_auth_devise 2017-09-08 23:55:48 +10:00
Rohan Mitchell
0a043a6919 Add permissions to :line_item resource, now called by Spree 2017-09-08 23:55:48 +10:00
Rohan Mitchell
2c374b448a check_authorization removed in Spree. Add load_order before_filter to cover our custom actions. 2017-09-08 23:55:48 +10:00
Rohan Mitchell
2a44b190fe Use spree_paypal_express 2-0-stable pretending to be 1.3 2017-09-08 23:55:48 +10:00
Rohan Mitchell
3605b610fe Use spree_auth_devise 2-0-stable pretending to be 1.3 2017-09-08 23:55:48 +10:00
Rohan Mitchell
0219118e19 Admin JS/CSS now in spree_backend 2017-09-08 23:55:48 +10:00
Rohan Mitchell
5ad197278c Fix rendering of order form for JSON requests 2017-09-08 23:55:48 +10:00
Rohan Mitchell
3135ef6b7f Reinstate explicit class name Spree::Calculator on calculated_adjustments association 2017-09-08 23:55:48 +10:00
Rohan Mitchell
0446b8d72f TestingSupport moved out of Core namespace 2017-09-08 23:55:48 +10:00
Rohan Mitchell
858576d870 CalculatedAdjustments requires include first 2017-09-08 23:55:48 +10:00
Rohan Mitchell
48e50540db Start Spree upgrade step 3 2017-09-08 23:55:48 +10:00
Rohan Mitchell
8eca260297 Update Spree: Prevent duplicate copies of images appearing 2017-09-08 23:55:48 +10:00
Rohan Mitchell
017b63fa71 Update Spree: Fix further admin authorization errors 2017-09-08 23:55:48 +10:00
Rohan Mitchell
efe0d3ab22 Update spree, upgrading jquery-rails to provide jquery 1.9. Fixes ng-tags-input. 2017-09-08 23:55:48 +10:00
Rohan Mitchell
bfd54ef621 Update Spree: Fix admin authorization errors 2017-09-08 23:55:48 +10:00
Rohan Mitchell
38da4c8e12 Adjustments now have state instead of locked/unlocked 2017-09-08 23:55:48 +10:00
Rohan Mitchell
b5d33fc4b5 Add migrations from Spree 2017-09-08 23:55:48 +10:00
Rohan Mitchell
f5c4537afa Start Spree upgrade step 2 2017-09-08 23:55:48 +10:00
Enrico Stano
36022fb143 Merge pull request #1815 from leandroalemao/missing-translations-edit-product-page
Fix i18n translation keys for Edit Product Page
2017-09-08 10:57:25 +02:00
leandroalemao
c70de9f73c Fix i18n translation keys for Edit Product Page 2017-09-08 09:27:20 +01:00
Enrico Stano
86460ffbde Merge pull request #1792 from leandroalemao/missing-translations-new-product-page
Fix i18n translation keys for New Product Page
2017-09-04 16:07:15 +02:00
Leandro C
90d1d5400a Fix i18n translation keys for New Product Page 2017-09-04 13:38:33 +01:00
Enrico Stano
3a04136705 Merge pull request #1758 from coopdevs/simplify-karma-rake-task
Always execute local karma
2017-08-28 10:21:41 +02:00
Maikel
880fda7b40 Merge pull request #1775 from openfoodfoundation/transifex
Transifex
2017-08-25 16:48:51 +10:00
Enrico Stano
67b992cf44 Merge pull request #1771 from coopdevs/feature/add-enterprise-relationhips-tab-name
Translate Enterprise Relationships tab name
2017-08-23 17:40:37 +02:00
Transifex-Openfoodnetwork
a1a2a66d21 Updating translations for config/locales/fr.yml [skip ci] 2017-08-21 06:20:59 +10:00
Transifex-Openfoodnetwork
0117e2e8b5 Updating translations for config/locales/es.yml [skip ci] 2017-08-19 02:22:36 +10:00
Enrico Stano
8645b4a7f6 Translate Enterprise Relationships tab name 2017-08-18 16:40:32 +02:00
Matt-Yorkley
a76b64b80b Spec for missing password confirmation 2017-08-18 13:59:54 +10:00
Matt-Yorkley
483db2bc29 Fix signup password confirmation 2017-08-18 13:59:54 +10:00
stveep
bd3f626872 Call toScroll after any new panel is . Also added an actual delay as it still scrolled to the 'old' location.. 10 ms was too short to allow the location to update after the old panel closes (on Chrome), 50 ms seems ok. 2017-08-18 10:51:48 +10:00
Continuous Integration
2650dc209e Merge remote-tracking branch 'origin/master' into HEAD 2017-08-12 20:52:20 +10:00
Julius Pabrinkis
efd3c34a0c Change JS I18n.fallbacks to be less confusing 2017-08-12 11:21:47 +01:00
Julius Pabrinkis
3e01636f77 Add missing i18n-js partial to registration layout 2017-08-12 11:20:58 +01:00
Pau Perez
f9c0edf4b9 Always execute local karma
This ensure the dev will run the version specified in the package.json.
Besides, makes the rake task work as all rails tests, allowing you to
pass a RAILS_ENV.
2017-08-11 16:48:24 +02:00
Enrico Stano
58d7d8f016 Merge pull request #1753 from coopdevs/complete-seed-data
Complete seed data to purchase to Enterprise 2
2017-08-11 15:42:03 +02:00
Enrico Stano
1fbb4b25d1 Merge pull request #1746 from oeoeaio/fix-flash-error-color
Fix styling of error flash in admin section
2017-08-11 11:45:31 +02:00
Continuous Integration
b43b92dcfd Merge remote-tracking branch 'origin/master' into HEAD 2017-08-11 18:16:25 +10:00
Pau Perez
649c25622a Add doc to method 2017-08-11 14:41:02 +10:00
Pau Perez
1f2820f6d4 Add #delivery? in ShippingMethod 2017-08-11 14:41:02 +10:00
Pau Perez
22f018f2bc Fix all specs of LastUsedAddress 2017-08-11 14:41:02 +10:00
Pau Perez
8c5ac4cb23 Fix extra empty line reported by rubocop 2017-08-10 11:35:26 +02:00
Lynne
b9ff5674af Correction for Transifex name mismatch 2017-08-04 16:18:57 +01:00
Lynne
f0968109c6 Copy transifex updates to en-GB 2017-08-03 20:33:26 +01:00
Transifex-Openfoodnetwork
eeb41ccfdd Updating translations for config/locales/en_GB.yml [skip ci] 2017-08-04 04:30:40 +10:00
Continuous Integration
587a53d36d Merge remote-tracking branch 'origin/master' into HEAD 2017-08-04 03:56:40 +10:00
Transifex-Openfoodnetwork
ec7b7e0391 Updating translations for config/locales/sv.yml [skip ci] 2017-08-03 17:43:53 +10:00
Pau Perez
7f982c0c90 Complete seed data to purchase to Enterprise 2 2017-08-02 13:11:41 +02:00
Rob Harrington
6c71ef8760 Fix styling of error flash in admin section 2017-08-02 19:50:18 +10:00
Enrico Stano
936355d54b Merge pull request #1681 from coopdevs/release-notes-in-template
Add release notes section in github template
2017-08-02 10:59:30 +02:00
Enrico Stano
07620c2e62 Merge pull request #1707 from oeoeaio/mirror-db-session-data
Exclude session data when mirroring data
2017-08-02 10:45:46 +02:00
Maikel Linke
686a8f3af9 Add legacy and default values for LOCALE
This makes sure there is a value in `config.i18n.available_locales` so
that i18n-js doesn't crash.
2017-08-02 10:44:55 +10:00
Maikel Linke
199bfe531e Correct typo in comment 2017-08-02 10:01:12 +10:00
Julius Pabrinkis
e4627fe0d0 Update README 2017-08-02 09:57:33 +10:00
Julius Pabrinkis
ec6a365227 Add test coverage for switching language in darkswarm and admin 2017-08-02 09:57:33 +10:00
Julius Pabrinkis
c6f6f5bc55 Adapt karma js tests for i18n-js 2017-08-02 09:57:33 +10:00
Julius Pabrinkis
5166a3d958 Add available_locales config feature 2017-08-02 09:57:33 +10:00
Julius Pabrinkis
9429695e15 Add i18n helper for controllers to switch language by params 2017-08-02 09:57:32 +10:00
Julius Pabrinkis
f396d30747 Render i18n-js config inside darkswarm and admin layouts 2017-08-02 09:57:32 +10:00
Julius Pabrinkis
2637574c93 Require new i18n-js translations in darkswarm and admin 2017-08-02 09:57:32 +10:00
Julius Pabrinkis
d2ba4650e5 Add temporary i18n-js workaround for Spree translations until upgrade 2017-08-02 09:57:32 +10:00
Julius Pabrinkis
3adb13e62c Add i18n-js gem 2017-08-02 09:57:32 +10:00
Transifex-Openfoodnetwork
f69d86ab8f Updating translations for config/locales/nb.yml [skip ci] 2017-07-31 20:50:37 +10:00
Rob Harrington
7c0feab08f Fix #1526: add descriptions for reports *before* they are filtered 2017-07-28 17:15:57 +10:00
Matt-Yorkley
ea784d6362 Invoice date and translation adjustments 2017-07-28 16:34:43 +10:00
Maikel
6e57f917d2 Merge pull request #1736 from oeoeaio/fix-zeus-crash
Fix zeus issue caused by location of iframe_test.html
2017-07-28 16:31:41 +10:00
Maikel Linke
ba97f61c9e Move translations into right scope 2017-07-28 15:23:18 +10:00
Maikel Linke
c5eca68d79 Remove unused translation 2017-07-28 15:23:18 +10:00
Maikel Linke
92814162dc Remove unused translation 2017-07-28 15:23:18 +10:00
Maikel Linke
44374e8499 Display "+1 More" correctly 2017-07-28 15:23:18 +10:00
Rob Harrington
2ca04bb84e Revert translations of LettuceShare report headers 2017-07-28 12:07:58 +10:00
Rob Harrington
66a85bb99f Revert translations of Xero report headers 2017-07-28 12:07:52 +10:00
Rob Harrington
9f6931ba18 Move embedded shopfronts iframe view into spec/support/views
Was causing issues with zeus where it was (in spec/dummy)
Didn't get to the bottom of what was happening, this was
just a quick, simple and zero-cost solution
2017-07-28 11:54:48 +10:00
Rob Harrington
8fe6800151 Add documentation to the top of mirror_db script 2017-07-27 12:58:54 +10:00
Rob Harrington
e86122cb3e Exclude session data when mirroring data
Probably a better long term solution would be to add a job to clean
up old session data on the server, but this is a quick & dirty fix
to speed mirroring up on a slow connection.
2017-07-27 12:58:54 +10:00
Laura Turk
7641dcc1be Add media query to panepadding mixin 2017-07-26 16:29:44 +10:00
Leta Keane
8648070a05 Add disabled class to shopfront property selectors 2017-07-26 15:46:00 +10:00
Matt-Yorkley
5200937165 Safari/iOS iframe issue fix 2017-07-26 13:56:36 +10:00
Matt-Yorkley
6215777986 Shopfront review adjustments 2017-07-26 13:56:36 +10:00
Matt-Yorkley
0eb4c7f7ba Require https for embedding sites 2017-07-26 13:56:36 +10:00
Matt-Yorkley
782a812596 Basic Embedded Shopfronts 2017-07-26 13:56:36 +10:00
Matt-Yorkley
113f6565be Enable iframes for embedded shopfronts 2017-07-26 13:56:36 +10:00
Maikel Linke
b1452f097d Add spanish translations manually
A change in the Transifex API made the automated commit fail. Hence
doing it manually here.
2017-07-26 13:38:35 +10:00
Transifex-Openfoodnetwork
6384b5abb3 Updating translations for config/locales/fr.yml [skip ci] 2017-07-26 13:38:35 +10:00
Transifex-Openfoodnetwork
2c14ed848f Updating translations for config/locales/nb.yml [skip ci] 2017-07-26 13:38:35 +10:00
Maikel Linke
5dfac10599 Mention upgrade_bundler.sh in README 2017-07-26 13:37:42 +10:00
Maikel Linke
250062bd2f Upgrade bundler according to Gemfile.lock on CI 2017-07-26 13:37:42 +10:00
Maikel Linke
3f2299e52e Add script to upgrade bundler to Gemfile version
Useful to sync your bundler version or the CI bundler version with the
rest of the team.
2017-07-26 13:37:42 +10:00
Rob Harrington
327753b7ca Remove zeus and guard-zeus from the bundle
Having guard-zeus specified as a dependency is problematic because
it also pulls in the zeus gem as a dependency. This makes it impo-
ssible to update or switch zeus versions locally without affecting
other developers.

The maintainers of zeus say that it is designed to be installed and
run outside of the bundle: https://github.com/burke/zeus
2017-07-26 13:36:58 +10:00
Matt-Yorkley
ba447b547d Order tooltip localisation 2017-07-26 13:36:16 +10:00
Matt-Yorkley
8ebd49ec0f Company number localisation 2017-07-26 13:35:46 +10:00
Maikel Linke
155a2574bb Fix typo to display email address 2017-07-21 12:17:14 +10:00
Maikel Linke
b8c2e54194 Fix i18n key and spec 2017-07-21 12:17:14 +10:00
Maikel Linke
9f243e6d3c Fix title of /admin/content/edit
Spree uses the global i18n key `contents` to print the title. A previous
change made that an object containing other i18n keys which was then
displayed as title.

This change moves the i18n content to the scope of the view where they
are displayed.
2017-07-21 12:17:13 +10:00
Maikel Linke
ece8d8b518 Fix typo to display "Producer signup page" 2017-07-21 12:17:13 +10:00
Maikel Linke
0624c49a4f Fix typo to display "Tax Rates" report 2017-07-21 12:17:13 +10:00
Maikel Linke
71742a80b5 Make two more strings translatable 2017-07-21 12:17:13 +10:00
Maikel Linke
f4b1667005 Replace global translations by local ones 2017-07-21 12:17:13 +10:00
Maikel Linke
e5c9845b10 Remove duplicate haml code 2017-07-21 12:17:13 +10:00
Maikel Linke
d3fc89f42a Unify haml code for colouring 2017-07-21 12:17:13 +10:00
Maikel Linke
9c6454b47a Remove duplicated code
A label was accidentally inserted twice. Also removed some duplicate
translation.
2017-07-21 12:17:13 +10:00
Maikel Linke
7d2484c8bf Remove superfluous string interpolation 2017-07-21 12:17:13 +10:00
Maikel Linke
9723c8b82b Move translation into the right place
The dashboard couldn't find a translation, because it is in the spree
namespace.

Also simplified the translation using the `count` feature.
2017-07-21 12:17:13 +10:00
Julius Pabrinkis
8b2b51d511 Fix code style for Rubocop 2017-07-21 12:17:13 +10:00
Julius Pabrinkis
872a150c7d Refactor some translations to use interpolation 2017-07-21 12:17:13 +10:00
Julius Pabrinkis
3a0c0fd638 Fix failing tests 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
739d06cf03 Extract translations from javascript 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
9fa7a30c7e Fix failing tests and extract validation message Procs into methods 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
ba0b17e168 Extract translations from controllers 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
5caaec8ef3 Extract translations from mailers and helpers 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
9971c9f923 Extract translations from models 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
974099747b Fix failing specs after text extraction 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
1920ee7e88 Extract translations from serializers and overrides 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
55b2c19b64 Extract translations from lib folder 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
60060a7017 Start admin/reports extract translations 2017-07-21 12:17:12 +10:00
Julius Pabrinkis
ef488133e8 Add missing translations from files list. 2017-07-21 12:17:12 +10:00
clairezed
5c66a2fc9d Fix wrong key replacement for producer_shop_description_text 2017-07-21 11:15:03 +10:00
clairezed
5f8890e963 update producers pack translation key from sell_description_text to producer_shop_description_text 2017-07-21 11:15:03 +10:00
clairezed
58c463497a #1541 fixing wrong translation key in producers packs 2017-07-21 11:15:03 +10:00
Rob Harrington
3bb6d68adf Exclude node_modules from rubocop analysis
I don't need to see offences for node modules when I run rubocop locally
2017-07-21 11:06:16 +10:00
Duende13
705295049e Improved test for variant serializer 2017-07-21 10:18:55 +10:00
Duende13
a07fd854f6 New test for variant serializer 2017-07-21 10:18:55 +10:00
Duende13
b2bae242d9 Sorting variants by name_to_display and unit_value. Issue 1604. 2017-07-21 10:18:55 +10:00
Maikel Linke
1a57a0b3ca Revert changes in fr.yml 2017-07-19 09:46:23 +10:00
François Turbelin
a0595bc45a Add missing translations on views 2017-07-19 09:45:11 +10:00
Enrico Stano
8853340fa1 Merge pull request #1655 from oeoeaio/update-eventmachine
Bump eventmachine version to resolve openssl issue on macOS
2017-07-13 13:04:28 +02:00
Enrico Stano
bde3fa4ce6 Merge pull request #1671 from coopdevs/multiline-method-calls
Use indented style for multiline method calls
2017-07-12 18:40:34 +02:00
Pau Perez
cee24dcca7 Use indented style for multiline method calls
This enables the Rubocop's Style/MultilineMethodCallIndentation cop with
indentend enforced style. Which makes you split multiline method calls like:

  orders = Spree::Order
    .an_scope
    .another_scope
    .where(id: list_of_ids)

It also autofixes the current violations and updates the
rubocop_todo.yml
2017-07-12 10:40:53 +02:00
Pau Perez
c1789c4833 Add release notes section in github template
Hopefully, this will make it easier for Kirsten to fill in the release
notes from all the pull requests included in a release.
2017-07-12 08:26:45 +02:00
Maikel
6fbf902562 Merge pull request #1680 from mkllnk/entreprise-typo
Correct typo raised by Sergi
2017-07-12 15:14:06 +10:00
Maikel Linke
dc0da6f7b7 Correct typo raised by Sergi 2017-07-12 14:40:44 +10:00
Pau Perez
385847d7da Doc why FinalizeAccount uses order objects
Read the top-level class documentation for the details.
2017-07-12 11:49:04 +10:00
Rob Harrington
9d7f63db42 Bump eventmachine version to resolve openssl issue on macOS 2017-07-12 11:42:15 +10:00
Pau Perez
d0c6292e9d Add github template for pull requests 2017-07-07 13:56:12 +10:00
Matt-Yorkley
994023ec10 Update codeclimate version 2017-07-06 18:15:24 +10:00
Pau Perez
1028b49719 Stop using Order#shipment as it will be deprecated
Spree 2.0 adds a deprecation warning to it and Spree 2.1 removes it.
2017-07-05 16:33:04 +10:00
Maikel Linke
b7f99c3185 Merge branch 'transifex' 2017-06-30 16:28:08 +10:00
Rob Harrington
ce85027b79 Update rubocop_todo.yml using rubocop 0.49.1 2017-06-29 10:47:56 +10:00
Rob Harrington
94b6a61665 Bump rubocop to latest version (0.49.1) 2017-06-29 10:47:56 +10:00
Rob Harrington
f84acf44f3 Disable scss-lint for CodeClimate
Until we can tweak #1393 to work with CodeClimate
2017-06-28 18:09:03 +10:00
Diogo Matsubara
386d651678 Fix #1611 (Rephrase error message for people logging in with an existing user email)
update test to use new rspec syntax
2017-06-28 15:35:21 +10:00
Matt-Yorkley
23a6e2dd8f Changed modal redirect behaviour 2017-06-28 14:35:17 +10:00
Transifex-Openfoodnetwork
6c69eebcbf Updating translations for config/locales/nb.yml [skip ci] 2017-06-27 05:41:31 +10:00
Rob Harrington
d8a158c56d Rubocop: Update comment on Rails/DynamicFindBy, justifying Enabled: false 2017-06-24 13:37:47 +10:00
Rob Harrington
dfda30f4cb Rubocop: Regenerate rubocop_todo.yml using --exclude-limit 100 2017-06-24 13:33:57 +10:00
Rob Harrington
d26970d04c Rubocop: Move Style/ClassAndModuleChildren back to rubocop_todo.yml 2017-06-24 12:59:03 +10:00
Transifex-Openfoodnetwork
63e453e2c7 Updating translations for config/locales/fr.yml [skip ci] 2017-06-23 18:09:39 +10:00
Rob Harrington
c7ed27286a Rubocop: Correct Lint/ParenthesesAsGroupedExpression offences 2017-06-23 17:02:20 +10:00
Rob Harrington
e5340cb53a Rubocop: Correct Lint/UselessAssignment offences, disable for /spec in main config 2017-06-23 16:49:08 +10:00
Rob Harrington
7079952f6b Add rubocop to development group in gemfile 2017-06-23 16:49:08 +10:00
Rob Harrington
f79dcaba15 Rubocop: Add Rails cops to config and todo 2017-06-23 16:49:08 +10:00
Rob Harrington
33a1d97d5e Rubocop: Disable Style/ClassAndModuleChildren in main config 2017-06-23 16:49:08 +10:00
Rob Harrington
28ea23965b Rubocop: Correct Lint/AmbiguousOperator offences 2017-06-23 16:49:08 +10:00
Rob Harrington
fbdbbb980f Rubocop: Disable Lint/AmbiguousBlockAssociation in main config 2017-06-23 16:49:08 +10:00
Rob Harrington
fc5b339e2a Rubocop: Correct Lint/DuplicateMethods offences 2017-06-23 16:49:08 +10:00
Rob Harrington
4acb3f1962 Rubocop: Use Relaxed.Ruby.Style as starting point for settings
Updated .rubocop_todo.yml
2017-06-23 16:49:08 +10:00
Rob Harrington
7bb58342fc Rubocop: Auto-correct Style/EmptyLineBetweenDefs offences 2017-06-23 16:49:08 +10:00
Rob Harrington
b277ff03ea Rubocop: Auto-correct Style/TrailingBlankLines offences 2017-06-23 16:49:07 +10:00
Rob Harrington
5061d0c4cd Rubocop: Tweak config, and add todo file 2017-06-23 16:49:07 +10:00
Continuous Integration
931a5be162 Merge remote-tracking branch 'origin/master' into HEAD 2017-06-22 13:19:25 +10:00
Maikel Linke
e437cba155 Make style flexible for all sizes of logos
Trying to support logos that are big. But logos that are too small
should not be stretched either, better small than ugly.

Remove static size declaration from HTML template since it doesn't
reflect the logo size.

Unfortunately, there are other CSS files that are in conflict. The file
mail/email.css.scss defines this globally:

    img {
      max-width: 100%;
    }
2017-06-16 16:49:43 +10:00
Maikel Linke
ec53d9df7a Merge tag 'v1.8.11' into transifex 2017-06-15 09:59:59 +10:00
Maikel Linke
3330e9b219 Init registration form with default country 2017-06-14 16:47:02 +10:00
Maikel Linke
884743ce97 Filter countries without states for registration 2017-06-14 16:47:01 +10:00
Maikel Linke
b482d1e57c Spec current behaviour of country selector
The enterprise sign-up form shows invalid countries without states and
does not choose the default country. See:

https://github.com/openfoodfoundation/openfoodnetwork/issues/1330
2017-06-14 16:47:01 +10:00
Maikel Linke
78f5002be5 Separate variant names by spaces
To enable the search for the beginning of a variant name, they need to
be separated.

See: https://github.com/openfoodfoundation/openfoodnetwork/pull/1545
2017-06-14 16:37:46 +10:00
Maikel Linke
a42799dff4 Initialise product.variant_names
Not initialising `product.variant_names` causes it to become the string
"undefinedVariant1Variant2" while it should just be "Variant1Variant2".

This mistake did not matter when `variant_names` was just used to search
for a sub-string. A recent change to search only for the beginning of a
word, caused this to fail.

See: https://github.com/openfoodfoundation/openfoodnetwork/pull/1545
2017-06-14 16:28:55 +10:00
Maikel Linke
1196cd7df4 Add style guide to the source locale
There has been a lack of rules how to structure our locale en.yml. This
is a start to document some guidelines which can evolve over time.

Rules can be discussed in the community forum or in pull requests. Once
there is a strong agreement, we should add it to this guide.
2017-06-14 15:20:01 +10:00
Enrico Stano
3c1eae1f47 Do not blindly clear the whole Rails cache 2017-06-09 10:32:57 +10:00
Matt-Yorkley
ba27d63f9c Fix logo sizing 2017-06-06 13:59:42 +01:00
Julius Pabrinkis
0083733c4c #1471 Do no let long producers' name go under icon 2017-06-02 16:29:43 +10:00
Julius Pabrinkis
a1ffc869f3 Refactor code by suggestion to use RegExp and add tests coverage 2017-06-02 15:42:35 +10:00
Rhodri Karim
7a07e8fa16 Issue 1233: product filter should only match if name begins withs search term 2017-06-02 15:42:35 +10:00
enricostano
699da16049 Remove unused spec support method 2017-05-31 15:22:30 +10:00
sseerrggii
18c7b03f3d Add plurals 2017-05-26 16:51:29 +10:00
Rob Harrington
8b560e6cee Cleaning up angular variant units controllers a little bit 2017-05-24 15:05:33 +10:00
Matt-Yorkley
7974ac45f2 Add unit description placeholder 2017-05-24 15:05:33 +10:00
Matt-Yorkley
41b5cf10dd Quick testing update 2017-05-24 15:05:33 +10:00
Matt-Yorkley
b6955cb98c Updated variant feature spec 2017-05-24 15:05:33 +10:00
Matt-Yorkley
6c36c269c8 Product Edit UX adjustments 2017-05-24 15:05:33 +10:00
Pierre de Lacroix
b879ea5a96 add comments 2017-05-24 14:37:54 +10:00
Pierre de Lacroix
a6ed4a2c6a fix bad return value
in method Spree::Adjustment#find_closest_tax_rates_from_included_tax
2017-05-24 14:37:54 +10:00
Pierre de Lacroix
6972822c49 fix escaping problems on ticket view 2017-05-24 13:35:59 +10:00
Pierre de Lacroix
db63f30a76 cosmetic fixes to the ticket view 2017-05-24 13:35:59 +10:00
Rob Harrington
848193434b Show item single_display_amount instead of variant price in order details table
Also has the effect of taking the inventory price into account (since it is stored against the line item price)
2017-05-19 17:27:04 +10:00
stveep
570f0344da Remove unused method in wrong controller ^_^ 2017-05-19 16:14:22 +10:00
stveep
38c25c412f Remove duplicated spec, better error message suppression, fix shipping test to wait correctly 2017-05-19 16:14:22 +10:00
stveep
3b4ffe1f70 Suppress line item validation error for newly-created orders 2017-05-19 16:10:06 +10:00
stveep
4699c654fc Fix feature specs for new 'new admin order' flow 2017-05-19 16:10:06 +10:00
stveep
c1c5d00f45 Add new view to set distribution, ensure the scoped variant single item price is used. 2017-05-19 16:10:06 +10:00
stveep
220693f4e3 Starting alternative flow for new manual order 2017-05-19 16:06:43 +10:00
stveep
fcce858ea4 Fix OC with override factory 2017-05-19 16:06:43 +10:00
stveep
1f9698f7a2 Test to reproduce bug with overridden price not being displayed when an order is added manually 2017-05-19 16:06:43 +10:00
Rob Harrington
1766da9d60 Adding ng-cloak directive to changeable orders banner 2017-05-19 15:54:55 +10:00
Rob Harrington
15ee62aaa8 Fixing race condition on link click in spec/features/consumer/shops_spec.rb 2017-05-19 13:29:47 +10:00
Rob Harrington
6fc4a297a0 Fixing race condition on link click in spec/features/consumer/shopping/products_spec.rb 2017-05-19 13:15:30 +10:00
Rob Harrington
74d8dc48b4 Rewriting shopfront alert regarding changeable orders to be dynamic 2017-05-18 15:35:07 +10:00
Rob Harrington
b6f4ce373e Preloading variants for VariantOverride.indexed 2017-05-18 15:34:22 +10:00
Rob Harrington
c9f186f48f Fixing SlideOutUp animation for darkswarm 2017-05-18 15:33:14 +10:00
Rob Harrington
daab0dfd7a Refactor: Splitting changeable_order_from_number out into separate method 2017-05-17 12:38:17 +10:00
Rob Harrington
22b5dafad2 Further tweaks to LineItemsController 2017-05-17 12:27:29 +10:00
Transifex-Openfoodnetwork
110f74eee8 Updating translations for config/locales/es.yml [skip ci] 2017-05-12 20:49:15 +10:00
Rob Harrington
61cb78fc93 Tweaks to LineItemsController, renaming #index to #bought 2017-05-12 16:29:15 +10:00
Rob Harrington
38d3b446cc Removing unused #tag_list method on VariantSerializer 2017-05-12 16:11:16 +10:00
Rob Harrington
e47e10d267 Removing n+1 query from #items_bought_by_user 2017-05-12 16:11:16 +10:00
Rob Harrington
77c8c85775 Memoizing the result of OrdersController#order_to_update 2017-05-12 16:11:16 +10:00
Rob Harrington
fab6d70832 Changeable orders only returns orders if the shop allows changes 2017-05-12 16:11:16 +10:00
Rob Harrington
9586666248 Updating translation for allow_changes option 2017-05-12 16:11:16 +10:00
Continuous Integration
f5ab9a3445 Merge remote-tracking branch 'origin/master' into HEAD 2017-05-12 10:39:06 +10:00
Continuous Integration
1ac8c85113 Merge remote-tracking branch 'origin/master' into HEAD 2017-05-12 09:55:25 +10:00
Rob Harrington
56c2350d36 Updating enterprise fees on completed order from OrdersController#update 2017-05-10 12:04:32 +10:00
Transifex-Openfoodnetwork
6eafed00f5 Updating translations for config/locales/fr.yml [skip ci] 2017-05-05 21:35:28 +10:00
Transifex-Openfoodnetwork
74661c0b77 Updating translations for config/locales/nb.yml [skip ci] 2017-05-05 18:10:25 +10:00
Rob Harrington
c4fbcb19d0 Only show Admin & Handling fees once on completed order form 2017-05-05 15:28:01 +10:00
Rob Harrington
08e391856c Ask user to confirm cancellation of order 2017-05-05 15:17:14 +10:00
Rob Harrington
8c8b40c5a8 Showing order cycle close time on banner when multiple open orders are present 2017-05-05 14:20:57 +10:00
Rob Harrington
c3eda435eb Hiding 'Back to Cart' and 'Back to Store' buttons on completed orders when distributor does not match cart 2017-05-05 14:20:57 +10:00
Rob Harrington
5eadb33db9 Using changes_allowed? to authorize cancellation of line_items 2017-05-05 14:20:57 +10:00
Rob Harrington
f977a05b08 Fixing broken spec for fetching list of bought items as json 2017-05-05 14:20:57 +10:00
Rob Harrington
217eda8362 Shipping and payment fees are updated for completed orders when the order changes 2017-05-05 14:20:57 +10:00
Rob Harrington
579f3bf90a Changing quantity and deleting line_items of completed orders works with inventory where present 2017-05-05 14:20:57 +10:00
Rob Harrington
348ab81c42 Overriding #increment! using variant overrides 2017-05-05 14:20:57 +10:00
Rob Harrington
3df629bc6e Prevent users from removing the final line item of an order, suggest cancelling instead 2017-05-05 14:20:57 +10:00
Rob Harrington
07b2f0a7c2 Showing banner for distributor of order on order summary, regardless of current_distributor 2017-05-05 14:20:57 +10:00
Rob Harrington
c0445d46f3 Changeable orders ignores cancelled orders 2017-05-05 14:20:57 +10:00
Rob Harrington
6c90b4e6d0 Adding alert to order summary, notifying user of remaining time to make changes 2017-05-05 14:20:57 +10:00
Rob Harrington
e79a23a554 Disabling save button on order page until changes are made to the order 2017-05-05 14:20:57 +10:00
Rob Harrington
314ccc2f27 Ensuring that #items_bought_by_user doesn't return items from cancelled orders 2017-05-05 14:20:57 +10:00
Rob Harrington
68c8759af1 Count of items in cart form looks is consistent with rest of UI (ie. uses quantities) 2017-05-05 14:20:57 +10:00
Rob Harrington
314e9a4f15 Open shopfront existing orders flash link in a new window 2017-05-05 14:20:57 +10:00
Rob Harrington
0029a1b6cf Ensure order adjustments are displayed in edit form for customers 2017-05-05 14:20:57 +10:00
Rob Harrington
bfcde72855 Use explicit format for dates on front-end account page 2017-05-05 14:20:57 +10:00
Rob Harrington
3d0ada803f Test presence of 'Edit' link for previous orders in cart 2017-05-05 14:20:57 +10:00
Rob Harrington
840c936a6f OrderSerializer#changes_allowed_until returns 'Not allowed' unless changes are allowed 2017-05-05 14:20:57 +10:00
Rob Harrington
7ea74ccf4a Order confirmation redirects 'Back to Cart' if cart is non-empty 2017-05-05 14:20:57 +10:00
Rob Harrington
b55036e165 Adding alert to shopfront to alert user to presence of orders open for editing 2017-05-05 14:20:57 +10:00
Rob Harrington
47011e11ff order_cycle.items_bought_by_user actually scopes to the current distributor 2017-05-05 14:20:57 +10:00
Rob Harrington
ae28d7a96b Adding a link in cart to allow user to edit existing + open orders for same OC 2017-05-05 14:20:57 +10:00
Rob Harrington
0dd8959bf7 Use an actual completed order for OrdersController#order_to_update spec 2017-05-05 14:20:57 +10:00
Rob Harrington
316b0915e4 Just display the date that orders can be changed until
No fancy moment.js stuff
2017-05-05 14:20:57 +10:00
Rob Harrington
e21bfd95f4 Renaming order.editable? to order.changes_allowed? 2017-05-05 14:20:57 +10:00
Rob Harrington
893331c7bb Adding 'Open Orders' section to the top of customer accounts page 2017-05-05 14:20:57 +10:00
Rob Harrington
b94bcd697f Restructuring customer accounts spec 2017-05-05 14:19:32 +10:00
Rob Harrington
b0ff7ca767 Making accounts page orders listing full-width 2017-05-05 14:19:32 +10:00
Rob Harrington
493a537f2c Making out-of-stock products in the cart more visible 2017-05-05 14:19:32 +10:00
Rob Harrington
cda43f075b Moving bought items listing up into main section of cart 2017-05-05 14:19:32 +10:00
Rob Harrington
5d9f92eaa7 Adding 'Cancel Order' button to order confimation interface 2017-05-05 14:19:32 +10:00
Rob Harrington
c6afa1849c Basic routing for front-end OrdersController#cancel action 2017-05-05 14:19:32 +10:00
Rob Harrington
eec3a21c89 Allow editing of completed orders from confirmation page where distributor allows it 2017-05-05 14:19:32 +10:00
Rob Harrington
768240a5ba Reorganising darkswarm order views into partials 2017-05-05 14:19:32 +10:00
Rob Harrington
5af8668560 Rewriting Spree::Taxons.distributed_taxons for better performance 2017-05-05 14:19:32 +10:00
Rob Harrington
630b8a2577 Add OrdersController#order_to_update method, to allow updating a complete order where appropriate 2017-05-05 14:19:32 +10:00
Maikel Linke
12a6f652ad Warn when allowing guest orders and order changes 2017-05-05 14:19:32 +10:00
Maikel Linke
db4a528ba3 Update shipment to re-calculate included tax
And re-create tax charges on the order. (untested)
2017-05-05 14:19:32 +10:00
Maikel Linke
479c7ba24b Update transaction fees of completed orders
The adjustments associated to incomplete payments are re-calculated when
a line item is removed from a completed order.
2017-05-05 14:19:32 +10:00
Maikel Linke
1f08729df3 Update shipping fees after removing item
After removing an item from a completed order, update the shipping fees
of all shipments that are pending or ready (not completed).
2017-05-05 14:19:32 +10:00
Maikel Linke
811671661e Remove item from dropdown cart after deletion 2017-05-05 14:19:32 +10:00
Maikel Linke
936df71d0d Link to bought products on cart page
The checkout page was just linking to the cart page, but not scrolling
down.
2017-05-05 14:19:32 +10:00
Maikel Linke
f3f6714472 Add message about previous orders on checkout page
The message appears if the user ordered before within the same order
cycle and the shop allows to change previous orders.
2017-05-05 14:19:32 +10:00
Maikel Linke
3bce2eb7b5 Rename translation key checkout to avoid conflicts
A top-level translation key `checkout` can't co-exist with translation
keys in the path `checkout`. Moving the old key to
`shared.menu.cart.checkout` avoids conflicts. It also structures the
locale better by view.
2017-05-05 14:19:32 +10:00
Maikel Linke
bf05866f92 Change headline of already ordered items 2017-05-05 14:19:32 +10:00
Maikel Linke
219ad4a3a7 Reload bought products after choosing order cycle 2017-05-05 14:19:32 +10:00
Maikel Linke
a7d8028d5a Add retry: 3 to intermittently failing spec 2017-05-05 14:19:32 +10:00
Maikel Linke
d49469a3e6 Show bought items only if changes are allowed
An enterprise can decide to allow changes to orders in open order
cycles. The items of these orders are then displayed in the shopping
cart and can be removed on the cart edit page.
2017-05-05 14:19:32 +10:00
Maikel Linke
4835ef067f Add feature to remove line items from open order cycle
- Add JS controller to send delete requests.
- Add resource controller to destroy items.
- Add authorisation check to abilities.
- Update fees after removing line item.
2017-05-05 14:19:32 +10:00
Maikel Linke
4112c3cc75 Set auth token for all JS HTTP requests 2017-05-05 14:19:32 +10:00
Maikel Linke
0fe4030d71 Display bought items only if present 2017-05-05 14:19:32 +10:00
Maikel Linke
e8d2d4d96f Display already bought items in edit cart view 2017-05-05 14:19:32 +10:00
Maikel Linke
88c3f414fb Handle missing order in cart 2017-05-05 14:18:20 +10:00
Maikel Linke
c0d6b68233 Apply some style guidelines to older code 2017-05-05 14:18:20 +10:00
Maikel Linke
65f62c42b9 Display products already ordered in this oc
Github issue #1083, part of standing orders.

For now, just display already bought products within the same order
cycle in the popup cart view. The edit cart view should follow. Later,
it should be possible to remove items as well.
2017-05-05 14:18:20 +10:00
Maikel Linke
fe7bd5e2cd Serialise tag_list only for variant overrides
Don't try to call tag_list on just variants since that will fail.

Normally, all variants of `current_order` should be extended to
VariantOverrides of the current order cycle. But in development
environment, it can happen that the variants are reloaded without being
extended again.
2017-05-05 14:18:20 +10:00
Maikel Linke
e1b40142b8 Remove unused translations 2017-05-05 14:18:20 +10:00
Maikel Linke
963b4617a9 Add allow-order-changes option to enterprise 2017-05-05 14:18:20 +10:00
Maikel Linke
95ddfc4e40 Merge tag 'v1.8.10' into transifex 2017-05-05 12:28:16 +10:00
François Turbelin
01746ed470 Add missing translations on views 2017-05-04 21:33:17 +02:00
Julius Pabrinkis
f25e3bc6f7 Implement with_currency rspec helper for money amounts 2017-05-04 18:02:38 +01:00
Julius Pabrinkis
e63f1c2991 Refactor time and currency symbol getters 2017-05-03 12:59:16 +01:00
Lynne
29e2886b05 Update contributing.md
Include link to discourse post: How to raise a github issue
2017-05-03 11:50:07 +01:00
Julius Pabrinkis
a97bcf74de Use more simple getter to retrieve currency symbol 2017-05-03 11:25:37 +01:00
Julius Pabrinkis
1e6f4aa73d Restore bundler version 2017-05-03 11:25:37 +01:00
Julius Pabrinkis
7c7933f8bb Use local time zone in tests instead of hardcoded 2017-05-03 11:25:37 +01:00
Julius Pabrinkis
dc69c6e825 Use currency symbol from config in tests 2017-05-03 11:25:37 +01:00
Julius Pabrinkis
41e91765ca Add capybara-screenshot gem for integration tests debugging 2017-05-03 11:25:37 +01:00
Julius Pabrinkis
19569f9316 #1291 Fix dropdown font-size not to zoom in iOS 2017-05-03 10:57:23 +01:00
Maikel Linke
d91c3d1241 Format reset password instructions like Spree 2017-05-03 11:06:48 +10:00
Maikel Linke
b302deb7a3 Add UserMailer specs adapted from Spree code 2017-05-03 11:06:48 +10:00
François Turbelin
2fae467e9a Translate ResetPasswordConfirmation mail 2017-05-03 11:06:48 +10:00
Transifex-Openfoodnetwork
6a5e4bb592 Updating translations for config/locales/sv.yml [skip ci] 2017-04-30 23:38:53 +10:00
Em-AK
c72d17dc83 Run karma task only in test environment
and fails otherwise, as it needs the defaults defined in test environment
2017-04-28 11:28:24 +10:00
Em-AK
78ffdec693 Force english locale in test environment 2017-04-28 11:28:24 +10:00
Pierre de Lacroix
49c19a1d6a update wkhtmltopdf-binary and wicked_pdf 2017-04-27 18:38:47 +10:00
Pierre de Lacroix
e854eb0426 add tests
for methods Spree::Order#tax_adjustment_totals
and Spree::Adjustment#find_closest_tax_rate_from_included_tax
2017-04-27 17:32:36 +10:00
Pierre de Lacroix
4a9c17cb28 better tax aggregation 2017-04-27 17:32:36 +10:00
Matt-Yorkley
0d1547f439 Require OC ready_for in simple OC UI 2017-04-21 09:34:50 +10:00
Matt-Yorkley
fa5ed529cb Added OC form validation 2017-04-21 09:32:49 +10:00
Matt-Yorkley
accb3076e9 Updated translations 2017-04-21 09:32:49 +10:00
Matt-Yorkley
a4e4e1ec68 Require OC name 2017-04-21 09:32:49 +10:00
Transifex-Openfoodnetwork
507e12adba Updating translations for config/locales/fr.yml [skip ci] 2017-04-20 22:05:19 +10:00
Maikel Linke
4809237ecc Fast fail set_order_cycles if distributor not ready 2017-04-19 14:28:17 +10:00
Maikel Linke
81877fedb6 Remove useless andand called on scope 2017-04-19 14:28:17 +10:00
Matt-Yorkley
1f2c6f2a85 Ensure shops display as closed when not configured for sales
squashme

squashme

squash

squash

squash
2017-04-19 14:28:17 +10:00
Matt-Yorkley
4fe5e60967 Updated controller stub to pass test 2017-04-19 14:28:17 +10:00
Matt-Yorkley
f4eb9cb790 Hubs display as closed when not configured for payment or shipping 2017-04-19 14:28:16 +10:00
Maikel Linke
775f9b3ada Move text from view to locale (i18n) 2017-04-12 10:06:53 +10:00
Maikel Linke
188b33921c Remove test entry in locale 2017-04-12 09:56:24 +10:00
Maikel Linke
20c033317f Remove unnecessary string interpolation from view 2017-04-12 09:49:24 +10:00
Matt-Yorkley
e7a5d063ac Update simple OC form 2017-04-12 09:41:40 +10:00
Matt-Yorkley
1fda781d7e Set maxlength on OC displayname field 2017-04-12 09:41:39 +10:00
Matt-Yorkley
45fc801a08 Added tooltips to OC form 2017-04-12 09:41:39 +10:00
Transifex-Openfoodnetwork
5fa45c0716 Updating translations for config/locales/es.yml [skip ci] 2017-04-08 01:22:10 +10:00
Maikel Linke
21337a5b50 Merge tag 'v1.8.9' into transifex 2017-04-06 10:36:14 +10:00
Maikel Linke
ec36a843cf Merge tag 'v1.8.8' into transifex 2017-04-06 10:31:26 +10:00
Transifex-Openfoodnetwork
e99dbaf4d8 Updating translations for config/locales/es.yml [skip ci] 2017-04-05 19:40:18 +10:00
Rob Harrington
c83ad2ecc4 Fixing broken limited reached page in registration flow 2017-04-05 17:02:40 +10:00
Matt-Yorkley
80d8d18eb2 Update terms of service config 2017-04-05 15:48:50 +10:00
Rob Harrington
903d1afb53 Stripping html tags from products description on new form as well 2017-04-05 14:29:23 +10:00
Matt-Yorkley
cd55d2e2ff Product Description - strip weird tags on paste
squashme
2017-04-05 11:29:35 +10:00
Rob Harrington
05cf8c4351 Sanitizing product description for textAngular input 2017-04-05 11:29:35 +10:00
Matt-Yorkley
b04d815408 Changes for code review
Fixed spec
2017-04-05 11:29:35 +10:00
Matt-Yorkley
7b370a2eb6 Removed underline option 2017-04-05 11:29:35 +10:00
Matt-Yorkley
5808b601b8 Added specs for HTML product description 2017-04-05 11:29:35 +10:00
Matt-Yorkley
fdcd3dc3e3 Fixed Capybara not interacting with textAngular 2017-04-05 11:29:35 +10:00
Matt-Yorkley
c4bd085393 Added Angular and textAngular to edit product page 2017-04-05 11:29:35 +10:00
Matt-Yorkley
0e91d01412 UX improvement for selected formatting options 2017-04-05 11:29:35 +10:00
Matt-Yorkley
fcb9e9fa56 Changed buttons 2017-04-05 11:29:35 +10:00
Matt-Yorkley
3591354cb1 Minor tweaks 2017-04-05 11:29:35 +10:00
Matt-Yorkley
b38eab11eb Fixed frontend HTML display 2017-04-05 11:29:35 +10:00
Matt-Yorkley
c43dea60b7 Product Descriptions formatting 2017-04-05 11:29:35 +10:00
Pierre de Lacroix
268bea25d0 add qz/ folder from ofn-qz gem to list of assets 2017-03-30 20:37:20 +02:00
Pierre de Lacroix
e94ae20b31 fix print_ticket authorization 2017-03-30 20:37:20 +02:00
Maikel Linke
a94961c0a7 Fixup merge conflicts and remove unused text 2017-03-29 14:58:19 +11:00
Lynne Davis
0d5fde919b Property name spans signle col heading 2017-03-29 14:47:17 +11:00
Matt-Yorkley
429ef4e2ba Altered product property headings for issue #522 2017-03-29 14:44:30 +11:00
Lynne Davis
e8999d23e1 Updated translations 2017-03-29 13:12:29 +11:00
Keir Osborn
209c9242d9 remove word-wrap class from enterprise.email_address and enterprise.website in javascripts/templates/partials/contact.html.haml 2017-03-24 12:55:30 +11:00
Transifex-Openfoodnetwork
6defb09d2e Updating translations for config/locales/fr.yml [skip ci] 2017-03-21 09:03:15 +11:00
Transifex-Openfoodnetwork
2774c09d7a Updating translations for config/locales/nb.yml [skip ci] 2017-03-20 07:10:53 +11:00
Matt-Yorkley
c62a044598 PI highlight invalid fields in feedback tables 2017-03-17 16:11:52 +11:00
Matt-Yorkley
f73fbe7f23 SpreadsheetEntry Class and PI refactor 2017-03-17 16:11:52 +11:00
Matt-Yorkley
5e1e4c1d19 Product Import UX review updates
Minor tweaks

Minor fix
2017-03-17 16:11:52 +11:00
Matt-Yorkley
cc5a335fb7 Refactor and additional permissions checks
Don't include non-permitted enterprises in existin product count

Tweaked feedback
2017-03-17 16:11:52 +11:00
Matt-Yorkley
91fc3f33a0 PI reset and save step improvements 2017-03-17 16:11:52 +11:00
Matt-Yorkley
648753b412 Improved save step UI 2017-03-17 16:11:52 +11:00
Matt-Yorkley
24fcc3dd34 PI reset absent products 2017-03-17 16:11:52 +11:00
Matt-Yorkley
14fb40a996 Product Import options and defaults
Added available_on test

Obscure case fix and extra spec
2017-03-17 16:11:52 +11:00
Matt-Yorkley
f4511fc74d PI permission test 2017-03-17 16:11:52 +11:00
Matt-Yorkley
3d0f192490 Product Import update 2017-03-17 16:11:52 +11:00
Matt-Yorkley
6b7cdf3a37 Product Import Refactoring 2017-03-17 16:11:52 +11:00
Matt-Yorkley
052d6c6b02 Product Import basic specs 2017-03-17 16:11:52 +11:00
Matt-Yorkley
6e5c878491 Product Import cancan permissions and ui tab 2017-03-17 16:11:52 +11:00
Matt-Yorkley
c0c6cd1a60 Product Import feature 2017-03-17 16:11:52 +11:00
Matt-Yorkley
2ad433590d Add roo gem 2017-03-17 16:11:52 +11:00
Rohan Mitchell
2cb3da56ab Fix regression: Transaction fee double-charged 2017-03-17 12:02:13 +11:00
Rohan Mitchell
8582e6d6b4 Add robustness check against intermittent spec failure 2017-03-17 12:02:13 +11:00
Rohan Mitchell
170101cbfe Avoid reloading order during checkout request, which clears credit card number 2017-03-17 12:02:13 +11:00
Maikel Linke
8107f49373 Merge remote-tracking branch 'origin/master' into transifex
Conflicts:
	config/locales/fr.yml
2017-03-16 09:30:22 +11:00
Rob Harrington
7ef0964af2 Adding shortcuts for both sales tax reports to the reports index 2017-03-15 23:57:13 +11:00
Rob Harrington
18472ea8c3 Making 'tax types' report the default sales tax report 2017-03-15 23:56:44 +11:00
Rob Harrington
36e0f45a89 Show the shops invoice text on old invoice template 2017-03-15 17:39:21 +11:00
Rob Harrington
bea0b2b1e5 Adding feature toggle for receipt printing using qz 2017-03-15 16:39:04 +11:00
Rob Harrington
9a69951136 Using correct key for invoice_settings title translation 2017-03-15 16:12:50 +11:00
Rob Harrington
e19bab1aa2 Fixing translations for invoice settings edit template 2017-03-15 15:06:28 +11:00
Rob Harrington
8e2a111a0b Changing ofn-qz to openfoodfoundation fork 2017-03-15 15:06:28 +11:00
Pierre de Lacroix
70707969f3 Add Qz integration 2017-03-15 15:06:28 +11:00
Pierre de Lacroix
2fe25c6219 Allow both invoice layouts to coexist
Add a new "Invoice" page in the admin backend
with a checkbox to toggle between layouts
2017-03-15 15:06:28 +11:00
Pierre de Lacroix
cc1ef5b28b fixes on invoice and tax report 2017-03-15 15:04:57 +11:00
Pierre de Lacroix
3fc2070b2c fix aggregation of taxes for taxes on adjustments 2017-03-15 15:03:46 +11:00
Pierre de Lacroix
d22f5678be small fixes for sales tax report 2017-03-15 15:03:46 +11:00
Rob Harrington
0429906eed Slight adjustments to invoice layout
1. Hide tax column when no tax included in the order

2. Save a little bit of space in the header by sharing rows
2017-03-15 15:03:46 +11:00
Pierre de Lacroix
88a09da325 fix for pull request #1374 2017-03-15 15:03:18 +11:00
Pierre de Lacroix
963f0d601f fix test for tax report 2017-03-15 15:03:18 +11:00
Pierre de Lacroix
8570471c00 add tax rates report 2017-03-15 15:03:18 +11:00
Pierre de Lacroix
7925af30d6 add enterprise logo and custom text on invoices 2017-03-15 15:03:18 +11:00
Pierre de Lacroix
6f59751582 change i18n fallbacks parameter to EN in production settings 2017-03-15 15:03:18 +11:00
Pierre de Lacroix
2d2792225a change invoice layout to include amount for each relevant tax rate 2017-03-15 15:03:18 +11:00
Maikel Linke
a079a64cbe Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into i18n2 2017-03-15 12:35:39 +11:00
Maikel Linke
656be690a3 Remove space from permalink tip 2017-03-15 12:11:56 +11:00
Maikel Linke
167045f695 Remove forgotten " character 2017-03-15 12:01:31 +11:00
François Turbelin
dbe968afbb Fixing translated interpolation in fr locale 2017-03-12 12:42:00 +01:00
François Turbelin
179b995fa0 Fixing wrong string interpolation in i18n files 2017-03-12 12:41:06 +01:00
François Turbelin
4791086207 Fixing i18n multiline issues 2017-03-12 12:39:29 +01:00
François Turbelin
be6b09a6e0 Adding i18n keys on JS templates 2017-03-12 12:22:13 +01:00
Transifex-Openfoodnetwork
f235099859 Updating translations for config/locales/fr.yml [skip ci] 2017-03-11 16:50:17 +11:00
Matt-Yorkley
ff8ca521ff Open tos pdf in new tab 2017-02-22 13:40:17 +11:00
Rob Harrington
98f7d52493 Refactor: wrapping registration templates in script tags 2017-02-22 13:40:17 +11:00
Rob Harrington
4815405839 WIP: Moving registration templates in app/views as partials 2017-02-22 13:40:17 +11:00
Rob Harrington
42a6e35185 Making registration spec click_and_ensure assertions more generic
Assertions can be made about checking checkboxes
2017-02-22 13:40:17 +11:00
Matt-Yorkley
408a57479e Flaky tests 2017-02-22 13:40:17 +11:00
Matt-Yorkley
beaf54107c Moved angular template to views folder 2017-02-22 13:40:17 +11:00
Matt-Yorkley
e45d1d42b4 Tidying up 2017-02-22 13:40:17 +11:00
Matt-Yorkley
bc442c7819 Re-adding a line removed in testing 2017-02-22 13:40:17 +11:00
Matt-Yorkley
6a361f2d7b Specced the new terms of service functionality 2017-02-22 13:40:17 +11:00
Matt-Yorkley
a62998e5f1 Enterprise Terms of Service 2017-02-22 13:40:17 +11:00
François Turbelin
ebcb8ff3e7 Finishing Translations keys implemtentation on Admin ERB views 2017-02-19 22:08:34 +01:00
Maikel Linke
da8c107331 Merge remote-tracking branch 'origin/master' into transifex
Conflicts:
	config/locales/fr.yml
2017-02-15 15:47:25 +11:00
Continuous Integration
5870927518 Merge remote-tracking branch 'origin/master' into HEAD 2017-02-10 16:42:27 +11:00
Transifex-Openfoodnetwork
e008a154e5 Updating translations for config/locales/sv.yml [skip ci] 2017-02-09 02:36:14 +11:00
Continuous Integration
a2d01b5144 Merge remote-tracking branch 'origin/master' into HEAD 2017-02-08 16:53:53 +11:00
Rob Harrington
8afd5c509b Using coffescript syntax to check for presence of enterprise_form 2017-02-08 15:59:11 +11:00
Matt-Yorkley
311f72e4cb Fixing JS spec failure 2017-02-08 15:59:11 +11:00
Matt-Yorkley
78563a7d75 Changed for build failure 2017-02-08 15:59:11 +11:00
Matt-Yorkley
9284dd9b63 Enable save after deleting enterprise manager 2017-02-08 15:59:11 +11:00
Continuous Integration
92981e4fcd Merge remote-tracking branch 'origin/master' into HEAD 2017-02-08 10:38:47 +11:00
Matt-Yorkley
9235727d45 Merge pull request #5 from mkllnk/pr-1329-enterprise-switcher
Re-use NavigationCheck logic
2017-02-02 15:26:01 +00:00
Matt-Yorkley
fc4ead9b05 Ensure on_demand set properly on new products 2017-02-02 01:06:20 +00:00
Maikel Linke
b8622e95b7 Re-use NavigationCheck logic
The enterprise switcher now uses the same code as NavigationCheck to
confirm leaving a changed form. This makes FormState obsolete.

Conflicts:
	app/assets/javascripts/admin/enterprises/controllers/enterprise_controller.js.coffee
2017-02-02 10:58:32 +11:00
Continuous Integration
f8341dccd4 Merge remote-tracking branch 'origin/master' into HEAD 2017-02-01 10:35:53 +11:00
Lynne
b8ed7789f0 Merge pull request #1427 from openfoodfoundation/revert-1424-master
Revert "translate ABN and ACN to company number, charity number"
2017-01-30 13:18:16 +00:00
Lynne
6d19613ecc Revert "translate ABN and ACN to company number, charity number" 2017-01-30 12:53:01 +00:00
Lynne
0d56cbf169 Merge pull request #1424 from OliverUK/master
translate ABN and ACN to company number, charity number
2017-01-30 12:04:54 +00:00
Lynne
67730e82c3 Update en-GB.yml 2017-01-30 12:04:24 +00:00
OliverUK
940ca7ade1 translate ABN and ACN to company number, charity number 2017-01-27 15:02:38 +00:00
Continuous Integration
05f9747f15 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-25 12:41:02 +11:00
Matt-Yorkley
27903ab744 Merge branch 'master' into uk/switcher 2017-01-22 18:57:25 +00:00
Matt-Yorkley
931e528e14 Code review changes 2017-01-22 18:55:28 +00:00
Matt-Yorkley
6bed94a09b Include E2E permissions 2017-01-22 18:42:23 +00:00
Paul Mackay
165b437f31 #1226: fix OSM URL to use HTTPS 2017-01-20 15:59:22 +00:00
Continuous Integration
b526307ad1 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-18 18:14:10 +11:00
Continuous Integration
a7bfddfcb5 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-18 17:22:21 +11:00
Continuous Integration
52e4722dcb Merge remote-tracking branch 'origin/master' into HEAD 2017-01-18 11:19:57 +11:00
Rob Harrington
017916b193 Enterprise distributing_products scope uses INNER JOINS instead of OUTER JOINS 2017-01-17 19:28:21 +11:00
Paul Mackay
02e5ba4dfd Convert .sass files to .scss format 2017-01-15 12:11:53 +00:00
Paul Mackay
651626eb4f #1365: Remove /test dir as it is not used 2017-01-14 11:47:21 +00:00
Continuous Integration
20d01c3047 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-13 11:44:47 +11:00
Continuous Integration
a391b6f076 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-13 11:12:17 +11:00
Continuous Integration
ade73f66c8 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-13 10:50:32 +11:00
Maikel Linke
44970a13bb Fix translation of email confirmation notice
The `_html` suffix was missing leading to `<br />` being displayed in
plain text. The new version also integrates the email address as a
variable in the translation.
2017-01-13 10:21:25 +11:00
Paul Mackay
d80f080af5 #1027: Use url helpers for basic pages
Set groups change frequency to monthly.
2017-01-12 10:18:30 +00:00
Continuous Integration
6ec7276cfc Merge remote-tracking branch 'origin/master' into HEAD 2017-01-11 16:30:37 +11:00
Continuous Integration
2444d3b547 Merge remote-tracking branch 'origin/master' into HEAD 2017-01-11 15:54:08 +11:00
Maikel Linke
e899633aff Merge duplicate locale entry admin.enterprises.index 2017-01-11 14:48:05 +11:00
Maikel Linke
a9f01c0f0d Fix typos in en.yml 2017-01-11 11:15:44 +11:00
Matt-Yorkley
e021afdd8a Updated spec 2017-01-10 23:53:13 +00:00
François Turbelin
88dea0f2b8 Adding i18n keys on Admin side (Rails views) 2017-01-11 10:00:06 +11:00
Matt-Yorkley
5150025641 Updated tag rules UI 2017-01-10 22:54:22 +00:00
Paul Mackay
fc400741b4 Remove lastmod for groups 2017-01-10 11:44:57 +00:00
Paul Mackay
5cb2194f5e #1027: Add sitemap.xml generation 2017-01-10 11:39:17 +00:00
Transifex-Openfoodnetwork
64f6a794fc Updating translations for config/locales/nb.yml [skip ci] 2017-01-08 23:36:57 +11:00
elf Pavlik
764c95488c made api key optional (google maps) 2017-01-07 10:25:32 -06:00
Lynne
6cabba4cd8 Merge pull request #1354 from openfoodfoundation/uk/translation
Uk/translation
2017-01-06 10:00:23 +00:00
elf Pavlik
bd1cd527d3 configurable google maps api key 2017-01-03 20:57:10 -06:00
Lynne Davis
d17f9dc504 update 2017-01-03 16:35:01 +00:00
Lynne Davis
f62c583130 uk translation updates 2017-01-03 16:12:41 +00:00
Maikel
b1e27e0dad Auto-merged master into uk/translation on deployment. 2017-01-04 02:24:40 +11:00
Levent Ali
6ae1272281 Mark order cycle form as dirty when removing fees
Resolves an issue where removing coordinator/exchange fees
wasn't allowing users to save the OC.

Fixes #1165
2016-12-23 09:33:34 +11:00
Lynne
e0cb6ed60a Merge pull request #1349 from openfoodfoundation/tos
Adding UK ToS to repo
2016-12-22 18:31:30 +00:00
Maikel
8aeec74fed Auto-merged master into tos on deployment. 2016-12-22 23:19:27 +11:00
Lynne Davis
7cd7e7367b Adding UK TOS to repo 2016-12-22 12:09:44 +00:00
Continuous Integration
4f4fe90db4 Merge remote-tracking branch 'origin/master' into HEAD 2016-12-21 15:27:57 +11:00
Continuous Integration
7a7cd3a937 Merge remote-tracking branch 'origin/master' into HEAD 2016-12-21 14:16:08 +11:00
Continuous Integration
bfc01e7c89 Merge remote-tracking branch 'origin/master' into HEAD 2016-12-21 11:21:42 +11:00
Matt-Yorkley
bc5672b5eb Added translation 2016-12-20 13:30:24 +00:00
Lynne Davis
d77f775c4c Moving commits from 1241 to trigger build on UK staging 2016-12-19 15:06:43 +00:00
Matt-Yorkley
7531c8cbc9 Removed dashes 2016-12-19 11:10:12 +00:00
Matt-Yorkley
38fe0afc03 Changed p widths 2016-12-17 22:59:29 +00:00
Matt-Yorkley
252f876827 Fixed orders closed display for mobile view 2016-12-17 22:54:59 +00:00
Matt-Yorkley
6d9bae8ef9 Checkout layout adjustments for mobile view 2016-12-17 20:39:13 +00:00
Matt-Yorkley
0b2281dfe2 Adjustment for chrome browser 2016-12-17 16:07:39 +00:00
Continuous Integration
72cff0688a Merge remote-tracking branch 'origin/master' into HEAD 2016-12-16 15:24:52 +11:00
Rohan Mitchell
9793450ed0 Make mobile menu mimic the large menu 2016-12-16 14:40:13 +11:00
Rohan Mitchell
c8f0502e71 Apply connect_learn_homepage feature toggle to mobile menu 2016-12-16 14:32:48 +11:00
Continuous Integration
b075ed373a Merge remote-tracking branch 'origin/master' into HEAD 2016-12-16 13:46:08 +11:00
Rafael Braz
eef308c4f6 create a pr-br translate file (#1266) 2016-12-15 08:39:37 +11:00
Transifex-Openfoodnetwork
70225afa13 Updating translations for config/locales/fr.yml [skip ci] 2016-12-12 05:53:28 +11:00
Matt-Yorkley
0a67876815 Update angular-file-uploader-rails to v1.1.6 2016-12-09 18:47:16 +00:00
Lynne
b59e5ad248 Merge pull request #1243 from openfoodfoundation/uk/translations
Translation updates
2016-12-09 16:37:38 +00:00
Matt-Yorkley
287e0b5b55 Enterprise switcher and navigation check 2016-12-09 15:15:42 +00:00
Continuous Integration
c6a1560845 Auto-merge from CI [skip ci] 2016-12-10 01:42:26 +11:00
Lynne Davis
45dc1341d3 translation updates 2016-12-09 14:41:16 +00:00
Matt-Yorkley
7d7197da58 Reordered enterprises submenu 2016-12-09 14:31:34 +00:00
Matt-Yorkley
066f42070a Fixed confusing wysiwyg line breaks display discrepency 2016-12-09 14:12:00 +00:00
Lynne Davis
cad3464f56 Adjusted BOM spec to reflect currency symbol changes 2016-12-09 11:40:55 +00:00
Rohan Mitchell
bbcaef20a8 Add unit specs for Spree::Admin::NavigationHelper 2016-12-09 11:24:58 +11:00
Rohan Mitchell
43726a0b23 Fix inventory link not appearing on menu 2016-12-08 10:38:29 +11:00
Rohan Mitchell
6e6efea328 Fix groups link not appearing on menu 2016-12-08 10:38:23 +11:00
Maikel Linke
a2a6ce1b3e Revert "TEMP: Remove override for no-longer-present method"
This reverts commit a3b91dabe5.

Conflicts:
	app/helpers/spree/admin/navigation_helper_decorator.rb
2016-12-08 10:38:21 +11:00
Maikel Linke
3a69c958ef Hide super admin menu items for enterprise users
Imported temporarily missing Spree functionality. This patch becomes
obsolete with another Spree upgrade.
2016-12-08 10:38:21 +11:00
Continuous Integration
14ee7a06ae Merge remote-tracking branch 'origin/master' into HEAD 2016-12-07 17:03:27 +11:00
Maikel Linke
6cd8289b27 Correct more typos 2016-12-02 16:50:54 +11:00
Rob Harrington
d0509b54bf Disabling override the adds coupon field to cart page 2016-11-30 18:30:20 +11:00
Lynne Davis
ee905cad5f Translation updates 2016-11-29 15:07:35 +00:00
Transifex-Openfoodnetwork
01efb63ad3 Updating translations for config/locales/en_GB.yml [skip ci] 2016-11-30 01:07:53 +11:00
Matt-Yorkley
7981feefa1 Updated form to include help tip for clarity 2016-11-28 14:38:13 +00:00
Rohan Mitchell
d4fd66461e Add retry to flaky specs 2016-11-25 14:37:47 +11:00
Rohan Mitchell
071ba5285d Put timecop config in spec support 2016-11-25 14:28:05 +11:00
Rohan Mitchell
6795237a2d Put timecop into safe mode and fix leaky Timecop.freeze 2016-11-25 14:14:42 +11:00
Rohan Mitchell
57363e2da5 When a product is deleted, touch the supplier and distributors 2016-11-25 14:14:42 +11:00
Rohan Mitchell
da9a3ce9f3 Refresh products cache when product is deleted (cf. destroyed) 2016-11-25 14:14:42 +11:00
Rohan Mitchell
c4318030d3 Fix spec: Second visit doesn't actually reload the page 2016-11-25 14:14:42 +11:00
Rohan Mitchell
44a301edb1 When touching distributing enterprises, do not touch self -> infinite recursion 2016-11-25 14:14:42 +11:00
Rohan Mitchell
dabac50128 Replace Enterprise.distributing_product and Enterprise.distributing_any_product_of with Enterprise.distributing_products 2016-11-25 14:14:42 +11:00
Rohan Mitchell
6030e9a294 Cache enterprise supplied and distributed properties and producer properties 2016-11-25 14:14:42 +11:00
Rohan Mitchell
9b656eaf4f Property / ProducerProperty changes update distributor enterprise cache 2016-11-25 14:14:42 +11:00
Rohan Mitchell
22080a9a08 Property / ProducerProperty changes update supplier enterprise cache 2016-11-25 14:14:42 +11:00
Rohan Mitchell
d93fe3cf2c Cache enterprise supplied and distributed taxons 2016-11-25 14:14:42 +11:00
Rohan Mitchell
1ea4f4274c Add enterprise cache invalidation for order cycle changes 2016-11-25 14:14:42 +11:00
Rohan Mitchell
bd11c6ce14 New hash style 2016-11-25 14:14:42 +11:00
Rohan Mitchell
e8848451a5 Spacing 2016-11-25 14:14:42 +11:00
Rohan Mitchell
f4f38b4183 Re-apply shop property filters - including performance regression
This reverts commit 7d149ed198.
2016-11-25 14:14:42 +11:00
Rob Harrington
27283c50b8 Customers service clears array fo each #index request 2016-11-25 12:43:48 +11:00
Matt-Yorkley
3e77534dcf Product variant form script 2016-11-25 01:31:45 +00:00
Rob Harrington
5e214a32b3 Moving ShippingMethods service to admin.resource module 2016-11-25 11:59:00 +11:00
Rob Harrington
7498b7f098 Moving PaymentMethods service to admin.resource module 2016-11-25 11:57:59 +11:00
Rob Harrington
268c8dbcdd Moving Customers and CustomerResource services to admin.resource module 2016-11-25 11:46:51 +11:00
Rob Harrington
dbbd52cace Fixing broken taxons filter on bulk product edit
Was referencing Taxons.taxons instead of Taxons.all
2016-11-25 10:37:01 +11:00
Rob Harrington
1770a67cd9 Adding #load function to services for resources, for generic loading of data into byID and pristineByID 2016-11-25 10:37:01 +11:00
Rob Harrington
3678d4d018 Creating new 'resources' module for holding interdependent ngResource services 2016-11-25 10:37:01 +11:00
Rob Harrington
3de69987e6 Changing convention for angular resource services to generic 'byID' object and 'all' array 2016-11-25 10:37:01 +11:00
Rob Harrington
cbbb047fc1 Expunge all mentions of includeBlank and blankOption from angular services 2016-11-25 10:37:01 +11:00
Maikel Linke
338d3cbc38 Delete old commented code 2016-11-25 10:27:13 +11:00
Maikel Linke
4c438ff101 Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into shop-navigation-directive 2016-11-25 10:24:42 +11:00
Rohan Mitchell
631b19084a Fix intermittent failure via FK when deleted taxon is primary taxon on p2 2016-11-25 09:37:05 +11:00
Levent Ali
63e815c7fc Correct spelling of further in translations 2016-11-24 08:31:01 +00:00
Rohan Mitchell
b7e9ffc9da Fix enterprise user being denied access to admin when spree dash configured (as on production) 2016-11-24 13:35:49 +11:00
Rohan Mitchell
d8ce0e7d58 A user without enterprises does not have access to the dashboard, so it's not meaningful to spec 2016-11-24 13:35:04 +11:00
Continuous Integration
a115f2a268 Merge remote-tracking branch 'origin/master' into HEAD 2016-11-23 15:00:02 +11:00
Maikel Linke
c0c8b07add Let shopping tabs listen to URL changes
When clicking on a shopping tab like "contact", it changed the URL. But
changing the URL did not change the tab. Listening to URL changes
enables manual manipulation of the URL and simple links to "#/contact"
to open the contact tab.
2016-11-11 17:11:39 +11:00
Rohan Mitchell
5913004e14 Fix datepicker error parsing date 2016-11-09 11:47:57 +11:00
Rohan Mitchell
f4034b1065 Fix spec 2016-11-04 09:39:17 +11:00
Rob Harrington
db93b74490 Refactoring ofnSelect2, works with multiple, and with promised data 2016-11-04 09:39:17 +11:00
Rohan Mitchell
d574b8943b WIP: Cherry-pick b2d82b6 - Using ofnSelect2 instead of plain select on BOM 2016-11-04 09:39:17 +11:00
Rohan Mitchell
46fcf7b62e Fix enterprise group save error - initialise address correctly 2016-11-04 09:39:17 +11:00
Rohan Mitchell
3e565ad7cb Mark admin enterprises form dirty when property removed 2016-11-04 09:39:17 +11:00
Rohan Mitchell
0e01350107 Use jquery-migrate instead of downgrading jQuery to access $.browser 2016-11-04 09:39:17 +11:00
Rohan Mitchell
7d79fffa33 Reinstate Spree::PaymentMethod::DISPLAY (removed in Spree but used by us) 2016-11-04 09:39:17 +11:00
Rohan Mitchell
4117b32ebd Fix specs: We had no permission to update the specified supplier (how did this ever work?) 2016-11-04 09:39:17 +11:00
Rohan Mitchell
7a68cc7da1 Remove spec for product distributions 2016-11-04 09:39:17 +11:00
Rohan Mitchell
20e6b703d9 Rewrite alias_method to alias_method_chain 2016-11-04 09:39:17 +11:00
Rohan Mitchell
a1535d6c04 Catch flash messages after fadeout 2016-11-04 09:39:17 +11:00
Rohan Mitchell
f33df883a0 Fix link_to_remove_fields - does not immediately delete the field 2016-11-04 09:39:17 +11:00
Rohan Mitchell
48acf80c85 Fix tabbing 2016-11-04 09:39:17 +11:00
Rohan Mitchell
d8f8c0df16 Fix API auth: Need Spree::Api::UsersController for authorise_api action to work 2016-11-04 09:39:17 +11:00
Rohan Mitchell
8ce917a422 Work around click obscuration 2016-11-04 09:39:17 +11:00
Rohan Mitchell
6546d2763b Add Spree::Money#to_html (from Spree 2.0) 2016-11-04 09:39:17 +11:00
Rohan Mitchell
d3a3b2da9a Pin jquery-rails to 2.1.4 (older version) to prevent missing $.browser errors 2016-11-04 09:39:17 +11:00
Rohan Mitchell
fdd6400cb8 Fix perms for API soft delete 2016-11-04 09:39:17 +11:00
Rohan Mitchell
225e436293 Update included tax param before loading resource 2016-11-04 09:39:17 +11:00
Rohan Mitchell
0e354f8fc1 Remove unused currency config vars: decimal_mark, thousands_separator 2016-11-04 09:39:17 +11:00
Rohan Mitchell
a6a0bdb063 Sanitize values before they're used 2016-11-04 09:39:17 +11:00
Rohan Mitchell
6753320336 Do not stomp address on create 2016-11-04 09:39:17 +11:00
Rohan Mitchell
a3b91dabe5 TEMP: Remove override for no-longer-present method 2016-11-04 09:39:17 +11:00
Rohan Mitchell
257441c9be Re-add object-level auth to Spree::Admin::ResourceController 2016-11-04 09:39:17 +11:00
Rohan Mitchell
1497d2c3bb Remove missing call 2016-11-04 09:39:17 +11:00
Rohan Mitchell
8f0bc367d0 Include missing helpers 2016-11-04 09:39:17 +11:00
Rohan Mitchell
764219b9ed Fix OrderMailer#find_order 2016-11-04 09:39:17 +11:00
Rohan Mitchell
7f7ee25e27 Money accessors changed to dollars/cents 2016-11-04 09:39:17 +11:00
Rohan Mitchell
1765ba0422 Fix spec dependent on product on_demand 2016-11-04 09:39:17 +11:00
Rohan Mitchell
32d2adc8a2 Fix mailers - provide from address 2016-11-04 09:39:17 +11:00
Rohan Mitchell
d890770104 Order state transition condition removed in Spree 2016-11-04 09:39:17 +11:00
Rohan Mitchell
376c4c3e0e Fix factories - base_product and base_variant removed 2016-11-04 09:39:17 +11:00
Rohan Mitchell
a0b740f52d Generalise fix for missing EnterpriseFee::Calculator to any use of calculated_adjustments 2016-11-04 09:39:17 +11:00
Rohan Mitchell
0d4c4f20df Fix missing EnterpriseFee::Calculator error
Conflicts:
	app/models/enterprise_fee.rb
2016-11-04 09:39:17 +11:00
Rohan Mitchell
ab707cf312 Bundle incremental Spree upgrade 2016-11-04 09:39:17 +11:00
Rohan Mitchell
9989b76b7d Integrate from Spree fork: Calculators work against LineItems 2016-11-04 09:39:17 +11:00
Rohan Mitchell
04a714426f Integrate from Spree fork: Fix spree issues #3531 and #2210 (patch provided by leiyangyou) 2016-11-04 09:39:17 +11:00
Maikel Linke
b66cf14bcb Merge remote-tracking branch 'origin/master' into transifex
Conflicts:
	config/locales/en_GB.yml
2016-10-28 15:21:03 +11:00
Transifex-Openfoodnetwork
b78739f777 Updating translations for config/locales/it.yml [skip ci] 2016-10-21 22:51:27 +11:00
Bing Xie
fb08759bec Add more tests 2016-10-21 14:45:04 +11:00
Bing Xie
a4755865ca Fix customer name 2016-10-21 11:58:50 +11:00
Bing Xie
5318aaedcf Fix country id and state in type bug 2016-10-21 11:42:13 +11:00
Rob Harrington
3e56571e59 Making checkout accordion work with new local storage library 2016-10-21 10:51:36 +11:00
Rob Harrington
e57a25d05f Replacing local storage library with actively maintained one: grevory/angular-local-storage 2016-10-21 10:51:36 +11:00
Rob Harrington
b59a1cc232 Using true/false instead of YES/NO for address defaults and billing same as shipping 2016-10-21 10:51:36 +11:00
Bing Xie
720ca17533 Fix the mistake 2016-10-21 10:51:36 +11:00
Bing Xie
d48b00c77c Fix failed user spec 2016-10-21 10:51:36 +11:00
Bing Xie
77f43e3ca7 Refactor setting default addresses 2016-10-21 10:51:36 +11:00
Bing Xie
23b8fbbbc7 Update customer's default address 2016-10-21 10:51:36 +11:00
Bing Xie
b0402daf32 Fix failed customers filter spec 2016-10-21 10:51:36 +11:00
Bing Xie
079788b4eb Add customer preferred bill and ship address 2016-10-21 10:51:36 +11:00
Bing Xie
21ed37189a Only search customers in user managed enterprises 2016-10-21 10:51:36 +11:00
Bing Xie
80d755da0d Convert state_id and country_id in serializer 2016-10-21 10:51:36 +11:00
Bing Xie
8d534041b2 Refactor js CurrentOrder 2016-10-21 10:51:36 +11:00
Bing Xie
e91c313f1e Fix state_id and country_id type bug 2016-10-21 10:51:36 +11:00
Bing Xie
2f241485a2 Set default addresses for user or customer 2016-10-21 10:51:36 +11:00
Bing Xie
f14ca87eb5 Set new address for user 2016-10-21 10:51:36 +11:00
Bing Xie
1caf648fe5 Move customer search to directive 2016-10-21 10:51:36 +11:00
Bing Xie
ac39c93bbf Fix failed js test 2016-10-21 10:51:36 +11:00
Bing Xie
63617f80c5 Add confirm when delete customer 2016-10-21 10:51:36 +11:00
Bing Xie
a94a30f422 Update the orders spec 2016-10-21 10:51:36 +11:00
Bing Xie
63dc48a075 Override customer search UI 2016-10-21 10:51:36 +11:00
Bing Xie
bc798504e0 Add new enterprise customers search API 2016-10-21 10:51:36 +11:00
Bing Xie
fd32152e88 Search customers in enterprises 2016-10-21 10:51:36 +11:00
Bing Xie
1877bea68d Customer serializer without tag_rule_mapping option 2016-10-21 10:51:36 +11:00
Bing Xie
f7523ad88c Create customer with default name and addresses 2016-10-21 10:51:36 +11:00
Bing Xie
ae2357d309 Edit customer address with first name and last name 2016-10-21 10:51:36 +11:00
Bing Xie
8afbdcaf79 Move phone down 2016-10-21 10:51:36 +11:00
Bing Xie
3e590f92ff Set default billing address and shipping address 2016-10-21 10:51:36 +11:00
Bing Xie
a6cfa061e4 Fix ship_address_same_as_billing checkbox value with string 2016-10-21 10:51:36 +11:00
Maikel Linke
d59db1cd97 Merge remote-tracking branch 'origin/master' into uk/delivery-address 2016-10-19 11:01:24 +11:00
Transifex-Openfoodnetwork
7cfb25ace9 Updating translations for config/locales/en_GB.yml [skip ci] 2016-10-15 01:48:24 +11:00
Continuous Integration
51f97f5b28 Merge remote-tracking branch 'origin/master' into HEAD 2016-10-12 13:02:27 +11:00
Transifex-Openfoodnetwork
33d940c736 Updating translations for config/locales/fr.yml [skip ci] 2016-10-12 01:03:42 +11:00
Maikel Linke
08b9b50f33 Re-phrase shop options 2016-10-07 13:17:28 +11:00
Maikel Linke
7c3968b64e Hide guest checkout if deactivated 2016-10-05 15:41:09 +11:00
Maikel Linke
c59cd21698 Add option 'allow guest orders' to enterprise
An enterprise manager can choose to allow guest orders (default) or
require a valid login for checkout.
2016-10-05 14:04:08 +11:00
Maikel Linke
92694c729f Move 'shopfront requires login' setting
Move 'shopfront requires login' setting to 'shop preferences' tab in
Profile Edit.

Solves issue #901.
2016-10-05 14:04:08 +11:00
Maikel Linke
7b2b285ba7 Rescue spec fails within enqueue_job matcher
Failing code tested by the enqueue_job matcher made it fail with:

  expected ConfirmOrderJob to be enqueued matching {} (??? others enqueued)

That was not helpful and masking the real failure. That failure is now
passed on. The hidden intermittent failure happened in 5% of runs on
Travis.
2016-10-05 14:04:08 +11:00
Maikel Linke
caeb8f08e7 Use link_to with mailto attribute to un-reverse email 2016-10-05 12:31:42 +11:00
Continuous Integration
499237715e Auto-merge from CI [skip ci] 2016-10-05 03:08:43 +11:00
Lynne Davis
7eb2dfba48 Update delivery report to use shipping address 2016-10-04 17:04:35 +01:00
Continuous Integration
815cf16822 Auto-merge from CI [skip ci] 2016-10-05 01:33:18 +11:00
Lynne Davis
a3722dee80 delete file - fix conflict 2016-10-04 15:29:57 +01:00
Lynne Davis
79ea2fd39d Reverse email address 2016-10-03 16:54:15 +01:00
Transifex-Openfoodnetwork
b349c28b9b Updating translations for config/locales/nb.yml [skip ci] 2016-10-02 00:38:02 +10:00
Lynne Davis
40ca2ccee4 Updating TOS url in confirmation email to refer to content_config 2016-09-25 15:14:44 +01:00
Lynne Davis
84b4a9bcbe update to internationalise email address in sell page 2016-09-25 14:00:11 +01:00
Maikel
1742367b36 Auto-merged master into issue_1134 on deployment. 2016-09-22 04:50:28 +10:00
Rhodri Karim
8a1d34e711 Fix for issue 1134 - 'Pack by supplier' report now groups by order rather than last name. 2016-09-21 19:41:43 +01:00
Maikel Linke
fba72498e3 Merge remote-tracking branch 'origin/master' into transifex 2016-09-21 16:36:22 +10:00
Lynne Davis
c533f6a15e Updates to UK translations 2016-09-19 20:33:58 +01:00
Transifex-Openfoodnetwork
23a216004e Updating translations for config/locales/en_GB.yml [skip ci] 2016-09-20 01:02:27 +10:00
Rob Harrington
7d149ed198 Revert shop property filters - causing 10x slowdown
This commit reverts commits 7eeee78c4e to e8f96e4818 (inclusive)
2016-09-18 17:46:43 +10:00
Rohan Mitchell
e8f96e4818 When a shop is open, only show taxon badges for currently open order cycles 2016-09-16 11:47:45 +10:00
Rohan Mitchell
3ca42ae055 Extract ids_to_objs to SerializerHelper 2016-09-16 11:36:27 +10:00
Rohan Mitchell
c0db23af90 Spree::Taxon.distributed_taxons can be scoped to taxons in open order cycles 2016-09-16 11:36:27 +10:00
Rohan Mitchell
db583df198 Use inner join for Spree::Taxon.distributed_taxons 2016-09-16 11:36:27 +10:00
Rohan Mitchell
306bd25dd9 EnterpriseSerialiser shows current properties for open shops and all properties for closed shops 2016-09-16 11:36:27 +10:00
Rohan Mitchell
f98b25b719 Add Spree::Property.ever_sold_by 2016-09-16 11:36:27 +10:00
Rohan Mitchell
1bc477f6b1 Add ProducerProperty.ever_sold_by 2016-09-16 11:36:26 +10:00
Rohan Mitchell
c37bf3d077 Rename Property#sold_by and ProducerProperty#sold_by to currently_sold_by 2016-09-16 11:36:26 +10:00
Rohan Mitchell
3a2e0b7eff Fix spacing 2016-09-16 11:36:26 +10:00
Rohan Mitchell
38c63fc88b Available producer filters update when taxon filter changed 2016-09-16 11:36:26 +10:00
Rohan Mitchell
8ec2ebbf94 Swap to using multi-line selectors for property filters - z-index issues with single-line-selectors 2016-09-16 11:36:26 +10:00
Rohan Mitchell
e00846776e Client-side, always show properties by their presentation, not their name 2016-09-16 11:36:26 +10:00
Rohan Mitchell
8339d247f8 Shops on groups page filter by property 2016-09-16 11:36:26 +10:00
Rohan Mitchell
ed2522f6d2 Explicitly specify supplied or distributed properties for ng filters: properties, propertiesOf 2016-09-16 11:36:26 +10:00
Rohan Mitchell
63ef5de0e5 Use short syntax for render partial 2016-09-16 11:28:45 +10:00
Rohan Mitchell
38d5682762 Add property filters for shops 2016-09-16 11:28:45 +10:00
Rohan Mitchell
4c40219352 Move hubs partials from home to shops, their rightful home 2016-09-16 11:28:45 +10:00
Rohan Mitchell
7eeee78c4e WIP: Move hubs partials from home to shops, their rightful home 2016-09-16 11:28:45 +10:00
Rob Harrington
0760d4cc1f Fixing property filters on shopfront 2016-09-08 12:15:36 +10:00
Rob Harrington
261a574da9 Tweaking styling on enterprise change form, and dashboard header row 2016-09-07 11:13:48 +10:00
Rob Harrington
da55eb6d27 Form for changing enterprise type specifies trial length 2016-09-07 11:13:05 +10:00
Rob Harrington
be51a55f16 Only display shopfront trial message on dashboard page. Fixes #1120 2016-09-02 13:45:49 +10:00
Rob Harrington
b2e14711ac Gateway providers inherit from decorated Gateway and PaymentMethod classes in production
Achieved by requiring payment method and gateway decorators in Spree initializer
2016-08-31 12:43:22 +10:00
Rob Harrington
1059c170d1 Adding require_relative of Gateway decorator in attempt to fix inheritance for Gateway::PayPalExpress 2016-08-31 11:32:09 +10:00
Rohan Mitchell
08465a531d Make properties and propertiesOf filters compatible with both products and enterprises 2016-08-26 12:13:48 +10:00
Rohan Mitchell
58e0b95cf6 Show property badges on shops 2016-08-26 12:13:48 +10:00
Rohan Mitchell
7b5e8fa603 Rename API field properties to supplied_properties 2016-08-26 12:13:47 +10:00
Rohan Mitchell
c70993ce75 Find producer properties of items sold by a shop 2016-08-26 12:13:47 +10:00
Rohan Mitchell
aa6e7cba30 Do not return duplicates with Spree::Property.sold_by 2016-08-26 12:13:47 +10:00
Rohan Mitchell
4529ced3f2 Find properties of items sold by a shop 2016-08-26 12:13:47 +10:00
Rohan Mitchell
509564819a Remove FlatPercentPerItem calculator for shipping methods and payment methods to reduce confusion 2016-08-26 10:26:50 +10:00
Rohan Mitchell
24d0e4fcf8 Update specs for calculator change 2016-08-26 09:29:09 +10:00
Rohan Mitchell
308c24caf4 Add FlatPercentPerItem calculator for shipping methods, remove FlatPercentItemTotal for enterprise fees (causes shopfront cart discrepencies). 2016-08-26 09:29:09 +10:00
Rohan Mitchell
10b076562f Make all calculators use FlatPercentPerItem instead of FlatPercentItemTotal 2016-08-26 09:29:09 +10:00
Rohan Mitchell
701c047a0a Move our customisations of FlatPercentItemTotal calculator to a new calc: FlatPercentPerItem 2016-08-26 09:28:29 +10:00
Rohan Mitchell
fa30e28335 Update spec: Our pricing calculations are now consistent between the frontend and backend carts 2016-08-26 09:28:29 +10:00
Rohan Mitchell
5b964ef502 Provide price to calculator to meet new requirements of FlatPercentItemTotal 2016-08-26 09:28:29 +10:00
Rohan Mitchell
b0eebc2e45 Round FlatPercentItemTotal calcs per-item before summing full quantity 2016-08-26 09:28:29 +10:00
Rohan Mitchell
7b2f65a965 Refactor spec so we can have different products in the cart 2016-08-26 09:28:29 +10:00
Rohan Mitchell
0dc12d8791 Parameterise add_product_to_cart spec helper method 2016-08-26 09:28:29 +10:00
Continuous Integration
88b9514090 Merge remote-tracking branch 'origin/master' into HEAD 2016-08-24 11:18:41 +10:00
Bing Xie
e5d7b545c9 I18n and refactoring 2016-08-24 10:43:50 +10:00
Maikel Linke
c4f81b019e Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into sign_up_email_i18n 2016-08-19 09:27:17 +10:00
Transifex-Openfoodnetwork
528af8759d Updating translations for config/locales/nb.yml [skip ci] 2016-08-19 01:23:43 +10:00
Maikel Linke
c34e9c046b Remove quotes around url 2016-08-17 16:44:27 +10:00
Transifex-Openfoodnetwork
baeabdd668 Updating translations for config/locales/nb.yml [skip ci] 2016-08-12 19:53:12 +10:00
Transifex-Openfoodnetwork
1de2300099 Updating translations for config/locales/nb.yml [skip ci] 2016-08-12 19:07:43 +10:00
Transifex-Openfoodnetwork
53e8056450 Updating translations for config/locales/fr.yml [skip ci] 2016-08-12 18:56:13 +10:00
Transifex-Openfoodnetwork
5773876cbc Updating translations for config/locales/fr.yml [skip ci] 2016-08-12 17:26:28 +10:00
Bing Xie
ed1f05e674 Show successful message 2016-08-12 16:31:49 +10:00
Bing Xie
98f3e15d87 Updating customer address feature tests 2016-08-12 14:44:59 +10:00
Bing Xie
95c152420c Test customer model updating shipping address 2016-08-12 14:44:59 +10:00
Bing Xie
bdb2b5cce8 Style and i18n the edit address page 2016-08-12 14:44:59 +10:00
Bing Xie
22ccbd5556 Required fields validation 2016-08-12 14:44:59 +10:00
Bing Xie
81d9ec71d9 Front-end updating address function 2016-08-12 14:44:59 +10:00
Bing Xie
45e3f8ab3a Fill the from with model 2016-08-12 14:44:59 +10:00
Bing Xie
5b40c745f3 Add address serializer to customer serializer 2016-08-12 14:44:59 +10:00
Bing Xie
69addf056b Edit customer address form 2016-08-12 14:44:59 +10:00
Bing Xie
34d5df69a5 Fix failed customers controller spec 2016-08-12 14:44:59 +10:00
Bing Xie
d160142945 Make bill address and ship address as nested attributes 2016-08-12 14:44:59 +10:00
Bing Xie
8234956a61 Inject available countries on admin customers page 2016-08-12 14:44:59 +10:00
Bing Xie
225bed9990 Add a simple edit address dialog 2016-08-12 14:44:59 +10:00
Bing Xie
7f203f5491 Show billing address and shipping address on customers index page 2016-08-12 14:44:59 +10:00
Bing Xie
add39f7401 Enterprise user can update customer's name 2016-08-12 14:44:59 +10:00
Bing Xie
ca0c3a028d Add name to customers 2016-08-12 14:44:59 +10:00
Bing Xie
b08a642377 Add billing_address and shipping_address to Customer 2016-08-12 14:44:59 +10:00
Bing Xie
37ace77734 Add bill_address_id and ship_address_id to customers 2016-08-12 14:44:59 +10:00
Maikel Linke
8645144231 Merge remote-tracking branch 'origin/master' into transifex 2016-08-10 21:01:12 +10:00
Rob Harrington
47df8d6d8e Refactoring AngularJS Shop Variant filtering logic for improved speed 2016-08-10 12:08:03 +10:00
Rob Harrington
f9b58b7b90 Ensure bill is > 0 for spec 2016-08-10 12:08:03 +10:00
Rob Harrington
b957555c82 Adding infinite-scroll to the shopfront
For performance improvement with large data sets
2016-08-10 12:08:03 +10:00
Maikel Linke
d40733d447 Add redirects to global site for /connect, /learn 2016-08-07 10:24:07 +10:00
Rohan Mitchell
1f5da8699d Build plz 2016-08-05 15:58:00 +10:00
Rohan Mitchell
fcd422c6ce Fix path helper fail in footer 2016-08-05 15:18:29 +10:00
Rohan Mitchell
5eecdb8c9c Update footer: Link to sell instead of individual register links 2016-08-05 15:03:07 +10:00
Rohan Mitchell
3b0084025a Add copy for home page learn and connect panes 2016-08-05 15:02:44 +10:00
Rohan Mitchell
8f4cbf1d9f Update page alert label and background colour 2016-08-05 15:02:10 +10:00
Rohan Mitchell
0dba54a4b8 Update page alert text 2016-08-05 14:43:44 +10:00
Rohan Mitchell
61c9355ffb Fill in sell page copy 2016-08-05 14:40:42 +10:00
Rohan Mitchell
0830a5bd85 Add basic sell page
Conflicts:
	config/routes.rb
2016-08-05 12:33:09 +10:00
Rohan Mitchell
1054fd2d05 View closed shops by URL 2016-08-03 16:07:15 +10:00
Rohan Mitchell
f03839b70c Update shopping header 2016-08-03 16:07:15 +10:00
Rohan Mitchell
0076b1b9a0 Add connect and learn panes to home page 2016-08-03 16:07:15 +10:00
Rohan Mitchell
d3ab9faede Show registration CTA in footer rather than connect and learn CTA 2016-08-03 16:07:15 +10:00
Rohan Mitchell
ee2c1ef195 Extract home page tagline to partial 2016-08-03 16:07:15 +10:00
Rohan Mitchell
57a2f1b339 Simplify, simplify 2016-08-03 16:07:15 +10:00
Rohan Mitchell
d93d1653db Add directive for smooth scrolling to anchor 2016-08-03 16:07:15 +10:00
Rohan Mitchell
140589fc2d Extract classical backgrounds to mixins 2016-08-03 16:07:15 +10:00
Rohan Mitchell
1216da38d1 Update menu: [Groups, About] -> [Connect, Learn] 2016-08-03 16:07:15 +10:00
Rohan Mitchell
5b43d7a87a Add connect and learn links to page alert 2016-08-03 16:07:15 +10:00
Rohan Mitchell
87e063593a Add feature toggle helper, allow hash or string queries 2016-08-03 16:07:15 +10:00
Rohan Mitchell
23827d6c57 Add feature toggle for Connect+Learn homepage 2016-08-03 16:07:15 +10:00
Rohan Mitchell
e966b474b4 Remove order cycles feature toggle 2016-08-03 16:07:11 +10:00
Rohan Mitchell
1388c077ea Remove unused feature toggles 2016-08-03 12:08:51 +10:00
Transifex-Openfoodnetwork
4d1a5c6ffc Updating translations for config/locales/en_GB.yml [skip ci] 2016-08-01 21:47:34 +10:00
Rohan Mitchell
1586cd3992 Uncache enterprise producer properties - we have no cache invalidation for this 2016-07-29 15:40:24 +10:00
Rohan Mitchell
4db29ce322 Update css_splitter, fixes problem with keyframes spanning limit
https://github.com/zweilove/css_splitter/issues/53
2016-07-29 11:53:46 +10:00
Rohan Mitchell
243dfa7a93 Add retry for intermittently failing spec in variant overrides 2016-07-29 11:01:52 +10:00
Rohan Mitchell
d9d3a4a645 Set up producer filters on group producers page 2016-07-29 11:01:52 +10:00
Rohan Mitchell
b13360d2d0 Extract filter helpers from individual spec to spec helper 2016-07-29 11:01:52 +10:00
Rohan Mitchell
13cf5d29de Add guard for selector overflow (only seen in phantom, not selenium/firefox or dev server/chrome) 2016-07-29 11:01:52 +10:00
Rohan Mitchell
1257ee09f2 Reorder methods for clarity 2016-07-29 11:01:52 +10:00
Rohan Mitchell
e3173c955d Refit filters when box opens 2016-07-29 11:01:51 +10:00
Rohan Mitchell
69382c4c13 Move properties filter dropdown in front of search results 2016-07-29 11:01:51 +10:00
Rohan Mitchell
0b84afd67a Display property filters for producers 2016-07-29 11:01:51 +10:00
Rohan Mitchell
6f947380cb Remove unused overrides and views 2016-07-29 09:18:31 +10:00
Rohan Mitchell
160c535fd7 Update knapsack report 2016-07-29 09:18:30 +10:00
Rohan Mitchell
377074416e Remove CMS tables. Adds migration helper: drop_table_cascade 2016-07-29 09:18:30 +10:00
Rohan Mitchell
932edeb1c1 Remove CMS style shim - Spree/CMS compatibility 2016-07-29 09:18:30 +10:00
Rohan Mitchell
d3ad823d97 Remove CMS configuration, gem. Fix permalink check dependent on CMS glob path. 2016-07-29 09:18:30 +10:00
Rohan Mitchell
b637b5b75a Remove CMS helper: home_page_cms_content 2016-07-29 09:14:36 +10:00
Rohan Mitchell
eb8cedc497 Remove CMS views and overrides 2016-07-29 09:14:36 +10:00
Rohan Mitchell
ba854d12c8 Remove CMS specs 2016-07-29 09:14:36 +10:00
Lynne Davis
9e03a130c2 Updating GB translation, from transifex 2016-07-27 18:43:48 +01:00
Maikel Linke
dee0fa6724 Trigger checkout click more reliably in specs 2016-07-22 14:10:16 +10:00
Maikel Linke
84c434c279 Remove unused/broken multi-cart feature and views
This removes ten old overrides of the Spree view. Since the Spree view
is not used any more and got completely replaced by custom views, the
overrides were just adding noise to the code base.
2016-07-22 13:49:20 +10:00
Transifex-Openfoodnetwork
f8898bc722 Updating translations for config/locales/nb.yml [skip ci] 2016-07-22 01:04:58 +10:00
Transifex-Openfoodnetwork
2b7da4738c Updating translations for config/locales/nb.yml [skip ci] 2016-07-22 00:59:57 +10:00
Maikel Linke
11a702667d Merge branch 'transifex' into HEAD 2016-07-20 17:12:59 +10:00
Maikel Linke
11ec903131 Merge tag 'v1.8.3' into transifex 2016-07-20 17:11:42 +10:00
Maikel Linke
e57c06c610 Use require_relative introduced in Ruby 1.9.2
The new `require_relative` command is much shorter and easier to read
then the previous:

    -require File.expand_path('../config/application', __FILE__)
    +require_relative 'config/application'
2016-07-20 16:07:35 +10:00
Maikel Linke
984641e46c Merge remote-tracking branch 'origin/master' into uk/trial-length
Conflicts:
	config/locales/en.yml
2016-07-20 11:40:52 +10:00
Transifex-Openfoodnetwork
477d48e9da Updating translations for config/locales/nb.yml [skip ci] 2016-07-15 19:46:47 +10:00
Maikel Linke
ddb54d1924 Delete fee on payment method if payment invalid
PayPalExpress is always creating two payments. The first one is
invalidated and the second one succeeds. Without deleting the old fee on
the invalidated payment, the order lists the fee twice.
2016-07-15 17:43:26 +10:00
Maikel Linke
c6bd548413 Don't trigger deployment for transifex branch 2016-07-15 11:19:19 +10:00
Maikel Linke
af6d0ec107 Remove unused code from order confirmation page 2016-07-13 13:54:55 +10:00
Maikel Linke
e693f71775 Inject only needed enterprises into order confirmation page 2016-07-13 13:54:32 +10:00
Maikel Linke
0ff1c95c3d Keep unreferenced entries when dereferencing in js 2016-07-13 12:08:11 +10:00
Maikel Linke
b5bc3a4ca3 Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into enterprise-load 2016-07-13 10:01:16 +10:00
Maikel
b587a72eb6 Auto-merged master into transifex on deployment. 2016-07-12 17:44:55 +10:00
Maikel Linke
8e73a2e0d6 Dereference enterprises and taxons later 2016-07-06 16:20:07 +10:00
Rohan Mitchell
e373284934 Fix intermittent spec failure 2016-07-06 16:14:32 +10:00
Rohan Mitchell
b5a9a1b6bf Add translation for business_model_configuration 2016-07-06 16:14:25 +10:00
Rohan Mitchell
13c8f0a230 Improve spec reliability
It seems that the success message on the customers page is disappearing before the spec can
detect it. This seems unlikely since it's present for 3 s, but this is my best theory right now.
2016-07-06 15:29:04 +10:00
Maikel Linke
f733c7f207 Include shop enterprise on shop front 2016-07-06 12:45:12 +10:00
Rohan Mitchell
d3c423f7ce Only perform URL search once, not every time map tiles change 2016-07-06 11:56:41 +10:00
Maikel Linke
52f68dac33 Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into enterprise-load 2016-07-06 11:35:26 +10:00
Maikel Linke
f984871b23 Inject only needed enterprises into cart and checkout 2016-07-06 11:14:13 +10:00
Rohan Mitchell
f09cd9e477 Allow groups to be searched by URL 2016-07-06 11:08:38 +10:00
Rohan Mitchell
d6f21b24da Add specs for producers and shops search by URL 2016-07-06 11:08:38 +10:00
Rohan Mitchell
34b2f72ae8 When query changed (typing or autocomplete), update URL. When page loads, perform query search. 2016-07-06 10:44:25 +10:00
Rohan Mitchell
e6bdd2303d Extract showing search result 2016-07-06 10:44:25 +10:00
Rohan Mitchell
a9a68151ec Syntax 2016-07-06 10:44:25 +10:00
Rohan Mitchell
f586dbc3e1 Extract OSM tile setup to own directive 2016-07-06 10:44:19 +10:00
Continuous Integration
5fb5ef1974 Auto-merge from CI [skip ci] 2016-07-02 00:58:27 +10:00
Rohan Mitchell
54028f4e7e Split directive into functions 2016-07-01 15:31:32 +10:00
Rohan Mitchell
e8b83bef41 Simplify responding to search 2016-07-01 15:31:32 +10:00
Bing Xie
78b22c4a82 Fix incorrectly aligned columns 2016-06-30 21:38:10 +10:00
Continuous Integration
e252414263 Auto-merge from CI [skip ci] 2016-06-30 01:30:53 +10:00
Lynne Davis
320db21d5c Updating spec with $ (not £) for automated testing 2016-06-29 16:30:11 +01:00
Maikel Linke
c253d73d11 Refactoring with feedback on pr #1073 2016-06-29 15:46:51 +10:00
Maikel Linke
08fdc8a5bd Load producers of all or selected order cycles into shop 2016-06-29 12:57:09 +10:00
Maikel
12df5de43c Auto-merged master into sign_up_email_i18n on deployment. 2016-06-24 00:45:34 +10:00
Lynne
4da7668dfc Merge pull request #1048 from lin-d-hop/sign_up_email_i18n
code cleanup
2016-06-23 15:30:42 +01:00
Lynne Davis
9c29e56fc3 More typo 2016-06-21 17:44:45 +01:00
Lynne Davis
e253590c1c code cleanup 2016-06-21 17:07:42 +01:00
Lynne
43b5216002 Merge pull request #1046 from lin-d-hop/sign_up_email_i18n
Sign up email i18n
2016-06-20 18:45:31 +01:00
Lynne Davis
e7adacc541 Typo 2016-06-20 18:34:54 +01:00
Lynne Davis
fa52712e35 More syntax fixes 2016-06-20 18:32:32 +01:00
Lynne
36093c0f64 Merge pull request #1045 from lin-d-hop/sign_up_email_i18n
Sign up email i18n
Merging so that I can test emails on UK staging.
2016-06-20 17:29:37 +01:00
Lynne Davis
02d8f52426 Fixing syntax 2016-06-20 17:02:10 +01:00
Lynne Davis
5b22e19ec9 Undoing locale changes accidentally committed 2016-06-20 15:24:24 +01:00
Lynne Davis
99d22649a2 Undoing this change, shouldn't be on this branch 2016-06-20 15:21:34 +01:00
Lynne Davis
98548e15c5 I18n of enterprise emails 2016-06-20 15:18:25 +01:00
Lynne Davis
f37f89dd07 Adding Community forum to ContentConfig 2016-06-20 15:13:49 +01:00
Lynne Davis
ed37604bc2 Update from address in notification emails 2016-06-18 09:09:43 +01:00
Maikel Linke
e284ad62b2 Inject only relative enterprises into shopfront
Other shops displayed in producer modals are lazy loaded when opening
their modal.
2016-06-17 17:15:16 +10:00
Maikel
61a4228e6b Auto-merged master into uk/trial-length on deployment. 2016-05-25 18:56:17 +10:00
Lynne Davis
f0a2098826 Adding text generation to new business model features 2016-05-25 09:45:47 +01:00
959 changed files with 34804 additions and 10399 deletions

View File

@@ -1,11 +1,9 @@
engines:
rubocop:
enabled: true
exclude_fingerprints:
- ac41db8d4ec4cbf508c353d9b65a024f
- 8e3b6322aef5be9f38700b3fd0cd347e
channel: rubocop-0-48
scss-lint:
enabled: true
enabled: false
ratings:
paths:
- app/**

28
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,28 @@
#### What? Why?
[Explain why is this change 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]
#### Release notes
[In case this should be present in the release notes, please write them or
remove this section otherwise]
#### How is this related to the Spree upgrade?
[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 if so or remove
this section otherwise]
#### Dependencies
[Does this PR depend on another one? add the link of so or remove this section
otherwise]

View File

@@ -1,4 +1,9 @@
inherit_from:
- .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.1
TargetRailsVersion: 3.2
Include:
- '**/Rakefile'
- '**/config.ru'
@@ -6,24 +11,169 @@ AllCops:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'spec/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
- !ruby/regexp /old_and_unused\.rb$/
Documentation:
# OFN SETTINGS
# Cop settings that have been agreed upon by the OFN community
Rails:
Enabled: true
Style/Documentation:
Enabled: false
Style/EmptyLinesAroundClassBody:
Style/StringLiterals:
Enabled: false
Style/BracesAroundHashParameters:
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
# 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
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
Max: 120
MethodLength:
Metrics/MethodLength:
Enabled: false
StringLiterals:
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false

2201
.rubocop_todo.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,9 @@ env:
- CI_NODE_INDEX=3
- CI_NODE_INDEX=4 KARMA="true" GITHUB_DEPLOY="true"
before_install:
- ./script/upgrade_bundler.sh
before_script:
- cp config/database.travis.yml config/database.yml
- cp config/application.yml.example config/application.yml
@@ -45,7 +48,7 @@ script:
after_success:
- >
if [ "$GITHUB_DEPLOY" = "true" -a "$TRAVIS_PULL_REQUEST" = "false" -a -n "$TRAVIS_BRANCH" -a -n "$GITHUB_API_SECRET" ]; then
if [ "$GITHUB_DEPLOY" = "true" -a "$TRAVIS_PULL_REQUEST" = "false" -a -n "$TRAVIS_BRANCH" -a "$TRAVIS_BRANCH" != "transifex" -a -n "$GITHUB_API_SECRET" ]; then
description="`git show "$TRAVIS_BRANCH" -s --oneline --no-color`"
data="{
\"ref\":\"$TRAVIS_BRANCH\",

View File

@@ -1,3 +1,6 @@
See this here post on raising a github issue:
https://community.openfoodnetwork.org/t/how-to-raise-a-github-issue/912
# Contributing
We love pull requests from everyone. Here are some instructions for

21
Gemfile
View File

@@ -4,24 +4,24 @@ ruby "2.1.5"
gem 'rails', '3.2.21'
gem 'rails-i18n', '~> 3.0.0'
gem 'i18n', '~> 0.6.11'
gem 'i18n-js', '~> 3.0.0'
# Patched version. See http://rubysec.com/advisories/CVE-2015-5312/.
gem 'nokogiri', '>= 1.6.7.1'
gem 'pg'
gem 'spree', github: 'openfoodfoundation/spree', branch: '1-3-stable'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6-adjustment-state-migration', ref: '48febb2'
gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '1-3-stable'
gem 'spree_auth_devise', github: 'openfoodfoundation/spree_auth_devise', branch: 'spree-upgrade-intermediate'
# Our branch contains two changes
# - Pass customer email and phone number to PayPal (merged to upstream master)
# - 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 => "hide-password"
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 'delayed_job_active_record'
gem 'daemons'
gem 'comfortable_mexican_sofa'
# Fix bug in simple_form preventing collection_check_boxes usage within form_for block
# When merged, revert to upstream gem
@@ -51,7 +51,7 @@ gem 'gmaps4rails'
gem 'spinjs-rails'
gem 'rack-ssl', :require => 'rack/ssl'
gem 'custom_error_message', :github => 'jeremydurham/custom-err-msg'
gem 'angularjs-file-upload-rails', '~> 1.1.0'
gem 'angularjs-file-upload-rails', '~> 1.1.6'
gem 'roadie-rails', '~> 1.0.3'
gem 'figaro'
gem 'blockenspiel'
@@ -64,6 +64,7 @@ gem 'wkhtmltopdf-binary'
gem 'foreigner'
gem 'immigrant'
gem 'roo', '~> 2.7.0'
gem 'whenever', require: false
@@ -88,8 +89,10 @@ gem "foundation-rails"
gem 'foundation_rails_helper', github: 'willrjmarshall/foundation_rails_helper', branch: "rails3"
gem 'jquery-rails'
gem 'jquery-migrate-rails'
gem 'css_splitter'
gem 'ofn-qz', github: 'openfoodfoundation/ofn-qz'
group :test, :development do
# Pretty printed test output
@@ -113,7 +116,6 @@ end
group :test do
gem 'webmock'
# See spec/spec_helper.rb for instructions
#gem 'perftools.rb'
end
@@ -125,7 +127,12 @@ group :development do
gem 'guard-livereload'
gem 'rack-livereload'
gem 'guard-rails'
gem 'guard-zeus'
gem 'guard-rspec'
gem 'parallel_tests'
gem 'rubocop', '>= 0.49.1'
# 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'
end

View File

@@ -14,54 +14,93 @@ GIT
GIT
remote: git://github.com/openfoodfoundation/better_spree_paypal_express.git
revision: 840d973cd5bd3250b17674a624dad494aeb09eb3
branch: hide-password
revision: 8d95f4544c682634812becaf50999fba0cd04df0
branch: spree-upgrade-intermediate
specs:
spree_paypal_express (2.0.3)
paypal-sdk-merchant (= 1.106.1)
spree_core (~> 1.3.4)
spree_core (~> 1.3.99)
GIT
remote: git://github.com/openfoodfoundation/ofn-qz.git
revision: 024680ccea429b2e5428d7b964fa67c52add34ec
specs:
ofn-qz (0.1.0)
railties (~> 3.1)
GIT
remote: git://github.com/openfoodfoundation/spree.git
revision: 6e3edfe40a5de8eba0095b2c5f3db9ea54c3afda
branch: 1-3-stable
revision: 48febb250a3b1eb2d42812b27b93457e89cde589
ref: 48febb2
branch: step-6-adjustment-state-migration
specs:
spree (1.3.6.beta)
spree_api (= 1.3.6.beta)
spree_cmd (= 1.3.6.beta)
spree_core (= 1.3.6.beta)
spree_promo (= 1.3.6.beta)
spree_sample (= 1.3.6.beta)
spree_api (1.3.6.beta)
spree_core (= 1.3.6.beta)
spree (1.3.99)
spree_api (= 1.3.99)
spree_backend (= 1.3.99)
spree_cmd (= 1.3.99)
spree_core (= 1.3.99)
spree_dash (= 1.3.99)
spree_frontend (= 1.3.99)
spree_sample (= 1.3.99)
spree_api (1.3.99)
rabl (= 0.7.2)
spree_core (= 1.3.99)
versioncake (= 0.4.0)
spree_cmd (1.3.6.beta)
spree_backend (1.3.99)
deface (>= 0.9.0)
jquery-rails (~> 2.0)
rails (~> 3.2.8)
select2-rails (~> 3.2)
spree_api (= 1.3.99)
spree_core (= 1.3.99)
stringex (~> 1.3.2)
spree_cmd (1.3.99)
thor (>= 0.14.6)
spree_core (1.3.6.beta)
activemerchant (~> 1.34)
acts_as_list (= 0.1.4)
spree_core (1.3.99)
activemerchant (~> 1.50.0)
acts_as_list (= 0.1.9)
awesome_nested_set (= 2.1.5)
aws-sdk (~> 1.11.1)
cancan (= 1.6.8)
deface (>= 0.9.0)
ffaker (~> 1.15.0)
highline (= 1.6.18)
jquery-rails (~> 2.2.0)
highline (= 1.6.15)
httparty (= 0.9.0)
json (>= 1.5.5)
kaminari (= 0.14.1)
money (= 5.1.1)
kaminari (= 0.13.0)
money (= 5.1.0)
paperclip (~> 3.0)
rabl (= 0.7.2)
rails (~> 3.2.16)
rails (~> 3.2.13)
ransack (= 0.7.2)
select2-rails (= 3.5.9.3)
state_machine (= 1.1.2)
state_machine (= 1.2.0)
stringex (~> 1.3.2)
truncate_html (~> 0.5.5)
spree_promo (1.3.6.beta)
spree_core (= 1.3.6.beta)
spree_sample (1.3.6.beta)
spree_core (= 1.3.6.beta)
truncate_html (= 0.9.2)
spree_dash (1.3.99)
httparty (~> 0.9.0)
spree_backend (= 1.3.99)
spree_frontend (= 1.3.99)
spree_frontend (1.3.99)
deface (>= 0.9.0)
jquery-rails (~> 2.2.1)
rails (~> 3.2.8)
select2-rails (~> 3.2)
spree_api (= 1.3.99)
spree_core (= 1.3.99)
stringex (~> 1.3.2)
spree_sample (1.3.99)
spree_core (= 1.3.99)
GIT
remote: git://github.com/openfoodfoundation/spree_auth_devise.git
revision: da9eecefc6fe13dedf4c6f3febec79caad839ec3
branch: spree-upgrade-intermediate
specs:
spree_auth_devise (2.0.0)
devise (~> 2.2.5)
devise-encryptable (= 0.1.2)
spree_backend (~> 1.3.6)
spree_core (~> 1.3.6)
spree_frontend (~> 1.3.6)
GIT
remote: git://github.com/spree/deface.git
@@ -73,17 +112,6 @@ GIT
nokogiri (~> 1.6.0)
rails (>= 3.1)
GIT
remote: git://github.com/spree/spree_auth_devise.git
revision: ba95589a85368297c844f096c2a0c121e5b08138
branch: 1-3-stable
specs:
spree_auth_devise (1.3.0)
cancan (~> 1.6.7)
devise (~> 2.2.3)
devise-encryptable (= 0.1.2)
spree_core
GIT
remote: git://github.com/spree/spree_i18n.git
revision: 752eb67204e9c5a4e22b62591a8fd55fe2285e43
@@ -121,11 +149,10 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
active_link_to (1.0.0)
active_model_serializers (0.8.3)
activemodel (>= 3.0)
activemerchant (1.57.0)
activesupport (>= 3.2.14, < 5.1)
activemerchant (1.50.0)
activesupport (>= 3.2.14, < 5.0.0)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
@@ -145,17 +172,18 @@ GEM
multi_json (~> 1.0)
acts-as-taggable-on (3.5.0)
activerecord (>= 3.2, < 5)
acts_as_list (0.1.4)
addressable (2.3.3)
acts_as_list (0.1.9)
addressable (2.4.0)
andand (1.3.3)
angular-rails-templates (0.2.0)
railties (>= 3.1)
sprockets (~> 2)
tilt
angularjs-file-upload-rails (1.1.0)
angularjs-file-upload-rails (1.1.6)
angularjs-rails (1.5.5)
ansi (1.4.2)
arel (3.0.3)
ast (2.3.0)
atomic (1.1.99)
awesome_nested_set (2.1.5)
activerecord (>= 3.0.0)
@@ -164,13 +192,11 @@ GEM
json (~> 1.4)
nokogiri (>= 1.4.4)
uuidtools (~> 2.1)
bcrypt (3.1.7)
bcrypt (3.1.11)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
blockenspiel (0.4.5)
bugsnag (1.5.2)
httparty (>= 0.6, < 1.0)
multi_json (~> 1.0)
bugsnag (4.1.0)
builder (3.0.4)
byebug (2.7.0)
columnize (~> 0.3)
@@ -187,10 +213,9 @@ GEM
timers (~> 1.1.0)
chronic (0.10.2)
chunky_png (1.3.4)
climate_control (0.0.3)
activesupport (>= 3.0)
climate_control (0.1.0)
cliver (0.3.2)
cocaine (0.5.7)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.0.9)
coffee-rails (3.2.2)
@@ -200,12 +225,8 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.10.0)
colorize (0.7.7)
colorize (0.8.1)
columnize (0.9.0)
comfortable_mexican_sofa (1.6.24)
active_link_to (~> 1.0.0)
paperclip (>= 2.3.0)
rails (>= 3.0.0)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@@ -222,11 +243,11 @@ GEM
compass (~> 1.0.0)
sass-rails (<= 5.0.1)
sprockets (< 2.13)
crack (0.4.1)
safe_yaml (~> 0.9.0)
crack (0.4.3)
safe_yaml (~> 1.0.0)
css_parser (1.3.5)
addressable
css_splitter (0.4.1)
css_splitter (0.4.5)
sprockets (>= 2.0.0)
daemons (1.2.2)
dalli (2.7.2)
@@ -254,7 +275,7 @@ GEM
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.5.3)
erubis (2.7.0)
eventmachine (1.0.8)
eventmachine (1.2.3)
excon (0.45.4)
execjs (2.6.0)
factory_girl (3.3.0)
@@ -404,34 +425,35 @@ GEM
guard-rspec (4.0.4)
guard (>= 2.1.1)
rspec (~> 2.14)
guard-zeus (0.0.1)
guard
zeus
haml (4.0.4)
tilt
highline (1.6.18)
highline (1.6.15)
hike (1.2.3)
http_parser.rb (0.5.3)
httparty (0.13.1)
json (~> 1.8)
multi_xml (>= 0.5.2)
httparty (0.9.0)
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)
activerecord (>= 3.0)
foreigner (>= 1.2.1)
inflecto (0.0.2)
ipaddress (0.8.0)
journey (1.0.4)
jquery-migrate-rails (1.2.1)
jquery-rails (2.2.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
json (1.8.6)
json_spec (1.1.1)
multi_json (~> 1.0)
rspec (~> 2.0)
kaminari (0.14.1)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
kgio (2.9.3)
knapsack (1.5.1)
rake
@@ -451,16 +473,16 @@ GEM
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile2 (2.0.0)
mini_portile2 (2.1.0)
momentjs-rails (2.5.1)
railties (>= 3.1)
money (5.1.1)
money (5.1.0)
i18n (~> 0.6.0)
multi_json (1.12.0)
multi_xml (0.5.5)
multi_json (1.12.1)
multi_xml (0.6.0)
newrelic_rpm (3.12.0.288)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
oj (2.1.2)
orm_adapter (0.5.0)
paper_trail (3.0.8)
@@ -471,9 +493,11 @@ GEM
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
parallel (1.4.1)
parallel_tests (1.3.7)
parallel (1.11.2)
parallel_tests (2.14.1)
parallel
parser (2.4.0.0)
ast (~> 2.2)
paypal-sdk-core (0.2.10)
multi_json (~> 1.0)
xml-simple
@@ -488,6 +512,7 @@ GEM
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.5)
powerpack (0.1.1)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
@@ -499,7 +524,7 @@ GEM
activesupport (>= 2.3.14)
multi_json (~> 1.0)
rack (1.4.7)
rack-cache (1.2)
rack-cache (1.7.0)
rack (>= 0.4)
rack-livereload (0.3.15)
rack
@@ -525,8 +550,10 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rainbow (2.2.2)
rake
raindrops (0.13.0)
rake (10.4.2)
rake (10.5.0)
ransack (0.7.2)
actionpack (~> 3.0)
activerecord (~> 3.0)
@@ -552,6 +579,9 @@ GEM
roadie-rails (1.0.3)
rails (>= 3.0, < 4.2)
roadie (~> 3.0)
roo (2.7.1)
nokogiri (~> 1)
rubyzip (~> 1.1, < 2.0.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
@@ -560,8 +590,9 @@ GEM
rspec-expectations (2.14.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.2)
rspec-rails (2.14.0)
rspec-rails (2.14.2)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
@@ -569,14 +600,22 @@ GEM
rspec-mocks (~> 2.14.0)
rspec-retry (0.4.2)
rspec-core
ruby-progressbar (1.7.1)
safe_yaml (0.9.5)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rubyzip (1.2.0)
safe_yaml (1.0.4)
sass (3.3.14)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
select2-rails (3.5.9.3)
select2-rails (3.5.10)
thor (~> 0.14)
shoulda-matchers (1.1.0)
activesupport (>= 3.0.0)
@@ -588,28 +627,29 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
state_machine (1.1.2)
state_machine (1.2.0)
stringex (1.3.3)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thor (0.19.4)
tilt (1.4.1)
timecop (0.6.2.2)
timecop (0.8.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
truncate_html (0.5.5)
truncate_html (0.9.2)
turbo-sprockets-rails3 (0.3.6)
railties (> 3.2.8, < 4.0.0)
sprockets (>= 2.0.0)
turn (0.8.3)
ansi
tzinfo (0.3.44)
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)
kgio (~> 2.6)
rack
@@ -622,25 +662,22 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
warden (1.2.3)
warden (1.2.6)
rack (>= 1.0)
webmock (1.13.0)
webmock (1.8.11)
addressable (>= 2.2.7)
crack (>= 0.3.2)
crack (>= 0.1.7)
websocket-driver (0.6.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.9.2)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
wicked_pdf (0.11.0)
rails
wkhtmltopdf-binary (0.9.9.3)
xml-simple (1.1.4)
wicked_pdf (1.1.0)
wkhtmltopdf-binary (0.12.3.1)
xml-simple (1.1.5)
xpath (2.0.0)
nokogiri (~> 1.3)
zeus (0.15.4)
method_source (>= 0.6.7)
PLATFORMS
ruby
@@ -650,7 +687,7 @@ DEPENDENCIES
acts-as-taggable-on (~> 3.4)
andand
angular-rails-templates (~> 0.2.0)
angularjs-file-upload-rails (~> 1.1.0)
angularjs-file-upload-rails (~> 1.1.6)
angularjs-rails (= 1.5.5)
atomic
awesome_print
@@ -659,7 +696,6 @@ DEPENDENCIES
bugsnag
capybara
coffee-rails (~> 3.2.1)
comfortable_mexican_sofa
compass-rails
css_splitter
custom_error_message!
@@ -671,6 +707,7 @@ DEPENDENCIES
deface!
delayed_job_active_record
diffy
eventmachine (>= 1.2.3)
factory_girl_rails
figaro
foreigner
@@ -684,10 +721,11 @@ DEPENDENCIES
guard-livereload
guard-rails
guard-rspec
guard-zeus
haml
i18n (~> 0.6.11)
i18n-js (~> 3.0.0)
immigrant
jquery-migrate-rails
jquery-rails
json_spec
knapsack
@@ -695,6 +733,7 @@ DEPENDENCIES
momentjs-rails
newrelic_rpm
nokogiri (>= 1.6.7.1)
ofn-qz!
oj
paper_trail (~> 3.0.8)
paperclip
@@ -710,8 +749,10 @@ DEPENDENCIES
redcarpet
representative_view
roadie-rails (~> 1.0.3)
roo (~> 2.7.0)
rspec-rails
rspec-retry
rubocop (>= 0.49.1)
sass (~> 3.3)
sass-rails (~> 3.2.3)
shoulda-matchers
@@ -734,5 +775,8 @@ DEPENDENCIES
wicked_pdf
wkhtmltopdf-binary
RUBY VERSION
ruby 2.1.5p273
BUNDLED WITH
1.11.2
1.15.4

View File

@@ -47,4 +47,3 @@ end
#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

@@ -54,6 +54,7 @@ First, check your dependencies: Ensure that you have Ruby 2.1.5 installed:
Install the project's gem dependencies:
cd openfoodnetwork
./script/upgrade_bundler.sh
bundle install
Configure the site:
@@ -98,6 +99,17 @@ The site is configured to use
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

View File

@@ -2,7 +2,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require_relative 'config/application'
Openfoodnetwork::Application.load_tasks

View File

@@ -6,6 +6,7 @@
//
//= require jquery
//= require jquery-migrate-min
//= require jquery_ujs
//= require jquery-ui
//= require shared/jquery-ui-timepicker-addon
@@ -13,9 +14,8 @@
//= require angular-resource
//= require angular-animate
//= require angular-sanitize
//= require admin/spree_core
//= require admin/spree_backend
//= require admin/spree_auth
//= require admin/spree_promo
//= require admin/spree_paypal_express
//= require ../shared/ng-infinite-scroll.min.js
//= require ../shared/ng-tags-input.min.js
@@ -36,6 +36,7 @@
//= require ./order_cycles/order_cycles
//= require ./payment_methods/payment_methods
//= require ./products/products
//= require ./resources/resources
//= require ./shipping_methods/shipping_methods
//= require ./side_menu/side_menu
//= require ./tag_rules/tag_rules
@@ -46,7 +47,7 @@
//= require textAngular-rangy.min.js
//= require textAngular-sanitize.min.js
//= require textAngular.min.js
//= require darkswarm/i18n.js
//= require i18n/translations
//= require darkswarm/i18n.translate.js

View File

@@ -22,7 +22,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
$scope.producers = producers
$scope.taxons = Taxons.taxons
$scope.taxons = Taxons.all
$scope.tax_categories = tax_categories
$scope.filterProducers = [{id: "0", name: ""}].concat $scope.producers
$scope.filterTaxons = [{id: "0", name: ""}].concat $scope.taxons

View File

@@ -14,8 +14,8 @@ angular.module("admin.businessModelConfiguration").controller "BusinessModelConf
$scope.cappedBill()
$scope.capReached = ->
return "No" if !$scope.cap? || Number($scope.cap) == 0
if $scope.bill() >= Number($scope.cap) then "Yes" else "No"
return t('no') if !$scope.cap? || Number($scope.cap) == 0
if $scope.bill() >= Number($scope.cap) then t('yes') else t('no')
$scope.includedTax = ->
return 0 if !$scope.taxRate? || Number($scope.taxRate) == 0

View File

@@ -1,10 +1,10 @@
angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filter, Customers, TagRuleResource, CurrentShop, RequestMonitor, Columns, pendingChanges, shops) ->
angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filter, Customers, TagRuleResource, CurrentShop, RequestMonitor, Columns, pendingChanges, shops, availableCountries) ->
$scope.shops = shops
$scope.availableCountries = availableCountries
$scope.RequestMonitor = RequestMonitor
$scope.submitAll = pendingChanges.submitAll
$scope.add = Customers.add
$scope.deleteCustomer = Customers.remove
$scope.customerLimit = 20
$scope.customers = Customers.all
$scope.columns = Columns.columns
$scope.confirmRefresh = (event) ->
@@ -16,10 +16,13 @@ angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filt
Customers.index({enterprise_id: $scope.shop_id}).then (data) ->
pendingChanges.removeAll()
$scope.customers_form.$setPristine()
$scope.customers = data
$scope.shop_id = shops[0].id if shops.length == 1
$scope.deleteCustomer = (customer) ->
if confirm(t('admin.customers.index.confirm_delete'))
Customers.remove(customer)
$scope.checkForDuplicateCodes = ->
delete this.customer.code unless this.customer.code
this.duplicate = $scope.isDuplicateCode(this.customer.code)

View File

@@ -0,0 +1,36 @@
angular.module("admin.customers").directive 'editAddressDialog', ($compile, $templateCache, $filter, DialogDefaults, Customers, StatusMessage) ->
restrict: 'A'
scope: true
link: (scope, element, attr) ->
scope.errors = []
scope.$watch 'address.country_id', (newVal) ->
if newVal
scope.states = scope.filter_states(newVal)
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
template.dialog('close')
StatusMessage.display('success', t('admin.customers.index.update_address_success'))
else
scope.errors.push(t('admin.customers.index.update_address_error'))
template = $compile($templateCache.get('admin/edit_address_dialog.html'))(scope)
template.dialog(DialogDefaults)
element.bind 'click', (e) ->
if e.target.id == 'bill-address-link'
scope.addressType = 'bill_address'
else
scope.addressType = 'ship_address'
scope.address = scope.customer[scope.addressType]
template.dialog('open')
scope.$apply()
scope.filter_states = (countryID) ->
$filter('filter')(scope.availableCountries, {id: countryID})[0].states

View File

@@ -1,4 +1,4 @@
angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $injector, $templateCache, DialogDefaults, CurrentShop, Customers) ->
angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $templateCache, DialogDefaults, CurrentShop, Customers) ->
restrict: 'A'
scope: true
link: (scope, element, attr) ->
@@ -21,7 +21,7 @@ angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $inj
if response.data.errors
scope.errors.push(error) for error in response.data.errors
else
scope.errors.push("Sorry! Could not create '#{scope.email}'")
scope.errors.push(t('js.customers.could_not_create') + " '#{scope.email}'")
return
# Compile modal template
@@ -35,4 +35,4 @@ angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $inj
if CurrentShop.shop.id
template.dialog('open')
else
alert('Please select a shop first')
alert(t('js.customers.select_shop'))

View File

@@ -1,27 +0,0 @@
angular.module("admin.customers").factory "Customers", ($q, InfoDialog, RequestMonitor, CustomerResource, CurrentShop) ->
new class Customers
customers: []
add: (email) ->
params =
enterprise_id: CurrentShop.shop.id
email: email
CustomerResource.create params, (customer) =>
@customers.unshift customer if customer.id
remove: (customer) ->
params = id: customer.id
CustomerResource.destroy params, =>
i = @customers.indexOf customer
@customers.splice i, 1 unless i < 0
, (response) =>
errors = response.data.errors
if errors?
InfoDialog.open 'error', errors[0]
else
InfoDialog.open 'error', "Could not delete customer: #{customer.email}"
index: (params) ->
request = CustomerResource.index(params, (data) => @customers = data)
RequestMonitor.load(request.$promise)
request.$promise

View File

@@ -2,7 +2,7 @@ angular.module('admin.enterpriseFees').directive 'spreeDeleteResource', ->
(scope, element, attrs) ->
if scope.enterprise_fee.id
url = '/admin/enterprise_fees/' + scope.enterprise_fee.id
html = '<a href="' + url + '" class="delete-resource icon_link icon-trash no-text" data-action="remove" data-confirm="Are you sure?" url="' + url + '"></a>'
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
return

View File

@@ -11,7 +11,7 @@ angular.module("admin.enterprises")
$scope.StatusMessage = StatusMessage
$scope.$watch 'enterprise_form.$dirty', (newValue) ->
StatusMessage.display 'notice', 'You have unsaved changes' if newValue
StatusMessage.display 'notice', t('admin.unsaved_changes') if newValue
$scope.setFormDirty = ->
$scope.$apply ->
@@ -24,13 +24,12 @@ angular.module("admin.enterprises")
$scope.navClear()
enterprise_form.submit()
# Provide a callback for generating warning messages displayed before leaving the page. This is passed in
# 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 .
# and on all new uses of this contoller, and we might not want that.
enterpriseNavCallback = ->
if $scope.Enterprise.$dirty
"Your changes to the enterprise are not saved yet."
if $scope.enterprise_form.$dirty
t('admin.unsaved_confirm_leave')
# Register the NavigationCheck callback
NavigationCheck.register(enterpriseNavCallback)
@@ -39,6 +38,8 @@ angular.module("admin.enterprises")
if manager.id?
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.addManager = (manager) ->
if manager.id? and manager.email?

View File

@@ -30,27 +30,27 @@ angular.module("admin.enterprises").controller 'enterprisesCtrl', ($scope, $q, E
$scope.producerTextFor = (enterprise) ->
switch enterprise.is_primary_producer
when true
"Producer"
t('js.enterprises.producer')
else
"Non-Producer"
t('js.enterprises.non_producer')
$scope.packageTextFor = (enterprise) ->
switch enterprise.is_primary_producer
when true
switch enterprise.sells
when "none"
"Profile"
t('js.profile')
when "own"
"Shop"
t('js.shop')
when "any"
"Hub"
t('js.hub')
else
"Choose"
t('js.choose')
else
switch enterprise.sells
when "none"
"Profile"
t('js.profile')
when "any"
"Hub"
t('js.hub')
else
"Choose"
t('js.choose')

View File

@@ -14,7 +14,7 @@ angular.module("admin.enterprises").controller 'indexPanelCtrl', ($scope, Enterp
, (response) ->
$scope.saving = false
if response.status == 422 && response.data.errors?
message = 'Please resolve the following errors:\n'
message = t('js.resolve_errors') + ':\n'
for attr, msg of response.data.errors
message += "#{attr} #{msg}\n"
alert(message)

View File

@@ -6,7 +6,6 @@ angular.module("admin.enterprises")
$scope.menu.setItems [
{ name: 'primary_details', label: t('primary_details'), icon_class: "icon-home" }
{ name: 'users', label: t('users'), icon_class: "icon-user" }
{ name: 'address', label: t('address'), icon_class: "icon-map-marker" }
{ name: 'contact', label: t('contact'), icon_class: "icon-phone" }
{ name: 'social', label: t('social'), icon_class: "icon-twitter" }
@@ -20,11 +19,11 @@ angular.module("admin.enterprises")
{ name: 'inventory_settings', label: t('inventory_settings'), icon_class: "icon-list-ol", show: "enterpriseIsShop()" }
{ name: 'tag_rules', label: t('tag_rules'), icon_class: "icon-random", show: "enterpriseIsShop()" }
{ name: 'shop_preferences', label: t('shop_preferences'), icon_class: "icon-shopping-cart", show: "enterpriseIsShop()" }
{ name: 'users', label: t('users'), icon_class: "icon-user" }
]
$scope.select(0)
$scope.showItem = (item) ->
if item.show?
$parse(item.show)($scope)

View File

@@ -0,0 +1,16 @@
angular.module('admin.enterprises').directive 'enterpriseSwitcher', (NavigationCheck) ->
restrict: 'A'
require: 'ngModel'
link: (scope, element, attr, ngModel) ->
initial = element[0].getAttribute('data-initial')
element.on 'change', ->
if not NavigationCheck.confirmLeave()
# Reset the current dropdown selection if staying on page
ngModel.$setViewValue initial
ngModel.$render()
element.select2 'val', initial
return
NavigationCheck.clear() # Don't ask twice if leaving
window.location = element[0].querySelector('option[selected]').getAttribute('data-url')

View File

@@ -19,16 +19,16 @@ angular.module("admin.enterprises").factory 'PermalinkChecker', ($q, $http) ->
if data.length > @MAX_PERMALINK_LENGTH || !data.match(/^[\w-]+$/)
deferredRequest.resolve
permalink: permalink
available: "Error"
available: t('js.error')
else
deferredRequest.resolve
permalink: data
available: "Available"
available: t('available')
).error (data,status) =>
if status == 409
deferredRequest.resolve
permalink: data
available: "Unavailable"
available: t('js.unavailable')
else
# Something went wrong or request was aborted
deferredRequest.reject()

View File

@@ -24,7 +24,7 @@ angular.module("admin.indexUtils").directive "objForUpdate", (switchClass, pendi
scope.savedValue = value
scope.success = ->
switchClass( element, "update-success", ["update-pending", "update-error"], 3000 )
switchClass( element, "update-success", ["update-pending", "update-error"], 5000 )
scope.pending = ->
switchClass( element, "update-pending", ["update-error", "update-success"], false )

View File

@@ -3,19 +3,42 @@ angular.module("admin.indexUtils").directive "ofnSelect2", ($sanitize, $timeout,
restrict: 'C'
scope:
data: "="
minSearch: "@?"
text: "@?"
minSearch: "@"
text: "@"
blank: "=?"
filter: "=?"
onSelecting: "=?"
multiple: '@'
link: (scope, element, attrs, ngModel) ->
$timeout ->
scope.text ||= 'name'
scope.filter ||= -> true
scope.text ?= 'name'
scope.multiple ?= false
scope.filter ?= -> true
if scope.data.$promise
scope.data.$promise.then -> init()
else
init()
element.on "select2-opening", scope.onSelecting || angular.noop
attrs.$observe 'disabled', (value) ->
element.select2('enable', !value)
ngModel.$formatters.push (value) ->
element.select2('val', value)
value
ngModel.$parsers.push (value) ->
return value.split(",") if scope.multiple
value
init = ->
scope.data.unshift(scope.blank) if scope.blank? && typeof scope.blank is "object"
item.name = $sanitize(item.name) for item in scope.data
element.select2
multiple: scope.multiple
minimumResultsForSearch: scope.minSearch || 0
data: ->
filtered = $filter('filter')(scope.data,scope.filter)
@@ -24,12 +47,3 @@ angular.module("admin.indexUtils").directive "ofnSelect2", ($sanitize, $timeout,
item[scope.text]
formatResult: (item) ->
item[scope.text]
element.on "select2-opening", scope.onSelecting || angular.noop
attrs.$observe 'disabled', (value) ->
element.select2('enable', !value)
ngModel.$formatters.push (value) ->
element.select2('val', value)
value

View File

@@ -1 +1 @@
angular.module("admin.indexUtils", ['ngResource', 'ngSanitize', 'templates', 'admin.utils']).config ($httpProvider) ->
angular.module("admin.indexUtils", ['admin.resources', 'ngSanitize', 'templates', 'admin.utils']).config ($httpProvider) ->

View File

@@ -3,7 +3,8 @@ angular.module("admin.indexUtils").factory 'Dereferencer', ->
dereference: (array, data)->
if array
for object, i in array
array[i] = data[object.id]
match = data[object.id]
array[i] = match if match?
dereferenceAttr: (array, attr, data)->
if array

View File

@@ -21,16 +21,16 @@ angular.module("admin.indexUtils").factory "pendingChanges", ($q, resources, Sta
submitAll: (form=null) =>
all = []
@errors = []
StatusMessage.display('progress', "Saving...")
StatusMessage.display('progress', t('js.saving'))
for id, objectChanges of @pendingChanges
for attrName, change of objectChanges
all.push @submit(change)
$q.all(all).then =>
if @errors.length == 0
StatusMessage.display('success', "All changes saved successfully")
StatusMessage.display('success', t('js.all_changes_saved_successfully'))
form.$setPristine() if form?
else
StatusMessage.display('failure', "Oh no! I was unable to save your changes")
StatusMessage.display('failure', t('js.oh_no'))
all
submit: (change) ->

View File

@@ -10,7 +10,7 @@ angular.module("admin.indexUtils").factory "SpreeApiAuth", ($q, $http, SpreeApiK
deferred.resolve()
.error (response) ->
error = response?.error || "You are unauthorised to access this page."
error = response?.error || t('js.unauthorized')
deferred.reject(error)
deferred.promise

View File

@@ -1,5 +1,5 @@
angular.module("admin.indexUtils").factory "switchClass", ($timeout) ->
return (element,classToAdd,removeClasses,timeout) ->
return (element, classToAdd, removeClasses, timeout) ->
$timeout.cancel element.timeout if element.timeout
element.removeClass className for className in removeClasses
element.addClass classToAdd

View File

@@ -1,4 +1,4 @@
angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $http, $q, StatusMessage, Columns, Dereferencer, Orders, LineItems, Enterprises, OrderCycles, blankOption, VariantUnitManager, RequestMonitor) ->
angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $http, $q, StatusMessage, Columns, Dereferencer, Orders, LineItems, Enterprises, OrderCycles, VariantUnitManager, RequestMonitor) ->
$scope.initialized = false
$scope.RequestMonitor = RequestMonitor
$scope.filteredLineItems = []
@@ -15,31 +15,31 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
LineItems.allSaved() || confirm(t("unsaved_changes_warning"))
$scope.resetSelectFilters = ->
$scope.distributorFilter = blankOption().id
$scope.supplierFilter = blankOption().id
$scope.orderCycleFilter = blankOption().id
$scope.distributorFilter = 0
$scope.supplierFilter = 0
$scope.orderCycleFilter = 0
$scope.quickSearch = ""
$scope.refreshData = ->
unless !$scope.orderCycleFilter? || $scope.orderCycleFilter == "0"
$scope.startDate = OrderCycles.orderCyclesByID[$scope.orderCycleFilter].first_order
$scope.endDate = OrderCycles.orderCyclesByID[$scope.orderCycleFilter].last_order
unless !$scope.orderCycleFilter? || $scope.orderCycleFilter == 0
$scope.startDate = OrderCycles.byID[$scope.orderCycleFilter].first_order
$scope.endDate = OrderCycles.byID[$scope.orderCycleFilter].last_order
RequestMonitor.load $scope.orders = Orders.index("q[state_not_eq]": "canceled", "q[completed_at_not_null]": "true", "q[completed_at_gt]": "#{parseDate($scope.startDate)}", "q[completed_at_lt]": "#{parseDate($scope.endDate)}")
RequestMonitor.load $scope.lineItems = LineItems.index("q[order][state_not_eq]": "canceled", "q[order][completed_at_not_null]": "true", "q[order][completed_at_gt]": "#{parseDate($scope.startDate)}", "q[order][completed_at_lt]": "#{parseDate($scope.endDate)}")
unless $scope.initialized
RequestMonitor.load $scope.distributors = Enterprises.index(includeBlank: true, action: "for_line_items", ams_prefix: "basic", "q[sells_in][]": ["own", "any"])
RequestMonitor.load $scope.orderCycles = OrderCycles.index(includeBlank: true, ams_prefix: "basic", as: "distributor", "q[orders_close_at_gt]": "#{daysFromToday(-90)}")
RequestMonitor.load $scope.suppliers = Enterprises.index(includeBlank: true, action: "for_line_items", ams_prefix: "basic", "q[is_primary_producer_eq]": "true")
RequestMonitor.load $scope.distributors = Enterprises.index(action: "for_line_items", ams_prefix: "basic", "q[sells_in][]": ["own", "any"])
RequestMonitor.load $scope.orderCycles = OrderCycles.index(ams_prefix: "basic", as: "distributor", "q[orders_close_at_gt]": "#{daysFromToday(-90)}")
RequestMonitor.load $scope.suppliers = Enterprises.index(action: "for_line_items", ams_prefix: "basic", "q[is_primary_producer_eq]": "true")
RequestMonitor.load $q.all([$scope.orders.$promise, $scope.distributors.$promise, $scope.orderCycles.$promise]).then ->
Dereferencer.dereferenceAttr $scope.orders, "distributor", Enterprises.enterprisesByID
Dereferencer.dereferenceAttr $scope.orders, "order_cycle", OrderCycles.orderCyclesByID
Dereferencer.dereferenceAttr $scope.orders, "distributor", Enterprises.byID
Dereferencer.dereferenceAttr $scope.orders, "order_cycle", OrderCycles.byID
RequestMonitor.load $q.all([$scope.orders.$promise, $scope.suppliers.$promise, $scope.lineItems.$promise]).then ->
Dereferencer.dereferenceAttr $scope.lineItems, "supplier", Enterprises.enterprisesByID
Dereferencer.dereferenceAttr $scope.lineItems, "order", Orders.ordersByID
Dereferencer.dereferenceAttr $scope.lineItems, "supplier", Enterprises.byID
Dereferencer.dereferenceAttr $scope.lineItems, "order", Orders.byID
$scope.bulk_order_form.$setPristine()
StatusMessage.clear()
unless $scope.initialized
@@ -51,13 +51,13 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.$watch 'bulk_order_form.$dirty', (newVal, oldVal) ->
if newVal == true
StatusMessage.display 'notice', "You have unsaved changes"
StatusMessage.display 'notice', t('js.unsaved_changes')
$scope.submit = ->
if $scope.bulk_order_form.$valid
StatusMessage.display 'progress', "Saving..."
StatusMessage.display 'progress', t('js.saving')
$q.all(LineItems.saveAll()).then(->
StatusMessage.display 'success', "All changes saved"
StatusMessage.display 'success', t('js.all_changes_saved')
$scope.bulk_order_form.$setPristine()
).catch ->
StatusMessage.display 'failure', t "unsaved_changes_error"

View File

@@ -1,8 +1,8 @@
angular.module("admin.lineItems").filter "selectFilter", (blankOption, RequestMonitor) ->
angular.module("admin.lineItems").filter "selectFilter", (RequestMonitor) ->
return (lineItems,selectedSupplier,selectedDistributor,selectedOrderCycle) ->
filtered = []
unless RequestMonitor.loading
filtered.push lineItem for lineItem in lineItems when (angular.equals(selectedSupplier,"0") || lineItem.supplier.id == selectedSupplier) &&
(angular.equals(selectedDistributor,"0") || lineItem.order.distributor.id == selectedDistributor) &&
(angular.equals(selectedOrderCycle,"0") || lineItem.order.order_cycle.id == selectedOrderCycle)
filtered.push lineItem for lineItem in lineItems when (angular.equals(selectedSupplier,0) || lineItem.supplier.id == selectedSupplier) &&
(angular.equals(selectedDistributor,0) || lineItem.order.distributor.id == selectedDistributor) &&
(angular.equals(selectedOrderCycle,0) || lineItem.order.order_cycle.id == selectedOrderCycle)
filtered

View File

@@ -12,7 +12,10 @@ angular.module('admin.orderCycles')
$scope.StatusMessage = StatusMessage
$scope.$watch 'order_cycle_form.$dirty', (newValue) ->
StatusMessage.display 'notice', 'You have unsaved changes' if newValue
StatusMessage.display 'notice', t("admin.unsaved_changes") if newValue
$scope.$watch 'order_cycle_form.$valid', (isValid) ->
StatusMessage.setValidation(isValid)
$scope.loaded = ->
Enterprise.loaded && EnterpriseFee.loaded && OrderCycle.loaded
@@ -81,7 +84,7 @@ angular.module('admin.orderCycles')
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', "Saving..."
StatusMessage.display 'progress', t('js.saving')
OrderCycle.create(destination)
$scope.cancel = (destination) ->

View File

@@ -13,7 +13,10 @@ angular.module('admin.orderCycles')
$scope.StatusMessage = StatusMessage
$scope.$watch 'order_cycle_form.$dirty', (newValue) ->
StatusMessage.display 'notice', 'You have unsaved changes' if newValue
StatusMessage.display 'notice', t("admin.unsaved_changes") if newValue
$scope.$watch 'order_cycle_form.$valid', (isValid) ->
StatusMessage.setValidation(isValid)
$scope.loaded = ->
Enterprise.loaded && EnterpriseFee.loaded && OrderCycle.loaded
@@ -68,6 +71,7 @@ angular.module('admin.orderCycles')
$scope.removeCoordinatorFee = ($event, index) ->
$event.preventDefault()
OrderCycle.removeCoordinatorFee(index)
$scope.order_cycle_form.$dirty = true
$scope.addExchangeFee = ($event, exchange) ->
$event.preventDefault()
@@ -76,17 +80,18 @@ angular.module('admin.orderCycles')
$scope.removeExchangeFee = ($event, exchange, index) ->
$event.preventDefault()
OrderCycle.removeExchangeFee(exchange, index)
$scope.order_cycle_form.$dirty = true
$scope.removeDistributionOfVariant = (variant_id) ->
OrderCycle.removeDistributionOfVariant(variant_id)
$scope.submit = (destination) ->
$event.preventDefault()
StatusMessage.display 'progress', "Saving..."
StatusMessage.display 'progress', t('js.saving')
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', "Saving..."
StatusMessage.display 'progress', t('js.saving')
OrderCycle.update(destination, $scope.order_cycle_form)
$scope.cancel = (destination) ->

View File

@@ -8,7 +8,10 @@ angular.module('admin.orderCycles').controller "AdminSimpleCreateOrderCycleCtrl"
$scope.enterprise_fees = EnterpriseFee.index(coordinator_id: ocInstance.coordinator_id)
$scope.$watch 'order_cycle_form.$dirty', (newValue) ->
StatusMessage.display 'notice', 'You have unsaved changes' if newValue
StatusMessage.display 'notice', t("admin.unsaved_changes") if newValue
$scope.$watch 'order_cycle_form.$valid', (isValid) ->
StatusMessage.setValidation(isValid)
$scope.init = (enterprises) ->
enterprise = enterprises[Object.keys(enterprises)[0]]
@@ -46,7 +49,7 @@ angular.module('admin.orderCycles').controller "AdminSimpleCreateOrderCycleCtrl"
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', "Saving..."
StatusMessage.display 'progress', t('js.saving')
OrderCycle.mirrorIncomingToOutgoingProducts()
OrderCycle.create(destination)

View File

@@ -10,7 +10,10 @@ angular.module('admin.orderCycles').controller "AdminSimpleEditOrderCycleCtrl",
$scope.init()
$scope.$watch 'order_cycle_form.$dirty', (newValue) ->
StatusMessage.display 'notice', 'You have unsaved changes' if newValue
StatusMessage.display 'notice', t("admin.unsaved_changes") if newValue
$scope.$watch 'order_cycle_form.$valid', (isValid) ->
StatusMessage.setValidation(isValid)
$scope.loaded = ->
Enterprise.loaded && EnterpriseFee.loaded && OrderCycle.loaded
@@ -39,7 +42,7 @@ angular.module('admin.orderCycles').controller "AdminSimpleEditOrderCycleCtrl",
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', "Saving..."
StatusMessage.display 'progress', t('js.saving')
OrderCycle.mirrorIncomingToOutgoingProducts()
OrderCycle.update(destination, $scope.order_cycle_form)

View File

@@ -1,4 +1,4 @@
angular.module('admin.orderCycles', ['ngResource', 'admin.utils', 'admin.indexUtils', 'ngTagsInput'])
angular.module('admin.orderCycles', ['admin.utils', 'admin.indexUtils', 'ngTagsInput'])
.config ($httpProvider) ->
$httpProvider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content')

View File

@@ -165,13 +165,13 @@ angular.module('admin.orderCycles').factory 'OrderCycle', ($resource, $window, S
if destination?
$window.location = destination
else
StatusMessage.display 'success', 'Your order cycle has been updated.'
StatusMessage.display 'success', t('js.order_cycles.update_success')
else
console.log('Failed to update order cycle')
confirmNoDistributors: ->
if @order_cycle.outgoing_exchanges.length == 0
confirm 'There are no distributors in this order cycle. This order cycle will not be visible to customers until you add one. Would you like to continue saving this order cycle?'
confirm t('js.order_cycles.no_distributors')
else
true

View File

@@ -0,0 +1,59 @@
angular.module("admin.orders").directive 'customerSearchOverride', ->
restrict: 'C'
link: (scope, element, attr) ->
formatCustomerResult = (customer) ->
customerTemplate
customer: customer
bill_address: customer.bill_address
ship_address: customer.ship_address
element.select2
placeholder: Spree.translations.choose_a_customer
ajax:
url: '/admin/search/customers.json'
datatype: 'json'
data: (term, page) ->
{
q: term
distributor_id: $('#distributor_id').val() # modified
}
results: (data, page) ->
{ results: data }
dropdownCssClass: 'customer_search'
formatResult: formatCustomerResult
formatSelection: (customer) ->
_.each [
'bill_address'
'ship_address'
], (address) ->
data = customer[address]
address_parts = [
'firstname'
'lastname'
'company'
'address1'
'address2'
'city'
'zipcode'
'phone'
]
attribute_wrapper = '#order_' + address + '_attributes_'
if data # modified
_.each address_parts, (part) ->
$(attribute_wrapper + part).val data[part]
return
$(attribute_wrapper + 'state_id').select2 'val', data['state_id']
$(attribute_wrapper + 'country_id').select2 'val', data['country_id']
else
_.each address_parts, (part) ->
$(attribute_wrapper + part).val ''
return
$(attribute_wrapper + 'state_id').select2 'val', ''
$(attribute_wrapper + 'country_id').select2 'val', ''
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

@@ -1,3 +1,3 @@
angular.module("admin.paymentMethods").controller "paymentMethodsCtrl", ($scope, PaymentMethods) ->
$scope.findPaymentMethodByID = (id) ->
$scope.PaymentMethod = PaymentMethods.findByID(id)
$scope.PaymentMethod = PaymentMethods.byID[id]

View File

@@ -1,8 +0,0 @@
angular.module("admin.paymentMethods")
.factory "PaymentMethods", (paymentMethods) ->
new class PaymentMethods
paymentMethods: paymentMethods
findByID: (id) ->
for paymentMethod in @paymentMethods
return paymentMethod if paymentMethod.id is id

View File

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

View File

@@ -0,0 +1,14 @@
angular.module("ofn.admin").controller "ImportOptionsFormCtrl", ($scope, $rootScope, ProductImportService) ->
$scope.toggleResetAbsent = () ->
confirmed = confirm t('js.product_import.confirmation') if $scope.resetAbsent
if confirmed or !$scope.resetAbsent
ProductImportService.updateResetAbsent($scope.supplierId, $scope.resetCount, $scope.resetAbsent)
else
$scope.resetAbsent = false
$scope.resetTotal = ProductImportService.resetTotal
$rootScope.$watch 'resetTotal', (newValue) ->
$scope.resetTotal = newValue if newValue || newValue == 0

View File

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

View File

@@ -0,0 +1,24 @@
angular.module("admin.products").controller "editUnitsCtrl", ($scope, VariantUnitManager) ->
$scope.product =
variant_unit: angular.element('#variant_unit').val()
variant_unit_scale: angular.element('#variant_unit_scale').val()
$scope.variant_unit_options = VariantUnitManager.variantUnitOptions()
if $scope.product.variant_unit == 'items'
$scope.variant_unit_with_scale = 'items'
else
$scope.variant_unit_with_scale = $scope.product.variant_unit + '_' + $scope.product.variant_unit_scale
$scope.setFields = ->
if $scope.variant_unit_with_scale == 'items'
variant_unit = 'items'
variant_unit_scale = null
else
options = $scope.variant_unit_with_scale.split('_')
variant_unit = options[0]
variant_unit_scale = options[1]
$scope.product.variant_unit = variant_unit
$scope.product.variant_unit_scale = variant_unit_scale

View File

@@ -0,0 +1,14 @@
angular.module("admin.products").controller "variantUnitsCtrl", ($scope, VariantUnitManager, $timeout) ->
$scope.unitName = (scale, type) ->
VariantUnitManager.getUnitName(scale, type)
$scope.scale = angular.element('#product_variant_unit_scale').val()
$scope.updateValue = ->
unit_value_human = angular.element('#unit_value_human').val()
$scope.unit_value = unit_value_human * $scope.scale
variant_unit_value = angular.element('#variant_unit_value').val()
$scope.unit_value_human = variant_unit_value / $scope.scale
$timeout -> $scope.updateValue()

View File

@@ -1 +1 @@
angular.module("admin.products", [])
angular.module("admin.products", ["textAngular", "admin.utils"])

View File

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

View File

@@ -1,4 +1,4 @@
angular.module("admin.customers").factory 'CustomerResource', ($resource) ->
angular.module("admin.resources").factory 'CustomerResource', ($resource) ->
$resource('/admin/customers/:id.json', {}, {
'index':
method: 'GET'
@@ -14,4 +14,8 @@ angular.module("admin.customers").factory 'CustomerResource', ($resource) ->
method: 'DELETE'
params:
id: '@id'
'update':
method: 'PUT'
params:
id: '@id'
})

View File

@@ -1,4 +1,4 @@
angular.module("admin.enterprises").factory 'EnterpriseResource', ($resource) ->
angular.module("admin.resources").factory 'EnterpriseResource', ($resource) ->
ignoredAttrs = ->
["$$hashKey", "producer", "package", "producerError", "packageError", "status"]

View File

@@ -1,5 +1,5 @@
angular.module("admin.lineItems").factory 'LineItemResource', ($resource) ->
$resource('/admin/:orders/:order_number/line_items/:id.json', {}, {
angular.module("admin.resources").factory 'LineItemResource', ($resource) ->
$resource('/admin/bulk_line_items/:id.json', {}, {
'index':
method: 'GET'
isArray: true

View File

@@ -1,4 +1,4 @@
angular.module("admin.orderCycles").factory 'OrderCycleResource', ($resource) ->
angular.module("admin.resources").factory 'OrderCycleResource', ($resource) ->
$resource('/admin/order_cycles/:id/:action.json', {}, {
'index':
method: 'GET'

View File

@@ -1,4 +1,4 @@
angular.module("admin.orders").factory 'OrderResource', ($resource) ->
angular.module("admin.resources").factory 'OrderResource', ($resource) ->
$resource('/admin/orders/:id/:action.json', {}, {
'index':
method: 'GET'

View File

@@ -0,0 +1,49 @@
angular.module("admin.resources").factory "Customers", ($q, InfoDialog, RequestMonitor, CustomerResource, CurrentShop) ->
new class Customers
all: []
byID: {}
pristineByID: {}
add: (email) ->
params =
enterprise_id: CurrentShop.shop.id
email: email
CustomerResource.create params, (customer) =>
if customer.id
@all.unshift customer
@byID[customer.id] = customer
@pristineByID[customer.id] = angular.copy(customer)
remove: (customer) ->
params = id: customer.id
CustomerResource.destroy params, =>
i = @all.indexOf customer
@all.splice i, 1 unless i < 0
, (response) =>
errors = response.data.errors
if errors?
InfoDialog.open 'error', errors[0]
else
InfoDialog.open 'error', t('js.resources.could_not_delete_customer') + ": #{customer.email}"
index: (params) ->
@clear()
request = CustomerResource.index(params, (data) => @load(data))
RequestMonitor.load(request.$promise)
request.$promise
load: (customers) ->
for customer in customers
@all.push customer
@byID[customer.id] = customer
@pristineByID[customer.id] = angular.copy(customer)
update: (address, customer, addressType) ->
params =
id: customer.id
customer:
"#{addressType}_attributes": address
CustomerResource.update params
clear: ->
@all.length = 0

View File

@@ -1,21 +1,18 @@
angular.module("admin.enterprises").factory 'Enterprises', ($q, EnterpriseResource, blankOption) ->
angular.module("admin.resources").factory 'Enterprises', ($q, EnterpriseResource) ->
new class Enterprises
enterprisesByID: {}
byID: {}
pristineByID: {}
index: (params={}, callback=null) ->
includeBlank = !!params['includeBlank']
delete params['includeBlank']
EnterpriseResource.index(params, (data) =>
for enterprise in data
@enterprisesByID[enterprise.id] = enterprise
@pristineByID[enterprise.id] = angular.copy(enterprise)
EnterpriseResource.index params, (data) =>
@load(data)
(callback || angular.noop)(data)
data.unshift(blankOption()) if includeBlank
data
)
load: (enterprises) ->
for enterprise in enterprises
@byID[enterprise.id] = enterprise
@pristineByID[enterprise.id] = angular.copy(enterprise)
save: (enterprise) ->
deferred = $q.defer()

View File

@@ -1,30 +1,32 @@
angular.module("admin.lineItems").factory 'LineItems', ($q, LineItemResource) ->
angular.module("admin.resources").factory 'LineItems', ($q, LineItemResource) ->
new class LineItems
lineItemsByID: {}
byID: {}
pristineByID: {}
index: (params={}, callback=null) ->
LineItemResource.index params, (data) =>
@resetData()
for lineItem in data
@lineItemsByID[lineItem.id] = lineItem
@pristineByID[lineItem.id] = angular.copy(lineItem)
@load(data)
(callback || angular.noop)(data)
resetData: ->
@lineItemsByID = {}
@byID = {}
@pristineByID = {}
load: (lineItems) ->
@resetData()
for lineItem in lineItems
@byID[lineItem.id] = lineItem
@pristineByID[lineItem.id] = angular.copy(lineItem)
saveAll: ->
for id, lineItem of @lineItemsByID
for id, lineItem of @byID
lineItem.errors = {} # removes errors when line_item has been returned to original state
@save(lineItem) if !@isSaved(lineItem)
save: (lineItem) ->
deferred = $q.defer()
lineItem.errors = {}
lineItem.$update({id: lineItem.id, orders: "orders", order_number: lineItem.order.number})
lineItem.$update({id: lineItem.id})
.then( (data) =>
@pristineByID[lineItem.id] = angular.copy(lineItem)
deferred.resolve(data)
@@ -34,7 +36,7 @@ angular.module("admin.lineItems").factory 'LineItems', ($q, LineItemResource) ->
deferred.promise
allSaved: ->
for id, lineItem of @lineItemsByID
for id, lineItem of @byID
return false unless @isSaved(lineItem)
true
@@ -52,9 +54,9 @@ angular.module("admin.lineItems").factory 'LineItems', ($q, LineItemResource) ->
delete: (lineItem, callback=null) ->
deferred = $q.defer()
lineItem.$delete({id: lineItem.id, orders: "orders", order_number: lineItem.order.number})
lineItem.$delete({id: lineItem.id})
.then( (data) =>
delete @lineItemsByID[lineItem.id]
delete @byID[lineItem.id]
delete @pristineByID[lineItem.id]
(callback || angular.noop)(data)
deferred.resolve(data)

View File

@@ -1,21 +1,24 @@
angular.module("admin.orderCycles").factory 'OrderCycles', ($q, OrderCycleResource, blankOption) ->
angular.module("admin.resources").factory 'OrderCycles', ($q, $injector, OrderCycleResource) ->
new class OrderCycles
orderCyclesByID: {}
all: []
byID: {}
pristineByID: {}
constructor: ->
if $injector.has('orderCycles')
@load($injector.get('orderCycles'))
index: (params={}, callback=null) ->
includeBlank = !!params['includeBlank']
delete params['includeBlank']
OrderCycleResource.index(params, (data) =>
for orderCycle in data
@orderCyclesByID[orderCycle.id] = orderCycle
@pristineByID[orderCycle.id] = angular.copy(orderCycle)
OrderCycleResource.index params, (data) =>
@load(data)
(callback || angular.noop)(data)
data.unshift(blankOption()) if includeBlank
data
)
load: (orderCycles) ->
for orderCycle in orderCycles
@all.push orderCycle
@byID[orderCycle.id] = orderCycle
@pristineByID[orderCycle.id] = angular.copy(orderCycle)
save: (order_cycle) ->
deferred = $q.defer()

View File

@@ -1,16 +1,18 @@
angular.module("admin.orders").factory 'Orders', ($q, OrderResource) ->
angular.module("admin.resources").factory 'Orders', ($q, OrderResource) ->
new class Orders
ordersByID: {}
byID: {}
pristineByID: {}
index: (params={}, callback=null) ->
OrderResource.index params, (data) =>
for order in data
@ordersByID[order.id] = order
@pristineByID[order.id] = angular.copy(order)
@load(data)
(callback || angular.noop)(data)
load: (orders) ->
for order in orders
@byID[order.id] = order
@pristineByID[order.id] = angular.copy(order)
save: (order) ->
deferred = $q.defer()
order.$update({id: order.number})

View File

@@ -0,0 +1,16 @@
angular.module("admin.resources")
.factory "PaymentMethods", ($injector) ->
new class PaymentMethods
paymentMethods: []
byID: {}
pristineByID: {}
constructor: ->
if $injector.has('paymentMethods')
@load($injector.get('paymentMethods'))
load: (paymentMethods) ->
for paymentMethod in paymentMethods
@paymentMethods.push paymentMethod
@byID[paymentMethod.id] = paymentMethod
@pristineByID[paymentMethod.id] = angular.copy(paymentMethod)

View File

@@ -0,0 +1,16 @@
angular.module("admin.resources")
.factory "ShippingMethods", ($injector) ->
new class ShippingMethods
shippingMethods: []
byID: {}
pristineByID: {}
constructor: ->
if $injector.has('shippingMethods')
@load($injector.get('shippingMethods'))
load: (shippingMethods) ->
for shippingMethod in shippingMethods
@shippingMethods.push shippingMethod
@byID[shippingMethod.id] = shippingMethod
@pristineByID[shippingMethod.id] = angular.copy(shippingMethod)

View File

@@ -1,4 +1,4 @@
angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher) ->
angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher, $http) ->
new class BulkProducts
products: []
@@ -11,14 +11,8 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher)
PagedFetcher.fetch url, (data) => @addProducts data.products
cloneProduct: (product) ->
dataFetcher("/admin/products/" + product.permalink_live + "/clone.json").then (data) =>
# Ideally we would use Spree's built in respond_override helper here to redirect the
# user after a successful clone with .json in the accept headers
# However, at the time of writing there appears to be an issue which causes the
# respond_with block in the destroy action of Spree::Admin::Product to break
# when a respond_overrride for the clone action is used.
id = data.product.id
dataFetcher("/api/products/" + id + "?template=bulk_show").then (newProduct) =>
$http.post("/api/products/" + product.id + "/clone").success (data) =>
dataFetcher("/api/products/" + data.id + "?template=bulk_show").then (newProduct) =>
@unpackProduct newProduct
@insertProductAfter(product, newProduct)

View File

@@ -1,6 +1,6 @@
angular.module("ofn.admin").factory "ofnConfirmHandler", (pendingChanges, $compile, $q) ->
return (scope, callback) ->
template = "<div id='dialog-div' style='padding: 10px'><h6>Unsaved changes currently exist, save now or ignore?</h6></div>"
template = "<div id='dialog-div' style='padding: 10px'><h6>" + t('js.services.unsaved_changes_message') + "</h6></div>"
dialogDiv = $compile(template)(scope)
return ->
if pendingChanges.changeCount(pendingChanges.pendingChanges) > 0

View File

@@ -26,7 +26,7 @@ angular.module("ofn.admin").factory 'EnterpriseRelationships', ($http, enterpris
permission_presentation: (permission) ->
switch permission
when "add_to_order_cycle" then "add to order cycle"
when "manage_products" then "manage products"
when "edit_profile" then "edit profile"
when "create_variant_overrides" then "add products to inventory"
when "add_to_order_cycle" then t('js.services.add_to_order_cycle')
when "manage_products" then t('js.services.manage_products')
when "edit_profile" then t('js.services.edit_profile')
when "create_variant_overrides" then t('js.services.add_products_to_inventory')

View File

@@ -1,3 +1,3 @@
angular.module("admin.shippingMethods").controller "shippingMethodsCtrl", ($scope, ShippingMethods) ->
$scope.findShippingMethodByID = (id) ->
$scope.ShippingMethod = ShippingMethods.findByID(id)
$scope.ShippingMethod = ShippingMethods.byID[id]

View File

@@ -1,8 +0,0 @@
angular.module("admin.shippingMethods")
.factory "ShippingMethods", (shippingMethods) ->
new class ShippingMethods
shippingMethods: shippingMethods
findByID: (id) ->
for shippingMethod in @shippingMethods
return shippingMethod if shippingMethod.id is id

View File

@@ -2,7 +2,7 @@ angular.module("admin.tagRules").controller "TagRulesCtrl", ($scope, $http, $fil
$scope.tagGroups = enterprise.tag_groups
$scope.defaultTagGroup = enterprise.default_tag_group
$scope.visibilityOptions = [ { id: "visible", name: "VISIBLE" }, { id: "hidden", name: "NOT VISIBLE" } ]
$scope.visibilityOptions = [ { id: "visible", name: t('js.tag_rules.visible') }, { id: "hidden", name: t('js.tag_rules.not_visible') } ]
$scope.updateRuleCounts = ->
index = $scope.defaultTagGroup.rules.length
@@ -38,7 +38,6 @@ angular.module("admin.tagRules").controller "TagRulesCtrl", ($scope, $http, $fil
newRule.peferred_exchange_tags = []
newRule.preferred_matched_order_cycles_visibility = "visible"
tagGroup.rules.push(newRule)
$scope.enterprise_form.$setDirty()
$scope.updateRuleCounts()
$scope.addNewTag = ->
@@ -58,3 +57,4 @@ angular.module("admin.tagRules").controller "TagRulesCtrl", ($scope, $http, $fil
.success ->
tagGroup.rules.splice(index, 1)
$scope.updateRuleCounts()
$scope.enterprise_form.$setDirty()

View File

@@ -9,10 +9,10 @@ angular.module("admin.tagRules").directive 'newTagRuleDialog', ($compile, $templ
scope.ruleTypes = [
# { id: "DiscountOrder", name: 'Apply a discount to orders' }
{ id: "FilterProducts", name: 'Show or Hide variants in my shopfront' }
{ id: "FilterShippingMethods", name: 'Show or Hide shipping methods at checkout' }
{ id: "FilterPaymentMethods", name: 'Show or Hide payment methods at checkout' }
{ id: "FilterOrderCycles", name: 'Show or Hide order cycles in my shopfront' }
{ id: "FilterProducts", name: t('js.tag_rules.show_hide_variants') }
{ id: "FilterShippingMethods", name: t('js.tag_rules.show_hide_shipping') }
{ id: "FilterPaymentMethods", name: t('js.tag_rules.show_hide_payment') }
{ id: "FilterOrderCycles", name: t('js.tag_rules.show_hide_order_cycles') }
]
scope.ruleType = scope.ruleTypes[0].id

View File

@@ -1,19 +1,20 @@
angular.module("admin.taxons").factory "Taxons", (taxons, $filter) ->
new class Taxons
taxons: taxons
taxonsByID: {}
all: []
byID: {}
constructor: ->
for taxon in @taxons
@taxonsByID[taxon.id] = taxon
for taxon in taxons
@all.push taxon
@byID[taxon.id] = taxon
# For finding a single Taxon
findByID: (id) ->
@taxonsByID[id]
@byID[id]
# For finding multiple Taxons represented by comma delimited string
findByIDs: (ids) ->
@taxonsByID[taxon_id] for taxon_id in ids.split(",") when @taxonsByID[taxon_id]
@byID[taxon_id] for taxon_id in ids.split(",") when @byID[taxon_id]
findByTerm: (term) ->
$filter('filter')(@taxons, term)
$filter('filter')(@all, term)

View File

@@ -30,8 +30,16 @@ show_flash_error = function(message) {
}
$(document).ready(function(){
$('a.close').click(function(event){
event.preventDefault();
$(this).parent().slideUp(250);
});
$('a.close').click(function(event){
event.preventDefault();
$(this).parent().slideUp(250);
});
// Spree locates hidden with prev(), which with our current version of jQuery
// does not locate the hidden field, resulting in the delete failing. This
// handler updates the hidden field, fixing the problem.
$('body').on('click', 'a.remove_fields', function() {
$(this).next("input[type=hidden]").val("1");
return false;
});
});

View File

@@ -0,0 +1,5 @@
angular.module("admin.utils").directive "textangularStrip", () ->
restrict: 'CA'
link: (scope, element, attrs) ->
scope.stripFormatting = ($html) ->
return String($html).replace(/<[^>]+>/gm, '')

View File

@@ -1,2 +0,0 @@
angular.module("admin.utils").value "blankOption", ->
{ id: "0", name: "All" }

View File

@@ -10,7 +10,6 @@ angular.module("admin.utils")
$rootScope.$on "$locationChangeStart", @locationChangeStartHandler
# Action for regular browser navigation.
onBeforeUnloadHandler: ($event) =>
message = @getMessage()
@@ -21,13 +20,17 @@ angular.module("admin.utils")
# Action for angular navigation.
locationChangeStartHandler: ($event) =>
message = @getMessage()
if message and not $window.confirm(message)
if not @confirmLeave()
$event.stopPropagation() if $event.stopPropagation
$event.preventDefault() if $event.preventDefault
$event.cancelBubble = true
$event.returnValue = false
# Check if leaving is okay
confirmLeave: =>
message = @getMessage()
!message or $window.confirm(message)
# Runs callback functions to retreive most recently added non-empty message.
getMessage: ->
message = null

View File

@@ -11,6 +11,14 @@ angular.module("admin.utils").factory "StatusMessage", ($timeout) ->
text: ""
style: {}
invalidMessage: ""
setValidation: (isValid) ->
if isValid
StatusMessage.invalidMessage = ''
else
StatusMessage.invalidMessage = t("admin.form_invalid")
active: ->
@statusMessage.text != ''

View File

@@ -15,11 +15,11 @@ angular.module("admin.variantOverrides").controller "AdminVariantOverridesCtrl",
$scope.currentView = -> Views.currentView
$scope.views = Views.setViews
inventory: { name: "Inventory Products", visible: true }
hidden: { name: "Hidden Products", visible: false }
new: { name: "New Products", visible: false }
inventory: { name: t('js.variant_overrides.inventory_products'), visible: true }
hidden: { name: t('js.variant_overrides.hidden_products'), visible: false }
new: { name: t('js.variant_overrides.new_products'), visible: false }
$scope.bulkActions = [ name: "Reset Stock Levels To Defaults", callback: 'resetStock' ]
$scope.bulkActions = [ name: t('js.variant_overrides.reset_stock_levels'), callback: 'resetStock' ]
$scope.columns = Columns.columns
@@ -52,22 +52,22 @@ angular.module("admin.variantOverrides").controller "AdminVariantOverridesCtrl",
$scope.displayDirty = ->
if DirtyVariantOverrides.count() > 0
num = if DirtyVariantOverrides.count() == 1 then "one override" else "#{DirtyVariantOverrides.count()} overrides"
StatusMessage.display 'notice', "Changes to #{num} remain unsaved."
num = if DirtyVariantOverrides.count() == 1 then t('js.variant_overrides.one_override') else "#{DirtyVariantOverrides.count()} " + t('js.variant_overrides.overrides')
StatusMessage.display 'notice', t('js.variant_overrides.changes_to') + ' ' + num + ' ' + t('js.variant_overrides.remain_unsaved')
else
StatusMessage.clear()
$scope.update = ->
if DirtyVariantOverrides.count() == 0
StatusMessage.display 'alert', 'No changes to save.'
StatusMessage.display 'alert', t('js.variant_overrides.no_changes_to_save')
else
StatusMessage.display 'progress', 'Saving...'
StatusMessage.display 'progress', t('js.saving')
DirtyVariantOverrides.save()
.success (updatedVos) ->
DirtyVariantOverrides.clear()
VariantOverrides.updateIds updatedVos
$scope.variant_overrides_form.$setPristine()
StatusMessage.display 'success', 'Changes saved.'
StatusMessage.display 'success', t('js.changes_saved')
VariantOverrides.updateData updatedVos # Refresh page data
.error (data, status) ->
StatusMessage.display 'failure', $scope.updateError(data, status)
@@ -75,32 +75,32 @@ angular.module("admin.variantOverrides").controller "AdminVariantOverridesCtrl",
$scope.updateError = (data, status) ->
if status == 401
"I couldn't get authorisation to save those changes, so they remain unsaved."
t('js.variant_overrides.no_authorisation')
else if status == 400 && data.errors?
errors = []
for field, field_errors of data.errors
errors = errors.concat field_errors
errors = errors.join ', '
"I had some trouble saving: #{errors}"
t('js.variant_overrides.some_trouble', {errors: errors})
else
"Oh no! I was unable to save your changes."
t('js.oh_no')
$scope.resetStock = ->
if DirtyVariantOverrides.count() > 0
StatusMessage.display 'alert', 'Save changes first.'
StatusMessage.display 'alert', t('js.save_changes_first')
$timeout ->
$scope.displayDirty()
, 3000 # 3 second delay
else
return unless $scope.hub_id?
StatusMessage.display 'progress', 'Changing on hand stock levels...'
StatusMessage.display 'progress', t('js.variant_overrides.changing_on_hand_stock')
$http
method: "POST"
url: "/admin/variant_overrides/bulk_reset"
data: { hub_id: $scope.hub_id }
.success (updatedVos) ->
VariantOverrides.updateData updatedVos
StatusMessage.display 'success', 'Stocks reset to defaults.'
StatusMessage.display 'success', t('js.variant_overrides.stock_reset')
.error (data, status) ->
$timeout -> StatusMessage.display 'failure', $scope.updateError(data, status)

View File

@@ -16,7 +16,7 @@
#= require ../shared/angular-local-storage.js
#= require ../shared/angular-slideables.js
#= require angularjs-file-upload
#= require i18n/translations
#= require angular-rails-templates
#= require_tree ../templates

View File

@@ -1,8 +1,8 @@
$ ->
if ($ 'form#update-cart').is('*')
($ 'form#update-cart a.delete').show().one 'click', ->
($ this).parents('.line-item').first().find('input.line_item_quantity').val 0
($ this).parents('form').first().submit()
if $('form#update-cart').is('*') || $('form#update-order').is('*')
$('form#update-cart a.delete, form#update-order a.delete').show().one 'click', ->
$(this).parents('.line-item').first().find('input.line_item_quantity').val 0
$(this).parents('form').first().submit()
false
($ 'form#update-cart').submit ->

View File

@@ -1,6 +1,8 @@
Darkswarm.controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) ->
$scope.path = "/signup"
$scope.spree_user.password_confirmation = ''
$scope.errors =
email: null
password: null

View File

@@ -1,10 +1,2 @@
Darkswarm.controller "CartCtrl", ($scope, Cart, $timeout) ->
$scope.Cart = Cart
initializing = true
$scope.$watchCollection "Cart.line_items_present()", ->
if initializing
$timeout ->
initializing = false
else
$scope.Cart.orderChanged()

View File

@@ -1,28 +1,25 @@
Darkswarm.controller "AccordionCtrl", ($scope, storage, $timeout, $document, CurrentHub) ->
$scope.accordion =
details: true
billing: false
shipping: false
payment: false
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"]
storage.bind $scope, "accordion", {storeName: "accordion_#{$scope.order.id}#{CurrentHub.hub.id}#{$scope.order.user_id}"}
# 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.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.$on 'purchaseFormInvalid', (event, form) ->
# Scroll to first invalid section
for section in $scope.accordionSections
if not form[section].$valid
$scope.show section
# 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 zero-length timeout is enough delay for the DOM to
# have updated.
$timeout ->
# 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, 500
break

View File

@@ -1,4 +1,4 @@
Darkswarm.controller "CheckoutCtrl", ($scope, storage, Checkout, CurrentUser, CurrentHub) ->
Darkswarm.controller "CheckoutCtrl", ($scope, localStorageService, Checkout, CurrentUser, CurrentHub) ->
$scope.Checkout = Checkout
$scope.submitted = false
@@ -7,11 +7,11 @@ Darkswarm.controller "CheckoutCtrl", ($scope, storage, Checkout, CurrentUser, Cu
prefix = "order_#{Checkout.order.id}#{CurrentUser.id or ""}#{CurrentHub.hub.id}"
for field in $scope.fieldsToBind
storage.bind $scope, "Checkout.order.#{field}",
storeName: "#{prefix}_#{field}"
storage.bind $scope, "Checkout.ship_address_same_as_billing",
storeName: "#{prefix}_sameasbilling"
defaultValue: true
localStorageService.bind $scope, "Checkout.order.#{field}", Checkout.order[field], "#{prefix}_#{field}"
localStorageService.bind $scope, "Checkout.ship_address_same_as_billing", true, "#{prefix}_sameasbilling"
localStorageService.bind $scope, "Checkout.default_bill_address", false, "#{prefix}_defaultasbilladdress"
localStorageService.bind $scope, "Checkout.default_ship_address", false, "#{prefix}_defaultasshipaddress"
$scope.order = Checkout.order # Ordering is important
$scope.secrets = Checkout.secrets

View File

@@ -0,0 +1,12 @@
Darkswarm.controller "EditBoughtOrderController", ($scope, $resource, Cart) ->
$scope.showBought = false
$scope.deleteLineItem = (id) ->
params = {id: id}
success = (response) ->
$(".line-item-" + id).remove()
Cart.removeFinalisedLineItem(id)
fail = (error) ->
console.log error
$resource("/line_items/:id").delete(params, success, fail)

View File

@@ -1,4 +1,4 @@
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
$scope.Enterprises = Enterprises
$scope.producers_to_filter = Enterprises.producers
$scope.filterSelectors = FilterSelectorsService.createSelectors()
@@ -6,10 +6,9 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
$scope.openModal = EnterpriseModal.open
$scope.activeTaxons = []
$scope.show_profiles = false
$scope.show_closed = false
$scope.filtersActive = false
$scope.distanceMatchesShown = false
$scope.filterExpression = {active: true}
$scope.$watch "query", (query)->
Enterprises.flagMatching query
@@ -21,6 +20,12 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
Enterprises.calculateDistance query, $scope.firstNameMatch()
$rootScope.$broadcast 'enterprisesChanged'
$timeout ->
if $location.search()['show_closed']?
$scope.showClosedShops()
$scope.$watch "filtersActive", (value) ->
$scope.$broadcast 'filtersToggled'
$rootScope.$on "enterprisesChanged", ->
$scope.filterEnterprises()
@@ -30,7 +35,7 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
# When filter settings change, this could change which name match is at the top, or even
# result in no matches. This affects the reference point that the distance matches are
# calculated from, so we need to recalculate distances.
$scope.$watch '[activeTaxons, shippingTypes, show_profiles]', ->
$scope.$watch '[activeTaxons, activeProperties, shippingTypes, show_profiles, show_closed]', ->
$timeout ->
Enterprises.calculateDistance $scope.query, $scope.firstNameMatch()
$rootScope.$broadcast 'enterprisesChanged'
@@ -68,7 +73,9 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, Enterpris
undefined
$scope.showClosedShops = ->
delete $scope.filterExpression['active']
$scope.show_closed = true
$location.search('show_closed', '1')
$scope.hideClosedShops = ->
$scope.filterExpression['active'] = true
$scope.show_closed = false
$location.search('show_closed', null)

View File

@@ -8,3 +8,6 @@ Darkswarm.controller "GroupEnterprisesCtrl", ($scope, Search, FilterSelectorsSer
$scope.$watch "query", (query)->
Search.search query
$scope.$watch "filtersActive", (value) ->
$scope.$broadcast 'filtersToggled'

View File

@@ -1,3 +1,7 @@
Darkswarm.controller "GroupsCtrl", ($scope, Groups) ->
Darkswarm.controller "GroupsCtrl", ($scope, Groups, Search) ->
$scope.Groups = Groups
$scope.order = 'position'
$scope.query = Search.search()
$scope.$watch "query", (query)->
Search.search query

View File

@@ -1,5 +0,0 @@
Darkswarm.controller "LineItemCtrl", ($scope)->
$scope.$watch '[line_item.quantity, line_item.max_quantity]', (newValue, oldValue)->
if newValue != oldValue
$scope.Cart.orderChanged()
, true

View File

@@ -10,7 +10,7 @@ Darkswarm.controller "OrderCycleCtrl", ($scope, $timeout, OrderCycle) ->
$("#order_cycle_id").trigger("openTrigger")
Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $timeout, OrderCycle, Products, Variants, Cart) ->
Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $timeout, OrderCycle, Products, Variants, Cart, ChangeableOrdersAlert) ->
# Track previous order cycle id for use with revertOrderCycle()
$scope.previous_order_cycle_id = OrderCycle.order_cycle.order_cycle_id
$scope.$watch 'order_cycle.order_cycle_id', (newValue, oldValue)->
@@ -30,3 +30,5 @@ Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $timeout, OrderCycle, Prod
Variants.clear()
Cart.clear()
Products.update()
Cart.reloadFinalisedLineItems()
ChangeableOrdersAlert.reload()

View File

@@ -1,18 +1,41 @@
Darkswarm.controller "ProductsCtrl", ($scope, $rootScope, Products, OrderCycle, FilterSelectorsService, Cart, Taxons, Properties) ->
Darkswarm.controller "ProductsCtrl", ($scope, $filter, $rootScope, Products, OrderCycle, FilterSelectorsService, Cart, Taxons, Properties) ->
$scope.Products = Products
$scope.Cart = Cart
$scope.query = ""
$scope.taxonSelectors = FilterSelectorsService.createSelectors()
$scope.propertySelectors = FilterSelectorsService.createSelectors()
$scope.filtersActive = true
$scope.limit = 3
$scope.limit = 10
$scope.order_cycle = OrderCycle.order_cycle
# $scope.infiniteDisabled = true
# All of this logic basically just replicates the functionality filtering an ng-repeat
# except that it allows us to filter a separate list before rendering, meaning that
# we can get much better performance when applying filters by resetting the limit on the
# number of products being rendered each time a filter is changed.
$scope.$watch "Products.loading", (newValue, oldValue) ->
$scope.updateFilteredProducts()
$scope.$broadcast("loadFilterSelectors") if !newValue
$scope.incrementLimit = ->
if $scope.limit < Products.products.length
$scope.limit = $scope.limit + 1
$scope.limit += 10
$scope.updateVisibleProducts()
$scope.$watch 'query', -> $scope.updateFilteredProducts()
$scope.$watchCollection 'activeTaxons', -> $scope.updateFilteredProducts()
$scope.$watchCollection 'activeProperties', -> $scope.updateFilteredProducts()
$scope.updateFilteredProducts = ->
$scope.limit = 10
f1 = $filter('products')(Products.products, $scope.query)
f2 = $filter('taxons')(f1, $scope.activeTaxons)
$scope.filteredProducts = $filter('properties')(f2, $scope.activeProperties)
$scope.updateVisibleProducts()
$scope.updateVisibleProducts = ->
$scope.visibleProducts = $filter('limitTo')($scope.filteredProducts, $scope.limit)
$scope.searchKeypress = (e)->
code = e.keyCode || e.which

View File

@@ -5,7 +5,20 @@ Darkswarm.controller "RegistrationCtrl", ($scope, RegistrationService, Enterpris
$scope.steps = ['details', 'contact', 'type', 'about', 'images', 'social']
$scope.countries = availableCountries
# Filter countries without states since the form requires a state to be selected.
# Consider changing the form to require a state only if a country requires them (Spree option).
# Invalid countries still need to be filtered (better server-side).
$scope.countries = availableCountries.filter (country) ->
country.states.length > 0
$scope.countriesById = $scope.countries.reduce (obj, country) ->
obj[country.id] = country
obj
, {}
$scope.setDefaultCountry = (id) ->
country = $scope.countriesById[id]
$scope.enterprise.country = country if country
$scope.countryHasStates = ->
$scope.enterprise.country.states.length > 0

View File

@@ -1,4 +1,4 @@
Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation) ->
Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation, $location) ->
angular.extend this, $controller('TabsCtrl', {$scope: $scope})
$scope.tabs =
@@ -6,3 +6,7 @@ Darkswarm.controller "ShoppingTabsCtrl", ($scope, $controller, Navigation) ->
producers: { active: Navigation.isActive('/producers') }
contact: { active: Navigation.isActive('/contact') }
groups: { active: Navigation.isActive('/groups') }
$scope.$on '$locationChangeStart', (event, url) ->
tab = $location.path().replace(/^\//, '')
$scope.tabs[tab]?.active = true

View File

@@ -1,6 +1,6 @@
window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'mm.foundation',
'angularLocalStorage',
'LocalStorageModule',
'infinite-scroll',
'angular-flash.service',
'templates',
@@ -11,8 +11,7 @@ window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'angularFileUpload',
'angularSlideables'
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers.put['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers['common']['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
$httpProvider.defaults.headers.common.Accept = "application/json, text/javascript, */*"

View File

@@ -1,4 +1,4 @@
Darkswarm.directive "ofnChangeOrderCycle", (OrderCycle, Cart, storage) ->
Darkswarm.directive "ofnChangeOrderCycle", (OrderCycle, Cart) ->
# Compares chosen order cycle with pre-set OrderCycle. Will trigger
# a confirmation if they are different, and Cart isn't empty
restrict: "A"

View File

@@ -0,0 +1,5 @@
Darkswarm.directive "changeableOrdersAlert", (ChangeableOrdersAlert) ->
restrict: "C"
scope: true
link: (scope, element, attrs) ->
scope.alert = ChangeableOrdersAlert

View File

@@ -0,0 +1,9 @@
Darkswarm.directive "confirmLinkClick", ($window) ->
restrict: 'A'
scope:
confirmMsg: '@confirmLinkClick'
link: (scope, elem, attr) ->
elem.bind 'click', (event) ->
unless confirm(scope.confirmMsg)
event.preventDefault()
event.stopPropagation()

View File

@@ -1,9 +1,15 @@
Darkswarm.directive "enterpriseModal", ($modal)->
Darkswarm.directive "enterpriseModal", ($modal, Enterprises, EnterpriseResource) ->
restrict: 'E'
replace: true
template: "<a ng-transclude></a>"
transclude: true
link: (scope, elem, attrs, ctrl)->
elem.on "click", (ev)=>
link: (scope, elem, attrs, ctrl) ->
elem.on "click", (ev) =>
ev.stopPropagation()
params =
id: scope.enterprise.id
EnterpriseResource.relatives params, (data) =>
Enterprises.addEnterprises data
scope.enterprise = Enterprises.enterprises_by_id[scope.enterprise.id]
Enterprises.dereferenceEnterprise scope.enterprise
scope.modalInstance = $modal.open(controller: ctrl, templateUrl: 'enterprise_modal.html', scope: scope)

View File

@@ -0,0 +1,21 @@
Darkswarm.directive 'mapOsmTiles', ($timeout) ->
restrict: 'E'
require: '^googleMap'
scope: {}
link: (scope, elem, attrs, ctrl) ->
$timeout =>
map = ctrl.getMap()
map.mapTypes.set 'OSM', new google.maps.ImageMapType
getTileUrl: (coord, zoom) ->
# "Wrap" x (logitude) at 180th meridian properly
# NB: Don't touch coord.x because coord param is by reference, and changing its x property breaks something in Google's lib
tilesPerGlobe = 1 << zoom
x = coord.x % tilesPerGlobe
if x < 0
x = tilesPerGlobe + x
# Wrap y (latitude) in a like manner if you want to enable vertical infinite scroll
'https://a.tile.openstreetmap.org/' + zoom + '/' + x + '/' + coord.y + '.png'
tileSize: new google.maps.Size(256, 256)
name: 'OpenStreetMap'
maxZoom: 18

View File

@@ -1,46 +1,54 @@
Darkswarm.directive 'mapSearch', ($timeout)->
Darkswarm.directive 'mapSearch', ($timeout, Search) ->
# Install a basic search field in a map
restrict: 'E'
require: '^googleMap'
require: ['^googleMap', 'ngModel']
replace: true
template: '<input id="pac-input" placeholder="' + t('location_placeholder') + '"></input>'
link: (scope, elem, attrs, ctrl)->
template: '<input id="pac-input" ng-model="query" placeholder="' + t('location_placeholder') + '"></input>'
scope: {}
controller: ($scope) ->
$scope.query = Search.search()
$scope.$watch 'query', (query) ->
Search.search query
link: (scope, elem, attrs, ctrls) ->
[ctrl, model] = ctrls
scope.input = document.getElementById("pac-input")
$timeout =>
map = ctrl.getMap()
# Use OSM tiles server
map.mapTypes.set 'OSM', new (google.maps.ImageMapType)(
getTileUrl: (coord, zoom) ->
# "Wrap" x (logitude) at 180th meridian properly
# NB: Don't touch coord.x because coord param is by reference, and changing its x property breakes something in Google's lib
tilesPerGlobe = 1 << zoom
x = coord.x % tilesPerGlobe
if x < 0
x = tilesPerGlobe + x
# Wrap y (latitude) in a like manner if you want to enable vertical infinite scroll
'http://tile.openstreetmap.org/' + zoom + '/' + x + '/' + coord.y + '.png'
tileSize: new (google.maps.Size)(256, 256)
name: 'OpenStreetMap'
maxZoom: 18)
searchBox = scope.createSearchBox map
scope.bindSearchResponse map, searchBox
scope.biasResults map, searchBox
scope.performUrlSearch map
input = (document.getElementById("pac-input"))
map.controls[google.maps.ControlPosition.TOP_LEFT].push input
searchBox = new google.maps.places.SearchBox((input))
scope.createSearchBox = (map) ->
map.controls[google.maps.ControlPosition.TOP_LEFT].push scope.input
return new google.maps.places.SearchBox(scope.input)
google.maps.event.addListener searchBox, "places_changed", ->
places = searchBox.getPlaces()
return if places.length is 0
# For each place, get the icon, place name, and location.
markers = []
bounds = new google.maps.LatLngBounds()
for place in places
#map.setCenter place.geometry.location
map.fitBounds place.geometry.viewport
#map.fitBounds bounds
scope.bindSearchResponse = (map, searchBox) ->
google.maps.event.addListener searchBox, "places_changed", =>
scope.showSearchResult map, searchBox
# Bias the SearchBox results towards places that are within the bounds of the
# current map's viewport.
scope.showSearchResult = (map, searchBox) ->
places = searchBox.getPlaces()
for place in places when place.geometry.viewport?
map.fitBounds place.geometry.viewport
scope.$apply ->
model.$setViewValue elem.val()
# When the map loads, and we have a search from ?query, perform that search
scope.performUrlSearch = (map) ->
google.maps.event.addListenerOnce map, "idle", =>
google.maps.event.trigger(scope.input, 'focus');
google.maps.event.trigger(scope.input, 'keydown', {keyCode: 13});
# Bias the SearchBox results towards places that are within the bounds of the
# current map's viewport.
scope.biasResults = (map, searchBox) ->
google.maps.event.addListener map, "bounds_changed", ->
bounds = map.getBounds()
searchBox.setBounds bounds

View File

@@ -6,7 +6,11 @@ Darkswarm.directive "ofnOnHand", ->
# In cases where this field gets its value from the HTML element rather than the model,
# initialise the model with the HTML value.
if scope.$eval(attr.ngModel) == undefined
ngModel.$setViewValue elem.val()
# Don't dirty the model when we do this
setDirty = ngModel.$setDirty
ngModel.$setDirty = angular.noop
ngModel.$setViewValue(elem.val())
ngModel.$setDirty = setDirty
ngModel.$parsers.push (viewValue) ->
on_hand = parseInt(attr.ofnOnHand)

View File

@@ -1,6 +1,9 @@
Darkswarm.directive "shopVariant", ->
Darkswarm.directive "shopVariant", ->
restrict: 'E'
replace: true
templateUrl: 'shop_variant.html'
scope:
variant: '='
controller: ($scope, Cart) ->
$scope.$watchGroup ['variant.line_item.quantity', 'variant.line_item.max_quantity'], ->
Cart.adjust($scope.variant.line_item)

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