mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge branch 'master' into 2-0-stable
* master: (125 commits) Fix syntax error in GETTING_STARTED.md Fix syntax error in README.md Fix link syntax errors in REAME.md and GETTING_STARTED.md Style recently merged code Update gem i18n-js to pick up locale changes Fix embedded shopfront menu responsiveness Add communications links to README Fix script/setup by making it less clever Change import and reset logic to work with first page Move options to first page Fix wrong sort predicates in customer index Reset reverse when clicking another column to sort Move logic for toggling by column into SortOptions Generalize sorting through SortOptions service Remove unused sorting preferences in ColumnsCtrl Fix frontend sorting in "Bulk Order Management" Fix frontend sorting in "Customers" index Change sorting to be done in ascending order first Wrap rows in customer index with TBODY tag Update .rubocop_todo.yml ...
This commit is contained in:
@@ -4,7 +4,7 @@ plugins:
|
||||
enabled: true
|
||||
channel: "rubocop-0-55"
|
||||
scss-lint:
|
||||
enabled: false
|
||||
enabled: true
|
||||
duplication:
|
||||
enabled: true
|
||||
exclude_patterns:
|
||||
@@ -16,9 +16,9 @@ checks:
|
||||
complex-logic:
|
||||
enabled: true
|
||||
file-lines:
|
||||
enabled: false
|
||||
enabled: true
|
||||
method-complexity:
|
||||
enabled: false
|
||||
enabled: true
|
||||
method-count:
|
||||
enabled: false
|
||||
method-lines:
|
||||
@@ -35,3 +35,4 @@ exclude_patterns:
|
||||
- "spec/**/*"
|
||||
- "vendor/**/*"
|
||||
- "app/assets/javascripts/shared/*"
|
||||
- "app/assets/javascripts/jquery-migrate-1.0.0.js"
|
||||
|
||||
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -16,6 +16,11 @@ context for others to understand it]
|
||||
[In case this should be present in the release notes, please write them or
|
||||
remove this section otherwise]
|
||||
|
||||
[To streamline the release process, please designate your PR with ONE of the following
|
||||
categories, based on the specification from keepachangelog.com (and delete the others):]
|
||||
|
||||
Changelog Category: Added | Changed | Deprecated | Removed | Fixed | Security
|
||||
|
||||
#### How is this related to the Spree upgrade?
|
||||
|
||||
[Any known conflicts with the Spree Upgrade? explain them or remove this section
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -32,7 +32,6 @@ public/stylesheets
|
||||
public/images
|
||||
public/spree
|
||||
config/abr.yml
|
||||
config/newrelic.yml
|
||||
config/initializers/feature_toggle.rb
|
||||
config/initializers/db2fog.rb
|
||||
NERD_tree*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --exclude-limit 1400`
|
||||
# on 2018-05-08 14:46:01 +1000 using RuboCop version 0.55.0.
|
||||
# on 2018-07-20 18:57:26 +0200 using RuboCop version 0.55.0.
|
||||
# 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: 124
|
||||
# Offense count: 116
|
||||
# Cop supports --auto-correct.
|
||||
Layout/AlignArray:
|
||||
Exclude:
|
||||
@@ -119,7 +119,7 @@ Layout/ElseAlignment:
|
||||
- 'app/serializers/api/admin/order_cycle_serializer.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
|
||||
# Offense count: 209
|
||||
# Offense count: 205
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLines:
|
||||
Exclude:
|
||||
@@ -173,7 +173,6 @@ Layout/EmptyLines:
|
||||
- 'app/models/spree/shipping_method_decorator.rb'
|
||||
- 'app/models/spree/tax_rate_decorator.rb'
|
||||
- 'app/models/spree/taxon_decorator.rb'
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
- 'app/serializers/api/enterprise_serializer.rb'
|
||||
- 'lib/open_food_network/cached_products_renderer.rb'
|
||||
- 'lib/open_food_network/enterprise_fee_applicator.rb'
|
||||
@@ -193,6 +192,7 @@ Layout/EmptyLines:
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/scope_product_to_hub.rb'
|
||||
- 'lib/open_food_network/scope_variant_to_hub.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/order_decorator.rb'
|
||||
- 'lib/tasks/cache.rake'
|
||||
- 'lib/tasks/dev.rake'
|
||||
@@ -217,7 +217,6 @@ Layout/EmptyLines:
|
||||
- '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'
|
||||
@@ -282,6 +281,7 @@ Layout/EmptyLinesAroundBlockBody:
|
||||
- 'lib/spree/money_decorator.rb'
|
||||
- 'lib/tasks/dev.rake'
|
||||
- 'lib/tasks/users.rake'
|
||||
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
|
||||
- 'spec/controllers/admin/tag_rules_controller_spec.rb'
|
||||
- 'spec/controllers/cart_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
|
||||
@@ -294,6 +294,7 @@ 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_groups_spec.rb'
|
||||
- 'spec/features/consumer/shopping/embedded_shopfronts_spec.rb'
|
||||
- 'spec/features/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
|
||||
@@ -321,7 +322,7 @@ Layout/EmptyLinesAroundBlockBody:
|
||||
- 'spec/support/matchers/select2_matchers.rb'
|
||||
- 'spec/support/matchers/table_matchers.rb'
|
||||
|
||||
# Offense count: 27
|
||||
# Offense count: 26
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
||||
@@ -332,7 +333,6 @@ Layout/EmptyLinesAroundClassBody:
|
||||
- 'app/controllers/admin/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/admin/inventory_items_controller.rb'
|
||||
- 'app/controllers/admin/invoice_settings_controller.rb'
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/admin/tag_rules_controller.rb'
|
||||
- 'app/controllers/api/enterprises_controller.rb'
|
||||
- 'app/controllers/application_controller.rb'
|
||||
@@ -364,7 +364,7 @@ Layout/EndAlignment:
|
||||
- 'app/serializers/api/admin/for_order_cycle/supplied_product_serializer.rb'
|
||||
- 'app/serializers/api/admin/order_cycle_serializer.rb'
|
||||
|
||||
# Offense count: 53
|
||||
# Offense count: 49
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
||||
Layout/ExtraSpacing:
|
||||
@@ -405,37 +405,29 @@ Layout/ExtraSpacing:
|
||||
- 'spec/spec_helper.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
||||
Layout/FirstParameterIndentation:
|
||||
Exclude:
|
||||
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
||||
Layout/IndentArray:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
# Offense count: 52
|
||||
# Offense count: 51
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# Configuration parameters: IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
||||
Layout/IndentHash:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
|
||||
- 'app/controllers/admin/business_model_configuration_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/search_controller_decorator.rb'
|
||||
- 'app/jobs/finalize_account_invoices.rb'
|
||||
- 'app/jobs/update_account_invoices.rb'
|
||||
- 'app/jobs/update_billable_periods.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb'
|
||||
- 'spec/controllers/admin/business_model_configuration_controller_spec.rb'
|
||||
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
|
||||
- 'spec/features/admin/accounts_and_billing_settings_spec.rb'
|
||||
- 'spec/features/admin/business_model_configuration_spec.rb'
|
||||
- 'spec/features/admin/tax_settings_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
|
||||
- 'spec/support/request/authentication_workflow.rb'
|
||||
EnforcedStyle: consistent
|
||||
|
||||
# Offense count: 20
|
||||
# Offense count: 19
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: normal, rails
|
||||
@@ -471,15 +463,13 @@ Layout/IndentationWidth:
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/spree/calculator/flexi_rate_spec.rb'
|
||||
|
||||
# Offense count: 51
|
||||
# Offense count: 46
|
||||
# Cop supports --auto-correct.
|
||||
Layout/LeadingCommentSpace:
|
||||
Exclude:
|
||||
- 'Gemfile'
|
||||
- 'app/models/billable_period.rb'
|
||||
- 'app/models/content_configuration.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spreadsheet_entry.rb'
|
||||
- 'app/models/spree/inventory_unit_decorator.rb'
|
||||
- 'app/models/spree/taxon_decorator.rb'
|
||||
- 'app/overrides/add_capture_order_shortcut.rb'
|
||||
@@ -523,7 +513,7 @@ Layout/MultilineBlockLayout:
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
- 'spec/serializers/enterprise_serializer_spec.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: symmetrical, new_line, same_line
|
||||
@@ -532,7 +522,6 @@ Layout/MultilineHashBraceLayout:
|
||||
- 'app/controllers/spree/admin/products_controller_decorator.rb'
|
||||
- 'app/models/billable_period.rb'
|
||||
- 'lib/spree/product_filters.rb'
|
||||
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
|
||||
- 'spec/support/request/authentication_workflow.rb'
|
||||
|
||||
# Offense count: 7
|
||||
@@ -557,7 +546,7 @@ Layout/MultilineMethodCallIndentation:
|
||||
- 'spec/lib/open_food_network/cached_products_renderer_spec.rb'
|
||||
- 'spec/serializers/variant_serializer_spec.rb'
|
||||
|
||||
# Offense count: 32
|
||||
# Offense count: 30
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented
|
||||
@@ -568,7 +557,6 @@ Layout/MultilineOperationIndentation:
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller_decorator.rb'
|
||||
- 'app/helpers/enterprises_helper.rb'
|
||||
- 'app/models/producer_property.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/ability_decorator.rb'
|
||||
- 'app/models/spree/product_set.rb'
|
||||
- 'app/models/variant_override_set.rb'
|
||||
@@ -588,7 +576,7 @@ Layout/SpaceAfterColon:
|
||||
- 'spec/models/variant_override_spec.rb'
|
||||
- 'spec/spec_helper.rb'
|
||||
|
||||
# Offense count: 85
|
||||
# Offense count: 83
|
||||
# Cop supports --auto-correct.
|
||||
Layout/SpaceAfterComma:
|
||||
Exclude:
|
||||
@@ -596,7 +584,6 @@ Layout/SpaceAfterComma:
|
||||
- 'app/controllers/spree/admin/products_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'
|
||||
@@ -628,7 +615,7 @@ Layout/SpaceAfterSemicolon:
|
||||
Exclude:
|
||||
- 'spec/controllers/spree/admin/base_controller_spec.rb'
|
||||
|
||||
# Offense count: 65
|
||||
# Offense count: 62
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: space, no_space
|
||||
@@ -647,7 +634,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
||||
- 'app/models/exchange.rb'
|
||||
- 'app/models/model_set.rb'
|
||||
- 'app/models/order_cycle_set.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/calculator/per_item_decorator.rb'
|
||||
- 'app/models/spree/payment_decorator.rb'
|
||||
- 'app/models/spree/payment_method_decorator.rb'
|
||||
@@ -665,6 +651,7 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'lib/open_food_network/scope_variant_to_hub.rb'
|
||||
- 'lib/open_food_network/tag_rule_applicator.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/money_decorator.rb'
|
||||
- 'spec/features/admin/enterprise_relationships_spec.rb'
|
||||
- 'spec/features/admin/reports_spec.rb'
|
||||
@@ -673,21 +660,20 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
||||
- 'spec/support/request/distribution_helper.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 59
|
||||
# Offense count: 57
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment.
|
||||
Layout/SpaceAroundOperators:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/helpers/admin/business_model_configuration_helper.rb'
|
||||
- 'app/jobs/update_billable_periods.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/address_decorator.rb'
|
||||
- 'app/overrides/remove_search_bar.rb'
|
||||
- 'app/overrides/remove_side_bar.rb'
|
||||
- 'app/overrides/replace_shipping_address_form_with_distributor_details.rb'
|
||||
- 'app/serializers/api/enterprise_serializer.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/product_filters.rb'
|
||||
- 'spec/controllers/admin/enterprises_controller_spec.rb'
|
||||
- 'spec/controllers/cart_controller_spec.rb'
|
||||
@@ -732,7 +718,7 @@ Layout/SpaceInLambdaLiteral:
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
|
||||
# Offense count: 129
|
||||
# Offense count: 130
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
||||
# SupportedStyles: space, no_space, compact
|
||||
@@ -752,8 +738,9 @@ Layout/SpaceInsideArrayLiteralBrackets:
|
||||
- 'spec/jobs/update_billable_periods_spec.rb'
|
||||
- 'spec/lib/open_food_network/order_grouper_spec.rb'
|
||||
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
|
||||
# Offense count: 192
|
||||
# Offense count: 194
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
||||
# SupportedStyles: space, no_space
|
||||
@@ -807,7 +794,7 @@ Layout/SpaceInsideBlockBraces:
|
||||
- 'spec/spec_helper.rb'
|
||||
- 'spec/support/cancan_helper.rb'
|
||||
|
||||
# Offense count: 786
|
||||
# Offense count: 798
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
||||
# SupportedStyles: space, no_space, compact
|
||||
@@ -839,7 +826,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/producer_property.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/gateway/stripe_connect.rb'
|
||||
- 'app/models/spree/order_populator_decorator.rb'
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
@@ -855,6 +841,7 @@ Layout/SpaceInsideHashLiteralBraces:
|
||||
- 'lib/open_food_network/reports/rule.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/variant_and_line_item_naming.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/tasks/users.rake'
|
||||
- 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb'
|
||||
- 'spec/controllers/admin/business_model_configuration_controller_spec.rb'
|
||||
@@ -900,6 +887,7 @@ Layout/SpaceInsideHashLiteralBraces:
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
- 'spec/models/model_set_spec.rb'
|
||||
- 'spec/models/product_distribution_spec.rb'
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
- 'spec/models/spree/ability_spec.rb'
|
||||
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
|
||||
- 'spec/models/spree/image_spec.rb'
|
||||
@@ -953,7 +941,7 @@ Layout/Tab:
|
||||
- 'spec/lib/spree/product_filters_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
|
||||
# Offense count: 62
|
||||
# Offense count: 60
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
@@ -969,7 +957,6 @@ Layout/TrailingWhitespace:
|
||||
- 'app/views/json/_producer.rabl'
|
||||
- 'app/views/json/partials/_producer.rabl'
|
||||
- 'spec/controllers/admin/column_preferences_controller_spec.rb'
|
||||
- 'spec/controllers/shop_controller_spec.rb'
|
||||
- 'spec/features/admin/enterprise_user_spec.rb'
|
||||
- 'spec/features/admin/variant_overrides_spec.rb'
|
||||
- 'spec/helpers/enterprises_helper_spec.rb'
|
||||
@@ -985,10 +972,14 @@ Layout/TrailingWhitespace:
|
||||
- 'spec/views/json/producers.json.rabl_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Lint/DeprecatedClassMethods:
|
||||
Lint/AmbiguousOperator:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'spec/controllers/spree/admin/payments_controller_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Lint/BooleanSymbol:
|
||||
Exclude:
|
||||
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
Lint/DuplicateMethods:
|
||||
@@ -1016,16 +1007,16 @@ Lint/InheritException:
|
||||
- 'lib/open_food_network/cached_products_renderer.rb'
|
||||
- 'lib/open_food_network/products_renderer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Lint/InterpolationCheck:
|
||||
Exclude:
|
||||
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Lint/LiteralAsCondition:
|
||||
Exclude:
|
||||
- 'lib/open_food_network/rack_request_blocker.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Lint/NonLocalExitFromIterator:
|
||||
Exclude:
|
||||
- 'app/models/product_importer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Lint/ScriptPermission:
|
||||
@@ -1039,7 +1030,7 @@ Lint/ShadowingOuterLocalVariable:
|
||||
- 'app/models/spree/product_set.rb'
|
||||
- 'spec/models/model_set_spec.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Offense count: 7
|
||||
# Cop supports --auto-correct.
|
||||
Lint/StringConversionInInterpolation:
|
||||
Exclude:
|
||||
@@ -1049,13 +1040,14 @@ Lint/StringConversionInInterpolation:
|
||||
- 'app/helpers/injection_helper.rb'
|
||||
- 'app/helpers/spree/products_helper_decorator.rb'
|
||||
- 'app/serializers/api/admin/tag_rule_serializer.rb'
|
||||
- 'spec/features/admin/product_import_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Lint/UnderscorePrefixedVariableName:
|
||||
Exclude:
|
||||
- 'spec/support/cancan_helper.rb'
|
||||
|
||||
# Offense count: 125
|
||||
# Offense count: 123
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
||||
Lint/UnusedBlockArgument:
|
||||
@@ -1066,7 +1058,6 @@ Lint/UnusedBlockArgument:
|
||||
- 'app/controllers/spree/orders_controller_decorator.rb'
|
||||
- 'app/models/column_preference.rb'
|
||||
- 'app/models/model_set.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/order_populator_decorator.rb'
|
||||
- 'lib/open_food_network/bulk_coop_report.rb'
|
||||
@@ -1080,6 +1071,7 @@ Lint/UnusedBlockArgument:
|
||||
- 'lib/open_food_network/reports/bulk_coop_allocation_report.rb'
|
||||
- 'lib/open_food_network/reports/bulk_coop_supplier_report.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'spec/lib/open_food_network/order_grouper_spec.rb'
|
||||
- 'spec/support/cancan_helper.rb'
|
||||
- 'spec/support/delayed_job_helper.rb'
|
||||
@@ -1118,7 +1110,7 @@ Lint/UselessAccessModifier:
|
||||
- 'lib/open_food_network/reports/bulk_coop_report.rb'
|
||||
- 'spec/lib/open_food_network/reports/report_spec.rb'
|
||||
|
||||
# Offense count: 315
|
||||
# Offense count: 288
|
||||
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
||||
Lint/Void:
|
||||
Exclude:
|
||||
@@ -1143,9 +1135,7 @@ Lint/Void:
|
||||
- 'spec/features/admin/enterprises_spec.rb'
|
||||
- 'spec/features/admin/order_cycles_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'
|
||||
@@ -1181,15 +1171,14 @@ Lint/Void:
|
||||
- 'spec/serializers/enterprise_serializer_spec.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 945
|
||||
# Offense count: 998
|
||||
# Configuration parameters: CountComments, ExcludedMethods.
|
||||
Metrics/BlockLength:
|
||||
Max: 773
|
||||
Max: 776
|
||||
|
||||
# Offense count: 8
|
||||
# Offense count: 7
|
||||
Naming/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'
|
||||
@@ -1221,7 +1210,7 @@ Naming/MemoizedInstanceVariableName:
|
||||
- 'app/controllers/spree/admin/payments_controller_decorator.rb'
|
||||
- 'lib/open_food_network/address_finder.rb'
|
||||
|
||||
# Offense count: 25
|
||||
# Offense count: 22
|
||||
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
|
||||
# NamePrefix: is_, has_, have_
|
||||
# NamePrefixBlacklist: is_, has_, have_
|
||||
@@ -1234,8 +1223,6 @@ Naming/PredicateName:
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spreadsheet_entry.rb'
|
||||
- 'app/models/spree/ability_decorator.rb'
|
||||
- 'app/models/spree/adjustment_decorator.rb'
|
||||
- 'app/models/spree/line_item_decorator.rb'
|
||||
@@ -1263,10 +1250,11 @@ Naming/UncommunicativeMethodParamName:
|
||||
- 'app/services/subscription_validator.rb'
|
||||
- 'lib/open_food_network/property_merge.rb'
|
||||
- 'lib/open_food_network/reports/bulk_coop_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'spec/lib/open_food_network/reports/report_spec.rb'
|
||||
- 'spec/mailers/producer_mailer_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 3
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: snake_case, camelCase
|
||||
Naming/VariableName:
|
||||
@@ -1331,24 +1319,26 @@ Performance/StringReplacement:
|
||||
- 'app/helpers/spree/admin/navigation_helper_decorator.rb'
|
||||
- 'app/models/spree/preferences/file_configuration.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
Performance/UnneededSort:
|
||||
Exclude:
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
- 'spec/features/admin/order_cycles_spec.rb'
|
||||
|
||||
# Offense count: 203
|
||||
# Offense count: 206
|
||||
# Cop supports --auto-correct.
|
||||
Rails/ActiveRecordAliases:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/bulk_line_items_controller.rb'
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
||||
- 'app/controllers/api/customers_controller.rb'
|
||||
- 'app/controllers/api/enterprises_controller.rb'
|
||||
- 'app/controllers/api/product_images_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/line_items_controller_decorator.rb'
|
||||
- 'app/controllers/spree/credit_cards_controller.rb'
|
||||
- 'app/controllers/spree/orders_controller_decorator.rb'
|
||||
- 'app/helpers/i18n_helper.rb'
|
||||
- 'app/jobs/subscription_placement_job.rb'
|
||||
@@ -1366,7 +1356,6 @@ Rails/ActiveRecordAliases:
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/subscription_payment_updater.rb'
|
||||
- 'lib/stripe/profile_storer.rb'
|
||||
- 'spec/controllers/admin/customers_controller_spec.rb'
|
||||
- 'spec/controllers/admin/proxy_orders_controller_spec.rb'
|
||||
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||
- 'spec/controllers/line_items_controller_spec.rb'
|
||||
@@ -1388,6 +1377,7 @@ Rails/ActiveRecordAliases:
|
||||
- 'spec/jobs/update_billable_periods_spec.rb'
|
||||
- 'spec/lib/open_food_network/products_cache_refreshment_spec.rb'
|
||||
- 'spec/lib/open_food_network/products_cache_spec.rb'
|
||||
- 'spec/lib/open_food_network/proxy_order_syncer_spec.rb'
|
||||
- 'spec/models/customer_spec.rb'
|
||||
- 'spec/models/enterprise_caching_spec.rb'
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
@@ -1395,6 +1385,7 @@ Rails/ActiveRecordAliases:
|
||||
- 'spec/models/producer_property_spec.rb'
|
||||
- 'spec/models/proxy_order_spec.rb'
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
- 'spec/models/spree/credit_card_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
- 'spec/models/spree/product_spec.rb'
|
||||
@@ -1490,7 +1481,7 @@ Rails/HasManyOrHasOneDependent:
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
|
||||
# Offense count: 43
|
||||
# Offense count: 45
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: numeric, symbolic
|
||||
@@ -1505,6 +1496,7 @@ Rails/HttpStatus:
|
||||
- 'app/controllers/admin/manager_invitations_controller.rb'
|
||||
- 'app/controllers/admin/tag_rules_controller.rb'
|
||||
- 'app/controllers/admin/variant_overrides_controller.rb'
|
||||
- 'app/controllers/api/customers_controller.rb'
|
||||
- 'app/controllers/api/enterprises_controller.rb'
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
@@ -1519,7 +1511,7 @@ Rails/HttpStatus:
|
||||
- 'app/controllers/stripe/callbacks_controller.rb'
|
||||
- 'app/controllers/stripe/webhooks_controller.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Offense count: 6
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
|
||||
@@ -1544,7 +1536,7 @@ Rails/Presence:
|
||||
Exclude:
|
||||
- 'app/serializers/api/admin/customer_serializer.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
|
||||
Rails/Present:
|
||||
@@ -1561,7 +1553,7 @@ Rails/ReadWriteAttribute:
|
||||
Exclude:
|
||||
- 'app/models/enterprise.rb'
|
||||
|
||||
# Offense count: 45
|
||||
# Offense count: 47
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/ScopeArgs:
|
||||
@@ -1580,12 +1572,11 @@ Rails/ScopeArgs:
|
||||
- 'app/models/spree/shipping_method_decorator.rb'
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
|
||||
# Offense count: 18
|
||||
# Offense count: 17
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: strict, flexible
|
||||
Rails/TimeZone:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/api/statuses_controller.rb'
|
||||
- 'app/jobs/heartbeat_job.rb'
|
||||
- 'app/models/enterprise_relationship.rb'
|
||||
@@ -1622,7 +1613,7 @@ Rails/Validation:
|
||||
- 'app/models/spree/variant_decorator.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
|
||||
# Offense count: 35
|
||||
# Offense count: 20
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, conditionals
|
||||
@@ -1635,8 +1626,6 @@ Style/AndOr:
|
||||
- 'app/controllers/spree/orders_controller_decorator.rb'
|
||||
- 'app/helpers/discourse_helper.rb'
|
||||
- 'app/helpers/spree/admin/navigation_helper_decorator.rb'
|
||||
- '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'
|
||||
@@ -1682,6 +1671,7 @@ Style/BracesAroundHashParameters:
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/reports/rule.rb'
|
||||
- 'lib/open_food_network/variant_and_line_item_naming.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb'
|
||||
- 'spec/controllers/admin/business_model_configuration_controller_spec.rb'
|
||||
- 'spec/controllers/admin/enterprises_controller_spec.rb'
|
||||
@@ -1732,7 +1722,7 @@ Style/CaseEquality:
|
||||
- 'app/helpers/angular_form_helper.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 87
|
||||
# Offense count: 86
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||
# SupportedStyles: nested, compact
|
||||
@@ -1743,7 +1733,6 @@ Style/ClassAndModuleChildren:
|
||||
- 'app/controllers/admin/business_model_configuration_controller.rb'
|
||||
- 'app/controllers/admin/cache_settings_controller.rb'
|
||||
- 'app/controllers/admin/invoice_settings_controller.rb'
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/spree/store_controller_decorator.rb'
|
||||
- 'app/helpers/angular_form_helper.rb'
|
||||
- 'app/models/calculator/flat_percent_per_item.rb'
|
||||
@@ -1833,16 +1822,20 @@ Style/ClassVars:
|
||||
Exclude:
|
||||
- 'lib/open_food_network/rack_request_blocker.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
Style/ColonMethodCall:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/spree/admin/products_controller_decorator.rb'
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
|
||||
# Offense count: 12
|
||||
# Offense count: 1
|
||||
Style/CommentedKeyword:
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
|
||||
# Offense count: 10
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
||||
# SupportedStyles: assign_to_condition, assign_inside_condition
|
||||
@@ -1872,14 +1865,6 @@ Style/EachWithObject:
|
||||
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||
- 'lib/open_food_network/products_renderer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty, nil, both
|
||||
Style/EmptyElse:
|
||||
Exclude:
|
||||
- 'app/models/spreadsheet_entry.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
Style/EmptyLiteral:
|
||||
@@ -1916,7 +1901,7 @@ Style/FormatStringToken:
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
|
||||
# Offense count: 88
|
||||
# Offense count: 83
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
@@ -1945,7 +1930,6 @@ Style/GuardClause:
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/producer_property.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/classification_decorator.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/order_populator_decorator.rb'
|
||||
@@ -1967,7 +1951,7 @@ Style/GuardClause:
|
||||
- 'spec/support/request/distribution_helper.rb'
|
||||
- 'spec/support/request/shop_workflow.rb'
|
||||
|
||||
# Offense count: 1040
|
||||
# Offense count: 970
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
||||
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
||||
@@ -2014,7 +1998,6 @@ Style/HashSyntax:
|
||||
- 'app/models/open_food_network/calculator/weight.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/product_distribution.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spree/address_decorator.rb'
|
||||
- 'app/models/spree/adjustment_decorator.rb'
|
||||
- 'app/models/spree/classification_decorator.rb'
|
||||
@@ -2097,6 +2080,7 @@ Style/HashSyntax:
|
||||
- 'spec/features/admin/subscriptions_spec.rb'
|
||||
- 'spec/features/admin/variant_overrides_spec.rb'
|
||||
- 'spec/features/consumer/account/cards_spec.rb'
|
||||
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
|
||||
- 'spec/features/consumer/shopping/products_spec.rb'
|
||||
- 'spec/features/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/jobs/subscription_placement_job_spec.rb'
|
||||
@@ -2127,7 +2111,7 @@ Style/HashSyntax:
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
- 'spec/support/seeds.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 3
|
||||
Style/IfInsideElse:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/column_preferences_controller.rb'
|
||||
@@ -2155,20 +2139,19 @@ Style/LineEndConcatenation:
|
||||
- 'lib/spree/core/controller_helpers/respond_with_decorator.rb'
|
||||
- 'spec/controllers/spree/admin/base_controller_spec.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IgnoredMethods.
|
||||
Style/MethodCallWithoutArgsParentheses:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/payment_methods_controller_decorator.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/views/json/_groups.rabl'
|
||||
- 'spec/controllers/spree/orders_controller_spec.rb'
|
||||
- 'spec/features/consumer/registration_spec.rb'
|
||||
- 'spec/models/spree/payment_method_spec.rb'
|
||||
- 'spec/support/request/ui_component_helper.rb'
|
||||
|
||||
# Offense count: 14
|
||||
# Offense count: 13
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
||||
@@ -2181,7 +2164,6 @@ Style/MethodDefParentheses:
|
||||
- 'lib/open_food_network/distribution_change_validator.rb'
|
||||
- 'lib/open_food_network/feature_toggle.rb'
|
||||
- 'lib/open_food_network/group_buy_report.rb'
|
||||
- 'lib/open_food_network/order_and_distributor_report.rb'
|
||||
- 'spec/support/request/authentication_workflow.rb'
|
||||
- 'spec/support/request/ui_component_helper.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
@@ -2235,23 +2217,21 @@ Style/NestedTernaryOperator:
|
||||
- 'app/views/spree/api/products/bulk_show.v1.rabl'
|
||||
- 'app/views/spree/api/variants/bulk_show.v1.rabl'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, MinBodyLength.
|
||||
# SupportedStyles: skip_modifier_ifs, always
|
||||
Style/Next:
|
||||
Exclude:
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'lib/tasks/data.rake'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 7
|
||||
# Cop supports --auto-correct.
|
||||
Style/NilComparison:
|
||||
Exclude:
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'lib/open_food_network/order_grouper.rb'
|
||||
- 'spec/features/admin/enterprise_fees_spec.rb'
|
||||
- 'spec/features/admin/product_import_spec.rb'
|
||||
- 'spec/features/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/models/order_cycle_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
@@ -2270,7 +2250,7 @@ Style/NumericLiteralPrefix:
|
||||
Exclude:
|
||||
- 'spec/features/admin/order_cycles_spec.rb'
|
||||
|
||||
# Offense count: 12
|
||||
# Offense count: 13
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Strict.
|
||||
Style/NumericLiterals:
|
||||
@@ -2291,6 +2271,7 @@ Style/NumericPredicate:
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'lib/open_food_network/integrity_checker.rb'
|
||||
- 'lib/open_food_network/rack_request_blocker.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/money_decorator.rb'
|
||||
|
||||
# Offense count: 2
|
||||
@@ -2306,14 +2287,13 @@ Style/ParenthesesAroundCondition:
|
||||
Exclude:
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: short, verbose
|
||||
Style/PreferredHashMethods:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/orders_controller_decorator.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'spec/controllers/spree/admin/orders_controller_spec.rb'
|
||||
|
||||
# Offense count: 18
|
||||
@@ -2359,14 +2339,13 @@ Style/RedundantParentheses:
|
||||
- 'spec/controllers/admin/enterprises_controller_spec.rb'
|
||||
- 'spec/features/admin/bulk_product_update_spec.rb'
|
||||
|
||||
# Offense count: 13
|
||||
# Offense count: 10
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowMultipleReturnValues.
|
||||
Style/RedundantReturn:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/spree/credit_cards_controller.rb'
|
||||
- 'app/models/enterprise_fee.rb'
|
||||
- 'app/models/spree/adjustment_decorator.rb'
|
||||
@@ -2374,7 +2353,7 @@ Style/RedundantReturn:
|
||||
- 'app/models/spree/order_populator_decorator.rb'
|
||||
- 'app/serializers/api/admin/enterprise_serializer.rb'
|
||||
|
||||
# Offense count: 114
|
||||
# Offense count: 98
|
||||
# Cop supports --auto-correct.
|
||||
Style/RedundantSelf:
|
||||
Exclude:
|
||||
@@ -2385,8 +2364,6 @@ Style/RedundantSelf:
|
||||
- 'app/models/open_food_network/calculator/weight.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/producer_property.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
- 'app/models/spreadsheet_entry.rb'
|
||||
- 'app/models/spree/address_decorator.rb'
|
||||
- 'app/models/spree/calculator/flat_percent_item_total_decorator.rb'
|
||||
- 'app/models/spree/calculator/flexi_rate_decorator.rb'
|
||||
@@ -2409,7 +2386,7 @@ Style/RedundantSelf:
|
||||
- 'lib/open_food_network/reports/report.rb'
|
||||
- 'lib/open_food_network/variant_and_line_item_naming.rb'
|
||||
|
||||
# Offense count: 13
|
||||
# Offense count: 12
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
||||
# SupportedStyles: slashes, percent_r, mixed
|
||||
@@ -2424,7 +2401,7 @@ Style/RegexpLiteral:
|
||||
- 'lib/discourse/single_sign_on.rb'
|
||||
- 'spec/models/content_configuration_spec.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
Style/RescueModifier:
|
||||
Exclude:
|
||||
@@ -2508,15 +2485,7 @@ Style/TrailingUnderscoreVariable:
|
||||
Exclude:
|
||||
- 'lib/open_food_network/option_value_namer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
|
||||
# Whitelist: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
|
||||
Style/TrivialAccessors:
|
||||
Exclude:
|
||||
- 'app/models/product_importer.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
Style/UnlessElse:
|
||||
Exclude:
|
||||
@@ -2569,7 +2538,7 @@ Style/UnneededPercentQ:
|
||||
- 'spec/features/consumer/producers_spec.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 6392
|
||||
# Offense count: 6631
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Metrics/LineLength:
|
||||
|
||||
@@ -42,7 +42,7 @@ before_script:
|
||||
|
||||
script:
|
||||
- 'if [ "$KARMA" = "true" ]; then bundle exec rake karma:run; else echo "Skipping karma run"; fi'
|
||||
- "bundle exec rake 'knapsack:rspec[--tag ~performance]'"
|
||||
- "bundle exec rake 'knapsack:rspec[--format progress --tag ~performance]'"
|
||||
|
||||
after_success:
|
||||
- >
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
# Contributing
|
||||
We love pull requests from everyone. Any contribution is valuable, but there are two issue streams that we especially love people to work on:
|
||||
|
||||
1) Our delivery backlog, is managed via a ZenHub board (ZenHub extensions are available for most major browsers). We use a Kanban-style approach, whereby devs pick issues from the top of the backlog which has been organised according to current priorities. If you have some time and are interested in working on some issues from the backlog, please make yourself known on the [#dev](https://openfoodnetwork.slack.com/messages/C2GQ45KNU) channel on Slack and we can direct you to the most appropriate issue to pick up.
|
||||
1) Our delivery backlog, is managed via a ZenHub board (ZenHub extensions are available for most major browsers). We use a Kanban-style approach, whereby devs pick issues from the top of the backlog which has been organised according to current priorities. If you have some time and are interested in working on some issues from the backlog, please make yourself known on the [#dev][slack-dev] channel on Slack and we can direct you to the most appropriate issue to pick up.
|
||||
|
||||
2) Our list of bugs and other self-contained issues that we consider to be a good starting point for new contributors, or devs who aren’t able to commit to seeing a whole feature through. These issues are marked with the `# good first issue` label.
|
||||
|
||||
## Set up
|
||||
|
||||
Set up your local development environment by following the appropriate guide from the `Development environment setup` section in the [developer wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
|
||||
Please follow the [GETTING_STARTED](GETTING_STARTED.md) guide to set up your local dev environment.
|
||||
|
||||
Add an `upstream` remote that points to the main repo:
|
||||
This guide assumes that the git remote name of the main repo is `upstream` and that your fork is named `origin`.
|
||||
|
||||
cd ~/location-of-your-local-ofn-repo
|
||||
git remote add upstream https://github.com/openfoodfoundation/openfoodnetwork
|
||||
|
||||
If you haven't already done so, fork this repo using the `Fork` button in the top-right corner of this screen. Then ensure that your fork is listed as the `origin` remote on your local machine.
|
||||
|
||||
git remote set-url origin https://github.com/your-username/openfoodnetwork
|
||||
|
||||
Fetch the latest version of `master` from `upstream` (ie. the main repo):
|
||||
|
||||
git fetch upstream master
|
||||
|
||||
Create a new branch on your local machine for (based on `upstream/master`):
|
||||
Create a new branch on your local machine to make your changes against (based on `upstream/master`):
|
||||
|
||||
git checkout -b branch-name-here --no-track upstream/master
|
||||
|
||||
@@ -30,6 +19,10 @@ If you want to run the whole test suite, we recommend using a free CI service to
|
||||
|
||||
bundle exec rspec spec
|
||||
|
||||
## Internationalisation (i18n)
|
||||
|
||||
The locale `en` is maintained in the source code, but other locales are managed at [Transifex][ofn-transifex]. Read more about [internationalisation][i18n] in the developer wiki.
|
||||
|
||||
## Making a change
|
||||
|
||||
Make your changes to the codebase. We recommend using TDD. Add a test, make changes and get the test suite back to green.
|
||||
@@ -47,7 +40,7 @@ Push your changes to a branch on your fork:
|
||||
|
||||
## Submitting a Pull Request
|
||||
|
||||
Use the GitHub UI to submit a [new pull request][pr] against upstream/master. To increase the chances that your pull request is swiftly accepted please have a look at our guide to [[making a great pull request]].
|
||||
Use the GitHub UI to submit a [new pull request][pr] against upstream/master. To increase the chances that your pull request is swiftly accepted please have a look at our guide to [making a great pull request][great-pr].
|
||||
|
||||
TL;DR:
|
||||
* Write tests
|
||||
@@ -66,3 +59,6 @@ From here, your pull request will progress through the [Review, Test, Merge & De
|
||||
[rebase]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing/workflow-walkthrough
|
||||
[travis]: https://travis-ci.org/
|
||||
[semaphore]: https://semaphoreci.com/
|
||||
[slack-dev]: https://openfoodnetwork.slack.com/messages/C2GQ45KNU
|
||||
[ofn-transifex]: https://www.transifex.com/open-food-foundation/open-food-network/
|
||||
[i18n]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/i18n
|
||||
|
||||
104
GETTING_STARTED.md
Normal file
104
GETTING_STARTED.md
Normal file
@@ -0,0 +1,104 @@
|
||||
### Getting Started
|
||||
|
||||
This is a general guide to setting up an Open Food Network development environment on your local machine.
|
||||
|
||||
The following guides are located in the wiki and provide more OS-specific step-by-step instructions:
|
||||
|
||||
- [Ubuntu Setup Guide][ubuntu]
|
||||
- [macOS Sierra Setup Guide][sierra]
|
||||
- [OSX El Capitan Setup Guide][el-capitan]
|
||||
|
||||
### Dependencies
|
||||
|
||||
* Rails 3.2.x
|
||||
* Ruby 2.1.5
|
||||
* PostgreSQL database
|
||||
* PhantomJS (for testing)
|
||||
* See Gemfile for a list of gems required
|
||||
|
||||
If you are likely to need to manage multiple version of ruby on your local machine, we recommend version managers such as [rbenv](https://github.com/rbenv/rbenv) or [RVM](https://rvm.io/).
|
||||
|
||||
For those new to Rails, the following tutorial will help get you up to speed with configuring a [Rails environment](http://guides.rubyonrails.org/getting_started.html).
|
||||
|
||||
### Get it
|
||||
|
||||
If you're planning on contributing code to the project (which we [LOVE](CONTRIBUTING.md)), it is a good idea to begin by forking this repo using the `Fork` button in the top-right corner of this screen. You should then be able to use `git clone` to copy your fork onto your local machine.
|
||||
|
||||
git clone https://github.com/YOUR_GITHUB_USERNAME_HERE/openfoodnetwork
|
||||
|
||||
Jump into your new local copy of the Open Food Network:
|
||||
|
||||
cd openfoodnetwork
|
||||
|
||||
And then add an `upstream` remote that points to the main repo:
|
||||
|
||||
git remote add upstream https://github.com/openfoodfoundation/openfoodnetwork
|
||||
|
||||
Fetch the latest version of `master` from `upstream` (ie. the main repo):
|
||||
|
||||
git fetch upstream master
|
||||
|
||||
### Get it running
|
||||
|
||||
First, you need to create the database user the app will use by manually typing the following in your terminal:
|
||||
|
||||
```sh
|
||||
$ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"
|
||||
```
|
||||
|
||||
This will create the "ofn" user as superuser and allowing it to create databases.
|
||||
|
||||
Once done, run `script/setup`. If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
|
||||
|
||||
If you run into any other issues getting your local environment up and running please consult [the wiki][wiki].
|
||||
|
||||
If still you get stuck do not hesitate to open an issue reporting the full output of the script.
|
||||
|
||||
Now, your dreams of spinning up a development server can be realised:
|
||||
|
||||
bundle exec rails server
|
||||
|
||||
To login as Spree default user, use:
|
||||
|
||||
email: spree@example.com
|
||||
password: spree123
|
||||
|
||||
### Testing
|
||||
|
||||
Tests, both unit and integration, are based on RSpec. To run the test suite, first prepare the test database:
|
||||
|
||||
bundle exec rake db:test:prepare
|
||||
|
||||
Then the tests can be run with:
|
||||
|
||||
bundle exec rspec spec
|
||||
|
||||
The project is configured to use [Zeus][zeus] to reduce the pre-test startup time while Rails loads. See the [Zeus GitHub page][zeus] for usage instructions.
|
||||
|
||||
Once [npm dependencies are installed][karma], AngularJS tests can be run with:
|
||||
|
||||
./script/karma run
|
||||
|
||||
If you want karma to automatically rerun the tests on file modification, use:
|
||||
|
||||
./script/karma start
|
||||
|
||||
### Multilingual
|
||||
Do not forget to run `rake tmp:cache:clear` after locales are updated to reload I18n js translations.
|
||||
|
||||
### Rubocop
|
||||
The project is configured to use [rubocop][rubocop] to automatically check for style and syntax errors.
|
||||
|
||||
You can run rubocop against your changes using:
|
||||
|
||||
rubocop
|
||||
|
||||
|
||||
[developer-wiki]: https://github.com/openfoodfoundation/openfoodnetwork/wiki
|
||||
[sierra]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup:-macOS-(Sierra)
|
||||
[el-capitan]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup:-OS-X-(El-Capitan)
|
||||
[ubuntu]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Development-Environment-Setup:-Ubuntu
|
||||
[wiki]: https://github.com/openfoodfoundation/openfoodnetwork/wiki
|
||||
[zeus]: https://github.com/burke/zeus
|
||||
[rubocop]: https://rubocop.readthedocs.io/en/latest/
|
||||
[karma]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Karma
|
||||
1
Gemfile
1
Gemfile
@@ -42,7 +42,6 @@ gem 'simple_form', github: 'RohanM/simple_form'
|
||||
gem 'unicorn'
|
||||
gem 'angularjs-rails', '1.5.5'
|
||||
gem 'bugsnag'
|
||||
gem 'newrelic_rpm'
|
||||
gem 'haml'
|
||||
gem 'sass', "~> 3.3"
|
||||
gem 'sass-rails', '~> 3.2.3', groups: [:default, :assets]
|
||||
|
||||
@@ -431,8 +431,8 @@ GEM
|
||||
httparty (0.16.2)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.6.11)
|
||||
i18n-js (3.0.0)
|
||||
i18n (~> 0.6, >= 0.6.6)
|
||||
i18n-js (3.0.11)
|
||||
i18n (>= 0.6.6, < 2)
|
||||
immigrant (0.1.6)
|
||||
activerecord (>= 3.0)
|
||||
foreigner (>= 1.2.1)
|
||||
@@ -480,7 +480,6 @@ GEM
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
nenv (0.3.0)
|
||||
newrelic_rpm (3.12.0.288)
|
||||
nokogiri (1.6.8.1)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
notiffany (0.1.1)
|
||||
@@ -760,7 +759,6 @@ DEPENDENCIES
|
||||
letter_opener (>= 1.4.1)
|
||||
listen (= 3.0.8)
|
||||
momentjs-rails
|
||||
newrelic_rpm
|
||||
nokogiri (>= 1.6.7.1)
|
||||
oauth2 (~> 1.2.0)
|
||||
ofn-qz!
|
||||
|
||||
93
README.md
93
README.md
@@ -6,89 +6,28 @@
|
||||
|
||||
The Open Food Network is an online marketplace for local food. It enables a network of independent online food stores that connect farmers and food hubs (including coops, online farmers' markets, independent food businesses etc); with individuals and local businesses. It gives farmers and food hubs an easier and fairer way to distribute their food.
|
||||
|
||||
Supported by the Open Food Foundation, we are proudly open source and not-for-profit - we're trying to seriously disrupt the concentration of power in global agri-food systems, and we need as many smart people working together on this as possible.
|
||||
Supported by the Open Food Foundation and a network of global affiliates, we are proudly open source and not-for-profit - we're trying to seriously disrupt the concentration of power in global agri-food systems, and we need as many smart people working together on this as possible.
|
||||
|
||||
We're part of global movement - get involved!
|
||||
|
||||
* Fill in this short survey to tell us who you are and what you want to do with OFN: https://docs.google.com/a/eaterprises.com.au/forms/d/1zxR5vSiU9CigJ9cEaC8-eJLgYid8CR8er7PPH9Mc-30/edit#
|
||||
* Find out more and join in the conversation - http://openfoodnetwork.org
|
||||
* Fill in this [short survey][survey] to tell us who you are and what you want to do with OFN.
|
||||
* Join the conversation [on Slack][slack-invite]. Make sure you introduce yourself in the #general channel
|
||||
* Head to [https://openfoodnetwork.org](https://openfoodnetwork.org) for more information about the global OFN project.
|
||||
* Check out the [User Guide](https://guide.openfoodnetwork.org/) for a list of features and tutorials.
|
||||
* Join our [discussion forum](https://community.openfoodnetwork.org).
|
||||
|
||||
## Contributing
|
||||
|
||||
## Getting started
|
||||
If you are interested in contributing to the OFN in any capacity, please introducing yourself [on Slack][slack-invite], and have a look through our [Contributor Guide][contributor-guide]
|
||||
|
||||
Below are instructions for setting up a development environment for Open Food Network. More information is in the [developer wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
|
||||
Our [GETTING_STARTED](GETTING_STARTED.md) and [CONTRIBUTING](CONTRIBUTING.md) guides are the best place to start for developers looking to set up a development environment and make contributions to the codebase.
|
||||
|
||||
If you're interested in provisioning a server, see [the project's Ansible playbooks](https://github.com/openfoodfoundation/ofn_deployment).
|
||||
## Provisioning
|
||||
|
||||
If you're interested in provisioning a server, see [ofn-install][ofn-install] for the project's Ansible playbooks.
|
||||
|
||||
### Dependencies
|
||||
We also have a [Super Admin Guide][super-admin-guide] to help with configuration of new servers.
|
||||
|
||||
* Rails 3.2.x
|
||||
* Ruby 2.1.5
|
||||
* PostgreSQL database
|
||||
* PhantomJS (for testing)
|
||||
* See Gemfile for a list of gems required
|
||||
|
||||
|
||||
### Get it
|
||||
|
||||
The source code is managed with Git (a version control system) and
|
||||
hosted at GitHub.
|
||||
|
||||
You can view the code at:
|
||||
|
||||
https://github.com/openfoodfoundation/openfoodnetwork
|
||||
|
||||
You can download the source with the command:
|
||||
|
||||
git clone https://github.com/openfoodfoundation/openfoodnetwork.git
|
||||
|
||||
|
||||
### Get it running
|
||||
|
||||
For those new to Rails, the following tutorial will help get you up to speed with configuring a [Rails environment](http://guides.rubyonrails.org/getting_started.html).
|
||||
|
||||
When ready, run `script/setup`. If the script succeeds you're ready to start developing. If not, take a look at the output as it should be informative enough to help you troubleshoot.
|
||||
|
||||
If you run into any other issues getting your local environment up and running please consult [the wiki](https://github.com/openfoodfoundation/openfoodnetwork/wiki).
|
||||
|
||||
If still you get stuck do not hesitate to open an issue reporting the full output of the script.
|
||||
|
||||
Now, your dreams of spinning up a development server can be realised:
|
||||
```
|
||||
bundle exec rails server
|
||||
```
|
||||
To login as Spree default user, use:
|
||||
```
|
||||
email: spree@example.com
|
||||
password: spree123
|
||||
```
|
||||
### Testing
|
||||
|
||||
Tests, both unit and integration, are based on RSpec. To run the test suite, first prepare the test database:
|
||||
|
||||
bundle exec rake db:test:prepare
|
||||
|
||||
Then the tests can be run with:
|
||||
|
||||
bundle exec rspec spec
|
||||
|
||||
The site is configured to use
|
||||
[Zeus](https://github.com/burke/zeus) to reduce the pre-test
|
||||
startup time while Rails loads. See the Zeus github page for
|
||||
usage instructions.
|
||||
|
||||
Once [npm dependencies are
|
||||
installed](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Karma), AngularJS tests can be run with:
|
||||
|
||||
./script/karma run
|
||||
|
||||
If you want karma to automatically rerun the tests on file modification, use:
|
||||
|
||||
./script/karma start
|
||||
|
||||
### Multilingual
|
||||
Do not forget to run `rake tmp:cache:clear` after locales are updated to reload I18n js translations.
|
||||
|
||||
## Credits
|
||||
|
||||
@@ -110,4 +49,10 @@ Do not forget to run `rake tmp:cache:clear` after locales are updated to reload
|
||||
|
||||
## Licence
|
||||
|
||||
Copyright (c) 2012 - 2015 Open Food Foundation, released under the AGPL licence.
|
||||
Copyright (c) 2012 - 2018 Open Food Foundation, released under the AGPL licence.
|
||||
|
||||
[survey]: https://docs.google.com/a/eaterprises.com.au/forms/d/1zxR5vSiU9CigJ9cEaC8-eJLgYid8CR8er7PPH9Mc-30/edit#
|
||||
[slack-invite]: https://openfoodnetwork.org/slack-invite
|
||||
[contributor-guide]: https://ofn-user-guide.gitbook.io/ofn-contributor-guide/who-are-we
|
||||
[ofn-install]: https://github.com/openfoodfoundation/ofn-install
|
||||
[super-admin-guide]: https://ofn-user-guide.gitbook.io/ofn-super-admin-guide
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout, $http, $window, BulkProducts, DisplayProperties, dataFetcher, DirtyProducts, VariantUnitManager, StatusMessage, producers, Taxons, SpreeApiAuth, Columns, tax_categories) ->
|
||||
$scope.loading = true
|
||||
$scope.loadingAllPages = true
|
||||
|
||||
$scope.StatusMessage = StatusMessage
|
||||
|
||||
@@ -49,7 +50,10 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
|
||||
$scope.fetchProducts = ->
|
||||
$scope.loading = true
|
||||
BulkProducts.fetch($scope.currentFilters).then ->
|
||||
$scope.loadingAllPages = true
|
||||
BulkProducts.fetch($scope.currentFilters, ->
|
||||
$scope.loadingAllPages = false
|
||||
).then ->
|
||||
$scope.resetProducts()
|
||||
$scope.loading = false
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filter, Customers, TagRuleResource, CurrentShop, RequestMonitor, Columns, pendingChanges, shops, availableCountries) ->
|
||||
angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filter, Customers, TagRuleResource, CurrentShop, RequestMonitor, Columns, SortOptions, pendingChanges, shops, availableCountries) ->
|
||||
$scope.shops = shops
|
||||
$scope.availableCountries = availableCountries
|
||||
$scope.RequestMonitor = RequestMonitor
|
||||
@@ -6,6 +6,7 @@ angular.module("admin.customers").controller "customersCtrl", ($scope, $q, $filt
|
||||
$scope.customerLimit = 20
|
||||
$scope.customers = Customers.all
|
||||
$scope.columns = Columns.columns
|
||||
$scope.sorting = SortOptions
|
||||
|
||||
$scope.confirmRefresh = (event) ->
|
||||
event.preventDefault() unless pendingChanges.unsavedCount() == 0 || confirm(t("unsaved_changes_warning"))
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
angular.module("admin.indexUtils").controller "ColumnsCtrl", ($scope, Columns) ->
|
||||
$scope.columns = Columns.columns
|
||||
$scope.predicate = ""
|
||||
$scope.reverse = false
|
||||
|
||||
@@ -3,14 +3,18 @@ angular.module("admin.indexUtils").factory "PagedFetcher", (dataFetcher) ->
|
||||
# Given a URL like http://example.com/foo?page=::page::&per_page=20
|
||||
# And the response includes an attribute pages with the number of pages to fetch
|
||||
# Fetch each page async, and call the processData callback with the resulting data
|
||||
fetch: (url, processData) ->
|
||||
fetch: (url, processData, onLastPageComplete) ->
|
||||
dataFetcher(@urlForPage(url, 1)).then (data) =>
|
||||
processData data
|
||||
|
||||
if data.pages > 1
|
||||
for page in [2..data.pages]
|
||||
dataFetcher(@urlForPage(url, page)).then (data) ->
|
||||
lastPromise = dataFetcher(@urlForPage(url, page)).then (data) ->
|
||||
processData data
|
||||
onLastPageComplete && lastPromise.then onLastPageComplete
|
||||
return
|
||||
else
|
||||
onLastPageComplete && onLastPageComplete()
|
||||
|
||||
urlForPage: (url, page) ->
|
||||
url.replace("::page::", page)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
angular.module("admin.indexUtils").factory 'SortOptions', ->
|
||||
new class SortOptions
|
||||
predicate: ""
|
||||
reverse: true
|
||||
|
||||
toggle: (predicate) ->
|
||||
@reverse = (@predicate == predicate) && !@reverse
|
||||
@predicate = predicate
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $http, $q, StatusMessage, Columns, Dereferencer, Orders, LineItems, Enterprises, OrderCycles, VariantUnitManager, RequestMonitor) ->
|
||||
angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $http, $q, StatusMessage, Columns, SortOptions, Dereferencer, Orders, LineItems, Enterprises, OrderCycles, VariantUnitManager, RequestMonitor) ->
|
||||
$scope.initialized = false
|
||||
$scope.RequestMonitor = RequestMonitor
|
||||
$scope.filteredLineItems = []
|
||||
@@ -10,6 +10,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
$scope.selectedUnitsVariant = {}
|
||||
$scope.sharedResource = false
|
||||
$scope.columns = Columns.columns
|
||||
$scope.sorting = SortOptions
|
||||
|
||||
$scope.confirmRefresh = ->
|
||||
LineItems.allSaved() || confirm(t("unsaved_changes_warning"))
|
||||
|
||||
@@ -3,6 +3,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
$scope.entries = {}
|
||||
$scope.update_counts = {}
|
||||
$scope.reset_counts = {}
|
||||
$scope.importSettings = null
|
||||
|
||||
$scope.updates = {}
|
||||
$scope.updated_total = 0
|
||||
@@ -72,20 +73,21 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
'end': end
|
||||
'filepath': $scope.filepath
|
||||
'settings': $scope.importSettings
|
||||
).success((data, status, headers, config) ->
|
||||
).success((data, status) ->
|
||||
angular.merge($scope.entries, angular.fromJson(data['entries']))
|
||||
$scope.sortUpdates(data['reset_counts'])
|
||||
|
||||
$scope.updateProgress()
|
||||
).error((data, status, headers, config) ->
|
||||
).error((data, status) ->
|
||||
$scope.exception = data
|
||||
console.error(data)
|
||||
)
|
||||
|
||||
$scope.importSettings = null
|
||||
|
||||
$scope.getSettings = () ->
|
||||
$scope.importSettings = ProductImportService.getSettings()
|
||||
$scope.importSettings = {
|
||||
reset_all_absent: document.getElementsByName('settings[reset_all_absent]')[0].value,
|
||||
import_into: document.getElementsByName('settings[import_into]')[0].value
|
||||
}
|
||||
|
||||
$scope.sortUpdates = (data) ->
|
||||
angular.forEach data, (value, key) ->
|
||||
@@ -104,7 +106,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
'end': end
|
||||
'filepath': $scope.filepath
|
||||
'settings': $scope.importSettings
|
||||
).success((data, status, headers, config) ->
|
||||
).success((data, status) ->
|
||||
$scope.sortResults(data['results'])
|
||||
|
||||
angular.forEach data['updated_ids'], (id) ->
|
||||
@@ -114,7 +116,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
$scope.update_errors.push(error)
|
||||
|
||||
$scope.updateProgress()
|
||||
).error((data, status, headers, config) ->
|
||||
).error((data, status) ->
|
||||
$scope.exception = data
|
||||
console.error(data)
|
||||
)
|
||||
@@ -129,10 +131,11 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
$scope.updated_total += value
|
||||
|
||||
$scope.resetAbsent = () ->
|
||||
return unless $scope.importSettings['reset_all_absent']
|
||||
enterprises_to_reset = []
|
||||
angular.forEach $scope.importSettings, (settings, enterprise) ->
|
||||
if settings['reset_all_absent']
|
||||
enterprises_to_reset.push(enterprise)
|
||||
|
||||
angular.forEach $scope.reset_counts, (count, enterprise_id) ->
|
||||
enterprises_to_reset.push(enterprise_id)
|
||||
|
||||
if enterprises_to_reset.length && $scope.updated_ids.length
|
||||
$http(
|
||||
@@ -144,11 +147,9 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
'reset_absent': true,
|
||||
'updated_ids': $scope.updated_ids,
|
||||
'enterprises_to_reset': enterprises_to_reset
|
||||
).success((data, status, headers, config) ->
|
||||
console.log(data)
|
||||
).success((data, status) ->
|
||||
$scope.updates.products_reset = data
|
||||
|
||||
).error((data, status, headers, config) ->
|
||||
).error((data, status) ->
|
||||
console.error(data)
|
||||
)
|
||||
|
||||
|
||||
@@ -2,37 +2,24 @@ angular.module("admin.productImport").controller "ImportOptionsFormCtrl", ($scop
|
||||
|
||||
$scope.initForm = () ->
|
||||
$scope.settings = {} if $scope.settings == undefined
|
||||
$scope.settings[$scope.supplierId] = {
|
||||
import_into: 'product_list'
|
||||
defaults:
|
||||
count_on_hand:
|
||||
mode: 'overwrite_all'
|
||||
on_hand:
|
||||
mode: 'overwrite_all'
|
||||
tax_category_id:
|
||||
mode: 'overwrite_all'
|
||||
shipping_category_id:
|
||||
mode: 'overwrite_all'
|
||||
available_on:
|
||||
mode: 'overwrite_all'
|
||||
$scope.settings = {
|
||||
import_into: 'product_list',
|
||||
reset_all_absent: false
|
||||
}
|
||||
$scope.import_into = 'product_list'
|
||||
|
||||
$scope.updateImportInto = () ->
|
||||
$scope.import_into = $scope.settings[$scope.supplierId]['import_into']
|
||||
|
||||
$scope.$watch 'settings', (updated) ->
|
||||
ProductImportService.updateSettings(updated)
|
||||
, true
|
||||
|
||||
$scope.toggleResetAbsent = (id) ->
|
||||
checked = $scope.settings[id]['reset_all_absent']
|
||||
$scope.toggleResetAbsent = ->
|
||||
checked = $scope.settings['reset_all_absent']
|
||||
confirmed = confirm t('js.product_import.confirmation') if checked
|
||||
|
||||
if confirmed or !checked
|
||||
ProductImportService.updateResetAbsent($scope.supplierId, $scope.reset_counts[$scope.supplierId], checked)
|
||||
else
|
||||
$scope.settings[id]['reset_all_absent'] = false
|
||||
$scope.settings['reset_all_absent'] = false
|
||||
|
||||
$scope.resetTotal = ProductImportService.resetTotal
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher,
|
||||
, ""
|
||||
|
||||
url = "/api/products/bulk_products?page=::page::;per_page=20;#{queryString}"
|
||||
PagedFetcher.fetch url, (data) => @addProducts data.products
|
||||
processData = (data) => @addProducts data.products
|
||||
PagedFetcher.fetch url, processData, onComplete
|
||||
|
||||
cloneProduct: (product) ->
|
||||
$http.post("/api/products/" + product.id + "/clone").success (data) =>
|
||||
@@ -66,8 +67,13 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher,
|
||||
variantUnitValue: (product, variant) ->
|
||||
if variant.unit_value?
|
||||
if product.variant_unit_scale
|
||||
variant.unit_value / product.variant_unit_scale
|
||||
@divideAsInteger variant.unit_value, product.variant_unit_scale
|
||||
else
|
||||
variant.unit_value
|
||||
else
|
||||
null
|
||||
|
||||
# forces integer division to avoid javascript floating point imprecision
|
||||
# using one billion as the multiplier so that it works for numbers with up to 9 decimal places
|
||||
divideAsInteger: (a, b) ->
|
||||
(a * 1000000000) / (b * 1000000000)
|
||||
|
||||
@@ -1,38 +1,43 @@
|
||||
angular.module("admin.subscriptions").controller "DetailsController", ($scope, $http, CreditCardResource, StatusMessage) ->
|
||||
angular.module("admin.subscriptions").controller "DetailsController", ($scope, $http, CustomerResource, StatusMessage) ->
|
||||
$scope.cardRequired = false
|
||||
|
||||
$scope.registerNextCallback 'details', ->
|
||||
$scope.subscription_form.$submitted = true
|
||||
if $scope.subscription_details_form.$valid
|
||||
$scope.subscription_form.$setPristine()
|
||||
StatusMessage.clear()
|
||||
$scope.setView('address')
|
||||
else
|
||||
StatusMessage.display 'failure', t('admin.subscriptions.details.invalid_error')
|
||||
return unless $scope.validate()
|
||||
$scope.subscription_form.$setPristine()
|
||||
StatusMessage.clear()
|
||||
$scope.setView('address')
|
||||
|
||||
$scope.$watch "subscription.customer_id", (newValue, oldValue) ->
|
||||
return if !newValue?
|
||||
$scope.loadAddresses(newValue) unless $scope.subscription.id?
|
||||
$scope.loadCreditCards(newValue)
|
||||
$scope.loadCustomer(newValue) unless $scope.subscription.id?
|
||||
|
||||
$scope.$watch "subscription.payment_method_id", (newValue, oldValue) ->
|
||||
return if !newValue?
|
||||
paymentMethod = ($scope.paymentMethods.filter (pm) -> pm.id == newValue)[0]
|
||||
return unless paymentMethod?
|
||||
if paymentMethod.type == "Spree::Gateway::StripeConnect"
|
||||
$scope.cardRequired = true
|
||||
else
|
||||
$scope.cardRequired = false
|
||||
$scope.subscription.credit_card_id = null
|
||||
$scope.cardRequired = (paymentMethod.type == "Spree::Gateway::StripeConnect")
|
||||
$scope.loadCustomer() if $scope.cardRequired && !$scope.customer
|
||||
|
||||
$scope.loadAddresses = (customer_id) ->
|
||||
$http.get("/admin/customers/#{customer_id}/addresses")
|
||||
.success (response) =>
|
||||
delete response.bill_address.id
|
||||
delete response.ship_address.id
|
||||
angular.extend($scope.subscription.bill_address, response.bill_address)
|
||||
angular.extend($scope.subscription.ship_address, response.ship_address)
|
||||
$scope.shipAddressFromBilling() unless response.ship_address.address1?
|
||||
$scope.loadCustomer = ->
|
||||
params = { id: $scope.subscription.customer_id }
|
||||
params.ams_prefix = 'subscription' unless $scope.subscription.id
|
||||
$scope.customer = CustomerResource.get params, (response) ->
|
||||
for address in ['bill_address','ship_address']
|
||||
return unless response[address]
|
||||
delete response[address].id
|
||||
return if $scope.subscription[address].address1?
|
||||
angular.extend($scope.subscription[address], response[address])
|
||||
$scope.shipAddressFromBilling() unless response.ship_address?.address1?
|
||||
|
||||
$scope.loadCreditCards = (customer_id) ->
|
||||
$scope.creditCards = CreditCardResource.index(customer_id: customer_id)
|
||||
$scope.validate = ->
|
||||
return true if $scope.subscription_details_form.$valid && $scope.creditCardOk()
|
||||
StatusMessage.display 'failure', t('admin.subscriptions.details.invalid_error')
|
||||
false
|
||||
|
||||
$scope.creditCardOk = ->
|
||||
return true unless $scope.cardRequired
|
||||
return false unless $scope.customer
|
||||
return false unless $scope.customer.allow_charges
|
||||
return false unless $scope.customer.default_card_present
|
||||
true
|
||||
|
||||
@@ -16,7 +16,7 @@ angular.module("admin.subscriptions").controller "OrdersPanelController", ($scop
|
||||
oc = OrderCycles.byID[id]
|
||||
return t('js.subscriptions.close_date_not_set') unless oc?.orders_close_at?
|
||||
closes_at = moment(oc.orders_close_at)
|
||||
text = if closes_at > moment() then t('js.subscriptions.closes') else t('js.subscription.closed')
|
||||
text = if closes_at > moment() then t('js.subscriptions.closes') else t('js.subscriptions.closed')
|
||||
"#{text} #{closes_at.fromNow()}"
|
||||
|
||||
$scope.stateText = (state) -> t("spree.order_state.#{state}")
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
angular.module("admin.subscriptions").factory 'CreditCardResource', ($resource) ->
|
||||
resource = $resource '/admin/customers/:customer_id/cards.json', {},
|
||||
'index':
|
||||
method: 'GET'
|
||||
isArray: true
|
||||
@@ -0,0 +1,2 @@
|
||||
angular.module("admin.subscriptions").factory 'CustomerResource', ($resource) ->
|
||||
$resource '/admin/customers/:id.json'
|
||||
@@ -0,0 +1,17 @@
|
||||
angular.module("admin.users").directive "resendUserEmailConfirmation", ($http) ->
|
||||
template: "{{ 'js.admin.resend_user_email_confirmation.' + status | t }}"
|
||||
scope:
|
||||
email: "@resendUserEmailConfirmation"
|
||||
link: (scope, element, attrs) ->
|
||||
sent = false
|
||||
scope.status = "resend"
|
||||
|
||||
element.bind "click", ->
|
||||
return if sent
|
||||
scope.status = "sending"
|
||||
$http.post("/user/spree_user/confirmation", {spree_user: {email: scope.email}}).success (data) ->
|
||||
sent = true
|
||||
element.addClass "action--disabled"
|
||||
scope.status = "done"
|
||||
.error (data) ->
|
||||
scope.status = "failed"
|
||||
@@ -0,0 +1,6 @@
|
||||
angular.module("admin.utils").directive "textangularLinksTargetBlank", () ->
|
||||
restrict: 'CA'
|
||||
link: (scope, element, attrs) ->
|
||||
setTimeout ->
|
||||
element.find(".ta-editor").scope().defaultTagAttributes.a.target = '_blank'
|
||||
, 500
|
||||
@@ -0,0 +1,3 @@
|
||||
angular.module("Darkswarm").controller "AuthorisedShopsCtrl", ($scope, Customers, Shops) ->
|
||||
$scope.customers = Customers.index()
|
||||
$scope.shopsByID = Shops.byID
|
||||
@@ -0,0 +1,10 @@
|
||||
Darkswarm.directive "helpModal", ($modal, $compile, $templateCache)->
|
||||
restrict: 'A'
|
||||
scope:
|
||||
helpText: "@helpModal"
|
||||
|
||||
link: (scope, elem, attrs, ctrl)->
|
||||
compiled = $compile($templateCache.get('help-modal.html'))(scope)
|
||||
|
||||
elem.on "click", =>
|
||||
$modal.open(controller: ctrl, template: compiled, scope: scope, windowClass: 'help-modal small')
|
||||
@@ -10,7 +10,7 @@ Darkswarm.directive "stripeElements", ($injector, StripeElements) ->
|
||||
stripe = $injector.get('stripeObject')
|
||||
|
||||
card = stripe.elements().create 'card',
|
||||
hidePostalCode: false
|
||||
hidePostalCode: true
|
||||
style:
|
||||
base:
|
||||
fontFamily: "Roboto, Arial, sans-serif"
|
||||
|
||||
20
app/assets/javascripts/darkswarm/services/customer.js.coffee
Normal file
20
app/assets/javascripts/darkswarm/services/customer.js.coffee
Normal file
@@ -0,0 +1,20 @@
|
||||
angular.module("Darkswarm").factory 'Customer', ($resource, RailsFlashLoader) ->
|
||||
Customer = $resource('/api/customers/:id/:action.json', {}, {
|
||||
'index':
|
||||
method: 'GET'
|
||||
isArray: true
|
||||
'update':
|
||||
method: 'PUT'
|
||||
params:
|
||||
id: '@id'
|
||||
transformRequest: (data, headersGetter) ->
|
||||
angular.toJson(customer: data)
|
||||
})
|
||||
|
||||
Customer.prototype.update = ->
|
||||
@$update().then (response) =>
|
||||
RailsFlashLoader.loadFlash({success: t('js.changes_saved')})
|
||||
, (response) =>
|
||||
RailsFlashLoader.loadFlash({error: response.data.error})
|
||||
|
||||
Customer
|
||||
@@ -0,0 +1,14 @@
|
||||
angular.module("Darkswarm").factory 'Customers', (Customer) ->
|
||||
new class Customers
|
||||
all: []
|
||||
byID: {}
|
||||
|
||||
index: (params={}) ->
|
||||
return @all if @all.length
|
||||
Customer.index params, (data) => @load(data)
|
||||
@all
|
||||
|
||||
load: (customers) ->
|
||||
for customer in customers
|
||||
@all.push customer
|
||||
@byID[customer.id] = customer
|
||||
13
app/assets/javascripts/darkswarm/services/shops.js.coffee
Normal file
13
app/assets/javascripts/darkswarm/services/shops.js.coffee
Normal file
@@ -0,0 +1,13 @@
|
||||
angular.module("Darkswarm").factory 'Shops', ($injector) ->
|
||||
new class Shops
|
||||
all: []
|
||||
byID: {}
|
||||
|
||||
constructor: ->
|
||||
if $injector.has('shops')
|
||||
@load($injector.get('shops'))
|
||||
|
||||
load: (shops) ->
|
||||
for shop in shops
|
||||
@all.push shop
|
||||
@byID[shop.id] = shop
|
||||
9
app/assets/javascripts/templates/help-modal.html.haml
Normal file
9
app/assets/javascripts/templates/help-modal.html.haml
Normal file
@@ -0,0 +1,9 @@
|
||||
.row.help-icon
|
||||
.small-12.text-center
|
||||
%i.ofn-i_013-help
|
||||
.row.help-text
|
||||
.small-12.columns.text-center
|
||||
{{ helpText }}
|
||||
.row.text-center
|
||||
%button.primary.small{ ng: { click: '$close()' } }
|
||||
= t(:ok)
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
.row.invoice_title {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
@@ -12,6 +14,6 @@ table.invoice_summary {
|
||||
|
||||
.invoice_title {
|
||||
.balance {
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@import "variables";
|
||||
|
||||
#advanced_settings {
|
||||
background-color: #eff5fc;
|
||||
border: 1px solid #cee1f4;
|
||||
background-color: $spree-light-blue;
|
||||
border: 1px solid $pale-blue;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.row{
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
@import "variables";
|
||||
|
||||
.alert {
|
||||
border: 3px solid #919191;
|
||||
border: 3px solid $medium-grey;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #919191;
|
||||
color: $medium-grey;
|
||||
padding: 5px 10px;
|
||||
|
||||
h6 {
|
||||
color: #919191;
|
||||
color: $medium-grey;
|
||||
}
|
||||
|
||||
.message {
|
||||
@@ -14,11 +16,11 @@
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: #DA5354;
|
||||
color: #DA5354;
|
||||
border-color: $warning-red;
|
||||
color: $warning-red;
|
||||
|
||||
h6 {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,7 @@
|
||||
*= require shared/ng-tags-input.min
|
||||
|
||||
*= require_self
|
||||
*= require_tree .
|
||||
*/
|
||||
|
||||
@import 'variables';
|
||||
@import '**/*';
|
||||
@@ -1,17 +1,18 @@
|
||||
@import "../darkswarm/branding";
|
||||
@import "../darkswarm/mixins";
|
||||
@import "variables";
|
||||
|
||||
#change_type {
|
||||
section {
|
||||
margin: 2em 0 0 0;
|
||||
|
||||
&, & * {
|
||||
color: #5498da;
|
||||
color: $spree-blue;
|
||||
}
|
||||
}
|
||||
|
||||
.description {
|
||||
background-color: #eff5fc;
|
||||
background-color: $spree-light-blue;
|
||||
margin-top: -2em;
|
||||
padding: 4em 2em 2em 1em;
|
||||
|
||||
@@ -21,7 +22,7 @@
|
||||
}
|
||||
|
||||
.admin-cta {
|
||||
border: 1px solid #5498da;
|
||||
border: 1px solid $spree-blue;
|
||||
|
||||
@include border-radius(3px);
|
||||
|
||||
@@ -65,14 +66,14 @@
|
||||
|
||||
&:after {
|
||||
border-color: rgba(136, 183, 213, 0);
|
||||
border-top-color: #5498da;
|
||||
border-top-color: $spree-blue;
|
||||
border-width: 12px;
|
||||
margin-left: -12px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
&:after {
|
||||
border-top-color: #9fc820;
|
||||
border-top-color: $spree-green;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@import "../../darkswarm/mixins";
|
||||
@import "../variables";
|
||||
|
||||
.alert-box {
|
||||
position: relative;
|
||||
display: block;
|
||||
background-color: #eff5dc;
|
||||
border: 1px solid #9fc820;
|
||||
border: 1px solid $spree-green;
|
||||
color: #666;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
@@ -22,21 +23,21 @@
|
||||
}
|
||||
|
||||
&.ok {
|
||||
border: 1px solid #9fc820;
|
||||
border: 1px solid $spree-green;
|
||||
background-color: #fbffee;
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
font-weight: bold;
|
||||
|
||||
a.button {
|
||||
padding: 3px 10px;
|
||||
background-color: #a7c44d;
|
||||
&:hover {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
}
|
||||
}
|
||||
|
||||
a.close {
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@import "../variables";
|
||||
|
||||
.alert-row{
|
||||
margin-bottom: 10px;
|
||||
font-weight: bold;
|
||||
background-color: #eff5fc;
|
||||
background-color: $spree-light-blue;
|
||||
|
||||
.column, .columns {
|
||||
padding-top: 8px;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "../variables";
|
||||
|
||||
#info-dialog, #confirm-dialog {
|
||||
.message {
|
||||
.text, .icon {
|
||||
@@ -21,7 +23,7 @@
|
||||
&.error {
|
||||
.message {
|
||||
.icon {
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +31,7 @@
|
||||
&.info {
|
||||
.message {
|
||||
.icon {
|
||||
color: #5498da;
|
||||
color: $spree-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "../variables";
|
||||
|
||||
/**
|
||||
Main colors:
|
||||
dark: #545454
|
||||
@@ -63,7 +65,7 @@ light: #ccc
|
||||
|
||||
&:hover {
|
||||
&:before {
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "../variables";
|
||||
|
||||
#save-bar {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
@@ -6,11 +8,11 @@
|
||||
left: 0;
|
||||
padding: 8px 8px;
|
||||
font-weight: bold;
|
||||
background-color: #eff5fc;
|
||||
color: #5498da;
|
||||
background-color: $spree-light-blue;
|
||||
color: $spree-blue;
|
||||
|
||||
h5 {
|
||||
color: #5498da;
|
||||
color: $spree-blue;
|
||||
}
|
||||
|
||||
input {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
@import "../variables";
|
||||
|
||||
.state {
|
||||
@extend .state;
|
||||
|
||||
&.active {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
&, a { color: #ffffff; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "../variables";
|
||||
|
||||
#trial_progress_bar {
|
||||
position: fixed;
|
||||
left: 0px;
|
||||
@@ -5,6 +7,6 @@
|
||||
width: 100vw;
|
||||
padding: 8px 10px;
|
||||
font-weight: bold;
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@import "../variables";
|
||||
|
||||
$color_unselected: #d9d9d9;
|
||||
$color_selected: #5498da;
|
||||
$color_selected: $spree-blue;
|
||||
|
||||
ul.wizard-progress {
|
||||
list-style: none;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
@import "variables";
|
||||
|
||||
.tag-with-rules {
|
||||
color: black;
|
||||
}
|
||||
|
||||
table#customers.index {
|
||||
|
||||
tr.customer {
|
||||
|
||||
.guest-label {
|
||||
color: $medium-grey;
|
||||
display: block;
|
||||
font-size: 0.85em;
|
||||
margin-top: 0.15em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
div.dashboard_item {
|
||||
margin-bottom: 30px;
|
||||
|
||||
@@ -15,22 +17,22 @@ div.dashboard_item {
|
||||
border-radius: 10px;
|
||||
|
||||
&.green {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
}
|
||||
|
||||
&.red {
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
}
|
||||
|
||||
&.orange {
|
||||
background-color: #DA7F52;
|
||||
background-color: $warning-orange;
|
||||
}
|
||||
}
|
||||
|
||||
div.header {
|
||||
height: 50px;
|
||||
border-radius: 6px 6px 0px 0px;
|
||||
border: 1px solid #5498da;
|
||||
border: 1px solid $spree-blue;
|
||||
position: relative;
|
||||
|
||||
a[ofn-with-tip] {
|
||||
@@ -40,20 +42,20 @@ div.dashboard_item {
|
||||
}
|
||||
|
||||
&.red {
|
||||
border-color: #DA5354;
|
||||
border-color: $warning-red;
|
||||
border-width: 3px;
|
||||
|
||||
h3 {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
}
|
||||
|
||||
&.orange {
|
||||
border-color: #DA7F52;
|
||||
border-color: $warning-orange;
|
||||
border-width: 3px;
|
||||
|
||||
h3 {
|
||||
color: #DA7F52;
|
||||
color: $warning-orange;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +74,7 @@ div.dashboard_item {
|
||||
|
||||
.tabs {
|
||||
height: 30px;
|
||||
border: solid #5498da;
|
||||
border: solid $spree-blue;
|
||||
border-width: 0px 0px 1px 0px;
|
||||
margin-top: 3px;
|
||||
|
||||
@@ -80,19 +82,19 @@ div.dashboard_item {
|
||||
cursor: pointer;
|
||||
height: 30px;
|
||||
color: #fff;
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
padding: 5px 5px 0px 5px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
border: solid #5498da;
|
||||
border: solid $spree-blue;
|
||||
border-width: 1px 1px 0px 1px;
|
||||
|
||||
&:hover {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
color: #5498da;
|
||||
color: $spree-blue;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +107,7 @@ div.dashboard_item {
|
||||
}
|
||||
|
||||
.list-title {
|
||||
border: solid #5498da;
|
||||
border: solid $spree-blue;
|
||||
border-width: 0px 1px 0px 1px;
|
||||
|
||||
span {
|
||||
@@ -120,7 +122,7 @@ div.dashboard_item {
|
||||
}
|
||||
|
||||
.list-item {
|
||||
border: solid #5498da;
|
||||
border: solid $spree-blue;
|
||||
border-width: 0px 1px 0px 1px;
|
||||
height: 38px;
|
||||
|
||||
@@ -142,28 +144,28 @@ div.dashboard_item {
|
||||
}
|
||||
|
||||
.icon-warning-sign {
|
||||
color: #DA7F52;
|
||||
color: $warning-orange;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.icon-remove-sign {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.icon-ok-sign {
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
&.orange {
|
||||
color: #DA7F52;
|
||||
border: solid #DA7F52;
|
||||
color: $warning-orange;
|
||||
border: solid $warning-orange;
|
||||
}
|
||||
|
||||
&.red {
|
||||
color: #DA5354;
|
||||
border: solid #DA5354;
|
||||
color: $warning-red;
|
||||
border: solid $warning-red;
|
||||
}
|
||||
|
||||
&.orange, &.red {
|
||||
@@ -175,13 +177,13 @@ div.dashboard_item {
|
||||
}
|
||||
|
||||
&.odd {
|
||||
background-color: #eff5fc;
|
||||
background-color: $spree-light-blue;
|
||||
}
|
||||
|
||||
&.even, &.odd {
|
||||
&:hover {
|
||||
color: #ffffff;
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
|
||||
.icon-arrow-right {
|
||||
color: #fff;
|
||||
@@ -201,7 +203,7 @@ div.dashboard_item {
|
||||
|
||||
.text-icon {
|
||||
&.green {
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
@@ -216,19 +218,19 @@ div.dashboard_item {
|
||||
text-align: center;
|
||||
|
||||
&.orange {
|
||||
background-color: #DA7F52;
|
||||
background-color: $warning-orange;
|
||||
}
|
||||
|
||||
&.blue {
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
}
|
||||
|
||||
&.red {
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
}
|
||||
|
||||
&.bottom {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@import "variables";
|
||||
|
||||
#content-header .ofn-drop-down {
|
||||
border: none;
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
color: #fff;
|
||||
float: none;
|
||||
margin-left: 3px;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
span.unavailable, span.available {
|
||||
font-weight: bold;
|
||||
i {
|
||||
@@ -6,9 +8,9 @@ span.unavailable, span.available {
|
||||
}
|
||||
|
||||
span.available {
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
}
|
||||
|
||||
span.unavailable {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
.enterprise_package_panel, .enterprise_producer_panel {
|
||||
.info {
|
||||
p {
|
||||
@@ -19,7 +21,7 @@
|
||||
}
|
||||
&:hover {
|
||||
&:after {
|
||||
border-top-color: #9fc820;
|
||||
border-top-color: $spree-green;
|
||||
}
|
||||
}
|
||||
&.disabled{
|
||||
@@ -60,7 +62,7 @@
|
||||
.status-ok {
|
||||
margin: 30px 0px;
|
||||
i.icon-ok-sign {
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +78,7 @@
|
||||
font-size: 1.5rem;
|
||||
|
||||
&.issue{
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
&.warning{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@import "variables";
|
||||
|
||||
form[name="enterprise_form"] {
|
||||
div.row.warning {
|
||||
color: #DA7F52;
|
||||
color: $warning-orange;
|
||||
}
|
||||
|
||||
table.managers {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@import 'plugins/font-awesome';
|
||||
|
||||
.icon-refund:before { @extend .icon-ok:before }
|
||||
.icon-credit:before { @extend .icon-ok:before }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
tbody.panel-ctrl {
|
||||
tr.panel-row {
|
||||
> td {
|
||||
@@ -5,7 +7,7 @@ tbody.panel-ctrl {
|
||||
cursor: pointer;
|
||||
margin-bottom: 10px;
|
||||
font-size: 1.3rem;
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
&:hover {
|
||||
background-color: #CD4E4F;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
tbody.panel-ctrl {
|
||||
td.panel-toggle{
|
||||
-webkit-touch-callout: none;
|
||||
@@ -26,7 +28,7 @@ tbody.panel-ctrl {
|
||||
font-size: 2rem;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
content: "\f071";
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
&.status {
|
||||
@@ -37,7 +39,7 @@ tbody.panel-ctrl {
|
||||
|
||||
i.issue::before {
|
||||
content: "\f071";
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
i.warning::before {
|
||||
@@ -47,7 +49,7 @@ tbody.panel-ctrl {
|
||||
|
||||
i.ok::before {
|
||||
content: "\f058";
|
||||
color: #9fc820;
|
||||
color: $spree-green;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
input[type="submit"], input[type="button"], button, .button {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -20,7 +22,7 @@ table .blank-action {
|
||||
}
|
||||
|
||||
text-angular .ta-editor {
|
||||
border: 1px solid #cee1f4;
|
||||
border: 1px solid $pale-blue;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
@@ -33,7 +35,7 @@ text-angular .ta-editor {
|
||||
}
|
||||
|
||||
span.error, div.error:not(.flash) {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
/* Fix conflict between Spree and elRTE's styles */
|
||||
@@ -43,7 +45,7 @@ span.error, div.error:not(.flash) {
|
||||
}
|
||||
|
||||
input.red, a.button.red, button.red {
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
margin-right: 5px;
|
||||
color: #ffffff;
|
||||
}
|
||||
@@ -51,7 +53,7 @@ input.red, a.button.red, button.red {
|
||||
a.button.red {
|
||||
&:not(:hover) {
|
||||
color: #fff;
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +73,14 @@ a {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
a.action--disabled {
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
color: #5498da;
|
||||
}
|
||||
}
|
||||
|
||||
form.order_cycle {
|
||||
h2 {
|
||||
margin-top: 2em;
|
||||
@@ -196,15 +206,15 @@ table#listing_enterprise_groups {
|
||||
// TODO: remove this, use class below
|
||||
#no_results {
|
||||
font-weight:bold;
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
.no-results {
|
||||
font-weight:bold;
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
#schedule-dialog {
|
||||
table {
|
||||
border: none;
|
||||
@@ -47,7 +49,7 @@
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #cee1f4;
|
||||
background-color: $pale-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
input, div {
|
||||
&.update-pending {
|
||||
border: solid 1px orange;
|
||||
@@ -8,20 +10,20 @@ input.show-dirty {
|
||||
&.ng-dirty {
|
||||
border: solid 1px orange;
|
||||
&.update-error {
|
||||
border: solid 1px #DA5354;
|
||||
border: solid 1px $warning-red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
input, div {
|
||||
&.update-error {
|
||||
border: solid 1px #DA5354;
|
||||
border: solid 1px $warning-red;
|
||||
}
|
||||
}
|
||||
|
||||
input, div {
|
||||
&.update-success {
|
||||
border: solid 1px #9fc820;
|
||||
border: solid 1px $spree-green;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +33,7 @@ input, div {
|
||||
|
||||
div#group_buy_calculation {
|
||||
border-radius: 3px;
|
||||
background-color: #eff5fc;
|
||||
background-color: $spree-light-blue;
|
||||
div {
|
||||
margin-bottom: 5px;
|
||||
span, h6 {
|
||||
|
||||
@@ -1,37 +1,4 @@
|
||||
.product-import-introduction {
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 1.5em 0 1em;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
span.category {
|
||||
display: inline-block;
|
||||
background-color: #f3f3f3;
|
||||
padding: 0.4em 0.8em;
|
||||
margin: 0 0.4em 0.5em 0;
|
||||
}
|
||||
|
||||
table {
|
||||
|
||||
&.product-import-columns tr:hover td {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
thead th {
|
||||
text-transform: none;
|
||||
font-size: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
@import "variables";
|
||||
|
||||
div.panel-section {
|
||||
|
||||
@@ -39,7 +6,7 @@ div.panel-section {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.warning {
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
.success {
|
||||
color: #86d83a;
|
||||
@@ -210,7 +177,7 @@ table.import-settings {
|
||||
|
||||
span.header-error {
|
||||
font-size: 0.85em;
|
||||
color: #da5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
.select2-search {
|
||||
@@ -315,3 +282,33 @@ div.progress-bar {
|
||||
transition: width 0.5s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
#upload-sidebar {
|
||||
float: right;
|
||||
background-color: lighten($spree-light-blue, 2.5%);
|
||||
border: 1px solid lighten($pale-blue, 2.5%);
|
||||
width: 50%;
|
||||
padding: 0 1.5em 1.5em;
|
||||
|
||||
h4, h5, h6, p {
|
||||
margin: 1.25em 0 1em;
|
||||
}
|
||||
|
||||
a.download {
|
||||
display: block;
|
||||
font-size: 1.05em;
|
||||
margin-bottom: 0.5em;
|
||||
|
||||
i {
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
}
|
||||
|
||||
span.category {
|
||||
display: inline-block;
|
||||
background-color: lighten($spree-blue, 10%);
|
||||
color: white;
|
||||
padding: 0.3em 0.6em;
|
||||
margin: 0 0.4em 0.5em 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
@import "variables";
|
||||
|
||||
#product_distributors_field span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
tbody.odd {
|
||||
tr.product { td { background-color: white; } }
|
||||
tr.variant.odd { td { background-color: lighten(#eff5fc, 3); } }
|
||||
tr.variant.odd { td { background-color: lighten($spree-light-blue, 3); } }
|
||||
tr.variant.even { td { background-color: white; } }
|
||||
}
|
||||
tbody.even {
|
||||
tr.product { td { background-color: darken(#eff5fc, 1); } }
|
||||
tr.variant.odd { td { background-color: lighten(#eff5fc, 2); } }
|
||||
tr.variant.even { td { background-color: darken(#eff5fc, 1); } }
|
||||
tr.product { td { background-color: darken($spree-light-blue, 1); } }
|
||||
tr.variant.odd { td { background-color: lighten($spree-light-blue, 2); } }
|
||||
tr.variant.even { td { background-color: darken($spree-light-blue, 1); } }
|
||||
}
|
||||
|
||||
tbody tr.product td.actions { background-color: transparent; }
|
||||
@@ -20,7 +22,7 @@ tbody tr.variant td { padding: 5px 10px; }
|
||||
th.left-actions, td.left-actions {
|
||||
background-color: transparent !important;
|
||||
border: none !important;
|
||||
border-right: 1px solid #cee1f4 !important;
|
||||
border-right: 1px solid $pale-blue !important;
|
||||
}
|
||||
|
||||
#status-message {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
@import "variables";
|
||||
|
||||
.report__table {
|
||||
margin-top: 2em;
|
||||
}
|
||||
.report__message {
|
||||
margin-top: 2em;
|
||||
border: 1px solid #cee1f4;
|
||||
border: 1px solid $pale-blue;
|
||||
border-radius: .5em;
|
||||
padding: .5em;
|
||||
text-align: center;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
.select2-container {
|
||||
.select2-choice {
|
||||
.select2-search-choice-close {
|
||||
@@ -15,12 +17,12 @@
|
||||
.select2-choice{
|
||||
background-color: #ffffff;
|
||||
font-weight: normal;
|
||||
border: 1px solid #5498da !important;
|
||||
color: #5498da !important;
|
||||
border: 1px solid $spree-blue !important;
|
||||
color: $spree-blue !important;
|
||||
|
||||
.select2-arrow {
|
||||
&:before {
|
||||
color: #5498da;
|
||||
color: $spree-blue;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
content: '\25be';
|
||||
@@ -32,7 +34,7 @@
|
||||
&:hover, &.select2-container-active {
|
||||
.select2-choice{
|
||||
color: #ffffff !important;
|
||||
background-color: #5498da !important;
|
||||
background-color: $spree-blue !important;
|
||||
|
||||
.select2-arrow {
|
||||
&:before {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
.side_menu {
|
||||
border-right: 2px solid #f6f6f6;
|
||||
border-top: 2px solid #f6f6f6;
|
||||
@@ -22,7 +24,7 @@
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
div.sidebar_item {
|
||||
margin-bottom: 30px;
|
||||
|
||||
@@ -12,11 +14,11 @@ div.sidebar_item {
|
||||
position: relative;
|
||||
|
||||
&.blue {
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
}
|
||||
|
||||
&.red {
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +28,10 @@ div.sidebar_item {
|
||||
overflow-x: hidden;
|
||||
|
||||
&.red {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
|
||||
.list-item {
|
||||
border: solid #DA5354;
|
||||
border: solid $warning-red;
|
||||
border-width: 0px 3px 0px 3px;
|
||||
|
||||
a.alpha, span.alpha {
|
||||
@@ -40,13 +42,13 @@ div.sidebar_item {
|
||||
background-color: #fcf6ef;
|
||||
|
||||
&:hover {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +59,7 @@ div.sidebar_item {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
border: solid #5498da;
|
||||
border: solid $spree-blue;
|
||||
border-width: 0px 1px 0px 1px;
|
||||
|
||||
a.alpha, span.alpha {
|
||||
@@ -75,7 +77,7 @@ div.sidebar_item {
|
||||
}
|
||||
|
||||
.icon-remove-sign {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
@@ -84,13 +86,13 @@ div.sidebar_item {
|
||||
}
|
||||
|
||||
&.odd {
|
||||
background-color: #eff5fc;
|
||||
background-color: $spree-light-blue;
|
||||
}
|
||||
|
||||
&.even, &.odd {
|
||||
&:hover {
|
||||
color: #ffffff;
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
|
||||
a {
|
||||
color: #ffffff;
|
||||
@@ -107,15 +109,15 @@ div.sidebar_item {
|
||||
border-radius: 0px;
|
||||
|
||||
&.blue {
|
||||
background-color: #5498da;
|
||||
background-color: $spree-blue;
|
||||
}
|
||||
|
||||
&.red {
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #9fc820;
|
||||
background-color: $spree-green;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
tags-input {
|
||||
&.limit-reached {
|
||||
input, span.input {
|
||||
@@ -21,13 +23,13 @@ tags-input {
|
||||
|
||||
.customer_tag, .default_rules {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #cee1f4;
|
||||
border: 1px solid $pale-blue;
|
||||
margin-bottom: 40px;
|
||||
|
||||
.header {
|
||||
padding: 8px 10px;
|
||||
background-color: #eff5fc;
|
||||
border-bottom: 1px solid #cee1f4;
|
||||
background-color: $spree-light-blue;
|
||||
border-bottom: 1px solid $pale-blue;
|
||||
|
||||
table {
|
||||
padding: 0px;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import "variables";
|
||||
|
||||
.text-normal {
|
||||
font-size: 1.0rem;
|
||||
font-weight: 300;
|
||||
@@ -9,7 +11,7 @@
|
||||
}
|
||||
|
||||
.text-red {
|
||||
color: #DA5354;
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
|
||||
|
||||
10
app/assets/stylesheets/admin/variables.css.scss
Normal file
10
app/assets/stylesheets/admin/variables.css.scss
Normal file
@@ -0,0 +1,10 @@
|
||||
// Admin variables and colours
|
||||
|
||||
$spree-green: #9fc820;
|
||||
$spree-blue: #5498da;
|
||||
$spree-light-blue: #eff5fc;
|
||||
|
||||
$warning-red: #da5354;
|
||||
$warning-orange: #da7f52;
|
||||
$medium-grey: #919191;
|
||||
$pale-blue: #cee1f4;
|
||||
@@ -1,8 +1,10 @@
|
||||
@import "variables";
|
||||
|
||||
.variant-override-unit {
|
||||
float: right;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
button.hide:hover {
|
||||
background-color: #DA5354;
|
||||
background-color: $warning-red;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.authorised_shops{
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.orders {
|
||||
|
||||
@@ -1,27 +1,78 @@
|
||||
@import "typography";
|
||||
|
||||
$large-menu-height: 4.6875rem;
|
||||
$medium-menu-height: 3rem;
|
||||
$gutter-width: 0.9375rem;
|
||||
|
||||
nav.top-bar ul.left li.powered-by {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body.embedded {
|
||||
nav.top-bar {
|
||||
ul.left, ul.center, ul.right li.current_hub {
|
||||
overflow: visible;
|
||||
padding: 0 $gutter-width;
|
||||
|
||||
ul.left li.ofn-logo, ul.center, ul.right li.current_hub {
|
||||
display: none;
|
||||
}
|
||||
|
||||
ul.left {
|
||||
float: left;
|
||||
width: auto;
|
||||
|
||||
li {
|
||||
line-height: $large-menu-height;
|
||||
height: $large-menu-height;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
li.powered-by {
|
||||
display: inline-block;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul.right {
|
||||
width: auto !important;
|
||||
|
||||
li {
|
||||
float: left;
|
||||
line-height: 4.6875rem;
|
||||
height: 4.6875rem;
|
||||
line-height: $large-menu-height;
|
||||
height: $large-menu-height;
|
||||
vertical-align: top;
|
||||
}
|
||||
li.powered-by {
|
||||
display: inline-block;
|
||||
|
||||
&.cart {
|
||||
|
||||
div.joyride-tip-guide { // Cart Dropdown
|
||||
top: 75px;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.show-for-large-up {
|
||||
display: inherit !important;
|
||||
}
|
||||
|
||||
&.show-for-medium-down {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -46,28 +97,68 @@ body.embedded {
|
||||
#group-page header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media all and (max-width: 640px) {
|
||||
nav.top-bar {
|
||||
height: 3.4rem;
|
||||
padding: 0.2rem $gutter-width;
|
||||
line-height: $medium-menu-height;
|
||||
|
||||
ul.left li, ul.right li {
|
||||
line-height: $medium-menu-height;
|
||||
|
||||
i, span {
|
||||
line-height: $medium-menu-height;
|
||||
}
|
||||
}
|
||||
|
||||
ul.right li.cart div.joyride-tip-guide {
|
||||
width: 95%;
|
||||
top: 51px;
|
||||
|
||||
h5 {
|
||||
margin-bottom: 0.6rem;
|
||||
}
|
||||
|
||||
.joyride-content-wrapper {
|
||||
line-height: 2rem;
|
||||
|
||||
table tr.product-cart {
|
||||
padding: 0;
|
||||
|
||||
td{
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.buttons {
|
||||
|
||||
.button {
|
||||
padding: 0.4rem 0.6rem !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 480px) {
|
||||
ul.left li.powered-by span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
ul.right {
|
||||
|
||||
li.cart {
|
||||
|
||||
div.joyride-tip-guide {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
.powered-by-embedded {
|
||||
opacity: 0.6;
|
||||
|
||||
@@ -36,6 +36,7 @@ footer {
|
||||
|
||||
img {
|
||||
margin-top: 36px;
|
||||
width: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
app/assets/stylesheets/darkswarm/help-modal.css.scss
Normal file
9
app/assets/stylesheets/darkswarm/help-modal.css.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
.help-modal {
|
||||
.help-text {
|
||||
font-size: 1rem;
|
||||
margin: 20px 0px;
|
||||
}
|
||||
.help-icon {
|
||||
font-size: 4rem;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
max-width: 45%;
|
||||
|
||||
@media all and (min-height: 500px) {
|
||||
max-width: 80%;
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
margin-bottom: 2rem;
|
||||
|
||||
@@ -87,6 +87,9 @@ button.success, .button.success {
|
||||
&.tiny {
|
||||
padding: 0rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,12 @@ p.callout {
|
||||
color: #0096ad;
|
||||
}
|
||||
|
||||
p.notice {
|
||||
font-style: italic;
|
||||
font-size: 12px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
table.social {
|
||||
background-color: #ebebeb;
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
render_as_json @customer, ams_prefix: params[:ams_prefix]
|
||||
end
|
||||
|
||||
def create
|
||||
@customer = Customer.new(params[:customer])
|
||||
if user_can_create_customer?
|
||||
@@ -55,22 +59,6 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
# GET /admin/customers/:id/addresses
|
||||
# Used by subscriptions form to load details for selected customer
|
||||
def addresses
|
||||
finder = OpenFoodNetwork::AddressFinder.new(@customer, @customer.email)
|
||||
bill_address = Api::AddressSerializer.new(finder.bill_address).serializable_hash
|
||||
ship_address = Api::AddressSerializer.new(finder.ship_address).serializable_hash
|
||||
render json: { bill_address: bill_address, ship_address: ship_address }
|
||||
end
|
||||
|
||||
# GET /admin/customers/:id/cards
|
||||
# Used by subscriptions form to load details for selected customer
|
||||
def cards
|
||||
cards = Spree::CreditCard.where(user_id: @customer.user_id)
|
||||
render json: ActiveModel::ArraySerializer.new(cards, each_serializer: Api::CreditCardSerializer)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def collection
|
||||
@@ -87,5 +75,9 @@ module Admin
|
||||
spree_current_user.admin? ||
|
||||
spree_current_user.enterprises.include?(@customer.enterprise)
|
||||
end
|
||||
|
||||
def ams_prefix_whitelist
|
||||
[:subscription]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ module Admin
|
||||
class OrderCyclesController < ResourceController
|
||||
include OrderCyclesHelper
|
||||
|
||||
prepend_before_filter :load_data_for_index, :only => :index
|
||||
before_filter :load_data_for_index, only: :index
|
||||
before_filter :require_coordinator, only: :new
|
||||
before_filter :remove_protected_attrs, only: [:update]
|
||||
before_filter :require_order_cycle_set_params, only: [:bulk_update]
|
||||
|
||||
@@ -4,7 +4,7 @@ module Admin
|
||||
class ProductImportController < Spree::Admin::BaseController
|
||||
before_filter :validate_upload_presence, except: %i[index guide validate_data]
|
||||
|
||||
def guide
|
||||
def index
|
||||
@product_categories = Spree::Taxon.order('name ASC').pluck(:name).uniq
|
||||
@tax_categories = Spree::TaxCategory.order('name ASC').pluck(:name)
|
||||
@shipping_categories = Spree::ShippingCategory.order('name ASC').pluck(:name)
|
||||
|
||||
13
app/controllers/api/base_controller.rb
Normal file
13
app/controllers/api/base_controller.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# Base controller for OFN's API
|
||||
# Includes the minimum machinery required by ActiveModelSerializers
|
||||
module Api
|
||||
class BaseController < Spree::Api::BaseController
|
||||
# Need to include these because Spree::Api::BaseContoller inherits
|
||||
# from ActionController::Metal rather than ActionController::Base
|
||||
# and they are required by ActiveModelSerializers
|
||||
include ActionController::Serialization
|
||||
include ActionController::UrlFor
|
||||
include Rails.application.routes.url_helpers
|
||||
use_renderers :json
|
||||
end
|
||||
end
|
||||
19
app/controllers/api/customers_controller.rb
Normal file
19
app/controllers/api/customers_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
module Api
|
||||
class CustomersController < BaseController
|
||||
def index
|
||||
@customers = current_api_user.customers.of_regular_shops
|
||||
render json: @customers, each_serializer: CustomerSerializer
|
||||
end
|
||||
|
||||
def update
|
||||
@customer = Customer.find(params[:id])
|
||||
authorize! :update, @customer
|
||||
|
||||
if @customer.update_attributes(params[:customer])
|
||||
render json: @customer, serializer: CustomerSerializer, status: 200
|
||||
else
|
||||
invalid_resource!(@customer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
module Api
|
||||
class StatusesController < BaseController
|
||||
class StatusesController < ::BaseController
|
||||
respond_to :json
|
||||
|
||||
def job_queue
|
||||
|
||||
@@ -56,48 +56,9 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def enable_embedded_shopfront
|
||||
return unless embeddable?
|
||||
return if embedding_without_https?
|
||||
|
||||
response.headers.delete 'X-Frame-Options'
|
||||
response.headers['Content-Security-Policy'] = "frame-ancestors #{URI(request.referer).host.downcase}"
|
||||
|
||||
check_embedded_request
|
||||
set_embedded_layout
|
||||
end
|
||||
|
||||
def embedded_shopfront_referer
|
||||
return if request.referer.blank?
|
||||
domain = URI(request.referer).host.downcase
|
||||
domain.start_with?('www.') ? domain[4..-1] : domain
|
||||
end
|
||||
|
||||
def embeddable?
|
||||
whitelist = Spree::Config[:embedded_shopfronts_whitelist]
|
||||
domain = embedded_shopfront_referer
|
||||
Spree::Config[:enable_embedded_shopfronts] && whitelist.present? && domain.present? && whitelist.include?(domain)
|
||||
end
|
||||
|
||||
def embedding_without_https?
|
||||
request.referer && URI(request.referer).scheme != 'https' && !Rails.env.test? && !Rails.env.development?
|
||||
end
|
||||
|
||||
def check_embedded_request
|
||||
return unless params[:embedded_shopfront]
|
||||
|
||||
# Show embedded shopfront CSS
|
||||
session[:embedded_shopfront] = true
|
||||
|
||||
# Get shopfront slug and set redirect path
|
||||
if params[:controller] == 'enterprises' && params[:action] == 'shop' && params[:id]
|
||||
slug = params[:id]
|
||||
session[:shopfront_redirect] = '/' + slug + '/shop?embedded_shopfront=true'
|
||||
end
|
||||
end
|
||||
|
||||
def set_embedded_layout
|
||||
return unless session[:embedded_shopfront]
|
||||
@shopfront_layout = 'embedded'
|
||||
embed_service = EmbeddedPageService.new(params, session, request, response)
|
||||
embed_service.embed!
|
||||
@shopfront_layout = 'embedded' if embed_service.use_embedded_layout?
|
||||
end
|
||||
|
||||
def action
|
||||
|
||||
@@ -7,7 +7,7 @@ class HomeController < BaseController
|
||||
if ContentConfig.home_show_stats
|
||||
@num_distributors = Enterprise.is_distributor.activated.visible.count
|
||||
@num_producers = Enterprise.is_primary_producer.activated.visible.count
|
||||
@num_users = Spree::User.joins(:orders).merge(Spree::Order.complete).count('DISTINCT spree_users.*')
|
||||
@num_users = Spree::Order.complete.count('DISTINCT user_id')
|
||||
@num_orders = Spree::Order.complete.count
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ Spree::Admin::SearchController.class_eval do
|
||||
:ship_address_lastname_start => params[:q],
|
||||
:bill_address_firstname_start => params[:q],
|
||||
:bill_address_lastname_start => params[:q]
|
||||
}).result.limit(10)
|
||||
}).result.limit(10)
|
||||
end
|
||||
|
||||
render json: @users, each_serializer: Api::Admin::UserSerializer
|
||||
|
||||
@@ -69,7 +69,8 @@ module InjectionHelper
|
||||
end
|
||||
|
||||
def inject_shops
|
||||
shops = Enterprise.where(id: @orders.pluck(:distributor_id).uniq)
|
||||
customers = spree_current_user.customers.of_regular_shops
|
||||
shops = Enterprise.where(id: @orders.pluck(:distributor_id).uniq | customers.pluck(:enterprise_id))
|
||||
inject_json_ams "shops", shops.all, Api::ShopForOrdersSerializer
|
||||
end
|
||||
|
||||
|
||||
@@ -46,11 +46,13 @@ class SubscriptionConfirmJob
|
||||
end
|
||||
|
||||
def send_confirm_email
|
||||
@order.update!
|
||||
record_success(@order)
|
||||
SubscriptionMailer.confirmation_email(@order).deliver
|
||||
end
|
||||
|
||||
def send_failed_payment_email
|
||||
@order.update!
|
||||
record_and_log_error(:failed_payment, @order)
|
||||
SubscriptionMailer.failed_payment_email(@order).deliver
|
||||
end
|
||||
|
||||
@@ -5,9 +5,13 @@ Spree::UserMailer.class_eval do
|
||||
:subject => t(:welcome_to) + Spree::Config[:site_name])
|
||||
end
|
||||
|
||||
def confirmation_instructions(user, token)
|
||||
# Overriding `Spree::UserMailer.confirmation_instructions` which is
|
||||
# overriding `Devise::Mailer.confirmation_instructions`.
|
||||
def confirmation_instructions(user, _opts)
|
||||
@user = user
|
||||
@token = token
|
||||
@instance = Spree::Config[:site_name]
|
||||
@contact = ContentConfig.footer_email
|
||||
|
||||
subject = t('spree.user_mailer.confirmation_instructions.subject')
|
||||
mail(to: user.email,
|
||||
from: from_address,
|
||||
|
||||
@@ -23,6 +23,11 @@ class Customer < ActiveRecord::Base
|
||||
|
||||
scope :of, ->(enterprise) { where(enterprise_id: enterprise) }
|
||||
|
||||
scope :of_regular_shops, lambda {
|
||||
next scoped unless Spree::Config.accounts_distributor_id
|
||||
where('enterprise_id <> ?', Spree::Config.accounts_distributor_id)
|
||||
}
|
||||
|
||||
before_create :associate_user
|
||||
|
||||
private
|
||||
|
||||
@@ -129,12 +129,6 @@ class Enterprise < ActiveRecord::Base
|
||||
joins('LEFT OUTER JOIN exchange_variants ON (exchange_variants.exchange_id = exchanges.id)').
|
||||
joins('LEFT OUTER JOIN spree_variants ON (spree_variants.id = exchange_variants.variant_id)')
|
||||
|
||||
scope :active_distributors, lambda {
|
||||
with_distributed_products_outer.with_order_cycles_as_distributor_outer.
|
||||
where('(product_distributions.product_id IS NOT NULL AND spree_products.deleted_at IS NULL AND spree_products.available_on <= ? AND spree_products.count_on_hand > 0) OR (order_cycles.id IS NOT NULL AND order_cycles.orders_open_at <= ? AND order_cycles.orders_close_at >= ?)', Time.zone.now, Time.zone.now, Time.zone.now).
|
||||
select('DISTINCT enterprises.*')
|
||||
}
|
||||
|
||||
scope :distributors_with_active_order_cycles, lambda {
|
||||
with_order_cycles_as_distributor_outer.
|
||||
merge(OrderCycle.active).
|
||||
@@ -199,10 +193,6 @@ class Enterprise < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def has_supplied_products_on_hand?
|
||||
self.supplied_products.where('count_on_hand > 0').present?
|
||||
end
|
||||
|
||||
def to_param
|
||||
permalink
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ module ProductImport
|
||||
next unless supplier_id && permission_by_id?(supplier_id)
|
||||
|
||||
products_count =
|
||||
if import_into_inventory_by_supplier?(supplier_id)
|
||||
if importing_into_inventory?
|
||||
VariantOverride.where('variant_overrides.hub_id IN (?)', supplier_id).count
|
||||
else
|
||||
Spree::Variant.
|
||||
@@ -57,19 +57,21 @@ module ProductImport
|
||||
def reset_absent_items
|
||||
# For selected enterprises; set stock to zero for all products/inventory
|
||||
# that were not listed in the newly uploaded spreadsheet
|
||||
return if total_saved_count.zero? || @updated_ids.empty? || !@import_settings.key?(:settings)
|
||||
return unless data_for_stock_reset?
|
||||
suppliers_to_reset_products = []
|
||||
suppliers_to_reset_inventories = []
|
||||
|
||||
@import_settings[:settings].each do |enterprise_id, settings|
|
||||
suppliers_to_reset_products.push enterprise_id if settings['reset_all_absent'] && permission_by_id?(enterprise_id) && !import_into_inventory_by_supplier?(enterprise_id)
|
||||
suppliers_to_reset_inventories.push enterprise_id if settings['reset_all_absent'] && permission_by_id?(enterprise_id) && import_into_inventory_by_supplier?(enterprise_id)
|
||||
settings = @import_settings[:settings]
|
||||
|
||||
@import_settings[:enterprises_to_reset].each do |enterprise_id|
|
||||
suppliers_to_reset_products.push Integer(enterprise_id) if settings['reset_all_absent'] && permission_by_id?(enterprise_id) && !importing_into_inventory?
|
||||
suppliers_to_reset_inventories.push Integer(enterprise_id) if settings['reset_all_absent'] && permission_by_id?(enterprise_id) && importing_into_inventory?
|
||||
end
|
||||
|
||||
unless suppliers_to_reset_inventories.empty?
|
||||
@products_reset_count += VariantOverride.
|
||||
where('variant_overrides.hub_id IN (?)
|
||||
AND variant_overrides.id NOT IN (?)', suppliers_to_reset_inventories, @updated_ids).
|
||||
AND variant_overrides.id NOT IN (?)', suppliers_to_reset_inventories, @import_settings[:updated_ids]).
|
||||
update_all(count_on_hand: 0)
|
||||
end
|
||||
|
||||
@@ -79,7 +81,7 @@ module ProductImport
|
||||
where('spree_products.supplier_id IN (?)
|
||||
AND spree_variants.id NOT IN (?)
|
||||
AND spree_variants.is_master = false
|
||||
AND spree_variants.deleted_at IS NULL', suppliers_to_reset_products, @updated_ids).
|
||||
AND spree_variants.deleted_at IS NULL', suppliers_to_reset_products, @import_settings[:updated_ids]).
|
||||
update_all(count_on_hand: 0)
|
||||
end
|
||||
|
||||
@@ -89,6 +91,10 @@ module ProductImport
|
||||
|
||||
private
|
||||
|
||||
def data_for_stock_reset?
|
||||
@import_settings[:settings] && @import_settings[:updated_ids] && @import_settings[:enterprises_to_reset]
|
||||
end
|
||||
|
||||
def save_to_inventory(entry)
|
||||
save_new_inventory_item entry if entry.validates_as? 'new_inventory_item'
|
||||
save_existing_inventory_item entry if entry.validates_as? 'existing_inventory_item'
|
||||
@@ -109,7 +115,7 @@ module ProductImport
|
||||
end
|
||||
|
||||
def import_into_inventory?(entry)
|
||||
entry.supplier_id && @import_settings[:settings][entry.supplier_id.to_s]['import_into'] == 'inventories'
|
||||
entry.supplier_id && @import_settings[:settings]['import_into'] == 'inventories'
|
||||
end
|
||||
|
||||
def save_new_inventory_item(entry)
|
||||
@@ -227,8 +233,8 @@ module ProductImport
|
||||
@editable_enterprises.value?(Integer(supplier_id))
|
||||
end
|
||||
|
||||
def import_into_inventory_by_supplier?(supplier_id)
|
||||
@import_settings[:settings] && @import_settings[:settings][supplier_id.to_s] && @import_settings[:settings][supplier_id.to_s]['import_into'] == 'inventories'
|
||||
def importing_into_inventory?
|
||||
@import_settings[:settings] && @import_settings[:settings]['import_into'] == 'inventories'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -221,7 +221,7 @@ module ProductImport
|
||||
end
|
||||
|
||||
def import_into_inventory?(entry)
|
||||
entry.supplier_id && @import_settings[:settings][entry.supplier_id.to_s]['import_into'] == 'inventories'
|
||||
entry.supplier_id && @import_settings[:settings]['import_into'] == 'inventories'
|
||||
end
|
||||
|
||||
def validate_inventory_item(entry, variant_override)
|
||||
|
||||
@@ -6,7 +6,7 @@ module ProductImport
|
||||
include ActiveModel::Conversion
|
||||
include ActiveModel::Validations
|
||||
|
||||
attr_reader :updated_ids
|
||||
attr_reader :updated_ids, :import_settings
|
||||
|
||||
def initialize(file, current_user, import_settings = {})
|
||||
unless file.is_a?(File)
|
||||
|
||||
@@ -64,6 +64,10 @@ class AbilityDecorator
|
||||
can [:update, :destroy], Spree::CreditCard do |credit_card|
|
||||
credit_card.user == user
|
||||
end
|
||||
|
||||
can [:update], Customer do |customer|
|
||||
customer.user == user
|
||||
end
|
||||
end
|
||||
|
||||
# New users can create an enterprise, and gain other permissions from doing this.
|
||||
@@ -251,7 +255,7 @@ class AbilityDecorator
|
||||
can [:admin, :index, :customers, :group_buys, :bulk_coop, :sales_tax, :payments, :orders_and_distributors, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management, :xero_invoices], :report
|
||||
|
||||
can [:create], Customer
|
||||
can [:admin, :index, :update, :destroy, :addresses, :cards], Customer, enterprise_id: Enterprise.managed_by(user).pluck(:id)
|
||||
can [:admin, :index, :update, :destroy, :show], Customer, enterprise_id: Enterprise.managed_by(user).pluck(:id)
|
||||
can [:admin, :new, :index], Subscription
|
||||
can [:create, :edit, :update, :cancel, :pause, :unpause], Subscription do |subscription|
|
||||
user.enterprises.include?(subscription.shop)
|
||||
|
||||
@@ -31,6 +31,7 @@ module Spree
|
||||
StripeAccount.find_by_enterprise_id(preferred_enterprise_id).andand.stripe_user_id
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
def purchase(money, creditcard, gateway_options)
|
||||
provider.purchase(*options_for_purchase_or_auth(money, creditcard, gateway_options))
|
||||
rescue Stripe::StripeError => e
|
||||
@@ -38,11 +39,18 @@ module Spree
|
||||
failed_activemerchant_billing_response(e.message)
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
def void(response_code, _creditcard, gateway_options)
|
||||
gateway_options[:stripe_account] = stripe_account_id
|
||||
provider.void(response_code, gateway_options)
|
||||
end
|
||||
|
||||
# NOTE: the name of this method is determined by Spree::Payment::Processing
|
||||
def credit(money, _creditcard, response_code, gateway_options)
|
||||
gateway_options[:stripe_account] = stripe_account_id
|
||||
provider.refund(money, response_code, gateway_options)
|
||||
end
|
||||
|
||||
def create_profile(payment)
|
||||
return unless payment.source.gateway_customer_profile_id.nil?
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ Spree::Product.class_eval do
|
||||
before_validation :sanitize_permalink
|
||||
before_save :add_primary_taxon_to_taxons
|
||||
after_touch :touch_distributors
|
||||
after_save :remove_previous_primary_taxon_from_taxons
|
||||
after_save :ensure_standard_variant
|
||||
after_save :update_units
|
||||
after_save :refresh_products_cache
|
||||
@@ -245,6 +246,11 @@ Spree::Product.class_eval do
|
||||
taxons << primary_taxon unless taxons.include? primary_taxon
|
||||
end
|
||||
|
||||
def remove_previous_primary_taxon_from_taxons
|
||||
return unless primary_taxon_id_changed? && primary_taxon_id_was
|
||||
taxons.destroy(primary_taxon_id_was)
|
||||
end
|
||||
|
||||
def self.all_variant_unit_option_types
|
||||
Spree::OptionType.where('name LIKE ?', 'unit_%%')
|
||||
end
|
||||
|
||||
@@ -73,6 +73,10 @@ Spree.user_class.class_eval do
|
||||
owned_enterprises(:reload).size < enterprise_limit
|
||||
end
|
||||
|
||||
def default_card
|
||||
credit_cards.where(is_default: true).first
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def limit_owned_enterprises
|
||||
|
||||
@@ -8,7 +8,6 @@ class Subscription < ActiveRecord::Base
|
||||
belongs_to :payment_method, class_name: 'Spree::PaymentMethod'
|
||||
belongs_to :bill_address, foreign_key: :bill_address_id, class_name: Spree::Address
|
||||
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: Spree::Address
|
||||
belongs_to :credit_card, foreign_key: :credit_card_id, class_name: 'Spree::CreditCard'
|
||||
has_many :subscription_line_items, inverse_of: :subscription
|
||||
has_many :order_cycles, through: :schedule
|
||||
has_many :proxy_orders
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
/ insert_bottom "[data-hook='admin_product_sub_tabs']"
|
||||
|
||||
- if spree_current_user.admin?
|
||||
= tab :spree_products, url: admin_products_path, :match_path => '/products'
|
||||
@@ -1,5 +0,0 @@
|
||||
/ insert_bottom "div[data-hook='admin_user_form_fields'] div.alpha"
|
||||
|
||||
= f.field_container :enterprise_limit do
|
||||
= f.label :enterprise_limit, t(:enterprise_limit)
|
||||
= f.text_field :enterprise_limit, :class => 'fullwidth'
|
||||
@@ -1,3 +0,0 @@
|
||||
/ insert_before "td[data-hook='admin_users_index_row_actions']"
|
||||
|
||||
%td.user_enterprise_limit= user.enterprise_limit
|
||||
@@ -1,3 +0,0 @@
|
||||
/ insert_before "th[data-hook='admin_users_index_header_actions']"
|
||||
|
||||
%th= sort_link @search,:enterprise_limit, t(:enterprise_limit)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user