Compare commits

..

3 Commits

Author SHA1 Message Date
Maikel Linke
3c3c3394a5 Add spanish translations manually
A change in the Transifex API made the automated commit fail. Hence
doing it manually here.
2017-07-12 11:30:47 +10:00
Transifex-Openfoodnetwork
5b3816fa9e Updating translations for config/locales/fr.yml [skip ci] 2017-07-01 16:17:12 +10:00
Transifex-Openfoodnetwork
3507bae002 Updating translations for config/locales/nb.yml [skip ci] 2017-06-30 17:54:18 +10:00
551 changed files with 2868 additions and 14147 deletions

View File

@@ -1,7 +1,6 @@
engines:
rubocop:
enabled: true
channel: rubocop-0-48
scss-lint:
enabled: false
ratings:

View File

@@ -1,30 +0,0 @@
#### 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]
#### What should we test?
[List which features should be tested and how]
#### Release notes
[In case this should be present in the release notes, please write them or
remove this section otherwise]
#### How is this related to the Spree upgrade?
[Any known conflicts with the Spree Upgrade? explain them or remove this section
otherwise]
#### Discourse thread
[Is there a discussion about this in Discourse? add the link if so or remove
this section otherwise]
#### Dependencies
[Does this PR depend on another one? add the link of so or remove this section
otherwise]

1
.gitignore vendored
View File

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

View File

@@ -1 +0,0 @@
5.12.0

View File

@@ -11,8 +11,6 @@ AllCops:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
- !ruby/regexp /old_and_unused\.rb$/
# OFN SETTINGS
@@ -27,10 +25,6 @@ Style/Documentation:
Style/StringLiterals:
Enabled: false
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
# TEMPORARY/CONTESTED SETTINGS
# These are still to be decided upon, but recommended for inclusion by
# oeoeaio after scrutinising offenses the codebase
@@ -143,10 +137,6 @@ 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

View File

@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 100`
# on 2017-08-25 14:27:48 +1000 using RuboCop version 0.49.1.
# on 2017-06-29 08:50:47 +1000 using RuboCop version 0.49.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -14,7 +14,7 @@ Bundler/OrderedGems:
Exclude:
- 'Gemfile'
# Offense count: 128
# Offense count: 77
# Cop supports --auto-correct.
Layout/AlignArray:
Exclude:
@@ -59,7 +59,7 @@ Layout/AlignHash:
- 'spec/models/spree/shipping_method_spec.rb'
- 'spec/models/spree/variant_spec.rb'
# Offense count: 43
# Offense count: 42
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
@@ -113,12 +113,11 @@ Layout/CaseIndentation:
- 'app/models/enterprise.rb'
- 'app/models/product_importer.rb'
# Offense count: 3
# Offense count: 2
# Cop supports --auto-correct.
Layout/ClosingParenthesisIndentation:
Exclude:
- 'app/overrides/add_capture_order_shortcut.rb'
- 'spec/serializers/variant_serializer_spec.rb'
# Offense count: 8
# Cop supports --auto-correct.
@@ -138,7 +137,7 @@ Layout/ElseAlignment:
- 'app/serializers/api/admin/order_cycle_serializer.rb'
- 'lib/open_food_network/sales_tax_report.rb'
# Offense count: 215
# Offense count: 223
# Cop supports --auto-correct.
Layout/EmptyLines:
Enabled: false
@@ -153,7 +152,7 @@ Layout/EmptyLinesAroundAccessModifier:
- 'spec/helpers/products_helper_spec.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 70
# Offense count: 73
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: empty_lines, no_empty_lines
@@ -171,6 +170,7 @@ Layout/EmptyLinesAroundBlockBody:
- 'app/models/spree/calculator_decorator.rb'
- 'app/models/spree/money_decorator.rb'
- 'app/models/spree/option_value_decorator.rb'
- 'app/models/spree/payment_decorator.rb'
- 'lib/open_food_network/group_buy_report.rb'
- 'lib/spree/money_decorator.rb'
- 'lib/tasks/dev.rake'
@@ -188,10 +188,10 @@ Layout/EmptyLinesAroundBlockBody:
- 'spec/features/admin/orders_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/features/consumer/shopping/embedded_shopfronts_spec.rb'
- 'spec/features/consumer/shopping/shopping_spec.rb'
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/helpers/admin/business_model_configuration_helper_spec.rb'
- 'spec/helpers/injection_helper_spec.rb'
- 'spec/helpers/shared_helper_spec.rb'
- 'spec/helpers/shop_helper_spec.rb'
- 'spec/helpers/spree/orders_helper_spec.rb'
@@ -212,7 +212,8 @@ Layout/EmptyLinesAroundBlockBody:
- 'spec/models/tag_rule/filter_shipping_methods_spec.rb'
- 'spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb'
- 'spec/serializers/admin/for_order_cycle/supplied_product_serializer_spec.rb'
- 'spec/serializers/variant_serializer_spec.rb'
- 'spec/serializers/order_serializer_spec.rb'
- 'spec/serializers/orders_by_distributor_serializer_spec.rb'
- 'spec/support/matchers/delegate_matchers.rb'
- 'spec/support/matchers/select2_matchers.rb'
- 'spec/support/matchers/table_matchers.rb'
@@ -269,7 +270,7 @@ Layout/EmptyLinesAroundMethodBody:
- 'app/serializers/api/product_serializer.rb'
- 'lib/open_food_network/orders_and_fulfillments_report.rb'
# Offense count: 12
# Offense count: 13
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
@@ -277,6 +278,7 @@ Layout/EmptyLinesAroundModuleBody:
Exclude:
- 'app/helpers/add_to_cart_helper.rb'
- 'app/helpers/groups_helper.rb'
- 'app/helpers/injection_helper.rb'
- 'app/helpers/spree/admin/base_helper_decorator.rb'
- 'lib/open_food_network/column_preference_defaults.rb'
- 'lib/open_food_network/group_buy_report.rb'
@@ -287,7 +289,7 @@ Layout/EmptyLinesAroundModuleBody:
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/ui_component_helper.rb'
# Offense count: 55
# Offense count: 54
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Layout/ExtraSpacing:
@@ -324,28 +326,29 @@ Layout/ExtraSpacing:
- 'spec/models/enterprise_spec.rb'
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/spree/adjustment_spec.rb'
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
- 'spec/models/spree/order_spec.rb'
- 'spec/models/variant_override_spec.rb'
- 'spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb'
- 'spec/serializers/admin/for_order_cycle/supplied_product_serializer_spec.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
Layout/FirstParameterIndentation:
Exclude:
- 'lib/open_food_network/permissions.rb'
- 'spec/serializers/variant_serializer_spec.rb'
# Offense count: 4
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Layout/IndentArray:
EnforcedStyle: consistent
Exclude:
- 'lib/open_food_network/users_and_enterprises_report.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
@@ -400,7 +403,7 @@ Layout/IndentationConsistency:
- 'spec/models/spree/line_item_spec.rb'
- 'spec/models/spree/product_spec.rb'
# Offense count: 18
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: Width, IgnoredPatterns.
Layout/IndentationWidth:
@@ -408,11 +411,13 @@ Layout/IndentationWidth:
- 'app/controllers/admin/invoice_settings_controller.rb'
- 'app/controllers/admin/order_cycles_controller.rb'
- 'app/controllers/api/order_cycles_controller.rb'
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'app/models/spree/line_item_decorator.rb'
- 'app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb'
- 'app/serializers/api/admin/for_order_cycle/supplied_product_serializer.rb'
- 'app/serializers/api/admin/order_cycle_serializer.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/last_used_address.rb'
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/helpers/admin/business_model_configuration_helper_spec.rb'
- 'spec/helpers/groups_helper_spec.rb'
@@ -450,6 +455,7 @@ Layout/LeadingCommentSpace:
- 'spec/factories.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/consumer/shops_spec.rb'
- 'spec/jobs/finalize_account_invoices_spec.rb'
- 'spec/lib/open_food_network/order_and_distributor_report_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
@@ -520,15 +526,55 @@ Layout/MultilineMethodCallBraceLayout:
- 'lib/open_food_network/products_renderer.rb'
- 'spec/lib/open_food_network/products_and_inventory_report_spec.rb'
# Offense count: 1
# Offense count: 191
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented, indented_relative_to_receiver
Layout/MultilineMethodCallIndentation:
Exclude:
- 'spec/serializers/variant_serializer_spec.rb'
- 'app/controllers/admin/order_cycles_controller.rb'
- 'app/controllers/admin/variant_overrides_controller.rb'
- 'app/controllers/api/order_cycles_controller.rb'
- 'app/controllers/base_controller.rb'
- 'app/controllers/checkout_controller.rb'
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'app/controllers/spree/admin/products_controller_decorator.rb'
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'app/controllers/spree/admin/search_controller_decorator.rb'
- 'app/controllers/spree/api/products_controller_decorator.rb'
- 'app/controllers/spree/orders_controller_decorator.rb'
- 'app/jobs/update_billable_periods.rb'
- 'app/models/column_preference.rb'
- 'app/models/enterprise.rb'
- 'app/models/enterprise_relationship.rb'
- 'app/models/exchange.rb'
- 'app/models/order_cycle.rb'
- 'app/models/product_importer.rb'
- 'app/models/spree/ability_decorator.rb'
- 'app/models/spree/calculator/default_tax_decorator.rb'
- 'app/models/spree/line_item_decorator.rb'
- 'app/models/spree/order_decorator.rb'
- 'app/models/spree/payment_method_decorator.rb'
- 'app/models/spree/product_decorator.rb'
- 'app/models/spree/shipping_method_decorator.rb'
- 'app/models/spree/taxon_decorator.rb'
- 'app/models/spree/user_decorator.rb'
- 'app/models/spree/variant_decorator.rb'
- 'app/serializers/api/admin/exchange_serializer.rb'
- 'lib/open_food_network/lettuce_share_report.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/order_cycle_permissions.rb'
- 'lib/open_food_network/permissions.rb'
- 'lib/open_food_network/products_cache.rb'
- 'spec/controllers/spree/admin/reports_controller_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/jobs/update_account_invoices_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/mailers/producer_mailer_spec.rb'
- 'spec/support/matchers/table_matchers.rb'
# Offense count: 33
# Offense count: 34
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented
@@ -541,6 +587,7 @@ Layout/MultilineOperationIndentation:
- 'app/models/producer_property.rb'
- 'app/models/product_importer.rb'
- 'app/models/spree/ability_decorator.rb'
- 'app/models/spree/order_decorator.rb'
- 'app/models/spree/product_set.rb'
- 'app/models/variant_override_set.rb'
- 'lib/open_food_network/accounts_and_billing_settings_validator.rb'
@@ -560,18 +607,20 @@ Layout/SpaceAfterColon:
- 'spec/models/variant_override_spec.rb'
- 'spec/spec_helper.rb'
# Offense count: 53
# Offense count: 58
# Cop supports --auto-correct.
Layout/SpaceAfterComma:
Exclude:
- 'app/controllers/admin/order_cycles_controller.rb'
- 'app/controllers/spree/admin/products_controller_decorator.rb'
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'app/controllers/spree/orders_controller_decorator.rb'
- 'app/models/column_preference.rb'
- 'app/models/product_importer.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/accounts_and_billing_settings_validator.rb'
- 'lib/open_food_network/business_model_configuration_validator.rb'
- 'lib/open_food_network/order_and_distributor_report.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/users_and_enterprises_report.rb'
- 'spec/controllers/admin/enterprises_controller_spec.rb'
@@ -648,7 +697,7 @@ Layout/SpaceAroundEqualsInParameterDefault:
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 60
# Offense count: 58
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Layout/SpaceAroundOperators:
@@ -677,7 +726,6 @@ Layout/SpaceAroundOperators:
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/stripe/account_connector_spec.rb'
- 'spec/models/calculator/weight_spec.rb'
- 'spec/support/cancan_helper.rb'
- 'spec/support/seeds.rb'
@@ -716,7 +764,7 @@ Layout/SpaceInLambdaLiteral:
- 'app/models/spree/product_decorator.rb'
- 'app/models/spree/variant_decorator.rb'
# Offense count: 187
# Offense count: 194
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
@@ -766,9 +814,11 @@ Layout/SpaceInsideBlockBraces:
- 'spec/models/spree/order_spec.rb'
- 'spec/models/spree/payment_spec.rb'
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/user_spec.rb'
- 'spec/models/tag_rule/discount_order_spec.rb'
- 'spec/serializers/admin/for_order_cycle/enterprise_serializer_spec.rb'
- 'spec/serializers/admin/for_order_cycle/supplied_product_serializer_spec.rb'
- 'spec/serializers/orders_by_distributor_serializer_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/cancan_helper.rb'
@@ -795,7 +845,7 @@ Layout/SpaceInsideBrackets:
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
- 'spec/performance/orders_controller_spec.rb'
# Offense count: 766
# Offense count: 729
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
# SupportedStyles: space, no_space, compact
@@ -822,11 +872,12 @@ Layout/Tab:
- 'spec/lib/spree/product_filters_spec.rb'
- 'spec/models/spree/line_item_spec.rb'
# Offense count: 42
# Offense count: 32
# Cop supports --auto-correct.
Layout/TrailingWhitespace:
Exclude:
- 'app/models/distributor_shipping_method.rb'
- 'app/models/product_importer.rb'
- 'app/models/spree/money_decorator.rb'
- 'app/serializers/api/image_serializer.rb'
- 'app/serializers/api/shipping_method_serializer.rb'
@@ -834,6 +885,7 @@ Layout/TrailingWhitespace:
- 'app/views/json/_enterprises.rabl'
- 'app/views/json/_producer.rabl'
- 'app/views/json/partials/_producer.rabl'
- 'lib/open_food_network/group_buy_report.rb'
- 'lib/tasks/dev.rake'
- 'spec/controllers/spree/store_controller_spec.rb'
- 'spec/features/admin/enterprise_user_spec.rb'
@@ -841,16 +893,17 @@ Layout/TrailingWhitespace:
- 'spec/lib/open_food_network/option_value_namer_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/serializers/admin/enterprise_serializer_spec.rb'
- 'spec/serializers/variant_serializer_spec.rb'
- 'spec/support/request/menu_helper.rb'
- 'spec/views/json/producers.json.rabl_spec.rb'
# Offense count: 6
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith.
# SupportedStylesAlignWith: either, start_of_block, start_of_line
Lint/BlockAlignment:
Exclude:
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'lib/open_food_network/last_used_address.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/models/enterprise_spec.rb'
- 'spec/models/spree/calculator/flat_percent_item_total_spec.rb'
@@ -1007,76 +1060,13 @@ Lint/UselessAccessModifier:
- 'lib/open_food_network/reports/bulk_coop_report.rb'
- 'spec/lib/open_food_network/reports/report_spec.rb'
# Offense count: 341
# Offense count: 340
Lint/Void:
Exclude:
- 'app/serializers/api/enterprise_serializer.rb'
- 'spec/archive/features/consumer/checkout_spec.rb'
- 'spec/controllers/api/order_cycles_controller_spec.rb'
- 'spec/controllers/base_controller_spec.rb'
- 'spec/controllers/cart_controller_spec.rb'
- 'spec/controllers/checkout_controller_spec.rb'
- 'spec/controllers/enterprises_controller_spec.rb'
- 'spec/controllers/shop_controller_spec.rb'
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
- 'spec/controllers/spree/admin/line_items_controller_spec.rb'
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
- 'spec/controllers/spree/admin/variants_controller_spec.rb'
- 'spec/controllers/spree/api/products_controller_spec.rb'
- 'spec/controllers/spree/api/variants_controller_spec.rb'
- 'spec/controllers/spree/checkout_controller_spec.rb'
- 'spec/controllers/spree/orders_controller_spec.rb'
- 'spec/controllers/user_passwords_controller_spec.rb'
- 'spec/controllers/user_registrations_controller_spec.rb'
- 'spec/features/admin/enterprise_fees_spec.rb'
- 'spec/features/admin/enterprise_groups_spec.rb'
- 'spec/features/admin/enterprise_user_spec.rb'
- 'spec/features/admin/enterprises/index_spec.rb'
- 'spec/features/admin/enterprises_spec.rb'
- 'spec/features/admin/order_cycles_spec.rb'
- 'spec/features/admin/orders_spec.rb'
- 'spec/features/admin/payment_method_spec.rb'
- 'spec/features/admin/product_import_spec.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/admin/shipping_methods_spec.rb'
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/features/admin/variants_spec.rb'
- 'spec/features/consumer/shopping/checkout_spec.rb'
- 'spec/features/consumer/shopping/shopping_spec.rb'
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/helpers/html_helper_spec.rb'
- 'spec/helpers/products_helper_spec.rb'
- 'spec/lib/open_food_network/bulk_coop_report_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_applicator_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/lib/open_food_network/enterprise_issue_validator_spec.rb'
- 'spec/lib/open_food_network/group_buy_report_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb'
- 'spec/lib/open_food_network/packing_report_spec.rb'
- 'spec/lib/open_food_network/reports/report_spec.rb'
- 'spec/lib/open_food_network/reports/rule_spec.rb'
- 'spec/mailers/enterprise_mailer_spec.rb'
- 'spec/mailers/order_mailer_spec.rb'
- 'spec/models/cart_spec.rb'
- 'spec/models/enterprise_relationship_spec.rb'
- 'spec/models/enterprise_spec.rb'
- 'spec/models/exchange_spec.rb'
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/product_distribution_spec.rb'
- 'spec/models/spree/adjustment_spec.rb'
- 'spec/models/spree/line_item_spec.rb'
- 'spec/models/spree/order_populator_spec.rb'
- 'spec/models/spree/order_spec.rb'
- 'spec/models/spree/payment_method_spec.rb'
- 'spec/models/spree/payment_spec.rb'
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/models/variant_override_spec.rb'
- 'spec/serializers/enterprise_serializer_spec.rb'
- 'spec/support/request/web_helper.rb'
- 'spec/**/*'
# Offense count: 747
# Offense count: 706
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 711
@@ -1161,7 +1151,7 @@ Rails/Delegate:
- 'app/serializers/api/admin/tag_rule_serializer.rb'
- 'app/serializers/api/variant_serializer.rb'
# Offense count: 7
# Offense count: 6
Rails/FilePath:
Exclude:
- 'lib/tasks/karma.rake'
@@ -1199,7 +1189,7 @@ Rails/HasAndBelongsToMany:
- 'app/models/spree/line_item_decorator.rb'
- 'app/models/spree/payment_method_decorator.rb'
# Offense count: 10
# Offense count: 11
Rails/OutputSafety:
Exclude:
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
@@ -1207,6 +1197,7 @@ Rails/OutputSafety:
- 'app/helpers/spree/reports_helper.rb'
- 'app/serializers/api/product_serializer.rb'
- 'lib/spree/money_decorator.rb'
- 'lib/tasks/karma.rake'
# Offense count: 6
# Cop supports --auto-correct.
@@ -1297,16 +1288,15 @@ Rails/Validation:
- 'app/models/spree/variant_decorator.rb'
- 'app/models/variant_override.rb'
# Offense count: 7
# Offense count: 6
Style/AccessorMethodName:
Exclude:
- 'app/models/product_importer.rb'
- 'app/models/spree/adjustment_decorator.rb'
- 'app/models/spree/order_decorator.rb'
- 'spec/support/request/shop_workflow.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 34
# Offense count: 35
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: always, conditionals
@@ -1322,6 +1312,7 @@ Style/AndOr:
- 'app/models/product_importer.rb'
- 'app/models/spreadsheet_entry.rb'
- 'app/models/spree/adjustment_decorator.rb'
- 'app/models/spree/order_decorator.rb'
- 'app/models/spree/product_set.rb'
- 'app/views/json/partials/_enterprise.rabl'
- 'lib/spree/core/controller_helpers/respond_with_decorator.rb'
@@ -1335,7 +1326,7 @@ Style/BarePercentLiterals:
- 'spec/features/admin/variants_spec.rb'
- 'spec/support/request/web_helper.rb'
# Offense count: 208
# Offense count: 209
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: braces, no_braces, context_dependent
@@ -1405,6 +1396,7 @@ Style/BracesAroundHashParameters:
- 'spec/models/spree/product_spec.rb'
- 'spec/models/spree/taxon_spec.rb'
- 'spec/serializers/admin/customer_serializer_spec.rb'
- 'spec/serializers/orders_by_distributor_serializer_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/cancan_helper.rb'
- 'spec/support/request/authentication_workflow.rb'
@@ -1416,7 +1408,7 @@ Style/CaseEquality:
- 'app/helpers/angular_form_helper.rb'
- 'spec/models/spree/payment_spec.rb'
# Offense count: 88
# Offense count: 86
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
@@ -1462,9 +1454,7 @@ Style/ClassAndModuleChildren:
- 'app/serializers/api/admin/line_item_serializer.rb'
- 'app/serializers/api/admin/order_cycle_serializer.rb'
- 'app/serializers/api/admin/order_serializer.rb'
- 'app/serializers/api/admin/payment_method/base_serializer.rb'
- 'app/serializers/api/admin/payment_method/payment_method_serializer.rb'
- 'app/serializers/api/admin/payment_method/stripe_serializer.rb'
- 'app/serializers/api/admin/payment_method_serializer.rb'
- 'app/serializers/api/admin/product_serializer.rb'
- 'app/serializers/api/admin/shipping_method_serializer.rb'
- 'app/serializers/api/admin/tag_rule_serializer.rb'
@@ -1597,7 +1587,7 @@ Style/FileName:
Style/FormatStringToken:
EnforcedStyle: template
# Offense count: 89
# Offense count: 88
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
@@ -1651,7 +1641,7 @@ Style/GuardClause:
- 'spec/support/request/distribution_helper.rb'
- 'spec/support/request/shop_workflow.rb'
# Offense count: 1255
# Offense count: 1241
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
@@ -1681,10 +1671,11 @@ Style/InverseMethods:
- 'app/controllers/admin/column_preferences_controller.rb'
- 'spec/support/cancan_helper.rb'
# Offense count: 5
# Offense count: 9
# Cop supports --auto-correct.
Style/LineEndConcatenation:
Exclude:
- 'app/controllers/spree/admin/base_controller_decorator.rb'
- 'lib/spree/core/controller_helpers/respond_with_decorator.rb'
- 'spec/controllers/spree/admin/base_controller_spec.rb'
@@ -1731,10 +1722,11 @@ Style/MultilineIfModifier:
- 'lib/open_food_network/enterprise_issue_validator.rb'
- 'lib/spree/core/controller_helpers/respond_with_decorator.rb'
# Offense count: 7
# Offense count: 8
# Cop supports --auto-correct.
Style/MutableConstant:
Exclude:
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'app/models/enterprise.rb'
- 'app/models/enterprise_fee.rb'
- 'app/models/spree/payment_method_decorator.rb'
@@ -1792,7 +1784,7 @@ Style/NumericLiteralPrefix:
Exclude:
- 'spec/features/admin/order_cycles_spec.rb'
# Offense count: 15
# Offense count: 16
# Cop supports --auto-correct.
# Configuration parameters: Strict.
Style/NumericLiterals:
@@ -2019,7 +2011,7 @@ Style/StructInheritance:
Exclude:
- 'lib/open_food_network/enterprise_fee_applicator.rb'
# Offense count: 183
# Offense count: 182
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinSize, SupportedStyles.
# SupportedStyles: percent, brackets
@@ -2063,7 +2055,7 @@ Style/SymbolArray:
- 'spec/models/exchange_spec.rb'
- 'spec/models/spree/ability_spec.rb'
# Offense count: 96
# Offense count: 97
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
# IgnoredMethods: respond_to, define_method
@@ -2095,6 +2087,7 @@ Style/SymbolProc:
- 'spec/features/admin/order_cycles_spec.rb'
- 'spec/lib/open_food_network/group_buy_report_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/models/spree/user_spec.rb'
# Offense count: 6
# Cop supports --auto-correct.

51
Gemfile
View File

@@ -1,37 +1,30 @@
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'
gem 'i18n', '~> 0.6.11'
gem 'i18n-js', '~> 3.0.0'
# Patched version. See http://rubysec.com/advisories/CVE-2015-5312/.
gem 'nokogiri', '>= 1.6.7.1'
gem 'pg'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '5a76d45'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'spree-upgrade-step1c'
gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable'
gem 'spree_auth_devise', github: 'openfoodfoundation/spree_auth_devise', branch: 'spree-upgrade-intermediate'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '1-3-stable'
# 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: "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 '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 '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'
@@ -49,14 +42,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'
@@ -102,19 +95,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', '~> 2.2.0'
gem 'rspec-rails', ">= 3.5.2"
gem 'turn', '~> 0.8.3', :require => false
gem 'fuubar'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'factory_girl_rails', require: false
gem 'capybara', '>= 2.15.4'
gem 'database_cleaner', '0.7.1', require: false
gem 'factory_girl_rails', :require => false
gem 'capybara'
gem 'database_cleaner', '0.7.1', :require => false
gem 'awesome_print'
gem 'letter_opener'
gem 'timecop'
gem 'poltergeist', '>= 1.16.0'
gem 'poltergeist'
gem 'rspec-retry'
gem 'json_spec', '~> 1.1.4'
gem 'json_spec'
gem 'unicorn-rails'
gem 'atomic'
gem 'knapsack'
@@ -127,20 +120,14 @@ group :test do
end
group :development do
gem 'byebug', '~> 9.0.0' # 9.1 requires ruby 2.2
gem 'pry-byebug', '>= 3.4.3'
gem 'pry-byebug'
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', '~> 4.7.3'
gem 'guard-zeus'
gem 'guard-rspec'
gem 'parallel_tests'
gem 'rubocop', '>= 0.49.1'
# 1.0.9 fixed openssl issues on macOS https://github.com/eventmachine/eventmachine/issues/602
# While we don't require this gem directly, no dependents forced the upgrade to a version
# greater than 1.0.9, so we just required the latest available version here.
gem 'eventmachine', '>= 1.2.3'
end

View File

@@ -1,5 +1,5 @@
GIT
remote: https://github.com/RohanM/simple_form.git
remote: git://github.com/RohanM/simple_form.git
revision: 45f08a213b40f3d4bda5f5398db841137587160a
specs:
simple_form (2.0.2)
@@ -7,103 +7,74 @@ GIT
activemodel (~> 3.0)
GIT
remote: https://github.com/jeremydurham/custom-err-msg.git
remote: git://github.com/jeremydurham/custom-err-msg.git
revision: 3a8ec9dddc7a5b0aab7c69a6060596de300c68f4
specs:
custom_error_message (1.1.1)
GIT
remote: https://github.com/openfoodfoundation/better_spree_paypal_express.git
revision: 8d95f4544c682634812becaf50999fba0cd04df0
branch: spree-upgrade-intermediate
remote: git://github.com/openfoodfoundation/better_spree_paypal_express.git
revision: 840d973cd5bd3250b17674a624dad494aeb09eb3
branch: hide-password
specs:
spree_paypal_express (2.0.3)
paypal-sdk-merchant (= 1.106.1)
spree_core (~> 1.3.99)
spree_core (~> 1.3.4)
GIT
remote: https://github.com/openfoodfoundation/ofn-qz.git
remote: git://github.com/openfoodfoundation/ofn-qz.git
revision: 024680ccea429b2e5428d7b964fa67c52add34ec
specs:
ofn-qz (0.1.0)
railties (~> 3.1)
GIT
remote: https://github.com/openfoodfoundation/spree.git
revision: 5a76d456ff70aea7aae3d25156558d71eb7febf2
ref: 5a76d45
branch: step-6a
remote: git://github.com/openfoodfoundation/spree.git
revision: a4c439570b77afa50f9e36299811f293232bd281
branch: spree-upgrade-step1c
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_frontend (= 1.3.99)
spree_promo (= 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)
acts_as_list (= 0.1.9)
activemerchant (~> 1.50.0)
acts_as_list (= 0.1.4)
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.15)
httparty (= 0.9.0)
highline (= 1.6.11)
jquery-rails (~> 2.0)
json (>= 1.5.5)
kaminari (= 0.13.0)
money (= 5.1.0)
money (= 5.0.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.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)
httparty (~> 0.8.1)
spree_core (= 1.3.99)
spree_promo (1.3.99)
spree_core (= 1.3.99)
stringex (~> 1.3.2)
spree_sample (1.3.99)
spree_core (= 1.3.99)
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
remote: git://github.com/spree/deface.git
revision: 1110a1336252109bce7f98f9182042e0bc2930ae
ref: 1110a13
specs:
@@ -113,7 +84,18 @@ GIT
rails (>= 3.1)
GIT
remote: https://github.com/spree/spree_i18n.git
remote: git://github.com/spree/spree_auth_devise.git
revision: ba95589a85368297c844f096c2a0c121e5b08138
branch: 1-3-stable
specs:
spree_auth_devise (1.3.0)
cancan (~> 1.6.7)
devise (~> 2.2.3)
devise-encryptable (= 0.1.2)
spree_core
GIT
remote: git://github.com/spree/spree_i18n.git
revision: 752eb67204e9c5a4e22b62591a8fd55fe2285e43
branch: 1-3-stable
specs:
@@ -123,7 +105,7 @@ GIT
spree_core (>= 1.1)
GIT
remote: https://github.com/willrjmarshall/foundation_rails_helper.git
remote: git://github.com/willrjmarshall/foundation_rails_helper.git
revision: 4d5d53fdc4b1fb71e66524d298c5c635de82cfbb
branch: rails3
specs:
@@ -151,8 +133,8 @@ GEM
sprockets (~> 2.2.1)
active_model_serializers (0.8.3)
activemodel (>= 3.0)
activemerchant (1.71.0)
activesupport (>= 3.2.14, < 6.x)
activemerchant (1.50.0)
activesupport (>= 3.2.14, < 5.0.0)
builder (>= 2.1.2, < 4.0.0)
i18n (>= 0.6.9)
nokogiri (~> 1.4)
@@ -172,9 +154,8 @@ GEM
multi_json (~> 1.0)
acts-as-taggable-on (3.5.0)
activerecord (>= 3.2, < 5)
acts_as_list (0.1.9)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
acts_as_list (0.1.4)
addressable (2.3.3)
andand (1.3.3)
angular-rails-templates (0.2.0)
railties (>= 3.1)
@@ -193,28 +174,33 @@ GEM
json (~> 1.4)
nokogiri (>= 1.4.4)
uuidtools (~> 2.1)
bcrypt (3.1.11)
bcrypt (3.1.7)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
blockenspiel (0.4.5)
bugsnag (4.1.0)
builder (3.0.4)
byebug (9.0.6)
byebug (2.7.0)
columnize (~> 0.3)
debugger-linecache (~> 1.2)
cancan (1.6.8)
capybara (2.15.4)
capybara (2.7.1)
addressable
mini_mime (>= 0.1.3)
mime-types (>= 1.16)
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.1.0)
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -222,7 +208,8 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.10.0)
colorize (0.8.1)
colorize (0.7.7)
columnize (0.9.0)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@@ -239,8 +226,8 @@ GEM
compass (~> 1.0.0)
sass-rails (<= 5.0.1)
sprockets (< 2.13)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crack (0.4.1)
safe_yaml (~> 0.9.0)
css_parser (1.3.5)
addressable
css_splitter (0.4.5)
@@ -265,13 +252,13 @@ GEM
warden (~> 1.2.1)
devise-encryptable (0.1.2)
devise (>= 2.1.0)
diff-lcs (1.3)
diff-lcs (1.2.4)
diffy (3.1.0)
em-websocket (0.5.1)
em-websocket (0.5.0)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
http_parser.rb (~> 0.5.3)
erubis (2.7.0)
eventmachine (1.2.3)
eventmachine (1.0.8)
excon (0.45.4)
execjs (2.6.0)
factory_girl (3.3.0)
@@ -279,10 +266,8 @@ 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.18)
ffi (1.9.3)
figaro (0.7.0)
bundler (~> 1.0)
rails (>= 3, < 5)
@@ -403,44 +388,38 @@ GEM
foundation-rails (5.5.0.0)
railties (>= 3.1.0)
sass (>= 3.2.0, < 3.4)
fuubar (2.2.0)
rspec-core (~> 3.0)
fuubar (1.3.3)
rspec (>= 2.14.0, < 3.1.0)
ruby-progressbar (~> 1.4)
geocoder (1.1.8)
gmaps4rails (1.5.6)
guard (2.14.1)
guard (2.2.4)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
listen (~> 2.1)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-livereload (2.5.2)
guard-livereload (2.0.1)
em-websocket (~> 0.5)
guard (~> 2.8)
guard-compat (~> 1.0)
guard (~> 2.0)
multi_json (~> 1.8)
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)
guard-rails (0.4.7)
guard (>= 0.2.2)
guard-rspec (4.0.4)
guard (>= 2.1.1)
rspec (~> 2.14)
guard-zeus (0.0.1)
guard
zeus
haml (4.0.4)
tilt
highline (1.6.15)
highline (1.6.11)
hike (1.2.3)
http_parser.rb (0.6.0)
httparty (0.9.0)
http_parser.rb (0.5.3)
httparty (0.8.3)
multi_json (~> 1.0)
multi_xml
i18n (0.6.11)
i18n-js (3.0.0)
i18n (~> 0.6, >= 0.6.6)
immigrant (0.1.6)
activerecord (>= 3.0)
foreigner (>= 1.2.1)
@@ -448,14 +427,13 @@ GEM
ipaddress (0.8.0)
journey (1.0.4)
jquery-migrate-rails (1.2.1)
jquery-rails (2.2.2)
jquery-rails (2.3.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.6)
json_spec (1.1.5)
json (1.8.3)
json_spec (1.1.1)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (1.5.4)
rspec (~> 2.0)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
@@ -469,37 +447,27 @@ GEM
letter_opener (1.0.0)
launchy (>= 2.0.4)
libv8 (3.16.14.11)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
lumberjack (1.0.12)
listen (2.2.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.9.0)
method_source (0.8.2)
mime-types (1.25.1)
mini_mime (0.1.4)
mini_portile2 (2.1.0)
mini_portile2 (2.0.0)
momentjs-rails (2.5.1)
railties (>= 3.1)
money (5.1.0)
i18n (~> 0.6.0)
money (5.0.0)
i18n (~> 0.4)
json
multi_json (1.12.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nenv (0.3.0)
multi_xml (0.5.5)
newrelic_rpm (3.12.0.288)
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)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
oj (2.1.2)
orm_adapter (0.5.0)
paper_trail (3.0.8)
@@ -521,28 +489,29 @@ GEM
paypal-sdk-merchant (1.106.1)
paypal-sdk-core (~> 0.2.3)
pg (0.13.2)
poltergeist (1.16.0)
poltergeist (1.9.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.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)
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)
rabl (0.7.2)
activesupport (>= 2.3.14)
multi_json (~> 1.0)
rack (1.4.7)
rack-cache (1.7.0)
rack-cache (1.6.1)
rack (>= 0.4)
rack-livereload (0.3.16)
rack-livereload (0.3.15)
rack
rack-ssl (1.3.4)
rack
@@ -569,14 +538,14 @@ GEM
rainbow (2.2.2)
rake
raindrops (0.13.0)
rake (10.5.0)
rake (11.3.0)
ransack (0.7.2)
actionpack (~> 3.0)
activerecord (~> 3.0)
polyamorous (~> 0.5.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
redcarpet (3.2.3)
@@ -598,29 +567,23 @@ GEM
roo (2.7.1)
nokogiri (~> 1)
rubyzip (~> 1.1, < 2.0.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
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)
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)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.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)
@@ -630,7 +593,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rubyzip (1.2.0)
safe_yaml (1.0.4)
safe_yaml (0.9.5)
sass (3.3.14)
sass-rails (3.2.6)
railties (~> 3.2.0)
@@ -638,9 +601,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)
@@ -650,24 +613,23 @@ 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.20.0)
thor (0.19.1)
tilt (1.4.1)
timecop (0.8.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
truncate_html (0.9.2)
truncate_html (0.5.5)
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.53)
tzinfo (0.3.49)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
@@ -684,12 +646,12 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
warden (1.2.7)
warden (1.2.3)
rack (>= 1.0)
webmock (1.8.11)
webmock (1.13.0)
addressable (>= 2.2.7)
crack (>= 0.1.7)
websocket-driver (0.7.0)
crack (>= 0.3.2)
websocket-driver (0.6.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.9.2)
@@ -697,16 +659,17 @@ GEM
chronic (>= 0.6.3)
wicked_pdf (1.1.0)
wkhtmltopdf-binary (0.12.3.1)
xml-simple (1.1.5)
xpath (2.1.0)
xml-simple (1.1.4)
xpath (2.0.0)
nokogiri (~> 1.3)
zeus (0.15.4)
method_source (>= 0.6.7)
PLATFORMS
ruby
DEPENDENCIES
active_model_serializers
activemerchant (~> 1.71.0)
acts-as-taggable-on (~> 3.4)
andand
angular-rails-templates (~> 0.2.0)
@@ -717,8 +680,7 @@ DEPENDENCIES
aws-sdk
blockenspiel
bugsnag
byebug (~> 9.0.0)
capybara (>= 2.15.4)
capybara
coffee-rails (~> 3.2.1)
compass-rails
css_splitter
@@ -731,43 +693,39 @@ DEPENDENCIES
deface!
delayed_job_active_record
diffy
eventmachine (>= 1.2.3)
factory_girl_rails
figaro
foreigner
foundation-icons-sass-rails
foundation-rails
foundation_rails_helper!
fuubar (~> 2.2.0)
fuubar
geocoder
gmaps4rails
guard
guard-livereload
guard-rails
guard-rspec (~> 4.7.3)
guard-rspec
guard-zeus
haml
i18n (~> 0.6.11)
i18n-js (~> 3.0.0)
immigrant
jquery-migrate-rails
jquery-rails
json_spec (~> 1.1.4)
jwt (~> 1.5)
json_spec
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 (>= 1.16.0)
pry-byebug (>= 3.4.3)
poltergeist
pry-byebug
rabl
rack-livereload
rack-ssl
@@ -777,7 +735,7 @@ DEPENDENCIES
representative_view
roadie-rails (~> 1.0.3)
roo (~> 2.7.0)
rspec-rails (>= 3.5.2)
rspec-rails
rspec-retry
rubocop (>= 0.49.1)
sass (~> 3.3)
@@ -789,7 +747,6 @@ DEPENDENCIES
spree_auth_devise!
spree_i18n!
spree_paypal_express!
stripe (~> 3.3.1)
therubyracer
timecop
truncate_html
@@ -807,4 +764,4 @@ RUBY VERSION
ruby 2.1.5p273
BUNDLED WITH
1.15.4
1.15.1

View File

@@ -71,22 +71,18 @@ createuser -s -P ofn
```
Create the development and test databases, using the settings specified in `config/database.yml`, and populate them with a schema and seed data:
```
bundle exec rake db:setup
```
rake db:setup
Load some default data for your environment:
```
bundle exec rake openfoodnetwork:dev:load_sample_data
```
rake openfoodnetwork:dev:load_sample_data
At long last, your dreams of spinning up a development server can be realised:
```
bundle exec rails server
```
To login as Spree default user, use:
```
email: spree@example.com
password: spree123
```
rails server
### Testing
Tests, both unit and integration, are based on RSpec. To run the test suite, first prepare the test database:
@@ -111,9 +107,6 @@ If you want karma to automatically rerun the tests on file modification, use:
./script/karma start
### Multilingual
Do not forget to run `rake tmp:cache:clear` after locales are updated to reload I18n js translations.
## Credits
* Andrew Spinks (http://github.com/andrewspinks)
@@ -126,7 +119,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 Pettitt (https://github.com/stveep)
* Steve Petitt (https://github.com/stveep)
## Licence

View File

@@ -14,8 +14,9 @@
//= require angular-resource
//= require angular-animate
//= require angular-sanitize
//= require admin/spree_backend
//= require admin/spree_core
//= 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
@@ -47,16 +48,8 @@
//= require textAngular-rangy.min.js
//= require textAngular-sanitize.min.js
//= require textAngular.min.js
//= require i18n/translations
//= require darkswarm/i18n.js
//= 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,6 +32,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
$scope.filteredProducts = []
$scope.currentFilters = []
$scope.limit = 15
$scope.productsWithUnsavedVariants = []
$scope.query = ""
$scope.DisplayProperties = DisplayProperties
@@ -113,6 +114,7 @@ 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
@@ -194,7 +196,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
filters: $scope.currentFilters
).success((data) ->
DirtyProducts.clear()
BulkProducts.updateVariantLists(data.products || [])
BulkProducts.updateVariantLists(data.products, $scope.productsWithUnsavedVariants)
$timeout -> $scope.displaySuccess()
).error (data, status) ->
if status == 400 && data.errors? && data.errors.length > 0

View File

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

View File

@@ -21,7 +21,7 @@ angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $tem
if response.data.errors
scope.errors.push(error) for error in response.data.errors
else
scope.errors.push(t('js.customers.could_not_create') + " '#{scope.email}'")
scope.errors.push("Sorry! Could not create '#{scope.email}'")
return
# Compile modal template
@@ -35,4 +35,4 @@ angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $tem
if CurrentShop.shop.id
template.dialog('open')
else
alert(t('js.customers.select_shop'))
alert('Please select a shop first')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -51,13 +51,13 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.$watch 'bulk_order_form.$dirty', (newVal, oldVal) ->
if newVal == true
StatusMessage.display 'notice', t('js.unsaved_changes')
StatusMessage.display 'notice', "You have unsaved changes"
$scope.submit = ->
if $scope.bulk_order_form.$valid
StatusMessage.display 'progress', t('js.saving')
StatusMessage.display 'progress', "Saving..."
$q.all(LineItems.saveAll()).then(->
StatusMessage.display 'success', t('js.all_changes_saved')
StatusMessage.display 'success', "All changes saved"
$scope.bulk_order_form.$setPristine()
).catch ->
StatusMessage.display 'failure', t "unsaved_changes_error"

View File

@@ -84,7 +84,7 @@ angular.module('admin.orderCycles')
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', t('js.saving')
StatusMessage.display 'progress', "Saving..."
OrderCycle.create(destination)
$scope.cancel = (destination) ->

View File

@@ -87,11 +87,11 @@ angular.module('admin.orderCycles')
$scope.submit = (destination) ->
$event.preventDefault()
StatusMessage.display 'progress', t('js.saving')
StatusMessage.display 'progress', "Saving..."
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', t('js.saving')
StatusMessage.display 'progress', "Saving..."
OrderCycle.update(destination, $scope.order_cycle_form)
$scope.cancel = (destination) ->

View File

@@ -49,7 +49,7 @@ angular.module('admin.orderCycles').controller "AdminSimpleCreateOrderCycleCtrl"
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', t('js.saving')
StatusMessage.display 'progress', "Saving..."
OrderCycle.mirrorIncomingToOutgoingProducts()
OrderCycle.create(destination)

View File

@@ -42,7 +42,7 @@ angular.module('admin.orderCycles').controller "AdminSimpleEditOrderCycleCtrl",
$scope.submit = ($event, destination) ->
$event.preventDefault()
StatusMessage.display 'progress', t('js.saving')
StatusMessage.display 'progress', "Saving..."
OrderCycle.mirrorIncomingToOutgoingProducts()
OrderCycle.update(destination, $scope.order_cycle_form)

View File

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

View File

@@ -1,18 +0,0 @@
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

@@ -1,33 +0,0 @@
// 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

@@ -1,7 +1,8 @@
angular.module("ofn.admin").controller "ImportOptionsFormCtrl", ($scope, $rootScope, ProductImportService) ->
$scope.toggleResetAbsent = () ->
confirmed = confirm t('js.product_import.confirmation') if $scope.resetAbsent
confirmed = confirm 'This will set stock level to zero on all products for this \n' +
'enterprise that are not present in the uploaded file.' if $scope.resetAbsent
if confirmed or !$scope.resetAbsent
ProductImportService.updateResetAbsent($scope.supplierId, $scope.resetCount, $scope.resetAbsent)

View File

@@ -12,10 +12,11 @@ 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)
["#{I18n.t(unit_type)} (#{name})", "#{unit_type}_#{scale}"]
options.push [[I18n.t('items'), 'items']]
["#{unit_type_cap} (#{name})", "#{unit_type}_#{scale}"]
options.push [['Items', 'items']]
[].concat options...
@getScale: (value, unitType) ->

View File

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

View File

@@ -24,7 +24,7 @@ angular.module("admin.resources").factory "Customers", ($q, InfoDialog, RequestM
if errors?
InfoDialog.open 'error', errors[0]
else
InfoDialog.open 'error', t('js.resources.could_not_delete_customer') + ": #{customer.email}"
InfoDialog.open 'error', "Could not delete customer: #{customer.email}"
index: (params) ->
@clear()

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})
lineItem.$update({id: lineItem.id, orders: "orders", order_number: lineItem.order.number})
.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})
lineItem.$delete({id: lineItem.id, orders: "orders", order_number: lineItem.order.number})
.then( (data) =>
delete @byID[lineItem.id]
delete @pristineByID[lineItem.id]

View File

@@ -1,4 +1,4 @@
angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher, $http) ->
angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher) ->
new class BulkProducts
products: []
@@ -11,14 +11,20 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher,
PagedFetcher.fetch url, (data) => @addProducts data.products
cloneProduct: (product) ->
$http.post("/api/products/" + product.id + "/clone").success (data) =>
dataFetcher("/api/products/" + data.id + "?template=bulk_show").then (newProduct) =>
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) =>
@unpackProduct newProduct
@insertProductAfter(product, newProduct)
updateVariantLists: (serverProducts) ->
for server_product in serverProducts
product = @findProductInList(server_product.id, @products)
updateVariantLists: (serverProducts, productsWithUnsavedVariants) ->
for product in productsWithUnsavedVariants
server_product = @findProductInList(product.id, serverProducts)
product.variants = server_product.variants
@loadVariantUnitValues product

View File

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

View File

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

View File

@@ -1,21 +1,9 @@
angular.module("admin.side_menu")
.factory "SideMenu", ($location) ->
.factory "SideMenu", ->
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
@@ -25,7 +13,6 @@ 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

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

View File

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

View File

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

View File

@@ -16,23 +16,14 @@
#= require ../shared/angular-local-storage.js
#= require ../shared/angular-slideables.js
#= require angularjs-file-upload
#= require i18n/translations
#= require angular-rails-templates
#= require_tree ../templates
#
#= 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

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

View File

@@ -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.purchase()
$scope.Checkout.submit()
else
$scope.$broadcast 'purchaseFormInvalid', form

View File

@@ -1,11 +1,23 @@
Darkswarm.controller "PaymentCtrl", ($scope, $timeout, savedCreditCards, Dates) ->
Darkswarm.controller "PaymentCtrl", ($scope, $timeout) ->
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

@@ -1,12 +0,0 @@
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

@@ -0,0 +1,9 @@
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,9 +6,10 @@ 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
@@ -35,7 +36,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, show_closed]', ->
$scope.$watch '[activeTaxons, activeProperties, shippingTypes, show_profiles]', ->
$timeout ->
Enterprises.calculateDistance $scope.query, $scope.firstNameMatch()
$rootScope.$broadcast 'enterprisesChanged'
@@ -73,9 +74,9 @@ Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location
undefined
$scope.showClosedShops = ->
$scope.show_closed = true
delete $scope.filterExpression['active']
$location.search('show_closed', '1')
$scope.hideClosedShops = ->
$scope.show_closed = false
$scope.filterExpression['active'] = true
$location.search('show_closed', null)

View File

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

View File

@@ -1,23 +1,15 @@
Darkswarm.controller "RegistrationFormCtrl", ($scope, RegistrationService, EnterpriseRegistrationService) ->
$scope.submitted = false
$scope.isDisabled = false
$scope.valid = (form) ->
$scope.submitted = !form.$valid
form.$valid
$scope.create = (form) ->
$scope.disableButton()
EnterpriseRegistrationService.create($scope.enableButton) if $scope.valid(form)
EnterpriseRegistrationService.create() 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

@@ -1,9 +0,0 @@
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

@@ -1,35 +0,0 @@
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

@@ -1,12 +0,0 @@
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

@@ -1,15 +0,0 @@
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

@@ -1,28 +0,0 @@
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

@@ -1,7 +0,0 @@
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,12 +3,13 @@ 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
# 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)
# We need to use parseFloat before toFixed as the amount should come in as a string.
amount_fixed = parseFloat(amount).toFixed(decimals)
# Build the final price string.
I18n.toCurrency(amount, {precision: decimals, unit: currencyConfig.symbol, format: format}) + currency_code
# 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

View File

@@ -0,0 +1,9 @@
<%# Defines a global I18n object containing the language of the current locale %>
<%
# Invalidate this asset if locale changes.
Dir[Rails.root.join('config', 'locales', "#{I18n.default_locale}.yml").to_s].each do |f|
depend_on(f)
end
%>
<%- I18n.backend.send(:init_translations) unless I18n.backend.initialized? %>
window.I18n = <%= I18n.backend.send(:translations)[I18n.default_locale].with_indifferent_access.to_json.html_safe %>

View File

@@ -4,5 +4,14 @@ window.translate = (key, options = {}) ->
unless 'I18n' of window
console.log 'The I18n object is undefined. Cannot translate text.'
return key
I18n.t(key, options)
dict = I18n
parts = key.split '.'
while (parts.length)
part = parts.shift()
return key unless part of dict
dict = dict[part]
text = dict
for name, value of options
text = text.split("%{#{name}}").join(value)
text
window.t = window.translate

View File

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

View File

@@ -1,18 +1,12 @@
Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeElements, PaymentMethods, $http, Navigation, CurrentHub, RailsFlashLoader, Loading)->
Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $http, Navigation, CurrentHub, RailsFlashLoader, Loading)->
new class Checkout
errors: {}
secrets: {}
order: CurrentOrder.order
purchase: ->
if @paymentMethod()?.method_type == 'stripe' && !@secrets.selected_card
StripeElements.requestToken(@secrets, @submit)
else
@submit()
submit: =>
submit: ->
Loading.message = t 'submitting_order'
$http.put('/checkout.json', {order: @preprocess()}).success (data, status)=>
$http.put('/checkout', {order: @preprocess()}).success (data, status)=>
Navigation.go data.path
.error (response, status)=>
if response.path
@@ -59,23 +53,6 @@ Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeE
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

@@ -1,41 +0,0 @@
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

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

View File

@@ -1,18 +0,0 @@
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

@@ -11,11 +11,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
for key, value of enterpriseAttributes
@enterprise[key] = value
# 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) =>
create: =>
Loading.message = t('creating') + " " + @enterprise.name
$http(
method: "POST"
@@ -37,7 +33,6 @@ 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,6 +21,3 @@ Darkswarm.factory 'Navigation', ($location, $window) ->
$window.location.href = path
else
$window.location.pathname = path
reload: ->
$window.location.reload()

View File

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

View File

@@ -1,18 +1,7 @@
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

@@ -1,47 +0,0 @@
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

@@ -1,22 +0,0 @@
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,7 +6,8 @@
//
//= require 'jquery'
//= require store/spree_frontend
//= require store/spree_core
//= require store/spree_auth
//= require store/spree_promo
//= require_tree .

View File

@@ -6,4 +6,4 @@
{{ message }}
.action-buttons.text-center
%button{ ng: { click: "close()" } }
= t(:ok)
OK

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')
Select all
.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')
Select all
.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')
Obsolete master
.exchange-product-variant{'ng-repeat' => 'variant in product.variants'}
%label

View File

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

View File

@@ -7,5 +7,4 @@
id: "enterprise_tag_rules_attributes_{{tagGroup.startIndex + $index}}_preferred_matched_order_cycles_visibility",
name: "enterprise[tag_rules_attributes][{{tagGroup.startIndex + $index}}][preferred_matched_order_cycles_visibility]",
ng: { value: "'hidden'", if: "rule.is_default" } }
%span.text-normal{ ng: { if: "rule.is_default" } }
=t(:not_visible)
%span.text-normal{ ng: { if: "rule.is_default" } } not visible

View File

@@ -7,5 +7,4 @@
id: "enterprise_tag_rules_attributes_{{tagGroup.startIndex + $index}}_preferred_matched_payment_methods_visibility",
name: "enterprise[tag_rules_attributes][{{tagGroup.startIndex + $index}}][preferred_matched_payment_methods_visibility]",
ng: { value: "'hidden'", if: "rule.is_default" } }
%span.text-normal{ ng: { if: "rule.is_default" } }
= t(:not_visible)
%span.text-normal{ ng: { if: "rule.is_default" } } not visible

View File

@@ -7,5 +7,4 @@
id: "enterprise_tag_rules_attributes_{{tagGroup.startIndex + $index}}_preferred_matched_variants_visibility",
name: "enterprise[tag_rules_attributes][{{tagGroup.startIndex + $index}}][preferred_matched_variants_visibility]",
ng: { value: "'hidden'", if: "rule.is_default" } }
%span.text-normal{ ng: { if: "rule.is_default" } }
= t(:not_visible)
%span.text-normal{ ng: { if: "rule.is_default" } } not visible

View File

@@ -7,6 +7,4 @@
id: "enterprise_tag_rules_attributes_{{tagGroup.startIndex + $index}}_preferred_matched_shipping_methods_visibility",
name: "enterprise[tag_rules_attributes][{{tagGroup.startIndex + $index}}][preferred_matched_shipping_methods_visibility]",
ng: { value: "'hidden'", if: "rule.is_default" } }
%span.text-normal{ ng: { if: "rule.is_default" } }
= t(:not_visible)
%span.text-normal{ ng: { if: "rule.is_default" } } not visible

View File

@@ -1,5 +1,4 @@
%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

@@ -11,7 +11,7 @@
%span.filter-shopfront.property-selectors.pad-top
%ul.inline-block
%li{"ng-repeat" => "property in enterprise.supplied_properties"}
%a.button.tiny.disabled{"ng-bind" => "property.presentation"}
%a.button.tiny{"ng-bind" => "property.presentation"}
.about-container.pad-top
%img.enterprise-logo{"ng-src" => "{{::enterprise.logo}}", "ng-if" => "::enterprise.logo"}

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 }}")
+ {{ overFlowSelectors().length }} more
%i.ofn-i_052-point-down
.f-dropdown.text-right.content{ ng: { attr: { id: "{{ 'show-more-' + selectorName }}" } } }
%ul

View File

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

View File

@@ -1,80 +0,0 @@
@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,6 +24,8 @@ light: #ccc
}
}
/*.ui-dialog .ui-icon-closethick{background:url(/static/assets/dialogCloseButton.png);}*/
.ui-dialog .ui-widget-header{
background-image: none;
background-color: #ffffff;
@@ -40,18 +42,21 @@ 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 .ui-dialog-titlebar .ui-dialog-titlebar-close {
.ui-dialog-titlebar-close {
float: right;
border: none;
background: none;
&:before {
color: #000000;
font-size: 2em;
@@ -71,18 +76,9 @@ 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,5 +1,27 @@
@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

@@ -28,8 +28,8 @@ text-angular .ta-editor {
left: 275px;
}
span.error, div.error:not(.flash) {
color: #DA5354;
span.error, div.error {
color: #DA5354;
}
/* Fix conflict between Spree and elRTE's styles */
@@ -43,13 +43,6 @@ 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,10 +69,4 @@ table#listing_products.bulk {
margin-bottom: 0.5em;
}
}
td.left-actions {
a.view-variants, a.add-variant {
cursor: pointer;
}
}
}

View File

@@ -5,32 +5,9 @@
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 {
@@ -47,10 +24,6 @@
height: auto;
}
&.active_table {
margin: 0px;
}
.active_table_row {
h3 {
margin-top: 0.5em;

View File

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

View File

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

View File

@@ -1,71 +0,0 @@
body.embedded {
nav.top-bar {
ul.left, ul.center, ul.right li.current_hub {
display: none;
}
ul.right {
width: auto !important;
li {
float: left;
line-height: 4.6875rem;
height: 4.6875rem;
vertical-align: top;
}
li.powered-by {
display: inline-block;
}
}
&.show-for-large-up {
display: inherit !important;
}
&.show-for-medium-down {
display: none !important;
}
}
footer {
display: none;
}
}
nav.top-bar ul.right li.powered-by {
display: none;
margin-right: 0.4rem;
opacity: 0.6;
img {
height: 1.8em;
margin: 0px 0.4em 0.4em 0px;
}
span, a {
font-family: "Oswald", sans-serif;
font-size: 1rem;
font-weight: 300;
color: #555;
padding: 0 !important;
}
a:hover {
color: #000;
}
}
.blocked-cookies {
text-align: center;
margin-bottom: 0 !important;
&.hidden {
display: none;
}
a.button.allow {
background-color: rgba(0,0,0,0.25);
margin-bottom: 0.4em;
&:hover {
background-color: rgba(0,0,0,0.35);
}
}
}

View File

@@ -15,10 +15,6 @@
@mixin panepadding {
padding-top: 100px;
padding-bottom: 100px;
@media all and (max-width: 640px) {
padding-top: 25px;
}
}
@mixin paneWhiteText {

View File

@@ -1,16 +0,0 @@
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

@@ -1,71 +0,0 @@
@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,12 +408,3 @@ 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,8 +4,9 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*
*= require store/spree_frontend
*= require store/spree_core
*= require store/spree_auth
*= require store/spree_promo
*= require_self
*= require_tree .

View File

@@ -15,11 +15,11 @@ class Admin::AccountsAndBillingSettingsController < Spree::Admin::BaseController
def start_job
if @update_account_invoices_job || @finalize_account_invoices_job
flash[:error] = I18n.t(:accounts_and_billing_task_already_running_error)
flash[:error] = "A task is already running, please wait until it has finished"
else
new_job = "#{params[:job][:name]}".camelize.constantize.new
Delayed::Job.enqueue new_job
flash[:success] = I18n.t(:accounts_and_billing_start_task_notice)
flash[:success] = "Task Queued"
end
redirect_to_edit

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