Compare commits

...

604 Commits

Author SHA1 Message Date
Pau Perez
0634735288 Adjust Codeclimate config to ignore Rails patch
Since it is a file copied from Rails 4, we want to keep it in its
original state and not refactor it.
2018-02-07 16:21:16 +11:00
Pau Perez
719c45b408 Apply Rails 4 patch at boot time not only specs
This makes this patch available also for things like database-related
rake tasks. It moves the patch to an initializer.
2018-02-07 16:21:16 +11:00
Maikel Linke
b70edd5424 Enabling non-privileged postgres users to run specs
Addressing issue #245.

A combination of fixtures and foreign key constraints requires the postgres
user to be superuser. Otherwise an attempt to disable constraints fails.
This got fixed in Rails 4 and this patch brings the same behaviour back to
Rails 3. It will allow us to run the specs with a nosuperuser postgres user.

See:
 - https://github.com/matthuhiggins/foreigner/issues/61
 - 9bb27f7ffe
2018-02-07 16:21:16 +11:00
Aaron Hursh
a6498c2f96 Removed ng-disabled conditional from submit button on admin customers index. 2018-02-07 15:09:07 +11:00
Rob Harrington
56be7b1d46 Fix spec to handle non-deterministic ordering 2018-02-07 11:45:48 +11:00
Rob Harrington
b2f3477261 Change unused creation_date translation key back to confirmation_date
See 22eae753fe for original change
2018-02-07 11:42:38 +11:00
Matt-Yorkley
14b73149be Remove stale form validation messages when showing new confirmation sent message 2018-02-07 10:41:54 +11:00
Matt-Yorkley
0ab7d95607 Remove mention of confirmation email from enterprise creation wizard 2018-02-07 10:41:53 +11:00
Matt-Yorkley
ee08dcfeb4 Use owner as contact if user record doesn't exist 2018-02-07 10:41:53 +11:00
Matt-Yorkley
b893dea810 Make sure userSelect directive uses our Admin::UserSerializer instead of base Spree api view 2018-02-07 10:41:53 +11:00
Matt-Yorkley
ec5ce45850 Change confirmation email wording 2018-02-07 10:41:53 +11:00
Matt-Yorkley
9afb97fa0f Show contact email without full permissions 2018-02-07 10:41:53 +11:00
Matt-Yorkley
676abe0ced Remove serialized contact attributes 2018-02-07 10:41:53 +11:00
Matt-Yorkley
73d38cb91b Re-add text version of confirmation email for accessibility 2018-02-07 10:41:53 +11:00
Matt-Yorkley
fffae46a63 Remove enterpriseRoles from enterprsies controller 2018-02-07 10:41:53 +11:00
Matt-Yorkley
6ed91cab1f Remove old translation keys 2018-02-07 10:41:53 +11:00
Matt-Yorkley
cc5d0c35dd Refactor enterprise contact user assignment 2018-02-07 10:41:53 +11:00
Matt-Yorkley
c34570154c Use contact model in printed tickets 2018-02-07 10:41:53 +11:00
Matt-Yorkley
a5940e1641 Fix user controller spec 2018-02-07 10:41:53 +11:00
Matt-Yorkley
39f0c5b5b0 Rename contact name field and revert contact name specs 2018-02-07 10:41:53 +11:00
Matt-Yorkley
abb5adec43 Enterprise managers UI specs 2018-02-07 10:41:53 +11:00
Matt-Yorkley
525cb4826f Code review refactoring 2018-02-07 10:41:53 +11:00
Matt-Yorkley
fde0aba96c Feedback when user changes email addess 2018-02-07 10:41:53 +11:00
Matt-Yorkley
ff18fd25f1 Adjust Discourse login for user confirmations 2018-02-07 10:41:53 +11:00
Matt-Yorkley
9248ac05ac Adjustments for failing specs 2018-02-07 10:41:53 +11:00
Matt-Yorkley
a066c6391d Adjust injection data namespacing 2018-02-07 10:41:53 +11:00
Matt-Yorkley
4d11485283 Use receives_notifications flag for enterprise contact 2018-02-07 10:41:53 +11:00
Matt-Yorkley
9e270690ef Remove enterprise email
A user with the same email address is receiving notifications now.
If the email address is invalid, the owner receives notifications.
2018-02-07 10:41:53 +11:00
Matt-Yorkley
15b781b271 Update enterprise managers and contact role 2018-02-07 10:41:52 +11:00
Matt-Yorkley
5dc8f21b7b Show confirmed status in enterprise managers UI 2018-02-07 10:41:52 +11:00
Matt-Yorkley
9ccb3ee80b Add receives_notifications flag to enterprise_roles 2018-02-07 10:41:52 +11:00
Matt-Yorkley
27de66b055 Owner's permissions can't be deleted 2018-02-07 10:41:52 +11:00
Matt-Yorkley
ba98c7e2c5 Rewrite enterprise contact functionality 2018-02-07 10:41:52 +11:00
Matt-Yorkley
22eae753fe Remove enterprise confirmations 2018-02-07 10:41:52 +11:00
Pierre de Lacroix
d832d850fe Revert removed translations for Enterprise mails 2018-02-07 10:41:52 +11:00
Matt-Yorkley
aead867ea0 Set all current users to confirmed 2018-02-07 10:41:51 +11:00
Matt-Yorkley
97f5022bdd Show signup message in modal wihout redirect 2018-02-07 10:41:51 +11:00
Matt-Yorkley
0cb7a555d3 Adjust confirmation template 2018-02-07 10:41:51 +11:00
Maikel Linke
52b7872a55 Simplify conditionals 2018-02-07 10:41:51 +11:00
Matt-Yorkley
522aaee1a3 Update login modal for resending confirmations 2018-02-07 10:41:51 +11:00
Matt-Yorkley
179cf6e484 Tidy up confirmation migrations 2018-02-07 10:41:51 +11:00
Matt-Yorkley
28ded1f0c2 Adjust user signup feedback 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
7d971fc39d Add UserConfirmationsController spec 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
4f0b20e8ad Better tests 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
a6f2ee1367 Add migration to confirm already confirmed email addresses 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
eb1c598a6c Fix tests 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
4706bf0528 Remove changes on FR locale file 2018-02-07 10:41:51 +11:00
Matt-Yorkley
969b6caa96 Code cleanup 2018-02-07 10:41:51 +11:00
Matt-Yorkley
69ea1e6d26 Set test users to confirmed by default 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
91704d9df7 Create user confirmation email 2018-02-07 10:41:51 +11:00
Pierre de Lacroix
dbbc2ddb1c Add confirmable email to user model 2018-02-07 10:41:51 +11:00
Pau Pérez Fabregat
99729457cc Merge pull request #2063 from coopdevs/autocorrect-cop
Autocorrect rubocop Layout/BlockEndNewline cop
2018-02-05 08:50:58 +01:00
Pau Pérez Fabregat
5a58294bc6 Merge pull request #2042 from erose357/master
addresses issue #1275
2018-02-02 13:41:23 +01:00
Enrico Stano
398b3bbd8b Merge pull request #1960 from coopdevs/remove-warning
Fix payment_method_decorator boot-time warning
2018-02-02 10:43:51 +01:00
Pau Perez
6cb038c362 Autocorrect rubocop Layout/BlockEndNewline cop 2018-02-01 09:52:53 +01:00
Pau Pérez Fabregat
cc40948783 Merge pull request #2051 from coopdevs/regenerate-knapsack-report
Regenerate Knapsack report
2018-01-31 15:04:30 +01:00
Enrico Stano
00bdcd3948 Merge pull request #2045 from coopdevs/use-symbol-hash-syntax
Enable HashSyntax rubocop cop with symbol style
2018-01-31 09:30:06 +01:00
Matt-Yorkley
c860ffc176 Adjust use of non-translatable open/closed icons 2018-01-24 15:33:26 +11:00
Pau Perez
8664411880 Disable knapsack report generation again
No need to enable it to regenerate the report again until Knapsack
itself tells us.
2018-01-23 09:21:56 +01:00
Pau Perez
f17f1008e3 Update knapsack report file with latest CI values 2018-01-23 09:21:10 +01:00
Pau Perez
a2828f3b9a Regenerate Knapsack report
It's already asking for it in the CI output
2018-01-23 08:06:53 +01:00
Pau Perez
cbfdfb43e3 Enable HashSyntax rubocop cop with symbol style
This enforces the ruby 1.9 symbol hash syntax and consistency among the
style of the keys.

  # bad
  {:a => 1, :b => 2}
  {c: 2, 'd' => 3} # should just use hash rockets

  # good
  {a: 1, b: 2}
  {:c => 3, 'd' => 4}

The .rubocop-todo.yml is also updated to keep track of the existing
violations.
2018-01-20 12:50:50 +01:00
Matt-Yorkley
23e672aef9 Add updated globe icon to mobile view 2018-01-19 10:56:11 +00:00
Matt-Yorkley
6d9cc7e29d Fix account page locale 2018-01-18 10:22:40 +11:00
Matt-Yorkley
8a47788a09 Remake OFN icon font 2018-01-18 10:22:40 +11:00
Matt-Yorkley
afed5ab666 Refector spec 2018-01-18 10:22:40 +11:00
Matt-Yorkley
357eda8c19 Adjustments for failing specs 2018-01-18 10:22:40 +11:00
Matt-Yorkley
f18401d183 Language switcher frontend 2018-01-18 10:22:40 +11:00
Matt-Yorkley
4ea91d14f9 Template I18n changes 2018-01-17 12:03:27 +11:00
Pau Perez
f57661b13f Fix payment_method_decorator boot-time warning
Removes the annoying message "warning: already initialized constant
Spree::PaymentMethod::DISPLAY" that appears 4 times when booting the
app.

We are declaring said constant exactly as our Spree version does so
there's no point on repeating work.
2018-01-15 12:50:05 +01:00
Pau Pérez Fabregat
ad25c1d1b2 Merge pull request #2033 from coopdevs/add-setup-script
Add setup script
2018-01-15 12:05:19 +01:00
Pau Perez
87af5dcee5 Point to rbenv and nodenv from setup script
Show the appropriate links when the Ruby and Node dependencies are not
met. This will make it easier for newcomers to install them.
2018-01-12 08:22:50 +01:00
Pau Perez
106871b956 Check node version and install npm packages 2018-01-11 14:14:08 +01:00
Pau Perez
4d25abcfce Add setup script
It aims to aid new open source contributors on setting up their dev
env by means of a single command with meaningful output.

Although ofn-install ansible scripts also work for development we don't
want to add too much burden to those single-time beginner contributions.
2018-01-11 14:14:08 +01:00
Rob Harrington
2ccdf3c97a Use upstream and origin as remote names
Also fixed a couple of typos
2018-01-11 14:30:08 +11:00
Rob Harrington
89bd9c8038 Update CONTRIBUTIONS.md to reflect current processes 2018-01-11 14:30:08 +11:00
Enrico Stano
88627dc837 Merge pull request #2038 from boveus/master
Update README.md
2018-01-10 12:17:21 +01:00
Brandon Stewart
8ca57b0705 Update README.md 2018-01-09 14:02:27 -07:00
Brandon Stewart
c7db283e8c Update README.md 2018-01-09 14:00:07 -07:00
erose357
83ca3b7b8b Adds a css rule to target the logo in .footer-local and padding between the logo and open source info at the bottom 2018-01-09 12:54:41 -07:00
Brandon Stewart
830699d2b8 Update README.md 2018-01-09 10:29:02 -07:00
Brandon Stewart
f822e658c4 Update README.md 2018-01-09 10:23:51 -07:00
Brandon Stewart
8817a1afb7 Update README.md 2018-01-09 10:23:30 -07:00
Brandon Stewart
693adf181e Update README.md 2018-01-09 10:21:24 -07:00
Brandon Stewart
f269f13b09 Update README.md 2018-01-08 11:50:44 -07:00
Matt-Yorkley
9845258a25 Merge pull request #2035 from Matt-Yorkley/uk/rubocop_fix
Update rubocop.yml
2018-01-05 20:16:44 +00:00
Enrico Stano
edbed2c8d3 Merge pull request #1984 from coopdevs/fix/api-key-taxons
Disable api auth as there is no Spree api key set
2018-01-05 10:31:36 +01:00
Matt-Yorkley
8e0f2d2500 Merge pull request #2037 from Matt-Yorkley/uk/codeclimate_checks
Codeclimate yml update
2018-01-05 01:37:06 +00:00
Matt-Yorkley
e022504c26 Codeclimate yml update 2018-01-04 17:10:55 +00:00
Matt-Yorkley
62e4cbd052 Update rubocop.yml 2018-01-04 16:01:06 +00:00
Enrico Stano
70ae59550d Merge pull request #2032 from Matt-Yorkley/uk/codeclimate_migrations
Adjust codeclimate engine for migrations folder
2018-01-03 13:48:47 +01:00
Lynne
f74af8fa2d Merge pull request #2034 from lin-d-hop/translations-uk
Manual uk translation update
2018-01-03 06:00:07 +01:00
lin-d-hop
82d1b57005 Not updated from transifex so manually commiting 2018-01-03 03:40:04 +00:00
Lynne
c32aacc1b3 Delete en-GB.yml
Superseded by en_GB.yml
2018-01-03 03:29:52 +00:00
Matt-Yorkley
523b4045bf Adjust codeclimate engine for migrations folder 2018-01-02 13:54:41 +00:00
Enrico Stano
8e4e273b7c Merge pull request #1994 from openfoodfoundation/transifex
Transifex
2017-12-22 16:36:44 +11:00
Enrico Stano
816297e22f Merge pull request #2022 from ltrls/add-order-print-ticket-feature-test
Add feature test for the Spree::Admin::OrdersController print_ticket action
2017-12-22 15:07:17 +11:00
Pau Perez
72889b5c36 Stub current_user instead of api key's user 2017-12-21 10:24:29 +11:00
Pau Perez
0f0216fe79 Upgrade spree to get our latest patch 2017-12-21 10:24:29 +11:00
Pierre de Lacroix
42433d1ad4 Add feature test for the Spree::Admin::OrdersController print_ticket action 2017-12-20 23:01:18 +01:00
Pau Perez
52533fc04c Rely on Spree's default value for requires_auth 2017-12-20 17:25:23 +11:00
Pau Perez
bb0223877c Remove unused arguments and reduce object creation 2017-12-20 17:25:23 +11:00
Pau Perez
5eb1fcddbb Remove dependency on TestingSupport by inlining 2017-12-20 17:25:23 +11:00
Pau Perez
c646eb3939 Disable api auth as there is no Spree api key set
Although Spree::Api::Config[:requires_authentication] is set to false by
default for some unknown reason if not done explicitly Spree still
returns it as false.

This amends the change done in a87c89c83d,
which introduced the bug. As there is no Spree api key set the auth
fails when getting taxons.
2017-12-20 17:25:23 +11:00
Enrico Stano
a313c99370 Merge pull request #2005 from coopdevs/upgrade-spree-fork-version
Upgrade spree's fork to latest commit
2017-12-20 17:23:48 +11:00
Enrico Stano
0f84d9f02e Merge pull request #2004 from coopdevs/is-this-needed
Remove unused Enterprise scopes
2017-12-20 16:59:15 +11:00
Enrico Stano
900a9c6145 Merge pull request #2000 from coopdevs/issue-template-improvement
Mention screenshot in the issue template
2017-12-20 16:48:54 +11:00
Pau Perez
5b33cbe9aa Upgrade spree's fork to latest commit
Needed to get
3289b5e31c
2017-12-20 16:37:14 +11:00
Enrico Stano
114ce3b764 Merge pull request #1940 from coopdevs/improve-readability-shop
Improve readability of shop's code
2017-12-20 16:28:53 +11:00
Enrico Stano
660d3f326f Remove unused Enterprise scopes 2017-12-20 16:00:35 +11:00
Pau Perez
b8d51ae0de Mention screenshot in the issue template
For things like translations it's enough sharing a screenshot when
reporting a bug. See
https://github.com/openfoodfoundation/openfoodnetwork/issues/1999
2017-12-20 10:16:53 +11:00
Enrico Stano
0bdda6387a Merge pull request #1996 from coopdevs/add-issue-template
Create issue template
2017-12-19 18:00:04 +11:00
Pau Perez
4fbdbb1aa2 Link to placeholder feature template
We'll write the template later on
2017-12-19 15:26:21 +11:00
Pau Perez
72ddcb4fff Create issue template
It assumes most of the times issues will be reported to keep track of
bugs.
2017-12-19 11:07:29 +11:00
Transifex-Openfoodnetwork
50ef2de5f9 Updating translations for config/locales/fr.yml 2017-12-15 20:06:43 +11:00
Transifex-Openfoodnetwork
55d3ee1af0 Updating translations for config/locales/pt.yml 2017-12-13 21:19:42 +11:00
Transifex-Openfoodnetwork
422166441e Updating translations for config/locales/en_US.yml 2017-12-09 02:29:48 +11:00
Transifex-Openfoodnetwork
9d3f85628c Updating translations for config/locales/nb.yml 2017-12-08 18:44:22 +11:00
Pierre de Lacroix
669d9c3c66 Fix translations on account page 2017-12-06 15:21:19 +11:00
Enrico Stano
dcb406d246 Merge pull request #1986 from andypalmer/github_protocol_warning
Change github definition to remove insecure protocol warning.
2017-12-04 21:49:05 +11:00
Andy Palmer
cadad28b0c Change github definition to remove insecure protocol warning. Consistently use 1.9.3 hash syntax 2017-12-04 16:50:36 +11:00
Enrico Stano
01b0a033fd Merge pull request #1904 from oeoeaio/spree-test-config
Use Spree's approach for preventing config caching when testing
2017-12-04 15:57:11 +11:00
Pierre de Lacroix
0fb66ab258 Fix CodeClimate issues 2017-12-01 13:37:30 +11:00
Pierre de Lacroix
a49c21cfd1 Add instance switch to enable number localization 2017-12-01 13:37:24 +11:00
Pierre de Lacroix
f67a8c1f2d Add tests 2017-12-01 13:37:24 +11:00
Pierre de Lacroix
f4624ead42 Make all products reload when updating in bulk edit 2017-12-01 13:37:24 +11:00
Pierre de Lacroix
2cd570383f Use localize_number in models 2017-12-01 13:37:24 +11:00
Pierre de Lacroix
920900b619 Add Spree::LocalizedNumber module 2017-12-01 13:37:24 +11:00
Pau Perez
e98d934a67 Include localization files as documented in gem
I followed the Usage help in
https://github.com/derekprior/momentjs-rails.
2017-11-29 10:13:05 +11:00
leandroalemao
31a846b9c3 Refactor _i18n_script.html.haml file and add new momentjs internationalisation files 2017-11-29 10:13:05 +11:00
leandroalemao
5eaea28401 Switch momentjs internationalisation according to I18n locale 2017-11-29 10:13:05 +11:00
Pierre de Lacroix
50ef902adb Add missing tooltip in products' bulk edit page 2017-11-23 11:31:41 +11:00
Pierre de Lacroix
75b6a078c6 Add missing translation 2017-11-23 11:31:41 +11:00
Pierre de Lacroix
c0c93c172e Add tooltips in products bulk edit page 2017-11-23 11:31:41 +11:00
Pau Perez
ed18244070 Remove TODO in favour of an issue in Github
It has become the issue
https://github.com/openfoodfoundation/openfoodnetwork/issues/1961
2017-11-23 11:12:17 +11:00
Pierre de Lacroix
e13063e0c6 Fix before_filter for Spree::Admin::OrdersController#print_ticket 2017-11-23 11:01:41 +11:00
Rob Harrington
6c38997010 Fix 1664: product tag rules not working
Caused by a combination of: fe7bd5e2cd and 38d3b446cc

Have added/tweaked specs to prevent this from happening again
2017-11-15 10:26:24 +11:00
Pau Perez
0e01c0d69b Turn TODO into issue #1957
TODOs that live in the code can't be prioritized and tend to be
forgotten.
2017-11-15 09:44:11 +11:00
Pau Perez
caab3ea74d Add spree user as admin of Enterprise 2 in seed 2017-11-15 09:42:21 +11:00
Lynne
c543dff2e1 Merge pull request #1956 from coopdevs/improve-pr-template
Add special keyword syntax to close issue from PR
2017-11-14 14:16:08 +01:00
Pau Perez
92badfd88c Add special keyword syntax to close issue from PR
We want the issue to be closed when the PR gets merged but we always
forget to add the "magic" comment as described in
https://help.github.com/articles/closing-issues-using-keywords/.
2017-11-14 09:02:52 +01:00
Lynne
dca64e6939 Merge pull request #1944 from lin-d-hop/master
Adding UK About pages to menus
2017-11-10 16:33:58 +01:00
Saimon Moore
a9c4d27d5e Undo i18n_fallbacks change to production.rb 2017-11-10 12:30:24 +11:00
Saimon Moore
610c2f9519 Ensure en is an I18n fallback in all environments
Since `en` is considered as the main fallback for all locales
ensure that it is present in all environments.

Note: Setting `config.i18n.fallbacks` to `true` means use the default locale
which means that if a particular instance is not using an `en` based locale
(the parent `en` locale is automatically derived as a fallback) then `en` will
not be available as a fallback.
2017-11-10 12:30:24 +11:00
Saimon Moore
05d757e7c4 Ensure we have min i18n fallbacks
This setting defines which locales will be exported to the frontend.
In general, ofn currently functions under a single locale
(which is also the default locale) but all translations are made from
the `en` locale.

The current process of ensuring translations are translated and make
their way into code is manual and prone to issues so occasionally
translations for keys in the default locale of a particular instance
are not deployed and the UI displays `missing translation` messages.

In these cases, it is far friendlier for the user to see fallbacks to
`en` rather than these errors so this commit ensure that at the very
least apart from the current default locale, `en` is also made available
and as such will be exported to the frontend so that it's translations
are available as a fallback in JS land.

I18n fallback config was already enabled in both frontend and backend.
Until now, available locales may not have been set (determined by the
`AVAILABLE_LOCALES` env var) and the translations for `en` not therefore
be present in the frontend for fallback to actually work.

This commit will ensure that a fallback to `en` is always possible in the
case of missing translations.
2017-11-10 12:30:24 +11:00
Maxim Colls
31a2453882 Bootstrap angular module in new_variant form 2017-11-10 09:37:36 +11:00
Rob Harrington
5febd0a0d6 Restructure flaky customer spec 2017-11-10 08:47:12 +11:00
Rob Harrington
694f1e9b25 Update knapsack report 2017-11-10 08:47:12 +11:00
Andy Palmer
131bf842a9 Update matchers to non-deprecated protocol 2017-11-10 08:47:12 +11:00
Andy Palmer
8ec1c2e04a No longer use expensive page.evaluate_script for imperative methods 2017-11-10 08:47:12 +11:00
Andy Palmer
e94dc257a1 We actually need to restart the driver, not the session 2017-11-10 08:47:12 +11:00
Andy Palmer
3bd4fc59d4 We reset the phantom js driver after each context to prevent it memory leaking and dying 2017-11-10 08:47:12 +11:00
Andy Palmer
7b8463b03a PhantomJS no longer crashes due to too specific selector 2017-11-10 08:47:12 +11:00
Rob Harrington
00e7fc1c0d Bump capybara version 2017-11-10 08:47:12 +11:00
Rob Harrington
2ca20ad701 Bump poltergeist version to 1.16.0 2017-11-10 08:47:12 +11:00
Maikel Linke
775da82072 Add waiting conditions to spec 2017-11-10 08:47:12 +11:00
Maikel Linke
162b392004 Use expect syntax, correct spec description 2017-11-10 08:47:12 +11:00
Maikel Linke
26bedf0523 Make title matcher more robust 2017-11-10 08:47:12 +11:00
Maikel Linke
ff3ee62509 Remove old comment 2017-11-10 08:47:12 +11:00
Maikel Linke
9c2a78adf2 Avoid warnings, use expect syntax 2017-11-10 08:47:12 +11:00
Maikel Linke
5a767ba3ef Avoid warning, use new syntax 2017-11-10 08:47:12 +11:00
Rob Harrington
691d642721 Use url helper instead of string to define expected url 2017-11-10 08:47:12 +11:00
Rob Harrington
7dbfc3740d Revert "Add workaround to pass Spree core tests in Travis"
This reverts commit 9cdec737078caa6eb5a90480cabb6ca477ab597b.
2017-11-10 08:47:12 +11:00
Rob Harrington
b2897d7feb Reset Spree::Config.allow_backorders to original value in spec 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
b18177c215 Add workaround to pass Spree core tests in Travis 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
cec0a8c2e7 Specify page object for Capybara#find methods 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
412de318ed Manually disable backorders in failing features 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
92cc7a4648 Another try for failing feature 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
96c0481e17 Fix intermittently failing product distribution feature 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
5dd7ddc288 Refactor base controller with new rspec syntax 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
ea91a82f30 Try to fix shopping cart failing feauture in Travis 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
8e10269b50 Try to fix intermittently failing test for product distribution 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
dae74666c5 Add missing 'type: :request' for request spec 2017-11-10 08:47:12 +11:00
Julius Pabrinkis
94e31e35ba Fix Spree::Admin::BaseController related issues 2017-11-10 08:47:12 +11:00
Rob Harrington
c835b4eb1a Replacing stub_model objects with actual factory generated instances 2017-11-10 08:47:12 +11:00
Rob Harrington
ef9e43fbd3 Replacing mock_model objects with instance_doubles 2017-11-10 08:47:12 +11:00
Rob Harrington
f083433854 Explicitly specifying 'type: :helper' for all helper specs 2017-11-10 08:47:12 +11:00
Rob Harrington
9052b1c3db A few updates to spec where 'be true' and 'be false' didn't cut it 2017-11-10 08:47:12 +11:00
Rob Harrington
59578a73af Changing all references to 'be_true' and 'be_false' to 'be true' and 'be false'
See next commit for changes where this substitution was broken
2017-11-10 08:47:12 +11:00
Rob Harrington
c691e260cf Rspec matcher enqueue_job for Delayed::Job supports block expectations 2017-11-10 08:47:12 +11:00
Rob Harrington
82072c8970 Explicitly specifying 'type: :controller' for all controller specs 2017-11-10 08:47:12 +11:00
Rob Harrington
d0c52ac176 Updating outdated guard gems 2017-11-10 08:47:12 +11:00
Rob Harrington
6811a62568 Updating RSpec Gems 2017-11-10 08:47:12 +11:00
Buildkite
8653d03969 Merge remote-tracking branch 'origin/master' into HEAD 2017-11-09 13:49:39 +00:00
lin-d-hop
90d5a04368 Adding UK About pages to menus 2017-11-09 11:06:58 +00:00
Pau Perez
84e4ebef08 Do not notify Bugsnag of a cache miss
It's not the responsibility of a error tracking software to track
neither cache misses nor logs. That is what log monitoring is for.
2017-11-09 10:22:31 +01:00
Pau Perez
98603c4042 Do not test private methods 2017-11-09 10:22:31 +01:00
Pau Perez
26a4ee0171 Do not stub object under test 2017-11-09 10:22:31 +01:00
Pau Perez
4f03a2d25c Remove unnecessary require 2017-11-09 10:22:31 +01:00
Pau Perez
6a830a3843 Isolate ArraySerializer case in injection helper
This makes this special case with the ArraySerializer stand out so that
the reader notices it.
2017-11-09 10:22:30 +01:00
Pau Perez
3ffd049135 Remove commented out code 2017-11-09 10:22:30 +01:00
Rob Harrington
e6d1b38b82 Remove upgrade_bundler script by reverting 250062bd2, 3f2299e52 and 5dfac10599 2017-11-09 19:46:41 +11:00
Rob Harrington
f8a892faf2 Remove upgrade_bundler script by reverting 250062bd2, 3f2299e52 and 5dfac10599 2017-11-09 18:24:22 +11:00
Pierre de Lacroix
54e141489a Add noindex meta tag for invisible shops and staging environment 2017-11-09 12:04:27 +11:00
Pau Perez
e64fd1d308 Lower log level in prod to :info so we can debug
Otherwise, there are no log lines for any request, which makes it
impossible to find out anything about the app in production.

Obviously this increases the size of the log files but this has to be
  dealt with log rotation. The data is our most important asset.
2017-11-09 11:13:32 +11:00
Matt-Yorkley
01647c3df9 Disable allow_backorders by default in test environment 2017-11-02 17:43:46 +11:00
Rob Harrington
cd6d7c76f6 Fix spec that requires preference persistence 2017-11-02 17:43:04 +11:00
Rob Harrington
efa71c4ac8 Use Spree's approach for handling config when testing 2017-11-02 17:43:04 +11:00
Rob Harrington
d4eb27a4ed Fix race condition in shipping method order spec 2017-11-01 16:37:12 +11:00
Duende13
eca18ba6ee Test to control order of shipping methods by name 2017-11-01 15:30:42 +11:00
Duende13
31fa49feed Added orderBy 'name' to the list of shipping methods offered. 2017-11-01 15:30:42 +11:00
yasirazgar
b68aafdb72 1799 - adding missing translations in new shipping methods page 2017-11-01 10:50:21 +11:00
Andy Palmer
fd09a63e48 Imperative specs as per review comments 2017-10-24 17:56:04 +11:00
Andy Palmer
afc50863cd Replace Deface with update to overridden template 2017-10-24 17:39:34 +11:00
Andy Palmer
fea2240c39 Disabled product links in cart for openfoodfoundation/openfoodnetwork#1075 2017-10-24 14:56:35 +11:00
Rob H
9642e8295e Merge transifex translations 2017-10-21 00:23:40 +11:00
Enrico Stano
1424d44eab Merge pull request #1919 from nicolauduran/add-dev-doc
Add more development documentation
2017-10-20 14:31:43 +02:00
Nicolau Duran
0a5f0a518d Add development doc 2017-10-20 13:18:21 +02:00
Transifex-Openfoodnetwork
ff1672e411 Updating translations for config/locales/nb.yml [skip ci] 2017-10-20 19:50:21 +11:00
Transifex-Openfoodnetwork
32d8368990 Updating translations for config/locales/fr.yml [skip ci] 2017-10-20 19:42:24 +11:00
Lynne
e7f8102eb9 Update en-GB.yml 2017-10-20 08:29:18 +01:00
Rob Harrington
24e1d0b775 Fix mistyped translation key for 'dashboard' 2017-10-20 16:26:08 +11:00
Rob Harrington
ceadd386aa Update order spec to test an order with a total > 0
This is necessary because the previous commit changed the logic
around payment state, meaning that a complete order with a total
of 0 and no complete paymnents is considered to have a payment
state of 'paid'. I don't think this is problematic, since it is
not possible to check out an order without line items.

This way the spec tests an order modelled on the real world.
2017-10-20 15:21:59 +11:00
Rob Harrington
d42dc2b286 Fix #1902: ensure correct payment state when failed payments are present
Problem: order payments didn't seem to be loaded in any particular order,
and OrderUpdater#update_payment_state was relying on payment order to de-
termine payment state.

Strategy: Adapt a version of this method from a future version of Spree.
I tried to select a version where I would have to make the absolute mini-
mum number of changes to get it to work. See comments in code for justif-
ications of the changes that I did make.
2017-10-20 15:21:59 +11:00
Continuous Integration
e9c8e17710 Merge remote-tracking branch 'origin/master' into HEAD 2017-10-19 20:42:35 +11:00
Lynne
bfd845915c Update en-GB.yml 2017-10-19 10:41:21 +01:00
Rob Harrington
b7976a2356 Do not update finalized fee adjustments 2017-10-19 16:54:39 +11:00
Rob Harrington
cd744dab68 Ignore .byebug_history after recent update of byebug gem 2017-10-19 10:45:24 +11:00
Transifex-Openfoodnetwork
02e3aac3f0 Updating translations for config/locales/fr.yml [skip ci] 2017-10-19 04:38:24 +11:00
Transifex-Openfoodnetwork
50075f02a0 Updating translations for config/locales/es.yml [skip ci] 2017-10-18 19:29:14 +11:00
Enrico Stano
05d8cd09e3 Merge pull request #1890 from coopdevs/add-node-version
Track node version in .node-version
2017-10-18 09:24:06 +02:00
Justyna Field
02fd87158e Add display flex on active table row to fix misalignment 2017-10-18 15:05:55 +11:00
Pierre de Lacroix
165af4b812 Use I18n "lazy" lookup 2017-10-18 14:38:40 +11:00
Pierre de Lacroix
dba8e36752 Change key for uncapitalized "items" translation 2017-10-18 14:38:40 +11:00
Pierre de Lacroix
a245590114 Fix some translations 2017-10-18 14:38:40 +11:00
Continuous Integration
5ecae39051 Merge remote-tracking branch 'origin/master' into HEAD 2017-10-17 19:36:45 +11:00
Transifex-Openfoodnetwork
2508234a7c Updating translations for config/locales/en_GB.yml [skip ci] 2017-10-17 19:23:35 +11:00
Transifex-Openfoodnetwork
da5f9e7ebc Updating translations for config/locales/nb.yml [skip ci] 2017-10-16 20:00:37 +11:00
Rob Harrington
0d483882de Update helper messages in Stripe Connect config UI 2017-10-16 10:37:04 +11:00
Rob Harrington
9e40502876 Update stripe controller routing comments 2017-10-16 09:39:15 +11:00
Continuous Integration
c38e58159f Merge remote-tracking branch 'origin/master' into HEAD 2017-10-13 18:57:25 +11:00
Transifex-Openfoodnetwork
acf0919bfa Updating translations for config/locales/en_GB.yml [skip ci] 2017-10-13 18:33:41 +11:00
Rob Harrington
bca409bfe4 Bumping very outdated versions of pry and byebug 2017-10-13 15:47:59 +11:00
Pierre de Lacroix
1fe10b4b25 Add pointer cursor to other links in products bulk edit 2017-10-13 15:33:30 +11:00
Pierre de Lacroix
768378b147 Add pointer cursor to EXPAND ALL link in products bulk edit 2017-10-13 15:33:30 +11:00
Rob Harrington
1fcbf6b44d Clear shipping_method_id from order when restarting checkout
If the order is allowed to retain a shipping_method_id, then subsequent
saves of the order will cause a new shipment to be initialised. Seems to
only happen for delivery shipping methods. This is undesirable because
fees for the new shipment will appear in the checkout summary, which is
not smart enough to recognise existing shipment fees and adjust the order
total accordingly.
2017-10-13 12:53:35 +11:00
Rob Harrington
f96502c369 Add unit specs for CheckoutController#restart_checkout 2017-10-13 12:53:35 +11:00
Rob Harrington
c031b0e52b Clear shipments and payments after failed payment at checkout 2017-10-13 12:53:35 +11:00
Rob Harrington
6006952603 Moving checkout request specs into their own folder 2017-10-13 12:53:35 +11:00
Duende13
e5fb8712d7 Simplify Product Edit Screen removing fields and adding 2 new menu options for seo and group buy (#1741) 2017-10-13 11:37:57 +11:00
Pierre de Lacroix
508dfa4f23 Fix failing tests assuming localizeCurrency has no "delimiter" 2017-10-13 10:26:13 +11:00
Pierre de Lacroix
65d176f533 Fix wrong way to force currency symbol after the amount 2017-10-13 10:26:13 +11:00
Pierre de Lacroix
089c754f62 Remove conversion of amounts to currency strings via Money in serializers as it's better done in JS 2017-10-13 10:26:13 +11:00
Pierre de Lacroix
aae8f1cbc4 Change localizeCurrency filter to use I18n.toCurrency 2017-10-13 10:26:12 +11:00
Matt-Yorkley
7194db40ee Merge pull request #1895 from Matt-Yorkley/codeclimate-symbol-arrays
Relax rubocop Style/SymbolArray rule
2017-10-13 00:06:32 +01:00
Rob Harrington
f2ad087be5 Change inheritance of StripeAccountsController 2017-10-13 07:57:16 +11:00
Rob Harrington
0b8b5e694e Move Stripe Connect callback action to dedicated controller 2017-10-12 22:47:51 +11:00
Rob Harrington
01f9fd3232 Rename webhook handler status mappings 2017-10-12 22:47:51 +11:00
Rob Harrington
99cac20725 Fall back to 200 when handler returns an unknown result 2017-10-12 22:47:51 +11:00
Rob Harrington
068dbe5013 Add verification to Stripe webhook endpoint 2017-10-12 22:47:45 +11:00
Rob Harrington
ed375a1e2c Build Event object in controller instead of service object 2017-10-12 20:51:17 +11:00
Rob Harrington
4345285164 Allow more granularity in Stripe WebhookHandler responses 2017-10-12 20:51:17 +11:00
Rob Harrington
eb7cb02f33 Namespace stripe webhook controller in Stripe module 2017-10-12 20:50:29 +11:00
Rob Harrington
f22dd7513d Add a service object for handling Stripe webhooks 2017-10-11 17:50:46 +11:00
Rob Harrington
c54119f482 Rename stripe controller action from 'deauthorize' to 'webhook' 2017-10-11 17:11:02 +11:00
Rob Harrington
23d2b3a664 Move Stripe webhook logic into dedicated frontend controller 2017-10-11 16:38:19 +11:00
Rob Harrington
c747bb5305 Remove improper use of quick_login_as_admin from unit spec 2017-10-11 16:10:08 +11:00
Matt-Yorkley
d147d2035d Disable symbol array cop 2017-10-07 11:50:59 +01:00
Maikel Linke
4dd71c1240 Add CSS workaround to display repeated table head
Fixes https://github.com/openfoodfoundation/openfoodnetwork/issues/1738
2017-10-06 16:51:19 +11:00
Maikel Linke
6ad7c7b835 Tidy up HTML indent 2017-10-06 14:24:28 +11:00
Maikel Linke
10bbc5f9ef Hide the menu on embedded group pages 2017-10-06 14:24:28 +11:00
Maikel Linke
b8a124b99e Add preview page for embedded groups 2017-10-06 14:24:28 +11:00
Maikel Linke
28b1ea2d9f Allow group pages to be in iframes 2017-10-06 14:24:28 +11:00
Maikel Linke
2b989f49ea Enable iframes in development environment 2017-10-06 14:24:28 +11:00
Enrico Stano
bdc701f880 Merge pull request #1816 from coopdevs/disable-create-profile-on-submit
Disable create profile on submit
2017-10-05 15:25:37 +02:00
Enrico Stano
7af154d675 Merge pull request #1820 from coopdevs/missing-translations-register
Missing translations in Enterprise Registration
2017-10-05 13:12:09 +02:00
Pau Perez
2552b5faac Track node version in .node-version
This is used by https://github.com/nodenv/nodenv
2017-09-29 16:11:22 +02:00
Pau Perez
d8e3052575 Ensure a callback function is provided 2017-09-29 16:10:11 +02:00
Transifex-Openfoodnetwork
3c797d3b86 Updating translations for config/locales/es.yml [skip ci] 2017-09-27 00:23:20 +10:00
Transifex-Openfoodnetwork
46ca3bc950 Updating translations for config/locales/fr.yml [skip ci] 2017-09-26 19:51:50 +10:00
Rob Harrington
75ec77dc31 Remove the 'confirm' step from the order checkout flow
This step is not being responded to anyway, since we are not rending a page for each checkout step

It was causing an issue whereby an order in the 'confirm' state was not able to progress through the
checkout controller because it was expecting to only redirect to paypal from the 'payment' state.
figured it was easiest to just remove the step, seeing as it wasn't being used in any meaningful way.
It should be fine to bring the 'confirm' step back in the future if we need it, we will just have to
make sure paypal the paypal issue is resolved.
2017-09-23 15:15:06 +10:00
Rob Harrington
a09a54e4cb Set transaction fee adjustments to ineligible if payment is invalid or failed 2017-09-23 15:15:06 +10:00
Rob Harrington
e486dbd4f8 Respond to Stripe webhook with status of 204 if specified account is not found 2017-09-23 14:58:35 +10:00
Rob Harrington
db5503dd80 Allow destruction of StripeAccounts even if deauthorise request fails
Log deauthorise failures to Bugsnag
2017-09-23 14:58:35 +10:00
Rob Harrington
dd3d205536 Update deauthorize webhook to latest version of API (again) 2017-09-23 14:58:35 +10:00
Rob Harrington
90007d7114 Prevent Stripe-based payment methods that are not linked to a StripeAccount from displaying in the checkout 2017-09-23 14:58:35 +10:00
Rob Harrington
7ba99c0fe0 Update Bogus Gateway error message in checkout spec 2017-09-23 14:58:35 +10:00
Rob Harrington
ba61f94906 Expose Stripe token creation error messages in Checkout 2017-09-23 14:58:35 +10:00
Rob Harrington
7c82fa3d44 Show more helpful payment processing error in checkout 2017-09-23 14:58:35 +10:00
Rob Harrington
665749d0c5 Refactor Stripe::AccountConnector
Connector now handles cancellation of the connection wizard by the user more elegantly
2017-09-23 14:58:35 +10:00
Rob Harrington
d3566f9303 Update deauthorize webhook to latest version of API 2017-09-23 14:58:35 +10:00
Rob Harrington
7d2deca969 Ensure cart_spec runs in context where backorders are disabled 2017-09-23 14:58:35 +10:00
Rob Harrington
0f19be4db4 Configure StripeElements service to map cc_type to that used by activemerchant 2017-09-23 14:58:35 +10:00
Rob Harrington
393a4efbf6 Fix flaky OrderSerializer spec
Make sure that completed payment is for an amount less that the order total
2017-09-23 14:58:35 +10:00
Rob Harrington
34b109cbb7 Add basic validation to credit card form on account page 2017-09-23 14:58:35 +10:00
Rob Harrington
4785f3eacc Use lowercased cc_type in CreditCard service 2017-09-23 14:58:34 +10:00
Rob Harrington
e14b017f1f Fix broken Stripe checkout spec 2017-09-23 14:58:34 +10:00
Rob Harrington
d2096cf6d1 Make request stubs less brittle by using regex 2017-09-23 14:58:34 +10:00
Rob Harrington
fbda1a27ad Add missing translation referenced from spree_auth_devise 2017-09-23 14:58:34 +10:00
Rob Harrington
098afc62c1 Fix rubocop issues 2017-09-23 14:58:34 +10:00
Rob Harrington
1cd1e9dc37 Extract filters for available PMs into service object 2017-09-23 14:58:34 +10:00
Rob Harrington
0bbaafbd41 Use guard clause 2017-09-23 14:58:34 +10:00
Rob Harrington
0e42c1cf30 Refactor ProfileStorer, call options as a separate method 2017-09-23 14:58:34 +10:00
Rob Harrington
620721c8cb Use find_by_id instead of find in EnterpriseController 2017-09-23 14:58:34 +10:00
Rob Harrington
5cba635783 Add documentation to StripeConnectSettings controller 2017-09-23 14:58:34 +10:00
Rob Harrington
08c723b10f Use expect syntax instead of should 2017-09-23 14:58:34 +10:00
Rob Harrington
61feb2b27d Rename Stripe existing_card param key to existing_card_id 2017-09-23 14:58:34 +10:00
Rob Harrington
a2dee8d3d8 Create a Struct for Stripe Connect settings once rather than on each request 2017-09-23 14:58:34 +10:00
Rob Harrington
a74c502fd9 Refactor logic for creating a payment profile from a Stripe token into a service object 2017-09-23 14:58:34 +10:00
Rob Harrington
f6c3a2a46e Remove new credit card initialisation logic from Spree::UsersController#show 2017-09-23 14:58:34 +10:00
Rob Harrington
4464a85a74 Add missing controller specs for CreditCardController #destroy 2017-09-23 14:58:34 +10:00
Rob Harrington
22bbe29f3d Call single-use before_filters from actions instead 2017-09-23 14:58:34 +10:00
Rob Harrington
9832966b77 Fix Admin::PaymentsController spec 2017-09-23 14:58:34 +10:00
Rob Harrington
19213a5ca8 Rearrange new card inputs on account page 2017-09-23 14:58:34 +10:00
Rob Harrington
3a0b47c451 Add border to Stripe Elements input, make text larger 2017-09-23 14:58:34 +10:00
Rob Harrington
0cd43987de Hide Stripe payment methods without a preferred_enterprise_id from the front-end 2017-09-23 14:58:34 +10:00
Rob Harrington
ca1987fc87 Prevent Stripe payment methods without account owners from being saved 2017-09-23 14:58:34 +10:00
Rob Harrington
2f153d799b Hide 'save credit card' checkbox for guests 2017-09-23 14:58:34 +10:00
Rob Harrington
742dd0b5dd Clean up jquery dialog styling 2017-09-23 14:58:34 +10:00
Rob Harrington
ecef905444 Allow Stripe-based payments to be voided (refunded) 2017-09-23 14:58:34 +10:00
Rob Harrington
dd56e03be1 Stop setting host for url helpers in specs 2017-09-23 14:58:34 +10:00
Rob Harrington
7b456461f3 Add ng-model directive to save credit card checkbox
I have no idea how this was working before\?!\?!\?!
2017-09-23 14:58:34 +10:00
Rob Harrington
e4872172c8 Move PaymentMethodSerializer to correct path 2017-09-23 14:58:34 +10:00
Rob Harrington
2ed5e144ca Convert problematic embedded shopfronts feature spec into request spec 2017-09-23 14:58:34 +10:00
Rob Harrington
f9df4d4c93 Rewrite js unit specs for Stripe Elements service 2017-09-23 14:58:34 +10:00
Rob Harrington
1aa477c57c Update feature specs to look for Stripe Elements element 2017-09-23 14:58:34 +10:00
Rob Harrington
69385370ee Initialize Stripe object only if a publishable_key has been defined 2017-09-23 14:58:34 +10:00
Rob Harrington
65ab83a9a5 Move StripeElements element to an AngularJS directive, mount from there 2017-09-23 14:58:34 +10:00
Rob Harrington
746c2ffef9 Add 'publishable_key' property to Stripe module (enables stubbing) 2017-09-23 14:58:34 +10:00
stveep
6690f2e9e7 Restyle add card form 2017-09-23 14:58:34 +10:00
stveep
74a7cb82bc Modify to use Stripe Elements to manually add cards in Account page. Remove StripeJS service 2017-09-23 14:58:34 +10:00
stveep
15ed4c32d9 Checkout switched to Stripe Elements from StripeJS 2017-09-23 14:58:34 +10:00
stveep
56ff877b25 Use Stripe Elements instead of StripeJS: https://stripe.com/docs/elements 2017-09-23 14:58:34 +10:00
Maikel Linke
926f196b96 Re-generate rubocop_todo 2017-09-23 14:58:34 +10:00
Maikel Linke
5b7e2f7ca8 Apply style guide 2017-09-23 14:58:34 +10:00
stveep
0a12f78444 Separate files for Payment Method serializers 2017-09-23 14:58:33 +10:00
stveep
da5c907e0f Add/remove comments from PR feedback 2017-09-23 14:58:33 +10:00
stveep
f065cbe251 Fix specs for saved credit cards: Add payment profile ID to fixture (now denotes that a card has been saved), check for current user to avoid error attempting to inject saved cards as a guest 2017-09-23 14:58:33 +10:00
stveep
511afa0ddc Bump Stripe gem version 2017-09-23 14:58:33 +10:00
Rob Harrington
d5ab9eb675 Hide option to 'Remember this card' when an existing card is selected 2017-09-23 14:58:33 +10:00
Rob Harrington
cb08011450 Fix typo in Stripe confirm modal 2017-09-23 14:58:33 +10:00
Rob Harrington
41b7be900c Restrict the meaning of 'Saved Cards' to mean those with a payment profile 2017-09-23 14:58:33 +10:00
Rob Harrington
6133b302af Use guard clause in PaymentMethodsController#restrict_stripe_account_change 2017-09-23 14:58:33 +10:00
Rob Harrington
4fb1c7fd92 Add 'Stripe is in Beta' warning 2017-09-23 14:58:33 +10:00
Rob Harrington
b31881baa5 Add explanation about configuring Stripe API keys 2017-09-23 14:58:33 +10:00
Rob Harrington
4e96487da9 Redirect to #/payment methods from stripe connect callback 2017-09-23 14:58:33 +10:00
Rob Harrington
98317e96d0 Remove unused stripe action abilities 2017-09-23 14:58:33 +10:00
Rob Harrington
4865533f26 Restrict edit permissions on Stripe payment methods 2017-09-23 14:58:33 +10:00
Rob Harrington
1f8890b430 Use an explicit date format for PaymentsSerializer#updated_at 2017-09-23 14:58:33 +10:00
Rob Harrington
11daf89005 Add admin views for Stripe payment methods
These views were pretty much just copied from https://github.com/spree/spree_gateway
2017-09-23 14:58:33 +10:00
Rob Harrington
fab893e60b Fix paypal source_form view
The previous commit broke the selectors used by app/assets/javascripts/spree/backend/paypal_express.js
in the better_spree_paypal_express gem.

We can remove this override of the paypal source_form view when we update better_spree_paypal_express
to a version that includes the following commit:
4360a1fb82
2017-09-23 14:58:33 +10:00
Rob Harrington
a04116466e Fix js for switching form partial for new admin payments
All of the functional changes made in this commit came from a future version of Spree:
8a3a80b08a
2017-09-23 14:58:33 +10:00
Rob Harrington
2f6493bb86 Use ng-cloak for admin/enterprises/edit form 2017-09-23 14:58:33 +10:00
Rob Harrington
589c2a1500 Add a modal to handle explanation of user's responsibilities before redirecting to Stripe 2017-09-23 14:58:33 +10:00
Rob Harrington
8cae874109 Fix styling on jquery dialogs 2017-09-23 14:58:33 +10:00
Rob Harrington
7c406f7c3a Use hash navigation to direct users to #/payment_methods from Stripe PM 2017-09-23 14:58:33 +10:00
Rob Harrington
862443ed6d Add hash navigation to admin Enterprise edit view 2017-09-23 14:58:33 +10:00
Rob Harrington
3b78179dea Ask customer about saving card details used in checkout 2017-09-23 14:58:33 +10:00
Rob Harrington
f317cee9e9 Tweak UI for selecting an existing card at Checkout 2017-09-23 14:58:33 +10:00
Rob Harrington
35912605c3 Include customer name in source attrs for Stripe checkout requests 2017-09-23 14:58:33 +10:00
Rob Harrington
8901af897a Store card details submitted via checkout 2017-09-23 14:58:33 +10:00
Rob Harrington
ee92f46bd5 Fix stripe request spec by providing en enterprise_id
The enterprise_id is used to lookup a StripeAccount which is provided to the Spree::Token#create call in the StripeConnect gateway
2017-09-23 14:58:33 +10:00
Rob Harrington
44ba499ad9 Stub rather than set Stripe api_key in specs 2017-09-23 14:58:33 +10:00
Rob Harrington
44d172f3b4 Mock stripe_account_id for StripeAccount gateway specs 2017-09-23 14:58:33 +10:00
Rob Harrington
d2b6ba4330 Provide a Stripe client_id for StripeAccountsController spec 2017-09-23 14:58:33 +10:00
Rob Harrington
576e4db9be Authorize StripeAccount#status using the account object
Rather than the enterprise
2017-09-23 14:58:33 +10:00
Rob Harrington
692ccf0598 Cleaning up oauth2 extension that is no longer required
(We're using Stripes built-in OAuth Libraries instead)
2017-09-23 14:58:33 +10:00
Rob Harrington
ce65a9d063 Bump stripe gem version to 3.0.1
Allows us to use the stripe gem's built-in OAuth wrappers, rather than our own
2017-09-23 14:58:33 +10:00
Rob Harrington
ffc99df373 Consolidate Stripe routes/actions into StripeAccountsController 2017-09-23 14:58:33 +10:00
Rob Harrington
5c58d30ca7 Create payment from user-specified payment method when using existing card 2017-09-23 14:58:33 +10:00
Rob Harrington
3efabf5c50 Add translations for Stripe connection flashes 2017-09-23 14:58:33 +10:00
Rob Harrington
919e39f950 Provide a valid enterprise for building redirect path for Stripe Connect callback 2017-09-23 14:58:33 +10:00
Rob Harrington
0e14704572 Kill empty space 2017-09-23 14:58:33 +10:00
Rob Harrington
e9d062a8c2 Use nested module/class definitions instead of compact style 2017-09-23 14:58:33 +10:00
Rob Harrington
f3af36deca Disable rubocop Style/PredicateName check against override of Spree method 2017-09-23 14:58:32 +10:00
Rob Harrington
ecb78233d9 Use guard clauses where possible 2017-09-23 14:58:32 +10:00
Rob Harrington
a68ae1fe2d Provide a sensible flash message when CreditCard#destroy action fails 2017-09-23 14:58:32 +10:00
Rob Harrington
28ba05ec6b Fix Lint/UselessAssignment offences for stripe-connect 2017-09-23 14:58:32 +10:00
Rob Harrington
5b675cbaba Make OAuth private methods actually private 2017-09-23 14:58:32 +10:00
Rob Harrington
42dd58426e Auto-correct rubocop offences for stripe-connect 2017-09-23 14:58:32 +10:00
Rob Harrington
c83755f901 Clean up StripeConnect gateway 2017-09-23 14:58:32 +10:00
Rob Harrington
ae2d3d3fd9 Refactoring StripeHelper into service objects 2017-09-23 14:58:32 +10:00
Rob Harrington
e6eb45b453 Name StripeAccountController spec file correctly 2017-09-23 14:58:32 +10:00
Rob Harrington
01ce092ebc Handle Stripe token creation request failure 2017-09-23 14:58:32 +10:00
Rob Harrington
5d77ef52c5 Replace text strings with variables in stripe request spec 2017-09-23 14:58:32 +10:00
Rob Harrington
e8636c0cbf Set dummy Stripe API key for front-end credits cards feature spec 2017-09-23 14:58:32 +10:00
Rob Harrington
f890927423 Implementing the Stripe Connect feature toggle 2017-09-23 14:58:32 +10:00
Rob Harrington
6499d17cb1 Adding feature toggle config variable for Stripe Connect 2017-09-23 14:58:32 +10:00
Rob Harrington
1d1e581c85 Refactoring CreditCardController, rendering card processing errors as json 2017-09-23 14:58:32 +10:00
Rob Harrington
64009a2c9e CheckoutController can render payment gateway error messages as json 2017-09-23 14:58:32 +10:00
Rob Harrington
14f6ea4c01 Adding required Stripe config variables to application.yml.example 2017-09-23 14:58:32 +10:00
Rob Harrington
fdca1f6606 Adding message about having no saved cards to account/cards UI 2017-09-23 14:58:32 +10:00
Rob Harrington
63a15ec392 CreditCardController#destroy redirects to account#/cards 2017-09-23 14:58:32 +10:00
Rob Harrington
356dad73ba Ensure spec has Stripe.api_key set 2017-09-23 14:58:32 +10:00
Rob Harrington
fb5784fbda Allow updating of account settings from account tabs interface 2017-09-23 14:58:32 +10:00
Rob Harrington
4ef97aa418 Showing past orders under the orders tab 2017-09-23 14:58:32 +10:00
Rob Harrington
b9d72ce4cf Refactoring logic for displaying orders on the front-end account page 2017-09-23 14:58:32 +10:00
Rob Harrington
9733bb3a77 Renaming account#history to account#transactions 2017-09-23 14:58:32 +10:00
Rob Harrington
532dc57725 Adding translations for /account tabs 2017-09-23 14:58:32 +10:00
Rob Harrington
f4c3fbf8bc Refactoring credit cards interface, and backend logic 2017-09-23 14:58:32 +10:00
Rob Harrington
778526af2e Rewriting styling for new tabs components 2017-09-23 14:58:32 +10:00
Rob Harrington
1aebee0583 WIP: rebuilding accounts page using tabs infrastructure 2017-09-23 14:58:32 +10:00
Rob Harrington
ed5c650456 Writing a new tabset component for front-end tabs
Modeled on back-end 'panels' infrastructure
2017-09-23 14:58:32 +10:00
Rob Harrington
b8c6da301c Removing unnecessary dependencies from OrdersCtrl 2017-09-23 14:58:32 +10:00
Rob Harrington
269a60b36f Adding request specs for case when using an existing card stored by Stripe for payment 2017-09-23 14:58:32 +10:00
Rob Harrington
25907f97a8 Cleaning up Stripe Connect request spec 2017-09-23 14:58:32 +10:00
Rob Harrington
d1779b9457 Keep timestamps as :null => false in schema 2017-09-23 14:58:32 +10:00
stveep
ddac179f9b Add translations 2017-09-23 14:58:31 +10:00
stveep
25f48d944c Add delete links, tidy up UI a bit (WIP), page refresh after adding still doesn't work 2017-09-23 14:58:31 +10:00
stveep
c9c4680ef6 Backend code to create Stripe customers and store their IDs in CreditCards. Page refresh not working 2017-09-23 14:58:31 +10:00
stveep
1449169b16 Basic UI for adding credit card details and getting a Stripe token without making a payment 2017-09-23 14:58:31 +10:00
stveep
c6e50a3f7f Stub Stripe requests in feature spec 2017-09-23 14:58:31 +10:00
stveep
56295e5ffb Fix request and feature specs 2017-09-23 14:58:31 +10:00
Rob Harrington
33a3db8698 Making :source attr_accessible for Spree::Payment 2017-09-23 14:58:31 +10:00
stveep
c4f9a5a234 Add code to CheckoutController to construct card attributes when using an existing card (via a818fbbecd/core/app/models/spree/order/checkout.rb:212) 2017-09-23 14:58:31 +10:00
stveep
627899bbd4 spec for source attributes to pass for saved card 2017-09-23 14:58:31 +10:00
stveep
12f4f2d17a Add some logic to check whether a saved card has been selected before making a request from Stripe 2017-09-23 14:58:31 +10:00
stveep
300dc3084c Add default card, disable inputs when a card is selected 2017-09-23 14:58:31 +10:00
stveep
50c3d1367d Tidy up comment 2017-09-23 14:58:31 +10:00
stveep
a1cad82564 Only show credit cards if previously saved, split credit card db migrations and tidy up serializer 2017-09-23 14:58:31 +10:00
stveep
298fd057f5 Check for current user before injecting credit cards 2017-09-23 14:58:31 +10:00
stveep
33b570b117 Inject cards for current user into checkout and add selector dropdown to gateway partial. 2017-09-23 14:58:31 +10:00
stveep
3b05b76b80 Bring in ability to store CreditCards against Users from Spree 2.3 (spree commit d470b31798f3). 2017-09-23 14:58:31 +10:00
Rob Harrington
c97a140471 WIP: Storing Stripe card details for later use
NOTE: No interface for actually selecting a stored card to use yet
2017-09-23 14:58:31 +10:00
Rob Harrington
7c831c9844 Adding StripeJS to checkout page
Allow tokens to be request and passed through as payment source_attributes
2017-09-23 14:57:02 +10:00
Rob Harrington
5c16fefe41 Creating basic angular StripeJS wrapper service for requesting tokens 2017-09-23 14:57:02 +10:00
Rob Harrington
5ad88f992c Adding live stripe account status display to payment method create/edit interface 2017-09-23 14:57:02 +10:00
Rob Harrington
f87f4310f0 Adding #status controller action for stripe accounts to fetch current info direct from Stripe 2017-09-23 14:57:02 +10:00
Rob Harrington
987ad0df6c Very basic Stripe Connect payment method interface 2017-09-23 14:57:02 +10:00
Rob Harrington
d500c20d3f Adding new StripeConnect payment gateway 2017-09-23 14:57:02 +10:00
Rob Harrington
99a7665edc Requesting read_write permission when authorizing Stripe standalone account 2017-09-23 14:57:02 +10:00
Rob Harrington
37f60bf7a1 Setting Stripe.api_key in an initializer rather than helper 2017-09-23 14:57:02 +10:00
Rob Harrington
b5a6bcdf9d Opening up restriction on activemerchant version by updating Spree ref
Allows use of v > 1.57 which includes support for Stripe Connect
2017-09-23 14:57:02 +10:00
stveep
858852123d Add configuration example 2017-09-23 14:57:02 +10:00
stveep
ae72ebef5e Fix disconnect button formatting 2017-09-23 14:57:02 +10:00
stveep
1450bfd726 Don't retrieve event from Stripe for a deauthorisation 2017-09-23 14:57:02 +10:00
stveep
22e4a50807 Change Stripe webhook handling to post request 2017-09-23 14:57:02 +10:00
stveep
a039286240 Webhook processing changes: fix expected request data formatting 2017-09-23 14:57:02 +10:00
stveep
9ac638f8ba Fix some leftover refactoring from an earlier modification to enterprises controller (now not needed as moved to admin/enterprises) 2017-09-23 14:57:02 +10:00
stveep
da335703b4 Fix specs for travis 2017-09-23 14:57:02 +10:00
stveep
d374ab569d Undo dodgy redirect changes and set spec to pending 2017-09-23 14:57:02 +10:00
stveep
47df2dc20b Tweaking redirects and links 2017-09-23 14:57:02 +10:00
stveep
5c43c75b00 Specify SHA-256 algorithm for JWT in spec fixture 2017-09-23 14:57:02 +10:00
stveep
f83c7a88df Specify SHA-256 algorithm for JWT 2017-09-23 14:57:02 +10:00
stveep
5ae473e07f Add specs, fix redirect after requring relogin 2017-09-23 14:57:02 +10:00
stveep
e69b27a3c4 Tidy up (temp) UI a bit 2017-09-23 14:57:02 +10:00
stveep
e52e04ba29 Adding Stripe Connect information so we don't forget it later 2017-09-23 14:57:02 +10:00
stveep
1dcffa790d Add JWT encoding to state param 2017-09-23 14:57:02 +10:00
stveep
f22278db51 Don't disconnect if the same Stripe account is connected to multiple Enterprises 2017-09-23 14:57:02 +10:00
stveep
0280e04008 Move OAuth2 patching to an initializer 2017-09-23 14:57:02 +10:00
Steve Pettitt
41607c5846 De-associate accounts in response to webhook (not tested with a real deauth request yet) 2017-09-23 14:57:02 +10:00
Steve Pettitt
1c69f2c670 Stripe Helper specs 2017-09-23 14:57:02 +10:00
Steve Pettitt
05a69ff0c6 Worklow to disconnect Stripe from OFN admin interface 2017-09-23 14:57:02 +10:00
Steve Pettitt
758f57a889 Remove CSRF check - doesn't work properly as implemented, but connect request should probably be changed to POST 2017-09-23 14:57:02 +10:00
Steve Pettitt
eed11faa62 Monkey patching OAuth2 gem to include Stripe disconnection method 2017-09-23 14:57:02 +10:00
Steve Pettitt
7fd8c5956d Check CSRF, allow a Stripe account to be connected to more than one enterprise (but not vice versa) 2017-09-23 14:57:02 +10:00
Steve Pettitt
8ed983cf03 Correct spelling :) 2017-09-23 14:57:02 +10:00
Steve Pettitt
b6292e2723 Add some logic to check for a connected Stripe Account in form 2017-09-23 14:57:02 +10:00
Steve Pettitt
8bdf57d0d9 Add Stripe Connect button (CSS) in admin/enterprises/:id/edit#payment_methods 2017-09-23 14:57:02 +10:00
Steve Pettitt
03f590ccc4 Callback creates a new StripeAccount with id and publishable key. 2017-09-23 14:57:02 +10:00
Steve Pettitt
06279848c6 Stripe auth and callback working. Still need to process callback. 2017-09-23 14:57:02 +10:00
Steve Pettitt
3623325cab Add missing files 2017-09-23 14:57:01 +10:00
Steve Pettitt
df18329233 Starting Stripe integration 2017-09-23 14:57:01 +10:00
Steve Pettitt
1db0bbef09 Create table for stripe accounts 2017-09-23 14:57:01 +10:00
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
Saimon Moore
09aed63cd4 Add todos to remove redundant i18n keys 2017-09-08 13:57:50 +02:00
Saimon Moore
757f886af5 Use proper namespaced translations
... in enterprise registration wizard Type step
2017-09-08 13:35:19 +02:00
Saimon Moore
f73f0d4bf9 Use proper namespaced translations
... in enterprise registration wizard Details step
2017-09-08 12:50:54 +02:00
Saimon Moore
d4f7efd08a Use proper namespaced translations
... in enterprise registration wizard Contact step
2017-09-08 12:49:08 +02:00
Saimon Moore
a1aac7643a Translate Entp registration modal tab titles
- Add proper namespaced translations for Details and Contact tabs
2017-09-08 12:47:53 +02: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
Pau Perez
d3d4628e29 Add doc 2017-09-08 09:51:06 +02:00
Pau Perez
942ab55ddc Disable create profile from signup when submitting
This prevents people re-submitting the form multiple times. Although the
backend validates it, we show an ugly alert message that is hard for
users to understand.
2017-09-07 16:02:06 +02: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
Pau Perez
1b151ee015 Add missing translations in registration wizard 2017-09-01 14:57:16 +02: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
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
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
517 changed files with 12614 additions and 3356 deletions

View File

@@ -1,14 +1,36 @@
engines:
version: "2"
plugins:
rubocop:
enabled: true
channel: rubocop-0-48
channel: "rubocop-0-48"
scss-lint:
enabled: false
ratings:
paths:
- app/**
- lib/**
- "**.rb"
exclude_paths:
- spec/**/*
- vendor/**/*
duplication:
enabled: true
exclude_patterns:
- "db/**"
- "config/initializers/active_record_postgresql_referential_integrity_patch.rb"
checks:
argument-count:
enabled: false
complex-logic:
enabled: true
file-lines:
enabled: false
method-complexity:
enabled: false
method-count:
enabled: false
method-lines:
enabled: false
nested-control-flow:
enabled: true
return-statements:
enabled: true
similar-code:
enabled: true
identical-code:
enabled: true
exclude_patterns:
- "spec/**/*"
- "vendor/**/*"

42
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,42 @@
<!--- If what you want to file is not a bug, please use the [Feature
template](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-template)
instead -->
<!--- Provide a general summary of the issue in the Title above -->
## Description
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
## Expected Behavior
<!--- Tell us what should happen -->
## Actual Behavior
<!--- Tell us what happens instead -->
## Steps to Reproduce
<!--- Provide an unambiguous set of steps to reproduce this bug -->
<!--- Include code to reproduce, if relevant -->
1.
2.
3.
4.
## Animated Gif/Screenshot
<!-- Provide a screenshot or brief animated gif reproducing the bug. Linux users can use
[Peek](https://github.com/phw/peek#ubuntu) while Mac users can use [Recordit](http://recordit.co/) -->
## Context
<!--- How has this bug affected you? What were you trying to accomplish? -->
## Severity
<!--- Use the [Bug severity
guideline](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity) to assign one to this bug -->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Browser name and version:
* Operating System and version (desktop or mobile):
## Possible Fix
<!--- Not obligatory, but suggest a fix or reason for the bug -->

View File

@@ -1,5 +1,7 @@
#### What? Why?
Closes #[the issue number this PR is related to]
[Explain why is this change needed and the solution you propose. Provide
context for others to understand it]

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
.bundle
.rbenv-version
.byebug_history
.swp
*.swo
*.swp

1
.node-version Normal file
View File

@@ -0,0 +1 @@
5.12.0

View File

@@ -27,6 +27,10 @@ Style/Documentation:
Style/StringLiterals:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
@@ -53,6 +57,10 @@ Lint/UselessAssignment:
Rails/DynamicFindBy:
Enabled: false
# Same as above, #find_by is not available until Rails 4
Rails/FindBy:
Enabled: false
# This should be the programmer's discretion, perhaps we should review all of
# the uses of it an make specific exceptions though.
Rails/SkipsModelValidations:
@@ -143,6 +151,10 @@ Style/WordArray:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewordarray
Style/SymbolArray:
Enabled: false
StyleGuide: https://rubocop.readthedocs.io/en/latest/cops_style/#stylesymbolarray
Lint/AmbiguousRegexpLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral

File diff suppressed because it is too large Load Diff

View File

@@ -22,9 +22,6 @@ 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
@@ -43,7 +40,6 @@ before_script:
script:
- 'if [ "$KARMA" = "true" ]; then bundle exec rake karma:run; else echo "Skipping karma run"; fi'
#- "KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec"
- "bundle exec rake 'knapsack:rspec[--tag ~performance]'"
after_success:

View File

@@ -1,36 +1,68 @@
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. Any contribution is valuable, but there are two issue streams that we especially love people to work on:
We love pull requests from everyone. Here are some instructions for
contributing code to Open Food Network. See the [developer wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki) for more information.
1) Our delivery backlog, is managed via a ZenHub board (ZenHub extensions are available for most major browsers). We use a Kanban-style approach, whereby devs pick issues from the top of the backlog which has been organised according to current priorities. If you have some time and are interested in working on some issues from the backlog, please make yourself known on the [#dev](https://openfoodnetwork.slack.com/messages/C2GQ45KNU) channel on Slack and we can direct you to the most appropriate issue to pick up.
Fork, then clone the repo:
2) Our list of bugs and other self-contained issues that we consider to be a good starting point for new contributors, or devs who arent able to commit to seeing a whole feature through. These issues are marked with the `# good first issue` label.
git clone git@github.com:your-username/openfoodnetwork.git
## Set up
Follow the instructions in README.markdown to set up your machine.
Set up your local development environment by following the appropriate guide from the `Development environment setup` section in the [developer wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
Make sure the tests pass:
Add an `upstream` remote that points to the main repo:
rspec spec
cd ~/location-of-your-local-ofn-repo
git remote add upstream https://github.com/openfoodfoundation/openfoodnetwork
Make your change. Add tests for your change. Make the tests pass:
If you haven't already done so, fork this repo using the `Fork` button in the top-right corner of this screen. Then ensure that your fork is listed as the `origin` remote on your local machine.
rspec spec
git remote set-url origin https://github.com/your-username/openfoodnetwork
Push to your fork and [submit a pull request][pr].
Fetch the latest version of `master` from `upstream` (ie. the main repo):
[pr]: https://github.com/openfoodfoundation/openfoodnetwork/compare/
git fetch upstream master
At this point you're waiting on us. We may suggest some changes or
improvements or alternatives.
Create a new branch on your local machine for (based on `upstream/master`):
To increase the chance that your pull request is swiftly accepted:
git checkout -b branch-name-here --no-track upstream/master
If you want to run the whole test suite, we recommend using a free CI service to run your tests in parallel. Running the whole suite locally in series is likely to take > 40 minutes. [TravisCI][travis] and [SemaphoreCI][semaphore] both work great in our experience. Either way, make sure the tests pass on your new branch:
bundle exec rspec spec
## Making a change
Make your changes to the codebase. We recommend using TDD. Add a test, make changes and get the test suite back to green.
bundle exec rspec spec
Once the tests are passing you can commit your changes. See [Making a great commit][great-commit] for more tips.
git add .
git commit -m "Add a concise commit message describing your change here"
Push your changes to a branch on your fork:
git push origin branch-name-here
## Submitting a Pull Request
Use the GitHub UI to submit a [new pull request][pr] against upstream/master. To increase the chances that your pull request is swiftly accepted please have a look at our guide to [[making a great pull request]].
TL;DR:
* Write tests
* Make sure the whole test suite is passing
* Keep your PR small, with a single focus
* Maintain a clean commit history
* Use a style consistent with the rest of the codebase
* Before submitting, [rebase your work][rebase] on the current master branch
From here, your pull request will progress through the [Review, Test, Merge & Deploy process][process].
[pr]: https://github.com/openfoodfoundation/openfoodnetwork/compare/
[great-pr]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Making-a-great-pull-request
[great-commit]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Making-a-great-commit
[process]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/The-process-of-review%2C-test%2C-merge-and-deploy
[rebase]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing/workflow-walkthrough
[travis]: https://travis-ci.org/
[semaphore]: https://semaphoreci.com/

44
Gemfile
View File

@@ -1,5 +1,6 @@
source 'https://rubygems.org'
ruby "2.1.5"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
gem 'rails', '3.2.21'
gem 'rails-i18n', '~> 3.0.0'
@@ -10,22 +11,27 @@ gem 'i18n-js', '~> 3.0.0'
gem 'nokogiri', '>= 1.6.7.1'
gem 'pg'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'spree-upgrade-step1c'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '86bf87f1b1e1b299edc8cd10a2486e44ba0a3987'
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 => "spree-contrib/better_spree_paypal_express", :branch => "1-3-stable"
gem 'spree_paypal_express', github: "openfoodfoundation/better_spree_paypal_express", branch: "spree-upgrade-intermediate"
#gem 'spree_paypal_express', github: "spree-contrib/better_spree_paypal_express", branch: "1-3-stable"
gem 'stripe', '~> 3.3.1'
gem 'activemerchant', '~> 1.71.0'
gem 'oauth2', '~> 1.2.0' # Used for Stripe Connect
gem 'jwt', '~> 1.5'
gem 'delayed_job_active_record'
gem 'daemons'
# Fix bug in simple_form preventing collection_check_boxes usage within form_for block
# When merged, revert to upstream gem
gem 'simple_form', :github => 'RohanM/simple_form'
gem 'simple_form', github: 'RohanM/simple_form'
gem 'unicorn'
gem 'angularjs-rails', '1.5.5'
@@ -43,14 +49,14 @@ gem 'representative_view'
gem 'rabl'
gem "active_model_serializers"
gem 'oj'
gem 'deface', :github => 'spree/deface', :ref => '1110a13'
gem 'deface', github: 'spree/deface', ref: '1110a13'
gem 'paperclip'
gem 'dalli'
gem 'geocoder'
gem 'gmaps4rails'
gem 'spinjs-rails'
gem 'rack-ssl', :require => 'rack/ssl'
gem 'custom_error_message', :github => 'jeremydurham/custom-err-msg'
gem 'rack-ssl', require: 'rack/ssl'
gem 'custom_error_message', github: 'jeremydurham/custom-err-msg'
gem 'angularjs-file-upload-rails', '~> 1.1.6'
gem 'roadie-rails', '~> 1.0.3'
gem 'figaro'
@@ -96,19 +102,19 @@ gem 'ofn-qz', github: 'openfoodfoundation/ofn-qz'
group :test, :development do
# Pretty printed test output
gem 'turn', '~> 0.8.3', :require => false
gem 'fuubar'
gem 'rspec-rails'
gem 'turn', '~> 0.8.3', require: false
gem 'fuubar', '~> 2.2.0'
gem 'rspec-rails', ">= 3.5.2"
gem 'shoulda-matchers'
gem 'factory_girl_rails', :require => false
gem 'capybara'
gem 'database_cleaner', '0.7.1', :require => false
gem 'factory_girl_rails', require: false
gem 'capybara', '>= 2.15.4'
gem 'database_cleaner', '0.7.1', require: false
gem 'awesome_print'
gem 'letter_opener'
gem 'timecop'
gem 'poltergeist'
gem 'poltergeist', '>= 1.16.0'
gem 'rspec-retry'
gem 'json_spec'
gem 'json_spec', '~> 1.1.4'
gem 'unicorn-rails'
gem 'atomic'
gem 'knapsack'
@@ -121,13 +127,15 @@ group :test do
end
group :development do
gem 'pry-byebug'
gem 'byebug', '~> 9.0.0' # 9.1 requires ruby 2.2
gem 'pry-byebug', '>= 3.4.3'
gem 'debugger-linecache'
gem 'guard'
gem 'listen', '3.0.8' # 3.1.0 requires ruby 2.2
gem 'guard-livereload'
gem 'rack-livereload'
gem 'guard-rails'
gem 'guard-rspec'
gem 'guard-rspec', '~> 4.7.3'
gem 'parallel_tests'
gem 'rubocop', '>= 0.49.1'

View File

@@ -1,5 +1,5 @@
GIT
remote: git://github.com/RohanM/simple_form.git
remote: https://github.com/RohanM/simple_form.git
revision: 45f08a213b40f3d4bda5f5398db841137587160a
specs:
simple_form (2.0.2)
@@ -7,74 +7,103 @@ GIT
activemodel (~> 3.0)
GIT
remote: git://github.com/jeremydurham/custom-err-msg.git
remote: https://github.com/jeremydurham/custom-err-msg.git
revision: 3a8ec9dddc7a5b0aab7c69a6060596de300c68f4
specs:
custom_error_message (1.1.1)
GIT
remote: git://github.com/openfoodfoundation/better_spree_paypal_express.git
revision: 840d973cd5bd3250b17674a624dad494aeb09eb3
branch: hide-password
remote: https://github.com/openfoodfoundation/better_spree_paypal_express.git
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
remote: https://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: a4c439570b77afa50f9e36299811f293232bd281
branch: spree-upgrade-step1c
remote: https://github.com/openfoodfoundation/spree.git
revision: 86bf87f1b1e1b299edc8cd10a2486e44ba0a3987
ref: 86bf87f1b1e1b299edc8cd10a2486e44ba0a3987
branch: step-6a
specs:
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_promo (= 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_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.99)
activemerchant (~> 1.50.0)
acts_as_list (= 0.1.4)
activemerchant (~> 1.50)
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.11)
jquery-rails (~> 2.0)
highline (= 1.6.15)
httparty (= 0.9.0)
json (>= 1.5.5)
kaminari (= 0.13.0)
money (= 5.0.0)
money (= 5.1.0)
paperclip (~> 3.0)
rabl (= 0.7.2)
rails (~> 3.2.13)
ransack (= 0.7.2)
select2-rails (~> 3.2)
state_machine (= 1.2.0)
stringex (~> 1.3.2)
truncate_html (= 0.9.2)
spree_dash (1.3.99)
httparty (~> 0.8.1)
spree_core (= 1.3.99)
spree_promo (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/spree/deface.git
remote: https://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: https://github.com/spree/deface.git
revision: 1110a1336252109bce7f98f9182042e0bc2930ae
ref: 1110a13
specs:
@@ -84,18 +113,7 @@ GIT
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
remote: https://github.com/spree/spree_i18n.git
revision: 752eb67204e9c5a4e22b62591a8fd55fe2285e43
branch: 1-3-stable
specs:
@@ -105,7 +123,7 @@ GIT
spree_core (>= 1.1)
GIT
remote: git://github.com/willrjmarshall/foundation_rails_helper.git
remote: https://github.com/willrjmarshall/foundation_rails_helper.git
revision: 4d5d53fdc4b1fb71e66524d298c5c635de82cfbb
branch: rails3
specs:
@@ -133,8 +151,8 @@ GEM
sprockets (~> 2.2.1)
active_model_serializers (0.8.3)
activemodel (>= 3.0)
activemerchant (1.50.0)
activesupport (>= 3.2.14, < 5.0.0)
activemerchant (1.71.0)
activesupport (>= 3.2.14, < 6.x)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
@@ -154,8 +172,9 @@ 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.5.2)
public_suffix (>= 2.0.2, < 4.0)
andand (1.3.3)
angular-rails-templates (0.2.0)
railties (>= 3.1)
@@ -174,33 +193,28 @@ 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 (4.1.0)
builder (3.0.4)
byebug (2.7.0)
columnize (~> 0.3)
debugger-linecache (~> 1.2)
byebug (9.0.6)
cancan (1.6.8)
capybara (2.7.1)
capybara (2.15.4)
addressable
mime-types (>= 1.16)
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.15.2)
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.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.0.9)
coderay (1.1.2)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -208,8 +222,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.10.0)
colorize (0.7.7)
columnize (0.9.0)
colorize (0.8.1)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@@ -226,8 +239,8 @@ 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.5)
@@ -252,11 +265,11 @@ GEM
warden (~> 1.2.1)
devise-encryptable (0.1.2)
devise (>= 2.1.0)
diff-lcs (1.2.4)
diff-lcs (1.3)
diffy (3.1.0)
em-websocket (0.5.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.5.3)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.2.3)
excon (0.45.4)
@@ -266,8 +279,10 @@ GEM
factory_girl_rails (3.3.0)
factory_girl (~> 3.3.0)
railties (>= 3.0.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
ffaker (1.15.0)
ffi (1.9.3)
ffi (1.9.18)
figaro (0.7.0)
bundler (~> 1.0)
rails (>= 3, < 5)
@@ -388,32 +403,39 @@ GEM
foundation-rails (5.5.0.0)
railties (>= 3.1.0)
sass (>= 3.2.0, < 3.4)
fuubar (1.3.3)
rspec (>= 2.14.0, < 3.1.0)
fuubar (2.2.0)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
geocoder (1.1.8)
gmaps4rails (1.5.6)
guard (2.2.4)
guard (2.14.1)
formatador (>= 0.2.4)
listen (~> 2.1)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-livereload (2.0.1)
guard-compat (1.2.1)
guard-livereload (2.5.2)
em-websocket (~> 0.5)
guard (~> 2.0)
guard (~> 2.8)
guard-compat (~> 1.0)
multi_json (~> 1.8)
guard-rails (0.4.7)
guard (>= 0.2.2)
guard-rspec (4.0.4)
guard (>= 2.1.1)
rspec (~> 2.14)
guard-rails (0.7.2)
guard (~> 2.11)
guard-compat (~> 1.0)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
haml (4.0.4)
tilt
highline (1.6.11)
highline (1.6.15)
hike (1.2.3)
http_parser.rb (0.5.3)
httparty (0.8.3)
http_parser.rb (0.6.0)
httparty (0.9.0)
multi_json (~> 1.0)
multi_xml
i18n (0.6.11)
@@ -426,13 +448,14 @@ GEM
ipaddress (0.8.0)
journey (1.0.4)
jquery-migrate-rails (1.2.1)
jquery-rails (2.3.0)
jquery-rails (2.2.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
json_spec (1.1.1)
json (1.8.6)
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (~> 2.0)
rspec (>= 2.0, < 4.0)
jwt (1.5.4)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
@@ -446,27 +469,37 @@ GEM
letter_opener (1.0.0)
launchy (>= 2.0.4)
libv8 (3.16.14.11)
listen (2.2.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
lumberjack (1.0.12)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
method_source (0.9.0)
mime-types (1.25.1)
mini_portile2 (2.0.0)
mini_mime (0.1.4)
mini_portile2 (2.1.0)
momentjs-rails (2.5.1)
railties (>= 3.1)
money (5.0.0)
i18n (~> 0.4)
json
money (5.1.0)
i18n (~> 0.6.0)
multi_json (1.12.1)
multi_xml (0.5.5)
multi_xml (0.6.0)
multipart-post (2.0.0)
nenv (0.3.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)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (2.1.2)
orm_adapter (0.5.0)
paper_trail (3.0.8)
@@ -488,29 +521,28 @@ GEM
paypal-sdk-merchant (1.106.1)
paypal-sdk-core (~> 0.2.3)
pg (0.13.2)
poltergeist (1.9.0)
poltergeist (1.16.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
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)
slop (~> 3.4)
pry-byebug (1.3.2)
byebug (~> 2.7)
pry (~> 0.9.12)
pry (0.11.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.4.3)
byebug (>= 9.0, < 9.1)
pry (~> 0.10)
public_suffix (3.0.0)
rabl (0.7.2)
activesupport (>= 2.3.14)
multi_json (~> 1.0)
rack (1.4.7)
rack-cache (1.6.1)
rack-cache (1.7.0)
rack (>= 0.4)
rack-livereload (0.3.15)
rack-livereload (0.3.16)
rack
rack-ssl (1.3.4)
rack
@@ -537,14 +569,14 @@ GEM
rainbow (2.2.2)
rake
raindrops (0.13.0)
rake (11.3.0)
rake (10.5.0)
ransack (0.7.2)
actionpack (~> 3.0)
activerecord (~> 3.0)
polyamorous (~> 0.5.0)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
ffi (>= 0.5.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdoc (3.12.2)
json (~> 1.4)
redcarpet (3.2.3)
@@ -566,23 +598,29 @@ GEM
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)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.4)
rspec-expectations (2.14.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.2)
rspec-rails (2.14.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-retry (0.4.2)
rspec-core
rspec-support (3.7.0)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
@@ -592,7 +630,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rubyzip (1.2.0)
safe_yaml (0.9.5)
safe_yaml (1.0.4)
sass (3.3.14)
sass-rails (3.2.6)
railties (~> 3.2.0)
@@ -600,9 +638,9 @@ GEM
tilt (~> 1.3)
select2-rails (3.5.10)
thor (~> 0.14)
shellany (0.0.1)
shoulda-matchers (1.1.0)
activesupport (>= 3.0.0)
slop (3.4.5)
spinjs-rails (1.3)
rails (>= 3.1)
sprockets (2.2.3)
@@ -612,23 +650,24 @@ GEM
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
stringex (1.3.3)
stripe (3.3.1)
faraday (~> 0.9)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thor (0.20.0)
tilt (1.4.1)
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.49)
tzinfo (0.3.53)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
@@ -645,12 +684,12 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
warden (1.2.3)
warden (1.2.7)
rack (>= 1.0)
webmock (1.13.0)
webmock (1.8.11)
addressable (>= 2.2.7)
crack (>= 0.3.2)
websocket-driver (0.6.3)
crack (>= 0.1.7)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.9.2)
@@ -658,8 +697,8 @@ GEM
chronic (>= 0.6.3)
wicked_pdf (1.1.0)
wkhtmltopdf-binary (0.12.3.1)
xml-simple (1.1.4)
xpath (2.0.0)
xml-simple (1.1.5)
xpath (2.1.0)
nokogiri (~> 1.3)
PLATFORMS
@@ -667,6 +706,7 @@ PLATFORMS
DEPENDENCIES
active_model_serializers
activemerchant (~> 1.71.0)
acts-as-taggable-on (~> 3.4)
andand
angular-rails-templates (~> 0.2.0)
@@ -677,7 +717,8 @@ DEPENDENCIES
aws-sdk
blockenspiel
bugsnag
capybara
byebug (~> 9.0.0)
capybara (>= 2.15.4)
coffee-rails (~> 3.2.1)
compass-rails
css_splitter
@@ -697,33 +738,36 @@ DEPENDENCIES
foundation-icons-sass-rails
foundation-rails
foundation_rails_helper!
fuubar
fuubar (~> 2.2.0)
geocoder
gmaps4rails
guard
guard-livereload
guard-rails
guard-rspec
guard-rspec (~> 4.7.3)
haml
i18n (~> 0.6.11)
i18n-js (~> 3.0.0)
immigrant
jquery-migrate-rails
jquery-rails
json_spec
json_spec (~> 1.1.4)
jwt (~> 1.5)
knapsack
letter_opener
listen (= 3.0.8)
momentjs-rails
newrelic_rpm
nokogiri (>= 1.6.7.1)
oauth2 (~> 1.2.0)
ofn-qz!
oj
paper_trail (~> 3.0.8)
paperclip
parallel_tests
pg
poltergeist
pry-byebug
poltergeist (>= 1.16.0)
pry-byebug (>= 3.4.3)
rabl
rack-livereload
rack-ssl
@@ -733,7 +777,7 @@ DEPENDENCIES
representative_view
roadie-rails (~> 1.0.3)
roo (~> 2.7.0)
rspec-rails
rspec-rails (>= 3.5.2)
rspec-retry
rubocop (>= 0.49.1)
sass (~> 3.3)
@@ -745,6 +789,7 @@ DEPENDENCIES
spree_auth_devise!
spree_i18n!
spree_paypal_express!
stripe (~> 3.3.1)
therubyracer
timecop
truncate_html
@@ -762,4 +807,4 @@ RUBY VERSION
ruby 2.1.5p273
BUNDLED WITH
1.15.2
1.16.0

View File

@@ -45,45 +45,23 @@ You can download the source with the command:
### Get it running
For those new to Rails, the following tutorial will help get you up to speed with configuring a Rails environment: http://guides.rubyonrails.org/getting_started.html .
For those new to Rails, the following tutorial will help get you up to speed with configuring a [Rails environment](http://guides.rubyonrails.org/getting_started.html).
First, check your dependencies: Ensure that you have Ruby 2.1.5 installed:
When ready, run `script/setup`. If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
ruby --version
If you run into any other issues getting your local environment up and running please consult [the wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
Install the project's gem dependencies:
cd openfoodnetwork
./script/upgrade_bundler.sh
bundle install
Configure the site:
cp config/application.yml.example config/application.yml
edit config/application.yml
Create a PostgreSQL user:
* Login as your system postrgresql priviledged user: `sudo -i -u postgres` (this may vary on your OS). Now your prompt looks like: `[postgres@your_host ~]$`
* Create the `ofn` database superuser and give it the password `f00d`:
If still you get stuck do not hesitate to open an issue reporting the full output of the script.
Now, your dreams of spinning up a development server can be realised:
```
createuser -s -P ofn
bundle exec rails server
```
To login as Spree default user, use:
```
email: spree@example.com
password: spree123
```
Create the development and test databases, using the settings specified in `config/database.yml`, and populate them with a schema and seed data:
rake db:setup
Load some default data for your environment:
rake openfoodnetwork:dev:load_sample_data
At long last, your dreams of spinning up a development server can be realised:
rails server
### Testing
Tests, both unit and integration, are based on RSpec. To run the test suite, first prepare the test database:
@@ -123,7 +101,7 @@ Do not forget to run `rake tmp:cache:clear` after locales are updated to reload
* Maikel Linke (https://github.com/mkllnk)
* Lynne Davis (https://github.com/lin-d-hop)
* Paul Mackay (https://github.com/pmackay)
* Steve Petitt (https://github.com/stveep)
* Steve Pettitt (https://github.com/stveep)
## Licence

View File

@@ -14,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
@@ -50,6 +49,14 @@
//= require textAngular.min.js
//= require i18n/translations
//= require darkswarm/i18n.translate.js
//
//= require moment
//= require moment/en-gb.js
//= require moment/es.js
//= require moment/fr.js
//= require moment/it.js
//= require moment/nb.js
//= require moment/pt-br.js
//= require moment/sv.js
//= require_tree .

View File

@@ -32,7 +32,6 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
$scope.filteredProducts = []
$scope.currentFilters = []
$scope.limit = 15
$scope.productsWithUnsavedVariants = []
$scope.query = ""
$scope.DisplayProperties = DisplayProperties
@@ -114,7 +113,6 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
display_name: null
on_hand: null
price: null
$scope.productsWithUnsavedVariants.push product
DisplayProperties.setShowVariants product.id, true
@@ -196,7 +194,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
filters: $scope.currentFilters
).success((data) ->
DirtyProducts.clear()
BulkProducts.updateVariantLists(data.products, $scope.productsWithUnsavedVariants)
BulkProducts.updateVariantLists(data.products || [])
$timeout -> $scope.displaySuccess()
).error (data, status) ->
if status == 400 && data.errors? && data.errors.length > 0

View File

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

View File

@@ -0,0 +1 @@
angular.module("admin.enterpriseRoles", [])

View File

@@ -4,10 +4,8 @@ angular.module("admin.enterprises")
$scope.PaymentMethods = EnterprisePaymentMethods.paymentMethods
$scope.ShippingMethods = EnterpriseShippingMethods.shippingMethods
$scope.navClear = NavigationCheck.clear
$scope.pristineEmail = $scope.Enterprise.email
$scope.menu = SideMenu
$scope.newManager = { id: '', email: (t('add_manager')) }
$scope.StatusMessage = StatusMessage
$scope.$watch 'enterprise_form.$dirty', (newValue) ->
@@ -36,6 +34,8 @@ angular.module("admin.enterprises")
$scope.removeManager = (manager) ->
if manager.id?
if manager.id == $scope.Enterprise.owner.id or manager.id == parseInt($scope.receivesNotifications)
return
for i, user of $scope.Enterprise.users when user.id == manager.id
$scope.Enterprise.users.splice i, 1
if $scope.enterprise_form?
@@ -46,6 +46,7 @@ angular.module("admin.enterprises")
manager =
id: manager.id
email: manager.email
confirmed: manager.confirmed
if (user for user in $scope.Enterprise.users when user.id == manager.id).length == 0
$scope.Enterprise.users.push manager
else

View File

@@ -22,7 +22,7 @@ angular.module("admin.enterprises")
{ name: 'users', label: t('users'), icon_class: "icon-user" }
]
$scope.select(0)
SideMenu.init()
$scope.showItem = (item) ->
if item.show?

View File

@@ -0,0 +1,18 @@
angular.module("admin.paymentMethods").controller "StripeController", ($scope, $http, shops) ->
$scope.shops = shops
$scope.stripe_account = {}
$scope.$watch "paymentMethod.preferred_enterprise_id", (newID, oldID) ->
return unless newID?
$scope.stripe_account = {}
$http.get("/admin/stripe_accounts/status.json?enterprise_id=#{newID}").success (data) ->
angular.extend($scope.stripe_account, data)
.error (response) ->
$scope.stripe_account.status = "request_failed"
$scope.current_enterprise_stripe_path = ->
return unless $scope.paymentMethod.preferred_enterprise_id?
permalink = shops.filter((shop) ->
shop.id == $scope.paymentMethod.preferred_enterprise_id
)[0].permalink
"/admin/enterprises/#{permalink}/edit#/payment_methods"

View File

@@ -0,0 +1,33 @@
// Override of Spree's logic in the file of the same name
// Changes made as per https://github.com/spree/spree/commit/8a3a80b08abf80fbed2fcee4b429ba1caf68baf1
// which allows the form partial in admin/payments/new to be switched using radio buttons
// We can remove this file when we reach 2.3.0
$(document).ready(function() {
if ($("#new_payment").is("*")) {
$('.payment_methods_radios').click(
function() {
$('.payment-methods').hide();
if (this.checked) {
$('#payment_method_' + this.value).show();
}
}
);
$('.payment_methods_radios').each(
function() {
if (this.checked) {
$('#payment_method_' + this.value).show();
} else {
$('#payment_method_' + this.value).hide();
}
}
);
$(".card_new").radioControlsVisibilityOfElement('.card_form');
$('select.jump_menu').change(function(){
window.location = this.options[this.selectedIndex].value;
});
}
});

View File

@@ -12,11 +12,10 @@ angular.module("admin.products").factory "VariantUnitManager", ->
@variantUnitOptions: ->
options = for unit_type, scale_with_name of @unitNames
unit_type_cap = unit_type[0].toUpperCase() + unit_type[1..-1]
for scale in @unitScales(unit_type)
name = @getUnitName(scale, unit_type)
["#{unit_type_cap} (#{name})", "#{unit_type}_#{scale}"]
options.push [['Items', 'items']]
["#{I18n.t(unit_type)} (#{name})", "#{unit_type}_#{scale}"]
options.push [[I18n.t('items'), 'items']]
[].concat options...
@getScale: (value, unitType) ->

View File

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

View File

@@ -26,7 +26,7 @@ angular.module("admin.resources").factory 'LineItems', ($q, LineItemResource) ->
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)
@@ -54,7 +54,7 @@ angular.module("admin.resources").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 @byID[lineItem.id]
delete @pristineByID[lineItem.id]

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,20 +11,14 @@ 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)
updateVariantLists: (serverProducts, productsWithUnsavedVariants) ->
for product in productsWithUnsavedVariants
server_product = @findProductInList(product.id, serverProducts)
updateVariantLists: (serverProducts) ->
for server_product in serverProducts
product = @findProductInList(server_product.id, @products)
product.variants = server_product.variants
@loadVariantUnitValues product

View File

@@ -1,9 +1,21 @@
angular.module("admin.side_menu")
.factory "SideMenu", ->
.factory "SideMenu", ($location) ->
new class SideMenu
items: []
selected: null
# Checks for path and uses it to set the view
# If no path, loads first view
init: =>
path = $location.path()?.match(/^\/\w+$/)?[0]
index = if path
name = path[1..]
@items.indexOf(@find_by_name(name))
else
0
@select(index)
setItems: (items) =>
@items = items
item.visible = true for item in @items
@@ -13,6 +25,7 @@ angular.module("admin.side_menu")
@selected.selected = false if @selected
@selected = @items[index]
@selected.selected = true
$location.path(@selected.name)
find_by_name: (name) =>
for item in @items when item.name is name

View File

@@ -1,4 +1,4 @@
angular.module("admin.indexUtils").directive "ofnSelect2", ($sanitize, $timeout, $filter) ->
angular.module("admin.utils").directive "ofnSelect2", ($sanitize, $timeout, $filter) ->
require: 'ngModel'
restrict: 'C'
scope:

View File

@@ -23,7 +23,16 @@
#
#= require angular-backstretch.js
#= require angular-flash.min.js
#
#= require moment
#= require moment/en-gb.js
#= require moment/es.js
#= require moment/fr.js
#= require moment/it.js
#= require moment/nb.js
#= require moment/pt-br.js
#= require moment/sv.js
#
#= require modernizr
#
#= require foundation

View File

@@ -10,4 +10,11 @@ Darkswarm.controller "LoginCtrl", ($scope, $http, $window, AuthenticationService
$window.location.href = $window.location.origin + $window.location.pathname # Strips out hash fragments
.error (data) ->
Loading.clear()
$scope.errors = data.message
$scope.errors = data.message || data.error
$scope.user_unconfirmed = (data.error == t('devise.failure.unconfirmed'))
$scope.resend_confirmation = ->
$http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user}).success (data)->
$scope.messages = t('devise.confirmations.send_instructions')
.error (data) ->
$scope.errors = t('devise.confirmations.failed_to_send')

View File

@@ -1,15 +1,15 @@
Darkswarm.controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) ->
$scope.path = "/signup"
$scope.spree_user.password_confirmation = ''
$scope.errors =
email: null
password: null
$scope.submit = ->
$http.post("/user/spree_user", {spree_user: $scope.spree_user}).success (data)->
if Redirections.after_login
$window.location.href = $window.location.origin + Redirections.after_login
else
$window.location.href = $window.location.origin + $window.location.pathname # Strips out hash fragments
$scope.errors = {email: null, password: null}
$scope.messages = t('devise.user_registrations.spree_user.signed_up_but_unconfirmed')
.error (data) ->
$scope.errors = data

View File

@@ -3,23 +3,23 @@ Darkswarm.controller "AccordionCtrl", ($scope, localStorageService, $timeout, $d
value = if localStorageService.get(key) then {} else { details: true, billing: false, shipping: false, payment: false }
localStorageService.bind $scope, "accordion", value, key
$scope.accordionSections = ["details", "billing", "shipping", "payment"]
# Scrolling is confused by our position:fixed top bar - add an offset to scroll
# to the correct location, plus 5px buffer
offset_height = $("nav.top-bar").height() + 5
$scope.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

@@ -22,6 +22,6 @@ Darkswarm.controller "CheckoutCtrl", ($scope, localStorageService, Checkout, Cur
event.preventDefault()
$scope.submitted = true
if form.$valid
$scope.Checkout.submit()
$scope.Checkout.purchase()
else
$scope.$broadcast 'purchaseFormInvalid', form

View File

@@ -1,23 +1,11 @@
Darkswarm.controller "PaymentCtrl", ($scope, $timeout) ->
Darkswarm.controller "PaymentCtrl", ($scope, $timeout, savedCreditCards, Dates) ->
angular.extend(this, new FieldsetMixin($scope))
$scope.savedCreditCards = savedCreditCards
$scope.name = "payment"
$scope.months = Dates.months
$scope.years = Dates.years
$scope.months = [
{key: t("january"), value: "1"},
{key: t("february"), value: "2"},
{key: t("march"), value: "3"},
{key: t("april"), value: "4"},
{key: t("may"), value: "5"},
{key: t("june"), value: "6"},
{key: t("july"), value: "7"},
{key: t("august"), value: "8"},
{key: t("september"), value: "9"},
{key: t("october"), value: "10"},
{key: t("november"), value: "11"},
{key: t("december"), value: "12"},
]
$scope.years = [moment().year()..(moment().year()+15)]
$scope.secrets.card_month = "1"
$scope.secrets.card_year = moment().year()

View File

@@ -0,0 +1,12 @@
Darkswarm.controller "CreditCardsCtrl", ($scope, $timeout, CreditCard, CreditCards, Dates) ->
angular.extend(this, new FieldsetMixin($scope))
$scope.savedCreditCards = CreditCards.saved
$scope.CreditCard = CreditCard
$scope.secrets = CreditCard.secrets
$scope.showForm = CreditCard.show
$scope.storeCard = ->
if $scope.new_card_form.$valid
CreditCard.requestToken()
$scope.allow_name_change = true
$scope.disable_fields = false

View File

@@ -1,9 +0,0 @@
Darkswarm.controller "DistributorNodeCtrl", ($scope, HashNavigation, $anchorScroll) ->
$scope.toggle = ->
HashNavigation.toggle $scope.distributor.hash
$scope.open = ->
HashNavigation.active($scope.distributor.hash)
if $scope.open()
$anchorScroll()

View File

@@ -6,10 +6,9 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location
$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
@@ -36,7 +35,7 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location
# 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, activeProperties, shippingTypes, show_profiles]', ->
$scope.$watch '[activeTaxons, activeProperties, shippingTypes, show_profiles, show_closed]', ->
$timeout ->
Enterprises.calculateDistance $scope.query, $scope.firstNameMatch()
$rootScope.$broadcast 'enterprisesChanged'
@@ -74,9 +73,9 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location
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

@@ -1,2 +1,2 @@
Darkswarm.controller "OrdersCtrl", ($scope, $rootScope, $timeout, Orders, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
Darkswarm.controller "OrdersCtrl", ($scope, Orders) ->
$scope.Orders = Orders

View File

@@ -1,15 +1,23 @@
Darkswarm.controller "RegistrationFormCtrl", ($scope, RegistrationService, EnterpriseRegistrationService) ->
$scope.submitted = false
$scope.isDisabled = false
$scope.valid = (form) ->
$scope.submitted = !form.$valid
form.$valid
$scope.create = (form) ->
EnterpriseRegistrationService.create() if $scope.valid(form)
$scope.disableButton()
EnterpriseRegistrationService.create($scope.enableButton) if $scope.valid(form)
$scope.update = (nextStep, form) ->
EnterpriseRegistrationService.update(nextStep) if $scope.valid(form)
$scope.selectIfValid = (nextStep, form) ->
RegistrationService.select(nextStep) if $scope.valid(form)
$scope.disableButton = ->
$scope.isDisabled = true
$scope.enableButton = ->
$scope.isDisabled = false

View File

@@ -0,0 +1,9 @@
Darkswarm.controller "ShopNodeCtrl", ($scope, HashNavigation, $anchorScroll) ->
$scope.toggle = ->
HashNavigation.toggle $scope.shop.hash
$scope.open = ->
HashNavigation.active($scope.shop.hash)
if $scope.open()
$anchorScroll()

View File

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

View File

@@ -0,0 +1,12 @@
Darkswarm.directive "tab", ->
restrict: "C"
require: "^^tabsetCtrl"
scope:
name: "@"
link: (scope, element, attrs, ctrl) ->
element.on "click", ->
scope.$apply ->
ctrl.toggle(scope.name)
ctrl.registerSelectionListener (prefix, selection) ->
element.toggleClass('selected', selection == scope.name)

View File

@@ -0,0 +1,15 @@
Darkswarm.directive "tabView", ->
restrict: "C"
require: "^^tabsetCtrl"
template: "<div ng-include='template'></div>"
scope:
templates: "="
link: (scope, element, attrs, ctrl) ->
scope.template = null
ctrl.registerSelectionListener (prefix, selection) ->
if selection?
selection = "#{prefix}/#{selection}" if prefix?
scope.template = "#{selection}.html"
else
scope.template = null

View File

@@ -0,0 +1,28 @@
Darkswarm.directive "tabsetCtrl", (Tabsets, $location) ->
restrict: "C"
scope:
id: "@"
selected: "@"
navigate: "="
prefix: "@?"
controller: ($scope, $element) ->
if $scope.navigate
path = $location.path()?.match(/^\/\w+$/)?[0]
$scope.selected = path[1..] if path
this.toggle = (name) ->
Tabsets.toggle($scope.id, name)
this.select = (selection) ->
$scope.$broadcast("selection:changed", selection)
$element.toggleClass("expanded", selection?)
$location.path(selection) if $scope.navigate
this.registerSelectionListener = (callback) ->
$scope.$on "selection:changed", (event, selection) ->
callback($scope.prefix, selection)
this
link: (scope, element, attrs, ctrl) ->
Tabsets.register(ctrl, scope.id, scope.selected)

View File

@@ -0,0 +1,7 @@
Darkswarm.filter 'closedShops', ->
(enterprises, show_closed) ->
enterprises ||= []
show_closed ?= false
enterprises.filter (enterprise) =>
show_closed or enterprise.active or !enterprise.is_distributor

View File

@@ -3,13 +3,12 @@ Darkswarm.filter "localizeCurrency", (currencyConfig)->
(amount) ->
# Set country code (eg. "US").
currency_code = if currencyConfig.display_currency then " " + currencyConfig.currency else ""
# Set decimal points, 2 or 0 if hide_cents.
# Set decimal points, 2 or 0 if hide_cents.
decimals = if currencyConfig.hide_cents == "true" then 0 else 2
# We need to use parseFloat before toFixed as the amount should come in as a string.
amount_fixed = parseFloat(amount).toFixed(decimals)
# Set format if the currency symbol should come after the number, otherwise (default) use the locale setting.
format = if currencyConfig.symbol_position == "after" then "%n %u" else undefined
# We need to use parseFloat as the amount should come in as a string.
amount = parseFloat(amount)
# Build the final price string. TODO use spree decimal point and spacer character settings.
if currencyConfig.symbol_position == 'before'
currencyConfig.symbol + amount_fixed + currency_code
else
amount_fixed + " " + currencyConfig.symbol + currency_code
# Build the final price string.
I18n.toCurrency(amount, {precision: decimals, unit: currencyConfig.symbol, format: format}) + currency_code

View File

@@ -1,6 +1,3 @@
# Old aliases before i18n-js was introduced.
# TODO - delete it after everything is moved to i18n-js
# Declares the translation function t.
# You can use translate('login') or t('login') in Javascript.
window.translate = (key, options = {}) ->

View File

@@ -1,6 +1,7 @@
window.FieldsetMixin = ($scope)->
$scope.next = (event = false)->
event.preventDefault() if event
return unless $scope.nextPanel
$scope.show $scope.nextPanel
$scope.onTimeout = ->

View File

@@ -1,12 +1,18 @@
Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $http, Navigation, CurrentHub, RailsFlashLoader, Loading)->
Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeElements, PaymentMethods, $http, Navigation, CurrentHub, RailsFlashLoader, Loading)->
new class Checkout
errors: {}
secrets: {}
order: CurrentOrder.order
submit: ->
purchase: ->
if @paymentMethod()?.method_type == 'stripe' && !@secrets.selected_card
StripeElements.requestToken(@secrets, @submit)
else
@submit()
submit: =>
Loading.message = t 'submitting_order'
$http.put('/checkout', {order: @preprocess()}).success (data, status)=>
$http.put('/checkout.json', {order: @preprocess()}).success (data, status)=>
Navigation.go data.path
.error (response, status)=>
if response.path
@@ -53,6 +59,23 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
last_name: @order.bill_address.lastname
}
if @paymentMethod()?.method_type == 'stripe'
if @secrets.selected_card
angular.extend munged_order, {
existing_card_id: @secrets.selected_card
}
else
angular.extend munged_order.payments_attributes[0], {
source_attributes:
gateway_payment_profile_id: @secrets.token
cc_type: @secrets.cc_type
last_digits: @secrets.card.last4
month: @secrets.card.exp_month
year: @secrets.card.exp_year
first_name: @order.bill_address.firstname
last_name: @order.bill_address.lastname
save_requested_by_customer: @secrets.save_requested_by_customer
}
munged_order
shippingMethod: ->

View File

@@ -0,0 +1,41 @@
Darkswarm.factory 'CreditCard', ($injector, $rootScope, CreditCards, StripeElements, Navigation, $http, RailsFlashLoader, Loading)->
new class CreditCard
visible: false
errors: {}
secrets: {}
requestToken: =>
@setFullName()
StripeElements.requestToken(@secrets, @submit, t("saving_credit_card"))
submit: =>
params = @process_params()
$http.put('/credit_cards/new_from_token', params )
.success (data, status) =>
Loading.clear()
@reset()
CreditCards.add(data)
.error (response, status) =>
if response.path
Navigation.go response.path
else
Loading.clear()
@errors = response.errors
RailsFlashLoader.loadFlash(response.flash)
setFullName: ->
@secrets.name = "#{@secrets.first_name} #{@secrets.last_name}"
process_params: ->
{"exp_month": @secrets.card.exp_month,
"exp_year": @secrets.card.exp_year,
"last4": @secrets.card.last4,
"token": @secrets.token,
"cc_type": @secrets.cc_type}
show: => @visible = true
reset: =>
@visible = false
delete @secrets[k] for k, v of @secrets
delete @errors[k] for k, v of @errors

View File

@@ -0,0 +1,6 @@
Darkswarm.factory 'CreditCards', (savedCreditCards)->
new class CreditCard
saved: savedCreditCards
add: (card) ->
@saved.push card

View File

@@ -0,0 +1,18 @@
Darkswarm.factory "Dates", ->
new class Dates
months: [
{key: t("january"), value: "1"},
{key: t("february"), value: "2"},
{key: t("march"), value: "3"},
{key: t("april"), value: "4"},
{key: t("may"), value: "5"},
{key: t("june"), value: "6"},
{key: t("july"), value: "7"},
{key: t("august"), value: "8"},
{key: t("september"), value: "9"},
{key: t("october"), value: "10"},
{key: t("november"), value: "11"},
{key: t("december"), value: "12"},
]
years: [moment().year()..(moment().year()+15)]

View File

@@ -2,7 +2,6 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
new class EnterpriseRegistrationService
enterprise:
user_ids: [CurrentUser.id]
email: CurrentUser.email
email_address: CurrentUser.email
address: {}
country: availableCountries[0]
@@ -11,7 +10,11 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
for key, value of enterpriseAttributes
@enterprise[key] = value
create: =>
# Creates the enterprise and redirects to the about step on success.
#
# @param callback [Function] executed at the end of the operation both in
# case of success or failure.
create: (callback) =>
Loading.message = t('creating') + " " + @enterprise.name
$http(
method: "POST"
@@ -33,6 +36,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
else
alert(t('failed_to_create_enterprise_unknown'))
)
callback.call() if callback?
update: (step) =>
Loading.message = t('updating') + " " + @enterprise.name

View File

@@ -21,3 +21,6 @@ Darkswarm.factory 'Navigation', ($location, $window) ->
$window.location.href = path
else
$window.location.pathname = path
reload: ->
$window.location.reload()

View File

@@ -1,22 +1,25 @@
Darkswarm.factory 'Orders', (orders_by_distributor, currencyConfig, CurrentHub, Taxons, Dereferencer, visibleFilter, Matcher, Geo, $rootScope)->
Darkswarm.factory 'Orders', (orders, shops, currencyConfig)->
new class Orders
all: orders
changeable: []
shops: shops
shopsByID: {}
currencySymbol = currencyConfig.symbol
constructor: ->
# Populate Orders.orders from json in page.
@orders_by_distributor = orders_by_distributor
@changeable_orders = []
@currency_symbol = currencyConfig.symbol
for shop in @shops
shop.orders = []
shop.balance = 0.0
@shopsByID[shop.id] = shop
for distributor in @orders_by_distributor
@findChangeableOrders(distributor.distributed_orders)
@updateRunningBalance(distributor.distributed_orders)
for order in @all by -1
shop = @shopsByID[order.shop_id]
shop.orders.unshift order
@changeable.unshift(order) if order.changes_allowed
updateRunningBalance: (orders) ->
for order, i in orders
balances = orders.slice(i,orders.length).map (o) -> parseFloat(o.outstanding_balance)
running_balance = balances.reduce (a,b) -> a+b
order.running_balance = running_balance.toFixed(2)
@updateRunningBalance(shop, order)
findChangeableOrders: (orders) ->
for order in orders when order.changes_allowed
@changeable_orders.push(order)
updateRunningBalance: (shop, order) ->
shop.balance += parseFloat(order.outstanding_balance)
order.runningBalance = shop.balance.toFixed(2)

View File

@@ -1,7 +1,18 @@
Darkswarm.factory 'RailsFlashLoader', (flash, railsFlash)->
new class RailsFlashLoader
# The 'flash' service requires type key to
# be one of: success, info, warn, error
typePairings:
success: 'success'
error: 'error'
notice: 'success'
info: 'info'
warn: 'warn'
initFlash: ->
@loadFlash railsFlash
loadFlash: (rails_flash)->
for type, message of rails_flash
type = @typePairings[type]
flash[type] = message

View File

@@ -0,0 +1,47 @@
Darkswarm.factory 'StripeElements', ($rootScope, Loading, RailsFlashLoader) ->
new class StripeElements
# TODO: add locale here for translations of error messages etc. from Stripe
# These are both set from the StripeElements directive
stripe: null
card: null
# New Stripe Elements method
requestToken: (secrets, submit, loading_message = t("processing_payment")) ->
return unless @stripe? && @card?
Loading.message = loading_message
cardData = @makeCardData(secrets)
@stripe.createToken(@card, cardData).then (response) =>
if(response.error)
Loading.clear()
RailsFlashLoader.loadFlash({error: t("error") + ": #{response.error.message}"})
else
secrets.token = response.token.id
secrets.cc_type = @mapCC(response.token.card.brand)
secrets.card = response.token.card
submit()
# Maps the brand returned by Stripe to that required by activemerchant
mapCC: (ccType) ->
if ccType == 'MasterCard'
return 'master'
else if ccType == 'Visa'
return 'visa'
else if ccType == 'American Express'
return 'american_express'
else if ccType == 'Discover'
return 'discover'
else if ccType == 'JCB'
return 'jcb'
else if ccType == 'Diners Club'
return 'diners_club'
return
# It doesn't matter if any of these are nil, all are optional.
makeCardData: (secrets) ->
{'name': secrets.name,
'address1': secrets.address1,
'city': secrets.city,
'zipcode': secrets.zipcode}

View File

@@ -0,0 +1,22 @@
Darkswarm.factory 'Tabsets', ->
new class Tabsets
tabsets: []
register: (ctrl, id, selected=null) ->
if ctrl? && id?
@tabsets.push { ctrl: ctrl, id: id, selected: selected }
ctrl.select(selected) if selected?
toggle: (id, name, state=null) ->
tabset = @findTabsetByObject(id)
if tabset.selected == name
@select(tabset, null) unless state == "open"
else
@select(tabset, name) unless state == "closed"
select: (tabset, name) ->
tabset.selected = name
tabset.ctrl.select(name)
findTabsetByObject: (id) ->
(tabset for tabset in @tabsets when tabset.id == id)[0]

View File

@@ -6,8 +6,7 @@
//
//= require 'jquery'
//= require store/spree_core
//= require store/spree_frontend
//= require store/spree_auth
//= require store/spree_promo
//= require_tree .

View File

@@ -2,7 +2,7 @@
%h2 {{ addressType === 'bill_address' ? "#{t('admin.customers.index.edit_bill_address')}" : "#{t('admin.customers.index.edit_ship_address')}" }}
%form{ name: 'edit_address_form', novalidate: true, ng: { submit: 'updateAddress()'}}
.row
= t('admin.customers.index.required_fileds')
{{ 'admin.customers.index.required_fileds' | t }}
(
%span.required *
)
@@ -11,62 +11,62 @@
%table.no-borders
%tr
%td{style: 'width: 30%'}
= t('spree.firstname')
{{ 'spree.firstname' | t }}
%span.required *
%td
%input{ type: 'text', name: 'firstname', required: true, ng: { model: 'address.firstname'} }
%tr
%td
= t('spree.lastname')
{{ 'spree.lastname' | t }}
%span.required *
%td
%input{ type: 'text', name: 'lastname', required: true, ng: { model: 'address.lastname'} }
%tr
%td
= t('spree.street_address')
{{ 'spree.street_address' | t }}
%span.required *
%td
%input{ type: 'text', name: 'address1', required: true, ng: { model: 'address.address1'} }
%tr
%td
= t('spree.street_address_1')
{{ 'spree.street_address_1' | t }}
%td
%input{ type: 'text', name: 'address2', ng: { model: 'address.address2'} }
%tr
%td
= t('spree.city')
{{ 'spree.city' | t }}
%span.required *
%td
%input{ type: 'text', name: 'city', required: true, ng: { model: 'address.city'} }
%tr
%td
= t('spree.zipcode')
{{ 'spree.zipcode' | t }}
%span.required *
%td
%input{ type: 'text', name: 'zipcode', required: true, ng: { model: 'address.zipcode'} }
%tr
%td
= t('spree.country')
{{ 'spree.country' | t }}
%span.required *
%td
%select{ name: 'country', required: true, ng: { model: 'address.country_id' } }
%option{value: ''}
= t('admin.customers.index.select_country')
{{ 'admin.customers.index.select_country' | t }}
%option{ ng: { repeat: 'country in availableCountries' }, value: '{{country.id}}' }
{{country.name}}
%tr
%td
= t('spree.state')
{{ 'spree.state' | t }}
%span.required *
%td
%select{ name: 'state', required: true, ng: { model: 'address.state_id' } }
%option{value: ''}
= t('admin.customers.index.select_state')
{{ 'admin.customers.index.select_state' | t }}
%option{ ng: { repeat: 'state in states' }, value: '{{state.id}}' }
{{state.name}}
%tr
%td
= t('spree.phone')
{{ 'spree.phone' | t }}
%span.required *
%td
%input{ type: 'text', name: 'phone', required: true, ng: { model: 'address.phone'} }

View File

@@ -1,7 +1,7 @@
.ofn-drop-down
%span
%i.icon-check
= t('admin.actions')
{{ 'admin.actions' | t }}
%i{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
%div.menu{ 'ng-show' => "expanded" }
%a.menu_item{ 'ng-repeat' => "link in links", href: '{{link.url}}', target: "{{link.target || '_self'}}", data: { method: "{{ link.method || 'get' }}", confirm: "{{link.confirm}}" } }

View File

@@ -1,19 +1,25 @@
#tag-rule-help
.margin-bottom-30.text-center
.text-big
= t('js.admin.modals.tag_rule_help.title')
{{ 'js.admin.modals.tag_rule_help.title' | t }}
.margin-bottom-30
.text-normal= t('js.admin.modals.tag_rule_help.overview')
%p= t('js.admin.modals.tag_rule_help.overview_text')
.text-normal
{{ 'js.admin.modals.tag_rule_help.overview' | t }}
%p
{{ 'js.admin.modals.tag_rule_help.overview_text' | t }}
.margin-bottom-30
.text-normal= t('js.admin.modals.tag_rule_help.by_default_rules')
%p= t('js.admin.modals.tag_rule_help.by_default_rules_text')
.text-normal
{{ 'js.admin.modals.tag_rule_help.by_default_rules' | t }}
%p
{{ 'js.admin.modals.tag_rule_help.by_default_rules_text' | t }}
.margin-bottom-30
.text-normal= t('js.admin.modals.tag_rule_help.customer_tagged_rules')
%p= t('js.admin.modals.tag_rule_help.customer_tagged_rules_text')
.text-normal
{{ 'js.admin.modals.tag_rule_help.customer_tagged_rules' | t }}
%p
{{ 'js.admin.modals.tag_rule_help.customer_tagged_rules_text' | t }}
.text-center
%input.button.red.icon-plus{ type: 'button', value: t('js.admin.modals.got_it'), ng: { click: 'close()' } }

View File

@@ -1,6 +1,6 @@
#new-customer-dialog
.text-normal.margin-bottom-30.text-center
= t('admin.customers.index.add_a_new_customer_for', shop_name: "{{ CurrentShop.shop.name }}:")
{{ 'admin.customers.index.add_a_new_customer_for' | t:{ shop_name: CurrentShop.shop.name } }}
%form{ name: 'new_customer_form', novalidate: true, ng: { submit: "addCustomer()" }}
@@ -8,7 +8,7 @@
%input.fullwidth{ type: 'email', name: 'email', required: true, placeholder: t('admin.customers.index.customer_placeholder'), ng: { model: "email" } }
%div{ ng: { show: "submitted && new_customer_form.$pristine" } }
.error{ ng: { show: "(new_customer_form.email.$error.email || new_customer_form.email.$error.required)" } }
= t('admin.customers.index.valid_email_error')
{{ 'admin.customers.index.valid_email_error' | t }}
.error{ ng: { repeat: "error in errors", bind: "error" } }
.text-center

View File

@@ -1,6 +1,6 @@
#new-tag-rule-dialog
.text-normal.margin-bottom-30.text-center
= t('js.admin.new_tag_rule_dialog.select_rule_type')
{{ 'js.admin.new_tag_rule_dialog.select_rule_type' | t }}
.text-center.margin-bottom-30
-# %select.fullwidth{ 'select2-min-search' => 5, 'ng-model' => 'newRuleType', 'ng-options' => 'ruleType.id as ruleType.name for ruleType in availableRuleTypes' }

View File

@@ -2,128 +2,162 @@
.alpha.eight.columns
%div{ ng: { if: "!enterprise.is_primary_producer", switch: "enterprise.sells" } }
.info{ ng: { switch: { when: "none" } } }
%h3= t('js.admin.panels.enterprise_package.hub_profile')
%h3
{{ 'js.admin.panels.enterprise_package.hub_profile' | t }}
%p
%strong= t('js.admin.panels.enterprise_package.hub_profile_cost')
%strong
{{ 'js.admin.panels.enterprise_package.hub_profile_cost' | t }}
%p= t('js.admin.panels.enterprise_package.hub_profile_text1')
%p
{{ 'js.admin.panels.enterprise_package.hub_profile_text1' | t }}
%p= t('js.admin.panels.enterprise_package.hub_profile_text2')
%p
{{ 'js.admin.panels.enterprise_package.hub_profile_text2' | t }}
.info{ ng: { switch: { when: "any" } } }
%h3= t('js.admin.panels.enterprise_package.hub_shop')
%h3
{{ 'js.admin.panels.enterprise_package.hub_shop' | t }}
%p
%strong
%monthly-pricing-description{ joiner: "comma" }
%p= t('js.admin.panels.enterprise_package.hub_shop_text1')
%p
{{ 'js.admin.panels.enterprise_package.hub_shop_text1' | t }}
%p= t('js.admin.panels.enterprise_package.hub_shop_text2')
%p
{{ 'js.admin.panels.enterprise_package.hub_shop_text2' | t }}
%p= t('js.admin.panels.enterprise_package.hub_shop_text3')
%p
{{ 'js.admin.panels.enterprise_package.hub_shop_text3' | t }}
.info{ ng: { switch: { default: true } } }
%h3
= t('js.admin.panels.enterprise_package.choose_package')
{{ 'js.admin.panels.enterprise_package.choose_package' | t }}
%i.icon-arrow-right
%p
%strong= t('js.admin.panels.enterprise_package.choose_package_text1')
%strong
{{ 'js.admin.panels.enterprise_package.choose_package_text1' | t }}
%p
= t('js.admin.panels.enterprise_package.choose_package_text2')
{{ 'js.admin.panels.enterprise_package.choose_package_text2' | t }}
%div{ ng: { if: "enterprise.is_primary_producer", switch: "enterprise.sells" } }
.info{ ng: { switch: { when: "none" } } }
%h3= t('js.admin.panels.enterprise_package.profile_only')
%h3
{{ 'js.admin.panels.enterprise_package.profile_only' | t }}
%p
%strong= t('js.admin.panels.enterprise_package.profile_only_cost')
%strong
{{ 'js.admin.panels.enterprise_package.profile_only_cost' | t }}
%p= t('js.admin.panels.enterprise_package.profile_only_text1')
%p
{{ 'js.admin.panels.enterprise_package.profile_only_text1' | t }}
%p= t('js.admin.panels.enterprise_package.profile_only_text2')
%p
{{ 'js.admin.panels.enterprise_package.profile_only_text2' | t }}
%p= t('js.admin.panels.enterprise_package.profile_only_text3')
%p
{{ 'js.admin.panels.enterprise_package.profile_only_text3' | t }}
.info{ ng: { switch: { when: "own" } } }
%h3= t('js.admin.panels.enterprise_package.producer_shop')
%h3
{{ 'js.admin.panels.enterprise_package.producer_shop' | t }}
%p
%strong
%monthly-pricing-description{ joiner: "comma" }
%p= t('js.admin.panels.enterprise_package.producer_shop_text1')
%p
{{ 'js.admin.panels.enterprise_package.producer_shop_text1' | t }}
%p= t('js.admin.panels.enterprise_package.producer_shop_text2')
%p
{{ 'js.admin.panels.enterprise_package.producer_shop_text2' | t }}
.info{ ng: { switch: { when: "any" } } }
%h3= t('js.admin.panels.enterprise_package.producer_hub')
%h3
{{ 'js.admin.panels.enterprise_package.producer_hub' | t }}
%p
%strong
%monthly-pricing-description{ joiner: "comma" }
%p= t('js.admin.panels.enterprise_package.producer_hub_text1')
%p
{{ 'js.admin.panels.enterprise_package.producer_hub_text1' | t }}
%p= t('js.admin.panels.enterprise_package.producer_hub_text2')
%p
{{ 'js.admin.panels.enterprise_package.producer_hub_text2' | t }}
%p= t('js.admin.panels.enterprise_package.producer_hub_text3')
%p
{{ 'js.admin.panels.enterprise_package.producer_hub_text3' | t }}
.info{ ng: { switch: { default: true } } }
%h3
= t('js.admin.panels.enterprise_package.choose_package')
{{ 'js.admin.panels.enterprise_package.choose_package' | t }}
%i.icon-arrow-right
%p
%strong= t('js.admin.panels.enterprise_package.choose_package_text1')
%strong
{{ 'js.admin.panels.enterprise_package.choose_package_text1' | t }}
%p
= t('js.admin.panels.enterprise_package.choose_package_text2')
{{ 'js.admin.panels.enterprise_package.choose_package_text2' | t }}
.omega.eight.columns{ ng: { switch: "enterprise.is_primary_producer" } }
%div{ ng: { switch: { when: "false" } } }
%a.button.selector.hub-profile{ ng: { click: "enterprise.owned && (enterprise.sells='none')", class: "{selected: enterprise.sells=='none', disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_package.profile_only')
%p= t('js.admin.panels.enterprise_package.get_listing')
.bottom= t('js.admin.panels.enterprise_package.always_free')
%h3
{{ 'js.admin.panels.enterprise_package.profile_only' | t }}
%p
{{ 'js.admin.panels.enterprise_package.get_listing' | t }}
.bottom
{{ 'js.admin.panels.enterprise_package.always_free' | t }}
%a.button.selector.hub{ ng: { click: "enterprise.owned && (enterprise.sells='any')", class: "{selected: enterprise.sells=='any', disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_package.hub_shop')
%p= t('js.admin.panels.enterprise_package.sell_produce_others')
%h3
{{ 'js.admin.panels.enterprise_package.hub_shop' | t }}
%p
{{ 'js.admin.panels.enterprise_package.sell_produce_others' | t }}
.bottom
%monthly-pricing-description{ joiner: "newline" }
%div{ ng: { switch: { when: "true" } } }
%a.button.selector.producer-profile{ ng: { click: "enterprise.owned && (enterprise.sells='none')", class: "{selected: enterprise.sells=='none', disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_package.profile_only')
%p= t('js.admin.panels.enterprise_package.get_listing')
.bottom= t('js.admin.panels.enterprise_package.always_free')
%h3
{{ 'js.admin.panels.enterprise_package.profile_only' | t }}
%p
{{ 'js.admin.panels.enterprise_package.get_listing' | t }}
.bottom
{{ 'js.admin.panels.enterprise_package.always_free' | t }}
%a.button.selector.producer-shop{ ng: { click: "enterprise.owned && (enterprise.sells='own')", class: "{selected: enterprise.sells=='own', disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_package.producer_shop')
%p= t('js.admin.panels.enterprise_package.sell_own_produce')
%h3
{{ 'js.admin.panels.enterprise_package.producer_shop' | t }}
%p
{{ 'js.admin.panels.enterprise_package.sell_own_produce' | t }}
.bottom
%monthly-pricing-description{ joiner: "newline" }
%a.button.selector.producer-hub{ ng: { click: "enterprise.owned && (enterprise.sells='any')", class: "{selected: enterprise.sells=='any', disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_package.producer_hub')
%p= t('js.admin.panels.enterprise_package.sell_both')
%h3
{{ 'js.admin.panels.enterprise_package.producer_hub' | t }}
%p
{{ 'js.admin.panels.enterprise_package.sell_both' | t }}
.bottom
%monthly-pricing-description{ joiner: "newline" }
%a.button.update.fullwidth{ ng: { show: "enterprise.owned", class: "{disabled: saved() && !saving, saving: saving}", click: "save()" } }
%span{ ng: {hide: "saved() || saving" } }
= t('js.admin.panels.save')
{{ 'js.admin.panels.save' | t }}
%i.icon-save
%span{ ng: {show: "saved() && !saving" } }
= t('js.admin.panels.saved')
{{ 'js.admin.panels.saved' | t }}
%i.icon-ok-sign
%span{ ng: {show: "saving" } }
= t('js.admin.panels.saving')
{{ 'js.admin.panels.saving' | t }}
%i.icon-refresh

View File

@@ -1,37 +1,47 @@
.row.enterprise_producer_panel{ ng: { controller: 'indexProducerPanelCtrl' } }
.alpha.eight.columns
.info{ ng: { show: "enterprise.is_primary_producer==true" } }
%h3= t('js.admin.panels.enterprise_producer.producer')
%p= t('js.admin.panels.enterprise_producer.producer_text1')
%p= t('js.admin.panels.enterprise_producer.producer_text2')
%h3
{{ 'js.admin.panels.enterprise_producer.producer' | t }}
%p
{{ 'js.admin.panels.enterprise_producer.producer_text1' | t }}
%p
{{ 'js.admin.panels.enterprise_producer.producer_text2' | t }}
.info{ ng: { show: "enterprise.is_primary_producer==false" } }
%h3= t('js.admin.panels.enterprise_producer.non_producer')
%p= t('js.admin.panels.enterprise_producer.non_producer_text1')
%p= t('js.admin.panels.enterprise_producer.non_producer_text2')
%h3
{{ 'js.admin.panels.enterprise_producer.non_producer' | t }}
%p
{{ 'js.admin.panels.enterprise_producer.non_producer_text1' | t }}
%p
{{ 'js.admin.panels.enterprise_producer.non_producer_text2' | t }}
.omega.eight.columns
%a.button.selector.producer{ ng: { click: 'enterprise.owned && changeToProducer()', class: "{selected: enterprise.is_primary_producer==true, disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_producer.producer')
%p= t('js.admin.panels.enterprise_producer.producer_desc')
.bottom= t('js.admin.panels.enterprise_producer.producer_example')
%h3
{{ 'js.admin.panels.enterprise_producer.producer' | t }}
%p
{{ 'js.admin.panels.enterprise_producer.producer_desc' | t }}
.bottom
{{ 'js.admin.panels.enterprise_producer.producer_example' | t }}
%a.button.selector.non-producer{ ng: { click: 'enterprise.owned && changeToNonProducer()', class: "{selected: enterprise.is_primary_producer==false, disabled: !enterprise.owned}" } }
.top
%h3= t('js.admin.panels.enterprise_producer.non_producer')
%p= t('js.admin.panels.enterprise_producer.non_producer_desc')
.bottom= t('js.admin.panels.enterprise_producer.non_producer_example')
%h3
{{ 'js.admin.panels.enterprise_producer.non_producer' | t }}
%p
{{ 'js.admin.panels.enterprise_producer.non_producer_desc' | t }}
.bottom
{{ 'js.admin.panels.enterprise_producer.non_producer_example' | t }}
%a.button.update.fullwidth{ ng: { show: "enterprise.owned", class: "{disabled: saved() && !saving, saving: saving}", click: "save()" } }
%span{ ng: {hide: "saved() || saving" } }
= t('js.admin.panels.save')
{{ 'js.admin.panels.save' | t }}
%i.icon-save
%span{ ng: {show: "saved() && !saving" } }
= t('js.admin.panels.saved')
{{ 'js.admin.panels.saved' | t }}
%i.icon-ok-sign
%span{ ng: {show: "saving" } }
= t('js.admin.panels.saving')
{{ 'js.admin.panels.saving' | t }}
%i.icon-refresh

View File

@@ -2,16 +2,16 @@
.alpha.omega.sixteen.columns
%h4.status-ok.text-center{ ng: { show: "issues.length == 0 && warnings.length == 0" } }
%i.icon-ok-sign
= t('js.admin.panels.enterprise_status.status_title', name: '{{ object.name }}')
{{ 'js.admin.panels.enterprise_status.status_title' | t:{ name: object.name } }}
%table{ ng: { show: "issues.length > 0 || warnings.length > 0" } }
%thead
%th.severity
= t('js.admin.panels.enterprise_status.severity')
{{ 'js.admin.panels.enterprise_status.severity' | t }}
%th.description
= t('js.admin.panels.enterprise_status.description')
{{ 'js.admin.panels.enterprise_status.description' | t }}
%th.resolve
= t('js.admin.panels.enterprise_status.resolve')
{{ 'js.admin.panels.enterprise_status.resolve' | t }}
%tr{ ng: { repeat: "issue in issues"} }
%td.severity
%i.icon-warning-sign.issue

View File

@@ -7,7 +7,7 @@
'ng-model' => 'exchange.select_all_variants',
'ng-change' => 'setExchangeVariants(exchange, incomingExchangeVariantsFor(exchange.enterprise_id), exchange.select_all_variants)',
'id' => 'order_cycle_outgoing_exchange_{{ $parent.$index }}_select_all_variants' }
= t('admin.select_all')
{{ 'admin.select_all' | t }}
.exchange-products
-# Scope product list based on permissions the current user has to view variants in this exchange

View File

@@ -7,7 +7,7 @@
'ng-model' => 'exchange.select_all_variants',
'ng-change' => 'setExchangeVariants(exchange, suppliedVariants(exchange.enterprise_id), exchange.select_all_variants)',
'id' => 'order_cycle_incoming_exchange_{{ $index }}_select_all_variants' }
= t('admin.select_all')
{{ 'admin.select_all' | t }}
.exchange-products
-# No need to scope product list based on permissions, because if an incoming exchange is visible,
@@ -36,7 +36,7 @@
'ofn-sync-distributions' => '{{ product.master_id }}',
'id' => 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}',
'ng-disabled' => '!order_cycle.editable_variants_for_incoming_exchanges.hasOwnProperty(exchange.enterprise_id) || order_cycle.editable_variants_for_incoming_exchanges[exchange.enterprise_id].indexOf(product.master_id) < 0' }
= t('admin.obsolete_master')
{{ 'admin.obsolete_master' | t }}
.exchange-product-variant{'ng-repeat' => 'variant in product.variants'}
%label

View File

@@ -1,6 +1,6 @@
.row.exchange-tags
.sixteen.columns.alpha.omega
%span.text-normal
= t('admin.tags')
{{ 'admin.tags' | t }}
%br
%tags-with-translation.fullwidth{ object: 'object' }

View File

@@ -3,9 +3,9 @@
{{$getDisplayText()}}
%span.tag-with-rules{ ng: { if: "data.rules == 1" } }
&mdash;
= t('admin.has_one_rule')
{{ 'admin.has_one_rule' | t }}
%span.tag-with-rules{ ng: { if: "data.rules > 1" } }
&mdash;
= t('admin.has_n_rules', { num: '{{data.rules}}' })
{{ 'admin.has_n_rules' | t:{ num: data.rules } }}
%span{ ng: { if: "!data.rules" } }
{{$getDisplayText()}}

View File

@@ -1,4 +1,5 @@
%tags-input{ template: 'admin/tag.html',
"placeholder" => t('admin.order_cycles.form.add_a_tag'),
ng: { model: 'object[tagsAttr]', class: "{'limit-reached': limitReached}"},
on: { tag: { added: 'tagAdded()', removed:'tagRemoved()' } } }
%auto-complete{ ng: { if: "findTags" }, source: "findTags({query: $query})",

View File

@@ -4,6 +4,10 @@
.large-12.columns
.alert-box.alert{"ng-show" => "errors != null"}
{{ errors }}
%a{ng: {show: 'user_unconfirmed', click: 'resend_confirmation()'}}
= t('devise.confirmations.resend_confirmation_email')
.alert-box.success{ng: {show: 'messages != null'}}
{{ messages }}
.row
.large-12.columns
%label{for: "email"} {{'email' | t}}

View File

@@ -1,13 +1,15 @@
%a.close-reveal-modal{"ng-click" => "$close()"}
%i.ofn-i_009-close
%h3= t('js.out_of_stock.reduced_stock_available')
%h3
{{ 'js.out_of_stock.reduced_stock_available' | t }}
%p= t('js.out_of_stock.out_of_stock_text')
%p
{{ 'js.out_of_stock.out_of_stock_text' | t }}
%p{'ng-repeat' => "v in variants"}
%em {{ v.name_to_display }} - {{ v.unit_to_display }}
%span{'ng-if' => "v.count_on_hand == 0"}
= t('js.out_of_stock.now_out_of_stock')
{{ 'js.out_of_stock.now_out_of_stock' | t }}
%span{'ng-if' => "v.count_on_hand > 0"}
= t('js.out_of_stock.only_n_remainging', num: '{{ v.count_on_hand }}')
{{ 'js.out_of_stock.only_n_remainging' | t:{ num: v.count_on_hand } }}

View File

@@ -17,8 +17,8 @@
%a.cta-hub{"ng-href" => "{{::enterprise.path}}",
"ng-class" => "{primary: enterprise.active, secondary: !enterprise.active}",
"ofn-change-hub" => "enterprise"}
%i.ofn-i_033-open-sign{"ng-if" => "::enterprise.active"}
%i.ofn-i_032-closed-sign{"ng-if" => "::!enterprise.active"}
.hub-name{"ng-bind" => "::enterprise.name"}
%span{"ng-if" => "::enterprise.active"} ({{'maps_open' | t}})
%span{"ng-if" => "::!enterprise.active"} ({{'maps_closed' | t}})
.button-address{"ng-bind" => "::[enterprise.address.city, enterprise.address.state_name] | printArray"}
/ %i.ofn-i_007-caret-right

View File

@@ -14,7 +14,7 @@
%a.cta-hub{"ng-repeat" => "hub in enterprise.hubs | filter:{id: '!'+enterprise.id} | orderBy:'-active'",
"ng-href" => "{{::hub.path}}", "ofn-empties-cart" => "hub",
"ng-class" => "::{primary: hub.active, secondary: !hub.active}"}
%i.ofn-i_033-open-sign{"ng-if" => "::hub.active"}
%i.ofn-i_032-closed-sign{"ng-if" => "::!hub.active"}
.hub-name{"ng-bind" => "::hub.name"}
%span{"ng-if" => "::hub.active"} ({{'maps_open' | t}})
%span{"ng-if" => "::!hub.active"} ({{'maps_closed' | t}})
.button-address{"ng-bind" => "::[hub.address.city, hub.address.state_name] | printArray"}

View File

@@ -1,5 +1,9 @@
%tab#sign-up-content{ heading: "{{'label_signup' | t}}", active: 'tabs.signup.active', select: "select(path)"}
%form{ ng: { controller: "SignupCtrl", submit: "submit()" } }
.row
.large-12.columns
.alert-box.success{ng: {show: 'messages != null'}}
{{ messages }}
.row
.large-12.columns
%label{for: "email"} {{'signup_email' | t}}

View File

@@ -5,7 +5,7 @@
%li.more
%a.dropdown{ data: { dropdown: "{{ 'show-more-' + selectorName }}" }, ng: { class: "{active: selectedOverFlowSelectors().length > 0}" } }
%span
= t('js.more_items', count: "{{ overFlowSelectors().length }}")
{{ 'js.more_items' | t:{ count: overFlowSelectors().length } }}
%i.ofn-i_052-point-down
.f-dropdown.text-right.content{ ng: { attr: { id: "{{ 'show-more-' + selectorName }}" } } }
%ul

View File

@@ -4,9 +4,8 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*
*= require admin/spree_core
*= require admin/spree_backend
*= require admin/spree_auth
*= require admin/spree_promo
*= require shared/jquery-ui-timepicker-addon
*= require shared/textAngular

View File

@@ -0,0 +1,80 @@
@import "../../darkswarm/mixins";
.alert-box {
position: relative;
display: block;
background-color: #eff5dc;
border: 1px solid #9fc820;
color: #666;
margin-top: 1em;
margin-bottom: 1em;
@include border-radius(3px);
transition: opacity 300ms ease-out;
padding: 0.77778em 1.33333em 0.77778em 0.77778em;
a.close {
position: absolute;
right: 5px;
top: 5px;
font-size: 1.5em;
}
&.ok {
border: 1px solid #9fc820;
background-color: #fbffee;
color: #9fc820;
font-weight: bold;
a.button {
padding: 3px 10px;
background-color: #a7c44d;
&:hover {
background-color: #9fc820;
}
}
a.close {
color: #9fc820;
}
}
&.error {
border: 1px solid #c82020;
background-color: #f5dcdc;
color: #c82020;
font-weight: bold;
a.button {
padding: 3px 10px;
background-color: #c85252;
&:hover {
background-color: #c82020;
}
}
a.close {
color: #c82020;
}
}
&.warning {
border: 1px solid #e6912e;
background-color: #fff4e6;
color: #e6912e;
font-weight: bold;
a.button {
padding: 3px 10px;
background-color: #db9350;
&:hover {
background-color: #e6912e;
}
}
a.close {
color: #e6912e;
}
}
}

View File

@@ -24,8 +24,6 @@ light: #ccc
}
}
/*.ui-dialog .ui-icon-closethick{background:url(/static/assets/dialogCloseButton.png);}*/
.ui-dialog .ui-widget-header{
background-image: none;
background-color: #ffffff;
@@ -42,21 +40,18 @@ light: #ccc
.ui-dialog .ui-corner-all{
border-radius: 8px;
}
.ui-dialog {
.ui-state-hover, .ui-state-focus{
border: none;
background: none;
color: #545454;
}
}
.ui-state-hover, .ui-widget-header .ui-state-hover, .ui-widget-content .ui-state-hover {
background-color: #ffffff;
background: none;
}
.ui-dialog-titlebar-close {
.ui-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close {
float: right;
border: none;
background: none;
&:before {
color: #000000;
font-size: 2em;
@@ -76,9 +71,18 @@ light: #ccc
display: none;
}
}
.ui-button-text {
display: none;
}
}
.ui-widget-overlay {
background: #000000;
opacity: 0.5;
position: fixed;
height: 100vh;
width: 100vw;
left: 0px;
top: 0px;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,27 +1,5 @@
@import "../darkswarm/mixins";
.alert-box {
position: relative;
display: block;
background-color: #eff5dc;
border: 1px solid #9fc820;
color: #666;
margin-top: 1em;
margin-bottom: 1em;
@include border-radius(3px);
transition: opacity 300ms ease-out;
padding: 0.77778em 1.33333em 0.77778em 0.77778em;
a.close {
position: absolute;
right: 5px;
top: 0px;
font-size: 1.5em;
}
}
.dashboard_item.single-ent {
.header {
padding: 0.77778em 1.33333em 0.77778em 0.77778em;

View File

@@ -1,3 +1,29 @@
form[name="enterprise_form"] div.row.warning {
color: #DA7F52;
form[name="enterprise_form"] {
div.row.warning {
color: #DA7F52;
}
table.managers {
i.role {
float: right;
margin-left: 0.5em;
font-size: 1.5em;
cursor: pointer;
}
i.confirmation {
margin-left: 0.2em;
font-size: 1.2em;
cursor: pointer;
vertical-align: bottom;
&.confirmed {
color: #1ece1e;
}
&.unconfirmed {
color: #ed9524;
}
}
}
}

View File

@@ -43,6 +43,13 @@ input.red {
margin-right: 5px;
}
a.button.red {
&:not(:hover) {
color: #fff;
background-color: #DA5354;
}
}
input.orange {
background-color: #FF9848;
margin-right: 5px;

View File

@@ -69,4 +69,10 @@ table#listing_products.bulk {
margin-bottom: 0.5em;
}
}
td.left-actions {
a.view-variants, a.add-variant {
cursor: pointer;
}
}
}

View File

@@ -36,6 +36,8 @@
text-align: right
p
max-width: 400px
h4 i
margin-right: 0.3rem
@media all and (max-width: 640px)
float: left
clear: left

View File

@@ -5,9 +5,32 @@
color: #4a4a4a;
}
.credit_cards {
.saved_cards {
table {
width: 100%;
}
}
.saved_cards, .no_cards {
margin-bottom: 1em;
}
.new_card {
opacity: 0;
-webkit-transition: opacity 0.4s linear;
transition: opacity 0.4s linear;
&.visible {
opacity: 1;
}
input.ng-invalid {
margin-bottom: 0px;
}
}
}
.orders {
margin-top: 50px;
margin-bottom: 100px;
a {
@@ -24,6 +47,10 @@
height: auto;
}
&.active_table {
margin: 0px;
}
.active_table_row {
h3 {
margin-top: 0.5em;

View File

@@ -68,7 +68,11 @@
margin-right: 0;
&, & > a.row {
display: block;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
}
@@ -96,7 +100,7 @@
&:hover, &:active, &:focus {
// color: $dark-grey
}
}

View File

@@ -81,3 +81,6 @@ checkout
display: inline
span.accordion-down
display: none
.error
color: #c82020

View File

@@ -88,6 +88,10 @@ footer {
@include panepadding;
div.row a img {
margin-bottom: 20px;
}
.row {
&, p, h1, h2, h3, h4, h5, h6 {
color: $disabled-med;

View File

@@ -8,6 +8,14 @@
white-space: nowrap;
overflow-x: hidden;
overflow-y: visible;
i {
margin-right: 0.5rem;
}
}
.active_table_row {
line-height: 1rem;
}
//Generic text link style
@@ -30,7 +38,7 @@
//Closed & Open column
.open_closed {
i {
font-size: 2rem;
font-size: 1.75rem;
float: right;
margin-left: 0.5rem;
}

View File

@@ -36,10 +36,15 @@ nav {
.top-bar-section .has-dropdown > a {
padding-right: ($topbar-height / 3) !important;
i.ofn-i_022-cog {
i.ofn-i_022-cog, .ofn-i_071-globe {
font-size: 24px;
line-height: $topbar-height;
}
i.ofn-i_071-globe {
color: #666;
font-size: 27px
}
}
.top-bar-section .has-dropdown > a:after {
@@ -95,6 +100,11 @@ nav {
background-color: white;
}
.off-canvas-list li.language-switcher ul li {
list-style-type: none;
padding-left: 0.5em;
}
.off-canvas-wrap.move-right .tab-bar .menu-icon {
@include box-shadow(inset 0 0 6px 2px rgba(0, 0, 0, 0.5));
}

View File

@@ -160,13 +160,6 @@
color: $clr-brick;
}
i.ofn-i_033-open-sign, i.ofn-i_032-closed-sign {
margin-right: 0.1rem;
font-size: 2rem;
padding: 0.15rem 0.25rem 0.35rem 0.25rem;
float: left;
}
.hub-name {
margin-top: 0.75rem;
margin-bottom: 0.2rem;

View File

@@ -10,4 +10,16 @@
background: #fff;
padding-top: 10px;
}
.alert-box {
a {
color: white;
text-decoration: underline;
&:hover {
color: rgba(255, 255, 255, 0.7);
text-decoration: underline;
}
}
}
}

View File

@@ -0,0 +1,16 @@
stripe-elements {
margin-bottom: 15px;
display: block;
#card-element {
background: white;
box-sizing: border-box;
font-weight: 400;
padding: 0.6rem 0.5rem;
border: 1px solid #cccccc;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
border-radius: 0px;
height: 42px;
width: 100%;
}
}

View File

@@ -233,3 +233,6 @@
.ofn-i_070-shop-map-reversed:before {
content: "\e645";
}
.ofn-i_071-globe:before {
content: "\e646";
}

View File

@@ -0,0 +1,71 @@
@import "typography";
@import "mixins";
@import "branding";
.tabset-ctrl {
.tab-view {
padding-top: 30px;
}
.tab {
text-align: center;
@media all and (max-width: 640px) {
text-align: left;
}
a {
@include headingFont;
background: transparent;
text-transform: uppercase;
font-size: 1.5em;
text-shadow: 0 -1px 1px #ffffff;
padding: 1em;
border: none;
@media all and (max-width: 640px) {
padding: 0.35em 0 0.65em 0;
text-shadow: none;
}
}
border-bottom: 4px solid transparent;
&:hover, &:focus, &:active {
transition: all 0.4s ease-in-out;
border-bottom: 4px solid $clr-brick-bright;
cursor: pointer;
@media all and (max-width: 640px) {
transition: none;
color: white;
background-color: $clr-brick-bright;
}
a {
color: $clr-brick-bright;
@media all and (max-width: 640px) {
color: #ffffff;
}
}
}
&.selected {
border-bottom: 4px solid $clr-brick;
@media all and (max-width: 640px) {
background-color: $clr-brick;
}
a {
color: $clr-brick;
@media all and (max-width: 640px) {
color: #ffffff;
}
}
}
}
}

View File

@@ -408,3 +408,12 @@ ul {
display: inline-block;
margin: 0px;
}
/*
* Fix overlapping table header on second page of long invoices.
* Problem description: https://github.com/openfoodfoundation/openfoodnetwork/issues/1738
* Solution: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1770#issuecomment-73530576
*/
thead { display: table-header-group }
tfoot { display: table-row-group }
tr { page-break-inside: avoid }

View File

@@ -4,9 +4,8 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*
*= require store/spree_core
*= require store/spree_frontend
*= require store/spree_auth
*= require store/spree_promo
*= require_self
*= require_tree .

View File

@@ -0,0 +1,68 @@
module Admin
class BulkLineItemsController < Spree::Admin::BaseController
# GET /admin/bulk_line_items.json
#
def index
order_params = params[:q].andand.delete :order
orders = OpenFoodNetwork::Permissions.new(spree_current_user).editable_orders.ransack(order_params).result
line_items = OpenFoodNetwork::Permissions.new(spree_current_user).editable_line_items.where(order_id: orders).ransack(params[:q])
render_as_json line_items.result.reorder('order_id ASC, id ASC')
end
# PUT /admin/bulk_line_items/:id.json
#
def update
load_line_item
authorize_update!
# `with_lock` acquires an exclusive row lock on order so no other
# requests can update it until the transaction is commited.
# See https://github.com/rails/rails/blob/3-2-stable/activerecord/lib/active_record/locking/pessimistic.rb#L69
# and https://www.postgresql.org/docs/current/static/sql-select.html#SQL-FOR-UPDATE-SHARE
order.with_lock do
if @line_item.update_attributes(params[:line_item])
order.update_distribution_charge!
render nothing: true, status: 204 # No Content, does not trigger ng resource auto-update
else
render json: { errors: @line_item.errors }, status: 412
end
end
end
# DELETE /admin/bulk_line_items/:id.json
#
def destroy
load_line_item
authorize! :update, order
@line_item.destroy
render nothing: true, status: 204 # No Content, does not trigger ng resource auto-update
end
private
def load_line_item
@line_item = Spree::LineItem.find(params[:id])
end
def model_class
Spree::LineItem
end
# Returns the appropriate serializer for this controller
#
# @return [Api::Admin::LineItemSerializer]
def serializer(_ams_prefix)
Api::Admin::LineItemSerializer
end
def authorize_update!
authorize! :update, order
authorize! :read, order
end
def order
@line_item.order
end
end
end

View File

@@ -39,6 +39,7 @@ module Admin
invoke_callbacks(:update, :before)
tag_rules_attributes = params[object_name].delete :tag_rules_attributes
update_tag_rules(tag_rules_attributes) if tag_rules_attributes.present?
update_enterprise_notifications
if @object.update_attributes(params[object_name])
invoke_callbacks(:update, :after)
flash[:success] = flash_message_for(@object, :successfully_updated)
@@ -198,6 +199,12 @@ module Admin
end
end
def update_enterprise_notifications
if params.key? :receives_notifications
@enterprise.update_contact params[:receives_notifications]
end
end
def create_calculator_for(rule, attrs)
if attrs[:calculator_type].present? && attrs[:calculator_attributes].present?
rule.update_attributes(calculator_type: attrs[:calculator_type])

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