Merge branch '2-0-stable' into 2-0-remove-unused-new-v2-features

This commit is contained in:
luisramos0
2019-03-12 16:05:49 +00:00
188 changed files with 7412 additions and 8201 deletions

View File

@@ -7,12 +7,12 @@ assignees: ''
---
**## Description**
## Description
<!-- Describe the story in detail:
**- As a:** (enterprise user, super admin, user...)
**- On page:** (provide url of the page you want to modify. If not provide where will be created the new url and the name we want to give it)
**- I want to be able to do:** (specify the desired behavior)
(Link to others issues or resources to provide context > only if really necessary). -->
**## Acceptance Criteria**
## Acceptance Criteria
<!-- Document the outcomes that need to be achieved before this component can be considered complete. -->

View File

@@ -22,9 +22,7 @@
Metrics/LineLength:
Max: 100
Exclude:
- app/controllers/admin/accounts_and_billing_settings_controller.rb
- app/controllers/admin/bulk_line_items_controller.rb
- app/controllers/admin/business_model_configuration_controller.rb
- app/controllers/admin/cache_settings_controller.rb
- app/controllers/admin/contents_controller.rb
- app/controllers/admin/customers_controller.rb
@@ -63,7 +61,6 @@ Metrics/LineLength:
- app/controllers/stripe/callbacks_controller.rb
- app/controllers/user_confirmations_controller.rb
- app/helpers/admin/account_helper.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/admin/injection_helper.rb
- app/helpers/angular_form_builder.rb
- app/helpers/angular_form_helper.rb
@@ -79,16 +76,12 @@ Metrics/LineLength:
- app/helpers/spree/admin/navigation_helper_decorator.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/helpers/spree/orders_helper.rb
- app/jobs/finalize_account_invoices.rb
- app/jobs/products_cache_integrity_checker_job.rb
- app/jobs/subscription_confirm_job.rb
- app/jobs/subscription_placement_job.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/mailers/producer_mailer.rb
- app/mailers/spree/order_mailer_decorator.rb
- app/mailers/subscription_mailer.rb
- app/models/billable_period.rb
- app/models/column_preference.rb
- app/models/content_configuration.rb
- app/models/customer.rb
@@ -160,11 +153,8 @@ Metrics/LineLength:
- engines/web/app/helpers/web/cookies_policy_helper.rb
- Gemfile
- lib/discourse/single_sign_on.rb
- lib/open_food_network/accounts_and_billing_settings_validator.rb
- lib/open_food_network/available_payment_method_filter.rb
- lib/open_food_network/bill_calculator.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/business_model_configuration_validator.rb
- lib/open_food_network/customers_report.rb
- lib/open_food_network/distribution_change_validator.rb
- lib/open_food_network/enterprise_fee_applicator.rb
@@ -201,7 +191,6 @@ Metrics/LineLength:
- lib/tasks/dev.rake
- lib/tasks/enterprises.rake
- spec/archive/features/consumer/checkout_spec.rb
- spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb
- spec/controllers/admin/bulk_line_items_controller_spec.rb
- spec/controllers/admin/column_preferences_controller_spec.rb
- spec/controllers/admin/customers_controller_spec.rb
@@ -245,7 +234,6 @@ Metrics/LineLength:
- spec/controllers/stripe/webhooks_controller_spec.rb
- spec/controllers/user_confirmations_controller_spec.rb
- spec/controllers/user_registrations_controller_spec.rb
- spec/features/admin/accounts_and_billing_settings_spec.rb
- spec/features/admin/adjustments_spec.rb
- spec/features/admin/bulk_order_management_spec.rb
- spec/features/admin/bulk_product_update_spec.rb
@@ -289,7 +277,6 @@ Metrics/LineLength:
- spec/features/consumer/shopping/shopping_spec.rb
- spec/features/consumer/shopping/variant_overrides_spec.rb
- spec/features/consumer/shops_spec.rb
- spec/helpers/admin/business_model_configuration_helper_spec.rb
- spec/helpers/admin/subscriptions_helper_spec.rb
- spec/helpers/checkout_helper_spec.rb
- spec/helpers/enterprises_helper_spec.rb
@@ -298,12 +285,9 @@ Metrics/LineLength:
- spec/helpers/order_cycles_helper_spec.rb
- spec/helpers/spree/admin/base_helper_spec.rb
- spec/jobs/confirm_order_job_spec.rb
- spec/jobs/finalize_account_invoices_spec.rb
- spec/jobs/refresh_products_cache_job_spec.rb
- spec/jobs/subscription_confirm_job_spec.rb
- spec/jobs/subscription_placement_job_spec.rb
- spec/jobs/update_account_invoices_spec.rb
- spec/jobs/update_billable_periods_spec.rb
- spec/lib/open_food_network/address_finder_spec.rb
- spec/lib/open_food_network/bulk_coop_report_spec.rb
- spec/lib/open_food_network/cached_products_renderer_spec.rb
@@ -337,7 +321,6 @@ Metrics/LineLength:
- spec/mailers/order_mailer_spec.rb
- spec/mailers/producer_mailer_spec.rb
- spec/mailers/subscription_mailer_spec.rb
- spec/models/billable_period_spec.rb
- spec/models/column_preference_spec.rb
- spec/models/customer_spec.rb
- spec/models/enterprise_caching_spec.rb
@@ -452,18 +435,13 @@ Metrics/AbcSize:
- app/controllers/user_confirmations_controller.rb
- app/controllers/user_passwords_controller.rb
- app/controllers/user_registrations_controller.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/i18n_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/helpers/spree/orders_helper.rb
- app/jobs/finalize_account_invoices.rb
- app/jobs/subscription_placement_job.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/mailers/producer_mailer.rb
- app/models/billable_period.rb
- app/models/calculator/flat_percent_per_item.rb
- app/models/column_preference.rb
- app/models/enterprise_group.rb
@@ -492,7 +470,6 @@ Metrics/AbcSize:
- app/services/order_syncer.rb
- app/services/subscription_validator.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/bill_calculator.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/customers_report.rb
- lib/open_food_network/enterprise_issue_validator.rb
@@ -534,13 +511,10 @@ Metrics/CyclomaticComplexity:
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/i18n_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb
- app/models/product_import/entry_processor.rb
@@ -553,7 +527,6 @@ Metrics/CyclomaticComplexity:
- app/models/variant_override_set.rb
- app/services/cart_service.rb
- lib/discourse/single_sign_on.rb
- lib/open_food_network/bill_calculator.rb
- lib/open_food_network/bulk_coop_report.rb
- lib/open_food_network/enterprise_issue_validator.rb
- lib/open_food_network/orders_and_fulfillments_report.rb
@@ -569,12 +542,10 @@ Metrics/PerceivedComplexity:
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/orders_controller_decorator.rb
- app/helpers/admin/business_model_configuration_helper.rb
- app/helpers/checkout_helper.rb
- app/helpers/i18n_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/jobs/update_account_invoices.rb
- app/models/enterprise_relationship.rb
- app/models/product_import/entry_processor.rb
- app/models/product_import/entry_validator.rb
@@ -624,12 +595,8 @@ Metrics/MethodLength:
- app/helpers/checkout_helper.rb
- app/helpers/order_cycles_helper.rb
- app/helpers/spree/admin/orders_helper_decorator.rb
- app/jobs/finalize_account_invoices.rb
- app/jobs/subscription_placement_job.rb
- app/jobs/update_account_invoices.rb
- app/jobs/update_billable_periods.rb
- app/mailers/producer_mailer.rb
- app/models/billable_period.rb
- app/models/column_preference.rb
- app/models/enterprise.rb
- app/models/enterprise_relationship.rb

View File

@@ -143,7 +143,6 @@ Layout/EmptyLines:
- 'app/helpers/angular_form_helper.rb'
- 'app/helpers/injection_helper.rb'
- 'app/helpers/spree/admin/base_helper_decorator.rb'
- 'app/jobs/finalize_account_invoices.rb'
- 'app/jobs/products_cache_integrity_checker_job.rb'
- 'app/jobs/refresh_products_cache_job.rb'
- 'app/models/coordinator_fee.rb'
@@ -218,7 +217,6 @@ Layout/EmptyLines:
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/features/consumer/shops_spec.rb'
- 'spec/helpers/checkout_helper_spec.rb'
- 'spec/jobs/finalize_account_invoices_spec.rb'
- 'spec/jobs/heartbeat_job_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/lib/open_food_network/option_value_namer_spec.rb'
@@ -278,17 +276,14 @@ Layout/EmptyLinesAroundBlockBody:
- 'spec/features/consumer/shopping/embedded_groups_spec.rb'
- 'spec/features/consumer/shopping/embedded_shopfronts_spec.rb'
- 'spec/features/consumer/shopping/shopping_spec.rb'
- 'spec/helpers/admin/business_model_configuration_helper_spec.rb'
- 'spec/helpers/shared_helper_spec.rb'
- 'spec/helpers/shop_helper_spec.rb'
- 'spec/helpers/spree/orders_helper_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/group_buy_report_spec.rb'
- 'spec/lib/open_food_network/lettuce_share_report_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/open_food_network/referer_parser_spec.rb'
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
- 'spec/models/billable_period_spec.rb'
- 'spec/models/product_distribution_spec.rb'
- 'spec/models/spree/ability_spec.rb'
- 'spec/models/spree/product_spec.rb'
@@ -307,7 +302,6 @@ Layout/EmptyLinesAroundBlockBody:
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
Layout/EmptyLinesAroundClassBody:
Exclude:
- 'app/controllers/admin/account_controller.rb'
- 'app/controllers/admin/cache_settings_controller.rb'
- 'app/controllers/admin/enterprise_fees_controller.rb'
- 'app/controllers/admin/inventory_items_controller.rb'
@@ -358,7 +352,6 @@ Layout/ExtraSpacing:
- 'lib/open_food_network/variant_and_line_item_naming.rb'
- 'lib/spree/product_filters.rb'
- 'lib/tasks/karma.rake'
- 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
- 'spec/features/admin/bulk_product_update_spec.rb'
- 'spec/features/admin/orders_spec.rb'
@@ -409,7 +402,6 @@ Layout/IndentationConsistency:
- 'lib/open_food_network/permissions.rb'
- 'spec/controllers/admin/tag_rules_controller_spec.rb'
- 'spec/features/consumer/shopping/checkout_spec.rb'
- 'spec/helpers/admin/business_model_configuration_helper_spec.rb'
- 'spec/models/spree/line_item_spec.rb'
- 'spec/models/spree/product_spec.rb'
@@ -425,7 +417,6 @@ Layout/IndentationWidth:
- 'app/serializers/api/admin/for_order_cycle/supplied_product_serializer.rb'
- 'app/serializers/api/admin/order_cycle_serializer.rb'
- 'spec/features/consumer/shopping/variant_overrides_spec.rb'
- 'spec/helpers/admin/business_model_configuration_helper_spec.rb'
- 'spec/helpers/groups_helper_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
@@ -439,7 +430,6 @@ Layout/IndentationWidth:
Layout/LeadingCommentSpace:
Exclude:
- 'Gemfile'
- 'app/models/billable_period.rb'
- 'app/models/content_configuration.rb'
- 'app/models/spree/inventory_unit_decorator.rb'
- 'app/models/spree/taxon_decorator.rb'
@@ -449,7 +439,6 @@ Layout/LeadingCommentSpace:
- 'spec/controllers/spree/api/line_items_controller_spec.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/jobs/finalize_account_invoices_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
- 'spec/models/enterprise_spec.rb'
@@ -471,7 +460,6 @@ Layout/MultilineBlockLayout:
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/features/consumer/shopping/cart_spec.rb'
- 'spec/helpers/enterprises_helper_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
- 'spec/lib/open_food_network/permissions_spec.rb'
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
@@ -489,7 +477,6 @@ Layout/MultilineBlockLayout:
Layout/MultilineHashBraceLayout:
Exclude:
- 'app/controllers/spree/admin/products_controller_decorator.rb'
- 'app/models/billable_period.rb'
- 'lib/spree/product_filters.rb'
- 'spec/support/request/authentication_workflow.rb'
@@ -528,7 +515,6 @@ Layout/MultilineOperationIndentation:
- 'app/models/producer_property.rb'
- 'app/models/spree/ability_decorator.rb'
- 'app/models/variant_override_set.rb'
- 'lib/open_food_network/accounts_and_billing_settings_validator.rb'
- 'lib/open_food_network/order_cycle_permissions.rb'
- 'lib/open_food_network/sales_tax_report.rb'
- 'lib/open_food_network/users_and_enterprises_report.rb'
@@ -551,8 +537,6 @@ Layout/SpaceAfterComma:
- 'app/controllers/spree/orders_controller_decorator.rb'
- 'app/models/column_preference.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/accounts_and_billing_settings_validator.rb'
- 'lib/open_food_network/business_model_configuration_validator.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/users_and_enterprises_report.rb'
- 'spec/controllers/admin/enterprises_controller_spec.rb'
@@ -561,7 +545,6 @@ Layout/SpaceAfterComma:
- 'spec/features/admin/bulk_product_update_spec.rb'
- 'spec/features/admin/customers_spec.rb'
- 'spec/features/admin/variant_overrides_spec.rb'
- 'spec/jobs/update_account_invoices_spec.rb'
- 'spec/lib/open_food_network/group_buy_report_spec.rb'
- 'spec/lib/open_food_network/subscription_summary_spec.rb'
- 'spec/models/content_configuration_spec.rb'
@@ -608,9 +591,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
- 'app/models/spree/taxon_decorator.rb'
- 'app/models/variant_override_set.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/accounts_and_billing_settings_validator.rb'
- 'lib/open_food_network/bill_calculator.rb'
- 'lib/open_food_network/business_model_configuration_validator.rb'
- 'lib/open_food_network/enterprise_fee_calculator.rb'
- 'lib/open_food_network/enterprise_issue_validator.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
@@ -631,8 +611,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
Layout/SpaceAroundOperators:
Exclude:
- 'app/controllers/checkout_controller.rb'
- 'app/helpers/admin/business_model_configuration_helper.rb'
- 'app/jobs/update_billable_periods.rb'
- 'app/overrides/remove_search_bar.rb'
- 'app/overrides/remove_side_bar.rb'
- 'app/overrides/replace_shipping_address_form_with_distributor_details.rb'
@@ -644,7 +622,6 @@ Layout/SpaceAroundOperators:
- 'spec/features/consumer/shopping/checkout_spec.rb'
- 'spec/helpers/checkout_helper_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/stripe/account_connector_spec.rb'
- 'spec/spec_helper.rb'
@@ -694,7 +671,6 @@ Layout/SpaceInsideArrayLiteralBrackets:
- 'lib/open_food_network/users_and_enterprises_report.rb'
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- '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'
@@ -715,8 +691,6 @@ Layout/SpaceInsideBlockBraces:
- 'lib/spree/product_filters.rb'
- 'lib/tasks/karma.rake'
- 'spec/archive/features/consumer/checkout_spec.rb'
- 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb'
- 'spec/controllers/admin/business_model_configuration_controller_spec.rb'
- 'spec/controllers/admin/inventory_items_controller_spec.rb'
- 'spec/controllers/admin/tag_rules_controller_spec.rb'
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
@@ -732,9 +706,6 @@ Layout/SpaceInsideBlockBraces:
- 'spec/helpers/enterprises_helper_spec.rb'
- 'spec/helpers/injection_helper_spec.rb'
- 'spec/helpers/spree/orders_helper_spec.rb'
- 'spec/jobs/finalize_account_invoices_spec.rb'
- 'spec/jobs/update_account_invoices_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb'
@@ -767,7 +738,6 @@ Layout/SpaceInsideHashLiteralBraces:
- 'app/controllers/spree/admin/line_items_controller_decorator.rb'
- 'app/controllers/spree/admin/products_controller_decorator.rb'
- 'app/controllers/spree/admin/search_controller_decorator.rb'
- 'app/helpers/admin/business_model_configuration_helper.rb'
- 'app/helpers/admin/injection_helper.rb'
- 'app/helpers/angular_form_builder.rb'
- 'app/helpers/injection_helper.rb'
@@ -775,9 +745,7 @@ Layout/SpaceInsideHashLiteralBraces:
- 'app/helpers/serializer_helper.rb'
- 'app/helpers/spree/admin/base_helper_decorator.rb'
- 'app/helpers/spree/admin/navigation_helper_decorator.rb'
- 'app/jobs/update_billable_periods.rb'
- 'app/mailers/spree/base_mailer_decorator.rb'
- 'app/models/billable_period.rb'
- 'app/models/enterprise.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/enterprise_relationship.rb'
@@ -796,8 +764,6 @@ Layout/SpaceInsideHashLiteralBraces:
- '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'
- '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'
- 'spec/controllers/admin/manager_invitations_controller_spec.rb'
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
@@ -816,7 +782,6 @@ Layout/SpaceInsideHashLiteralBraces:
- 'spec/controllers/spree/user_sessions_controller_spec.rb'
- 'spec/controllers/user_passwords_controller_spec.rb'
- 'spec/controllers/user_registrations_controller_spec.rb'
- 'spec/features/admin/accounts_and_billing_settings_spec.rb'
- 'spec/features/admin/image_settings_spec.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/reports_spec.rb'
@@ -972,7 +937,6 @@ Lint/ShadowingOuterLocalVariable:
# Cop supports --auto-correct.
Lint/StringConversionInInterpolation:
Exclude:
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/enterprises_controller.rb'
- 'app/helpers/admin/injection_helper.rb'
- 'app/helpers/injection_helper.rb'
@@ -1025,8 +989,6 @@ Lint/UnusedMethodArgument:
- 'app/helpers/angular_form_helper.rb'
- 'app/helpers/order_cycles_helper.rb'
- 'app/helpers/spree/base_helper_decorator.rb'
- 'app/jobs/finalize_account_invoices.rb'
- 'app/jobs/update_account_invoices.rb'
- 'app/models/spree/ability_decorator.rb'
- 'app/models/spree/product_decorator.rb'
- 'lib/open_food_network/enterprise_fee_applicator.rb'
@@ -1337,8 +1299,6 @@ Rails/HasAndBelongsToMany:
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/account_invoice.rb'
- 'app/models/billable_period.rb'
- 'app/models/customer.rb'
- 'app/models/enterprise.rb'
- 'app/models/order_cycle.rb'
@@ -1394,8 +1354,6 @@ Rails/OutputSafety:
Rails/PluralizationGrammar:
Exclude:
- 'spec/features/admin/order_cycles_spec.rb'
- 'spec/jobs/update_account_invoices_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/models/order_cycle_spec.rb'
- 'spec/models/spree/product_spec.rb'
@@ -1515,15 +1473,9 @@ Style/BracesAroundHashParameters:
- 'app/controllers/checkout_controller.rb'
- 'app/controllers/spree/admin/products_controller_decorator.rb'
- 'app/controllers/spree/admin/search_controller_decorator.rb'
- 'app/helpers/admin/account_helper.rb'
- 'app/helpers/admin/business_model_configuration_helper.rb'
- 'app/helpers/angular_form_builder.rb'
- 'app/helpers/checkout_helper.rb'
- 'app/helpers/spree/admin/orders_helper_decorator.rb'
- 'app/jobs/finalize_account_invoices.rb'
- 'app/jobs/update_account_invoices.rb'
- 'app/jobs/update_billable_periods.rb'
- 'app/models/billable_period.rb'
- 'app/models/exchange.rb'
- 'app/models/spree/adjustment_decorator.rb'
- 'app/models/spree/line_item_decorator.rb'
@@ -1533,8 +1485,6 @@ Style/BracesAroundHashParameters:
- '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'
- 'spec/controllers/admin/manager_invitations_controller_spec.rb'
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
@@ -1552,19 +1502,14 @@ Style/BracesAroundHashParameters:
- 'spec/controllers/spree/orders_controller_spec.rb'
- 'spec/controllers/user_confirmations_controller_spec.rb'
- 'spec/controllers/user_registrations_controller_spec.rb'
- 'spec/features/admin/accounts_and_billing_settings_spec.rb'
- 'spec/features/admin/business_model_configuration_spec.rb'
- 'spec/features/admin/order_cycles_spec.rb'
- 'spec/features/admin/products_spec.rb'
- 'spec/features/admin/reports_spec.rb'
- 'spec/features/admin/tax_settings_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/jobs/finalize_account_invoices_spec.rb'
- 'spec/jobs/update_account_invoices_spec.rb'
- 'spec/lib/open_food_network/feature_toggle_spec.rb'
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
- 'spec/lib/open_food_network/subscription_summarizer_spec.rb'
- 'spec/models/billable_period_spec.rb'
- 'spec/models/product_distribution_spec.rb'
- 'spec/models/spree/ability_spec.rb'
- 'spec/models/spree/order_spec.rb'
@@ -1588,9 +1533,6 @@ Style/CaseEquality:
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'app/controllers/admin/account_controller.rb'
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/admin/business_model_configuration_controller.rb'
- 'app/controllers/admin/cache_settings_controller.rb'
- 'app/controllers/spree/store_controller_decorator.rb'
- 'app/helpers/angular_form_helper.rb'
@@ -1758,7 +1700,6 @@ Style/FormatStringToken:
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/admin/enterprises_controller.rb'
- 'app/controllers/admin/order_cycles_controller.rb'
- 'app/controllers/admin/product_import_controller.rb'
@@ -1775,8 +1716,6 @@ Style/GuardClause:
- 'app/controllers/spree/orders_controller_decorator.rb'
- 'app/controllers/spree/paypal_controller_decorator.rb'
- 'app/jobs/products_cache_integrity_checker_job.rb'
- 'app/jobs/update_account_invoices.rb'
- 'app/jobs/update_billable_periods.rb'
- 'app/models/enterprise.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/producer_property.rb'
@@ -1786,7 +1725,6 @@ Style/GuardClause:
- 'app/models/spree/product_decorator.rb'
- 'app/models/spree/user_decorator.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/accounts_and_billing_settings_validator.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/products_cache.rb'
- 'lib/open_food_network/products_renderer.rb'
@@ -1805,7 +1743,6 @@ Style/GuardClause:
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
Exclude:
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/admin/contents_controller.rb'
- 'app/controllers/admin/enterprise_fees_controller.rb'
- 'app/controllers/admin/enterprises_controller.rb'
@@ -1823,7 +1760,6 @@ Style/HashSyntax:
- 'app/controllers/spree/paypal_controller_decorator.rb'
- 'app/controllers/spree/store_controller_decorator.rb'
- 'app/controllers/user_passwords_controller.rb'
- 'app/helpers/admin/account_helper.rb'
- 'app/helpers/angular_form_builder.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/checkout_helper.rb'
@@ -1832,7 +1768,6 @@ Style/HashSyntax:
- 'app/helpers/spree/admin/orders_helper_decorator.rb'
- 'app/mailers/enterprise_mailer.rb'
- 'app/mailers/spree/user_mailer_decorator.rb'
- 'app/models/billable_period.rb'
- 'app/models/calculator/flat_percent_per_item.rb'
- 'app/models/enterprise.rb'
- 'app/models/enterprise_fee.rb'
@@ -2090,9 +2025,7 @@ Style/NumericLiterals:
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'app/helpers/admin/business_model_configuration_helper.rb'
- 'app/helpers/checkout_helper.rb'
- 'app/jobs/update_account_invoices.rb'
- 'app/models/spree/calculator/flexi_rate_decorator.rb'
- 'app/models/spree/line_item_decorator.rb'
- 'app/models/spree/order_decorator.rb'
@@ -2181,7 +2114,6 @@ Style/RedundantReturn:
# Cop supports --auto-correct.
Style/RedundantSelf:
Exclude:
- 'app/models/billable_period.rb'
- 'app/models/calculator/flat_percent_per_item.rb'
- 'app/models/enterprise.rb'
- 'app/models/exchange.rb'
@@ -2295,7 +2227,6 @@ Style/StabbyLambdaParentheses:
Style/StringLiteralsInInterpolation:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/jobs/update_billable_periods.rb'
- 'lib/discourse/single_sign_on.rb'
- 'lib/open_food_network/users_and_enterprises_report.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
@@ -2373,12 +2304,9 @@ Style/UnneededCondition:
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Exclude:
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/admin/resource_controller.rb'
- 'app/helpers/admin/business_model_configuration_helper.rb'
- 'app/helpers/angular_form_builder.rb'
- 'app/helpers/injection_helper.rb'
- 'app/jobs/update_billable_periods.rb'
- 'lib/discourse/single_sign_on.rb'
- 'spec/features/admin/bulk_order_management_spec.rb'
- 'spec/features/admin/bulk_product_update_spec.rb'

View File

@@ -27,7 +27,8 @@ gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-0-stable'
# - Pass customer email and phone number to PayPal (merged to upstream master)
# - Change type of password from string to password to hide it in the form
gem 'spree_paypal_express', github: "openfoodfoundation/better_spree_paypal_express", branch: "2-0-stable"
gem 'stripe', '~> 4.5.0'
gem 'stripe', '~> 4.9.0'
# We need at least this version to have Digicert's root certificate
# which is needed for Pin Payments (and possibly others).
gem 'activemerchant', '~> 1.78'

View File

@@ -227,7 +227,7 @@ GEM
execjs
coffee-script-source (1.10.0)
colorize (0.8.1)
combine_pdf (1.0.15)
combine_pdf (1.0.16)
ruby-rc4 (>= 0.1.5)
compass (1.0.3)
chunky_png (~> 1.2)
@@ -551,7 +551,7 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.7.8)
oj (3.7.9)
orm_adapter (0.5.0)
paper_trail (5.2.3)
activerecord (>= 3.0, < 6.0)
@@ -719,7 +719,7 @@ GEM
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
stringex (1.5.1)
stripe (4.5.0)
stripe (4.9.0)
faraday (~> 0.13)
net-http-persistent (~> 3.0)
therubyracer (0.12.0)
@@ -858,7 +858,7 @@ DEPENDENCIES
spree_paypal_express!
spring (= 1.7.2)
spring-commands-rspec
stripe (~> 4.5.0)
stripe (~> 4.9.0)
therubyracer (= 0.12.0)
timecop
truncate_html

View File

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

View File

@@ -1,14 +0,0 @@
angular.module("admin.accounts_and_billing_settings").directive "methodSettingsFor", ->
template: "<div ng-include='include_html'></div>"
restrict: 'A'
scope: {
enterprise_id: '=methodSettingsFor'
}
link: (scope, element, attrs) ->
scope.include_html = ""
scope.$watch "enterprise_id", (newVal, oldVal)->
if !newVal? || newVal == ""
scope.include_html = ""
else
scope.include_html = "/admin/accounts_and_billing_settings/show_methods?enterprise_id=#{newVal};"

View File

@@ -9,7 +9,7 @@
//= require jquery-migrate-min
//= require jquery_ujs
//= require jquery.ui.all
//= require shared/jquery-ui-timepicker-addon
//= require jquery-ui-timepicker-addon
//= require angular
//= require angular-resource
//= require angular-animate
@@ -23,8 +23,6 @@
//= require angular-rails-templates
//= require_tree ../templates/admin
//= require ./admin_ofn
//= require ./accounts_and_billing_settings/accounts_and_billing_settings
//= require ./business_model_configuration/business_model_configuration
//= require ./customers/customers
//= require ./dropdown/dropdown
//= require ./enterprises/enterprises

View File

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

View File

@@ -1,25 +0,0 @@
angular.module("admin.businessModelConfiguration").controller "BusinessModelConfigCtrl", ($scope, $filter) ->
$scope.turnover = 1000
$scope.bill = ->
return $filter('currency')(0) unless $scope.fixed || $scope.rate
Number($scope.fixed) + Number($scope.turnover) * Number($scope.rate)
$scope.cappedBill = ->
return $scope.bill() if !$scope.cap? || Number($scope.cap) == 0
Math.min($scope.bill(), Number($scope.cap))
$scope.finalBill = ->
return 0 if Number($scope.turnover) < Number($scope.minBillableTurnover)
$scope.cappedBill()
$scope.capReached = ->
return t('no') if !$scope.cap? || Number($scope.cap) == 0
if $scope.bill() >= Number($scope.cap) then t('yes') else t('no')
$scope.includedTax = ->
return 0 if !$scope.taxRate? || Number($scope.taxRate) == 0
($scope.cappedBill() * Number($scope.taxRate))
$scope.total = ->
$scope.finalBill() + $scope.includedTax()

View File

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

View File

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

View File

@@ -57,18 +57,20 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo
scope = $rootScope.$new(true)
scope.variants = []
# TODO: These changes to quantity/max_quantity trigger another cart update, which
# is unnecessary.
# TODO: These changes to quantity/max_quantity trigger another cart update, which is unnecessary.
for li in @line_items when li.quantity > 0
if stockLevels[li.variant.id]?
li.variant.count_on_hand = stockLevels[li.variant.id].on_hand
if li.quantity > li.variant.count_on_hand
li.quantity = li.variant.count_on_hand
scope.variants.push li.variant
if li.variant.count_on_hand == 0 && li.max_quantity > li.variant.count_on_hand
li.max_quantity = li.variant.count_on_hand
scope.variants.push(li.variant) unless li.variant in scope.variants
continue unless stockLevels[li.variant.id]?
li.variant.on_hand = stockLevels[li.variant.id].on_hand
li.variant.on_demand = stockLevels[li.variant.id].on_demand
continue if li.variant.on_demand
if li.quantity > li.variant.on_hand
li.quantity = li.variant.on_hand
scope.variants.push li.variant
if li.variant.on_hand == 0 && li.max_quantity > li.variant.on_hand
li.max_quantity = li.variant.on_hand
scope.variants.push(li.variant) unless li.variant in scope.variants
if scope.variants.length > 0
$modal.open(templateUrl: "out_of_stock.html", scope: scope, windowClass: 'out-of-stock-modal')

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
%p{'ng-repeat' => "v in variants"}
%em {{ v.name_to_display }} - {{ v.unit_to_display }}
%span{'ng-if' => "v.count_on_hand == 0"}
%span{'ng-if' => "v.on_hand == 0"}
{{ 'js.out_of_stock.now_out_of_stock' | t }}
%span{'ng-if' => "v.count_on_hand > 0"}
{{ 'js.out_of_stock.only_n_remainging' | t:{ num: v.count_on_hand } }}
%span{'ng-if' => "v.on_hand > 0"}
{{ 'js.out_of_stock.only_n_remainging' | t:{ num: v.on_hand } }}

View File

@@ -7,6 +7,6 @@
placeholder: "0",
"ofn-disable-scroll" => true,
"ng-model" => "variant.line_item.quantity",
"ofn-on-hand" => "{{variant.on_demand && 9999 || variant.count_on_hand }}",
"ng-disabled" => "!variant.on_demand && variant.count_on_hand == 0",
"ofn-on-hand" => "{{variant.on_demand && 9999 || variant.on_hand }}",
"ng-disabled" => "!variant.on_demand && variant.on_hand == 0",
name: "variants[{{::variant.id}}]", id: "variants_{{::variant.id}}"}

View File

@@ -9,7 +9,7 @@
"ng-model" => "variant.line_item.quantity",
placeholder: "{{::'shop_variant_quantity_min' | t}}",
"ofn-disable-scroll" => true,
"ofn-on-hand" => "{{variant.on_demand && 9999 || variant.count_on_hand }}",
"ofn-on-hand" => "{{variant.on_demand && 9999 || variant.on_hand }}",
name: "variants[{{::variant.id}}]", id: "variants_{{::variant.id}}"}
%span.bulk-input
%input.bulk.second{type: :number,

View File

@@ -1,7 +1,7 @@
.container
.row.modal-centered
%h2 {{'welcome_to_ofn' | t}}
%h5 {{'signup_or_login' | t}}:
%h2 {{'js.registration.welcome_to_ofn' | t}}
%h5 {{'js.registration.signup_or_login' | t}}:
%div{"ng-controller" => "AuthenticationCtrl"}
%tabset
%ng-include{src: "'signup.html'"}
@@ -9,9 +9,9 @@
%ng-include{src: "'forgot.html'"}
%div{ ng: { show: "active('/signup')"} }
%hr
{{'have_an_account' | t}}
{{'js.registration.have_an_account' | t}}
%a{ href: "", ng: { click: "select('/login')"}}
{{'action_login' | t}}
{{'js.registration.action_login' | t}}
%a.close-reveal-modal{"ng-click" => "$close()"}
%i.ofn-i_009-close

View File

@@ -1,19 +0,0 @@
@import "variables";
.row.invoice_title {
margin-bottom: 0px;
}
table.invoice_summary {
margin-bottom: 70px;
tr.total {
font-weight: bold;
}
}
.invoice_title {
.balance {
color: $spree-green;
}
}

View File

@@ -7,9 +7,10 @@
*= require admin/spree_backend
*= require admin/spree_auth
*= require shared/jquery-ui-timepicker-addon
*= require jquery-ui-timepicker-addon
*= require shared/textAngular
*= require shared/ng-tags-input.min
*= require admin/custom
*= require_self
*/

View File

@@ -1,12 +0,0 @@
@import "../variables";
#trial_progress_bar {
position: fixed;
left: 0px;
bottom: 0px;
width: 100vw;
padding: 8px 10px;
font-weight: bold;
background-color: $spree-blue;
color: white;
}

View File

@@ -0,0 +1,2 @@
/* Custom fix */
.ui-timepicker-div.ui-timepicker-oneLine dl dd { width: 25%; }

View File

@@ -1,10 +0,0 @@
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; }
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }

View File

@@ -1,6 +0,0 @@
class Admin::AccountController < Spree::Admin::BaseController
def show
@invoices = spree_current_user.account_invoices
end
end

View File

@@ -1,74 +0,0 @@
require 'open_food_network/accounts_and_billing_settings_validator'
class Admin::AccountsAndBillingSettingsController < Spree::Admin::BaseController
before_filter :load_distributors, only: [:edit, :update, :start_job]
before_filter :load_jobs, only: [:edit, :update, :start_job]
before_filter :load_settings, only: [:edit, :update, :start_job]
before_filter :require_valid_settings, only: [:update, :start_job]
before_filter :require_known_job, only: [:start_job]
def update
Spree::Config.set(params[:settings])
flash[:success] = t(:successfully_updated, :resource => t(:billing_and_account_settings))
redirect_to_edit
end
def start_job
if @update_account_invoices_job || @finalize_account_invoices_job
flash[:error] = I18n.t(:accounts_and_billing_task_already_running_error)
else
new_job = "#{params[:job][:name]}".camelize.constantize.new
Delayed::Job.enqueue new_job
flash[:success] = I18n.t(:accounts_and_billing_start_task_notice)
end
redirect_to_edit
end
def show_methods
@enterprise = Enterprise.find_by_id(params[:enterprise_id])
@shipping_methods = @enterprise.shipping_methods
@payment_methods = @enterprise.payment_methods
render partial: 'method_settings'
end
private
def redirect_to_edit
redirect_to main_app.edit_admin_accounts_and_billing_settings_path
end
def require_valid_settings
render :edit unless @settings.valid?
end
def known_jobs
['update_account_invoices', 'finalize_account_invoices']
end
def require_known_job
unless known_jobs.include?(params[:job][:name])
flash[:error] = "Unknown Task: #{params[:job][:name].to_s}"
redirect_to_edit
end
end
def load_settings
@settings = OpenFoodNetwork::AccountsAndBillingSettingsValidator.new(params[:settings] || {
accounts_distributor_id: Spree::Config[:accounts_distributor_id],
default_accounts_payment_method_id: Spree::Config[:default_accounts_payment_method_id],
default_accounts_shipping_method_id: Spree::Config[:default_accounts_shipping_method_id],
auto_update_invoices: Spree::Config[:auto_update_invoices],
auto_finalize_invoices: Spree::Config[:auto_finalize_invoices]
})
end
def load_distributors
@distributors = Enterprise.is_distributor.select([:id, :name])
end
def load_jobs
@update_account_invoices_job = Delayed::Job.where("handler LIKE (?)", "%UpdateAccountInvoices%").last
@finalize_account_invoices_job = Delayed::Job.where("handler LIKE (?)", "%FinalizeAccountInvoices%").last
end
end

View File

@@ -1,35 +0,0 @@
require 'open_food_network/business_model_configuration_validator'
class Admin::BusinessModelConfigurationController < Spree::Admin::BaseController
before_filter :load_settings, only: [:edit, :update]
before_filter :require_valid_settings, only: [:update]
def update
Spree::Config.set(params[:settings])
flash[:success] = t(:successfully_updated,
resource: t('admin.business_model_configuration.edit.business_model_configuration'))
redirect_to_edit
end
private
def redirect_to_edit
redirect_to main_app.edit_admin_business_model_configuration_path
end
def load_settings
@settings = OpenFoodNetwork::BusinessModelConfigurationValidator.new(params[:settings] || {
shop_trial_length_days: Spree::Config[:shop_trial_length_days],
account_invoices_monthly_fixed: Spree::Config[:account_invoices_monthly_fixed],
account_invoices_monthly_rate: Spree::Config[:account_invoices_monthly_rate],
account_invoices_monthly_cap: Spree::Config[:account_invoices_monthly_cap],
account_invoices_tax_rate: Spree::Config[:account_invoices_tax_rate],
minimum_billable_turnover: Spree::Config[:minimum_billable_turnover]
})
end
def require_valid_settings
render :edit unless @settings.valid?
end
end

View File

@@ -1,8 +1,7 @@
require 'open_food_network/products_cache_integrity_checker'
class Admin::CacheSettingsController < Spree::Admin::BaseController
def show
def edit
@results = Exchange.cachable.map do |exchange|
checker = OpenFoodNetwork::ProductsCacheIntegrityChecker.new(exchange.receiver, exchange.order_cycle)
@@ -10,4 +9,10 @@ class Admin::CacheSettingsController < Spree::Admin::BaseController
end
end
def update
Spree::Config.set(params[:preferences])
respond_to do |format|
format.html { redirect_to main_app.edit_admin_cache_settings_path }
end
end
end

View File

@@ -64,10 +64,6 @@ module Admin
attributes = { sells: params[:sells], visible: true }
if ['own', 'any'].include? params[:sells]
attributes[:shop_trial_start_date] = @enterprise.shop_trial_start_date || Time.zone.now
end
if @enterprise.update_attributes(attributes)
flash[:success] = I18n.t(:enterprise_register_success_notice, enterprise: @enterprise.name)
redirect_to admin_path

View File

@@ -79,11 +79,9 @@ module Admin
end
def save_uploaded_file(upload)
filename = 'import' + Time.zone.now.strftime('%d-%m-%Y-%H-%M-%S')
extension = '.' + upload.original_filename.split('.').last
directory = 'tmp/product_import'
Dir.mkdir(directory) unless File.exist?(directory)
File.open(Rails.root.join(directory, filename + extension), 'wb') do |f|
extension = File.extname(upload.original_filename)
directory = Dir.mktmpdir 'product_import'
File.open(File.join(directory, "import#{extension}"), 'wb') do |f|
data = UploadSanitizer.new(upload.read).call
f.write(data)
f.path

View File

@@ -1,7 +1,7 @@
module Api
class CustomersController < BaseController
def index
@customers = current_api_user.customers.of_regular_shops
@customers = current_api_user.customers
render json: @customers, each_serializer: CustomerSerializer
end

View File

@@ -10,10 +10,6 @@ Spree::UsersController.class_eval do
def show
@orders = @user.orders.where(state: 'complete').order('completed_at desc')
@unconfirmed_email = spree_current_user.unconfirmed_email
return unless Spree::Config.accounts_distributor_id
@orders = @orders.where('distributor_id != ?', Spree::Config.accounts_distributor_id)
end
# Endpoint for queries to check if a user is already registered

View File

@@ -1,14 +0,0 @@
module Admin
module AccountHelper
def invoice_description_for(invoice)
month = t(:abbr_month_names, :scope => :date)[invoice.month]
year = invoice.year
star = invoice.order.nil? || invoice.order.completed? ? "" : "*"
"#{month} #{year}#{star}"
end
def invoice_total_for(invoice)
invoice.order.andand.display_total || Spree::Money.new(0, { :currency => Spree::Config[:currency] })
end
end
end

View File

@@ -1,71 +0,0 @@
module Admin
module BusinessModelConfigurationHelper
def monthly_bill_description
plus = monthly_bill_includes_fixed? && monthly_bill_includes_rate? ? " + " : ""
ts = trial_description.empty? ? "": " "
ms = minimum_description.empty? ? "": " "
if fixed_description.empty? && rate_description.empty?
t(:free).upcase
elsif monthly_bill_includes_rate_limits? && monthly_bill_includes_rate? # only care about cap/min-bill-to if there is a rate too
"#{trial_description}#{ts}#{fixed_description}#{plus}#{rate_description}#{ms}#{minimum_description}#{cap_description} #{t(:per_month).upcase}#{tax_description.upcase}"
else
"#{trial_description}#{ts}#{fixed_description}#{plus}#{rate_description} #{t(:per_month).upcase}#{tax_description.upcase}"
end
end
private
def free_use?
Spree::Config[:account_invoices_monthly_fixed] == 0 && Spree::Config[:account_invoices_monthly_rate] == 0
end
def fixed_description
fixed_amount = Spree::Money.new(Spree::Config[:account_invoices_monthly_fixed], {currency: Spree::Config[:currency]} ).rounded
monthly_bill_includes_fixed? ? "#{fixed_amount}" : ""
end
def rate_description
percentage = (Spree::Config[:account_invoices_monthly_rate]*100).round(2)
monthly_bill_includes_rate? ? t(:percentage_of_sales, percentage: "#{percentage}%").upcase : ""
end
def cap_description
cap_amount = Spree::Money.new(Spree::Config[:account_invoices_monthly_cap], { currency: Spree::Config[:currency] }).rounded
monthly_bill_includes_cap? ? ", #{t(:capped_at_cap, cap: cap_amount).upcase}" : ""
end
def tax_description
Spree::Config[:account_invoices_tax_rate] > 0 ? ", #{t(:plus_tax).upcase}" : ""
end
def trial_description
Spree::Config[:shop_trial_length_days] > 0 ? "#{t(:free_trial).upcase} #{t(:then).upcase}" : ""
end
def minimum_description
mbt_amount = Spree::Money.new(Spree::Config[:minimum_billable_turnover], { currency: Spree::Config[:currency] }).rounded
monthly_bill_includes_min_turnover? ? "#{t(:min_bill_turnover_desc, mbt_amount: mbt_amount).upcase}" : ""
end
def monthly_bill_includes_fixed?
Spree::Config[:account_invoices_monthly_fixed] > 0
end
def monthly_bill_includes_rate?
Spree::Config[:account_invoices_monthly_rate] > 0
end
def monthly_bill_includes_cap?
Spree::Config[:account_invoices_monthly_cap] > 0
end
def monthly_bill_includes_min_turnover?
Spree::Config[:minimum_billable_turnover] > 1
end
def monthly_bill_includes_rate_limits?
monthly_bill_includes_min_turnover? || monthly_bill_includes_cap?
end
end
end

View File

@@ -1,7 +1,5 @@
module Admin
module InjectionHelper
include BusinessModelConfigurationHelper
def admin_inject_enterprise
admin_inject_json_ams "admin.enterprises", "enterprise", @enterprise, Api::Admin::EnterpriseSerializer
end
@@ -110,10 +108,6 @@ module Admin
admin_inject_json_ams_array "admin.orders", "orderCycles", @order_cycles, Api::Admin::BasicOrderCycleSerializer, current_user: spree_current_user
end
def admin_inject_monthly_bill_description
render partial: "admin/json/injection_ams", locals: {ngModule: "admin.enterprises", name: "monthlyBillDescription", json: monthly_bill_description.to_json}
end
def admin_inject_spree_api_key
render partial: "admin/json/injection_ams", locals: {ngModule: 'admin.indexUtils', name: 'SpreeApiKey', json: "'#{@spree_api_key.to_s}'"}
end

View File

@@ -78,22 +78,6 @@ module EnterprisesHelper
link_to_with_icon 'icon-trash', name, url, options
end
def shop_trial_in_progress?(enterprise)
!!enterprise.shop_trial_start_date &&
(enterprise.shop_trial_start_date + Spree::Config[:shop_trial_length_days].days > Time.zone.now) &&
%w(own any).include?(enterprise.sells)
end
def shop_trial_expired?(enterprise)
!!enterprise.shop_trial_start_date &&
(enterprise.shop_trial_start_date + Spree::Config[:shop_trial_length_days].days <= Time.zone.now) &&
%w(own any).include?(enterprise.sells)
end
def remaining_trial_days(enterprise)
distance_of_time_in_words(Time.zone.now, enterprise.shop_trial_start_date + Spree::Config[:shop_trial_length_days].days)
end
def order_changes_allowed?
current_order.andand.distributor.andand.allow_order_changes?
end

View File

@@ -65,7 +65,7 @@ module InjectionHelper
end
def inject_shops
customers = spree_current_user.customers.of_regular_shops
customers = spree_current_user.customers
shops = Enterprise.where(id: @orders.pluck(:distributor_id).uniq | customers.pluck(:enterprise_id))
inject_json_ams "shops", shops.all, Api::ShopForOrdersSerializer
end

View File

@@ -1,110 +0,0 @@
# This class is part of the system that charges hubs for using OFN. It does so
# by creating orders. These are not orders for food that customers place, but
# instead are orders for OFN usage, so to speak. Thus, they're technically not
# "shipped" anywhere, so they're just given a default shipping method.
#
# The "orders" used by this class are not real orders, they are basically
# "invoices" that enterprise owners need to pay for use of an open food network
# instance. The amount that the enterprise owner is charged is configurable by
# the instance, and can be based on a combination of a percentage of their
# turnover, fixed fees, caps and floors and trial periods. This "orders" hold
# the billing information for a particular enterprise owner for a given month.
#
# We assign them also a default shipping method because there is a validation
# on Spree::Shipment that requires it.
class FinalizeAccountInvoices
attr_reader :year, :month, :start_date, :end_date
def initialize(year = nil, month = nil)
ref_point = Time.zone.now - 1.month
@year = year || ref_point.year
@month = month || ref_point.month
@start_date = Time.zone.local(@year, @month)
@end_date = Time.zone.local(@year, @month) + 1.month
end
def before(job)
UpdateBillablePeriods.new(year, month).perform
UpdateAccountInvoices.new(year, month).perform
end
def perform
return unless settings_are_valid?
invoice_orders = AccountInvoice.where(year: year, month: month).map(&:order)
invoice_orders.select{ |order| order.present? && order.completed_at.nil? }.each{ |order| finalize(order) }
end
def finalize(invoice_order)
# TODO: When we implement per-customer and/or per-user preferences around shipping and payment methods
# we can update these to read from those preferences
invoice_order.payments.create(payment_method_id: Spree::Config.default_accounts_payment_method_id, amount: invoice_order.total)
invoice_order.update_attribute(:shipping_method_id, Spree::Config.default_accounts_shipping_method_id)
while invoice_order.state != "complete"
if invoice_order.errors.any?
Bugsnag.notify(RuntimeError.new("FinalizeInvoiceError"), {
job: "FinalizeAccountInvoices",
error: "Cannot finalize invoice due to errors",
data: {
errors: invoice_order.errors.full_messages
}
})
break
else
invoice_order.next
end
end
end
private
def settings_are_valid?
unless end_date <= Time.zone.now
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "FinalizeAccountInvoices",
error: "end_date is in the future",
data: {
end_date: end_date.in_time_zone.strftime("%F %T"),
now: Time.zone.now.strftime("%F %T")
}
})
return false
end
unless @accounts_distributor = Enterprise.find_by_id(Spree::Config.accounts_distributor_id)
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "FinalizeAccountInvoices",
error: "accounts_distributor_id is invalid",
data: {
accounts_distributor_id: Spree::Config.accounts_distributor_id
}
})
return false
end
unless @accounts_distributor.payment_methods.find_by_id(Spree::Config.default_accounts_payment_method_id)
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "FinalizeAccountInvoices",
error: "default_accounts_payment_method_id is invalid",
data: {
default_accounts_payment_method_id: Spree::Config.default_accounts_payment_method_id
}
})
return false
end
unless @accounts_distributor.shipping_methods.find_by_id(Spree::Config.default_accounts_shipping_method_id)
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "FinalizeAccountInvoices",
error: "default_accounts_shipping_method_id is invalid",
data: {
default_accounts_shipping_method_id: Spree::Config.default_accounts_shipping_method_id
}
})
return false
end
true
end
end

View File

@@ -25,7 +25,7 @@ class SubscriptionConfirmJob
def proxy_orders
ProxyOrder.not_canceled.where('confirmed_at IS NULL AND placed_at IS NOT NULL')
.joins(:order_cycle).merge(recently_closed_order_cycles)
.joins(:order).merge(Spree::Order.complete)
.joins(:order).merge(Spree::Order.complete.not_state('canceled'))
end
def recently_closed_order_cycles

View File

@@ -1,108 +0,0 @@
class UpdateAccountInvoices
attr_reader :year, :month, :start_date, :end_date
def initialize(year = nil, month = nil)
ref_point = Time.zone.now - 1.day
@year = year || ref_point.year
@month = month || ref_point.month
@start_date = Time.zone.local(@year, @month)
@end_date = Time.zone.local(@year, @month) + 1.month
@end_date = Time.zone.now.beginning_of_day if start_date == Time.zone.now.beginning_of_month
end
def before(job)
UpdateBillablePeriods.new(year, month).perform
end
def perform
return unless settings_are_valid?
account_invoices = AccountInvoice.where(year: year, month: month)
account_invoices.each { |account_invoice| update(account_invoice) }
end
def update(account_invoice)
current_adjustments = []
unless account_invoice.order
account_invoice.order = account_invoice.user.orders.new(distributor_id: Spree::Config[:accounts_distributor_id])
end
if account_invoice.order.complete?
Bugsnag.notify(RuntimeError.new("InvoiceAlreadyFinalized"), {
invoice_order: account_invoice.order.as_json
})
else
billable_periods = account_invoice.billable_periods.order(:enterprise_id, :begins_at).reject{ |bp| bp.bill == 0 }
if billable_periods.any?
oldest_enterprise = billable_periods.first.enterprise
address = oldest_enterprise.address.dup
first, _space, last = (oldest_enterprise.contact_name || "").partition(' ')
address.update_attributes(phone: oldest_enterprise.phone) if oldest_enterprise.phone.present?
address.update_attributes(firstname: first, lastname: last) if first.present? && last.present?
account_invoice.order.update_attributes(bill_address: address, ship_address: address)
end
billable_periods.each do |billable_period|
current_adjustments << billable_period.ensure_correct_adjustment_for(account_invoice.order)
end
account_invoice.save if current_adjustments.any?
clean_up(account_invoice.order, current_adjustments)
end
end
def clean_up(invoice_order, current_adjustments)
# Snag and then delete any obsolete adjustments
obsolete_adjustments = invoice_order.adjustments.where('source_type = (?) AND id NOT IN (?)', "BillablePeriod", current_adjustments)
if obsolete_adjustments.any?
Bugsnag.notify(RuntimeError.new("Obsolete Adjustments"), {
current: current_adjustments.map(&:as_json),
obsolete: obsolete_adjustments.map(&:as_json)
})
obsolete_adjustments.destroy_all
end
if current_adjustments.empty?
if invoice_order.persisted?
Bugsnag.notify(RuntimeError.new("Empty Persisted Invoice"), {
invoice_order: invoice_order.as_json
})
else
invoice_order.destroy
end
end
end
private
def settings_are_valid?
unless end_date <= Time.zone.now
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "UpdateAccountInvoices",
error: "end_date is in the future",
data: {
end_date: end_date.in_time_zone.strftime("%F %T"),
now: Time.zone.now.strftime("%F %T")
}
})
return false
end
unless Enterprise.find_by_id(Spree::Config.accounts_distributor_id)
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "UpdateAccountInvoices",
error: "accounts_distributor_id is invalid",
data: {
accounts_distributor_id: Spree::Config.accounts_distributor_id
}
})
return false
end
true
end
end

View File

@@ -1,130 +0,0 @@
class UpdateBillablePeriods
attr_reader :year, :month, :start_date, :end_date
def initialize(year = nil, month = nil)
ref_point = Time.zone.now - 1.day
@year = year || ref_point.year
@month = month || ref_point.month
@start_date = Time.zone.local(@year, @month)
@end_date = Time.zone.local(@year, @month) + 1.month
@end_date = Time.zone.now.beginning_of_day if start_date == Time.zone.now.beginning_of_month
end
def perform
return unless settings_are_valid?
job_start_time = Time.zone.now
enterprises = Enterprise.where('created_at < (?)', end_date).select([:id, :name, :owner_id, :sells, :shop_trial_start_date, :created_at])
# Cycle through enterprises
enterprises.each do |enterprise|
start_for_enterprise = [start_date, enterprise.created_at].max
end_for_enterprise = [end_date].min # [end_date, enterprise.deleted_at].min
# Cycle through previous versions of this enterprise
versions = enterprise.versions.where('created_at >= (?) AND created_at < (?)', start_for_enterprise, end_for_enterprise).order(:created_at)
trial_start = enterprise.shop_trial_start_date
trial_expiry = enterprise.shop_trial_expiry
versions.each do |version|
begins_at = version.previous.andand.created_at || start_for_enterprise
ends_at = version.created_at
split_for_trial(version.reify, begins_at, ends_at, trial_start, trial_expiry)
end
# Update / create billable_period for current start
begins_at = versions.last.andand.created_at || start_for_enterprise
ends_at = end_date
split_for_trial(enterprise, begins_at, ends_at, trial_start, trial_expiry)
clean_up_untouched_billable_periods_for(enterprise, job_start_time)
end
end
def split_for_trial(enterprise, begins_at, ends_at, trial_start, trial_expiry)
trial_start = trial_expiry = begins_at-1.day if trial_start.nil? || trial_expiry.nil?
# If the trial begins after ends_at, create a bill for the entire period
# Otherwise, create a normal billable_period from the begins_at until the start of the trial
if trial_start > begins_at
update_billable_period(enterprise, begins_at, [ends_at, trial_start].min, false)
end
# If all or some of the trial occurs between begins_at and ends_at
# Create a trial billable_period from the from begins_at or trial_start, whichever occurs last, until ends_at, or trial_expiry whichever occurs first
if trial_expiry >= begins_at && trial_start <= ends_at
update_billable_period(enterprise, [trial_start, begins_at].max, [ends_at, trial_expiry].min, true)
end
# If the trial finishes before begins_at, or trial has not been set, create a bill for the entire period
# Otherwise, create a normal billable_period from the end of the trial until ends_at
if trial_expiry < ends_at
update_billable_period(enterprise, [trial_expiry, begins_at].max, ends_at, false)
end
end
def update_billable_period(enterprise, begins_at, ends_at, trial)
owner_id = enterprise.owner_id
sells = enterprise.sells
orders = Spree::Order.where('distributor_id = (?) AND completed_at >= (?) AND completed_at < (?)', enterprise.id, begins_at, ends_at)
account_invoice = AccountInvoice.find_or_create_by_user_id_and_year_and_month(owner_id, begins_at.year, begins_at.month)
billable_period = BillablePeriod.where(account_invoice_id: account_invoice.id, begins_at: begins_at, enterprise_id: enterprise.id).first
unless account_invoice.order.andand.complete?
billable_period ||= BillablePeriod.new(account_invoice_id: account_invoice.id, begins_at: begins_at, enterprise_id: enterprise.id)
billable_period.update_attributes({
ends_at: ends_at,
sells: sells,
trial: trial,
owner_id: owner_id,
turnover: orders.sum(&:total)
})
end
billable_period.touch
end
def clean_up_untouched_billable_periods_for(enterprise, job_start_time)
# Snag and then delete any BillablePeriods which overlap
obsolete_billable_periods = enterprise.billable_periods.where('ends_at > (?) AND begins_at < (?) AND billable_periods.updated_at < (?)', start_date, end_date, job_start_time)
if obsolete_billable_periods.any?
current_billable_periods = enterprise.billable_periods.where('ends_at >= (?) AND begins_at <= (?) AND billable_periods.updated_at > (?)', start_date, end_date, job_start_time)
Delayed::Worker.logger.info "#{enterprise.name} #{start_date.strftime("%F %T")} #{job_start_time.strftime("%F %T")}"
Delayed::Worker.logger.info "#{obsolete_billable_periods.first.updated_at.strftime("%F %T")}"
Bugsnag.notify(RuntimeError.new("Obsolete BillablePeriods"), {
current: current_billable_periods.map(&:as_json),
obsolete: obsolete_billable_periods.map(&:as_json)
})
end
obsolete_billable_periods.includes({ account_invoice: :order}).
where('spree_orders.state <> \'complete\' OR account_invoices.order_id IS NULL').
each(&:delete)
end
private
def settings_are_valid?
unless end_date <= Time.zone.now
Bugsnag.notify(RuntimeError.new("InvalidJobSettings"), {
job: "UpdateBillablePeriods",
error: "end_date is in the future",
data: {
end_date: end_date.in_time_zone.strftime("%F %T"),
now: Time.zone.now.strftime("%F %T")
}
})
return false
end
true
end
end

View File

@@ -1,6 +0,0 @@
class AccountInvoice < ActiveRecord::Base
belongs_to :user, class_name: "Spree::User"
belongs_to :order, class_name: "Spree::Order"
attr_accessible :user_id, :order_id, :issued_at, :month, :year
has_many :billable_periods
end

View File

@@ -1,77 +0,0 @@
require 'open_food_network/bill_calculator'
class BillablePeriod < ActiveRecord::Base
belongs_to :enterprise
belongs_to :owner, class_name: 'Spree::User'
belongs_to :account_invoice
has_one :adjustment, :as => :source, class_name: "Spree::Adjustment" #, :dependent => :destroy
default_scope where(deleted_at: nil)
def display_turnover
Spree::Money.new(turnover, {currency: Spree::Config[:currency]})
end
def display_bill
Spree::Money.new(bill, {currency: Spree::Config[:currency]})
end
def bill
return 0 if trial?
return 0 unless ['own', 'any'].include?(sells)
OpenFoodNetwork::BillCalculator.new(turnover: turnover).bill
end
def label
enterprise_version = enterprise.version_at(begins_at)
category = enterprise_version.category.to_s.titleize
category += (trial ? " #{I18n.t(:trial)}" : "")
"#{enterprise_version.name} (#{category})"
end
def adjustment_label
begins = begins_at.in_time_zone.strftime("%d/%m/%y")
ends = ends_at.in_time_zone.strftime("%d/%m/%y")
"#{label} [#{begins} - #{ends}]"
end
def delete
self.update_column(:deleted_at, Time.zone.now)
end
def ensure_correct_adjustment_for(invoice)
if adjustment
# adjustment.originator = enterprise.package
adjustment.adjustable = invoice
adjustment.update_attributes( label: adjustment_label, amount: bill )
else
self.adjustment = invoice.adjustments.new( adjustment_attrs, :without_protection => true )
end
if Spree::Config.account_invoices_tax_rate > 0
adjustment.set_included_tax! Spree::Config.account_invoices_tax_rate
else
adjustment.set_included_tax! 0
end
adjustment
end
private
def adjustment_attrs
# We should ultimately have an EnterprisePackage model, which holds all info about shop type, producer, trials, etc.
# It should also implement a calculator that we can use here by specifying the package as the originator of the
# adjustment, meaning that adjustments are created and updated using Spree's existing architecture.
{ label: adjustment_label,
amount: bill,
source: self,
originator: nil, # enterprise.package
mandatory: true,
state: 'closed'
}
end
end

View File

@@ -1,3 +1,21 @@
# Validates the combination of on_demand and count_on_hand values.
#
# `on_demand` can have three values: true, false or nil
# `count_on_hand` can either be: nil or a number
#
# This means that a variant override can be in six different stock states
# but only three of them are valid.
#
# | on_demand | count_on_hand | stock_overridden? | use_producer_stock_settings? | valid? |
# |-----------|---------------|-------------------|------------------------------|--------|
# | 1 | nil | false | false | true |
# | 0 | x | true | false | true |
# | nil | nil | false | true | true |
# | 1 | x | ? | ? | false |
# | 0 | nil | ? | ? | false |
# | nil | x | ? | ? | false |
#
# This module has one method for each invalid case.
module StockSettingsOverrideValidation
extend ActiveSupport::Concern

View File

@@ -20,61 +20,30 @@ module VariantStock
after_update :save_stock
end
# Returns the number of items of the variant available in the stock. When
# allowing on demand, it returns infinite.
#
# Spree computes it as the sum of the count_on_hand of all its stock_items.
# Returns the number of items of the variant available.
# Spree computes total_on_hand as the sum of the count_on_hand of all its stock_items.
#
# @return [Float|Integer]
def on_hand
warn_deprecation(__method__, '#total_on_hand')
if on_demand
Float::INFINITY
else
total_on_hand
end
end
# Returns the number of items available in the stock for this variant
#
# @return [Float|Integer]
def count_on_hand
warn_deprecation(__method__, '#total_on_hand')
total_on_hand
end
# Sets the stock level when `track_inventory_levels` config is
# set. It raises otherwise.
# Sets the stock level of the variant.
# This will only work if `track_inventory_levels` config is set
# and if there is a stock item for the variant.
#
# @raise [StandardError] when the track_inventory_levels config
# key is not set.
# @raise [StandardError] when the track_inventory_levels config key is not set
# and when the variant has no stock item
def on_hand=(new_level)
warn_deprecation(__method__, '#total_on_hand')
error = 'Cannot set on_hand value when Spree::Config[:track_inventory_levels] is false'
raise error unless Spree::Config.track_inventory_levels
self.count_on_hand = new_level
end
# Sets the stock level. As opposed to #on_hand= it does not check
# `track_inventory_levels`'s value as it was previously an ActiveModel
# setter of the database column of the `spree_variants` table. That is why
# #on_hand= is more widely used in Spree's codebase using #count_on_hand=
# underneath.
#
# So, if #count_on_hand= is used, `track_inventory_levels` won't be taken
# into account thus dismissing instance's configuration.
#
# It does ensure there's a stock item for the variant however. See
# #raise_error_if_no_stock_item_available for details.
#
# @raise [StandardError] when the variant has no stock item yet
def count_on_hand=(new_level)
warn_deprecation(__method__, '#total_on_hand')
raise_error_if_no_stock_item_available
overwrite_stock_levels(new_level)
end
@@ -131,7 +100,7 @@ module VariantStock
# Here we depend only on variant.total_on_hand and variant.on_demand.
# This way, variant_overrides only need to override variant.total_on_hand and variant.on_demand.
def fill_status(quantity)
if count_on_hand >= quantity
if on_hand >= quantity
on_hand = quantity
backordered = 0
else

View File

@@ -23,11 +23,6 @@ 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

View File

@@ -37,7 +37,6 @@ class Enterprise < ActiveRecord::Base
has_many :distributor_shipping_methods, foreign_key: :distributor_id
has_many :shipping_methods, through: :distributor_shipping_methods
has_many :customers
has_many :billable_periods
has_many :inventory_items
has_many :tag_rules
has_one :stripe_account, dependent: :destroy
@@ -322,10 +321,6 @@ class Enterprise < ActiveRecord::Base
end
end
def shop_trial_expiry
shop_trial_start_date.andand + Spree::Config[:shop_trial_length_days].days
end
def can_invoice?
abn.present?
end

View File

@@ -218,7 +218,7 @@ module ProductImport
end
when 'overwrite_empty'
if object.public_send(attribute).blank? ||
((attribute == 'on_hand' || attribute == 'count_on_hand') &&
((attribute == 'on_hand') &&
entry.on_hand_nil)
object.assign_attributes(attribute => setting['value'])

View File

@@ -372,7 +372,6 @@ module ProductImport
return if entry.on_hand.present?
object.on_hand = 0 if object.respond_to?(:on_hand)
object.count_on_hand = 0 if object.respond_to?(:count_on_hand)
entry.on_hand_nil = true
end

View File

@@ -9,7 +9,7 @@ module ProductImport
return 0 if enterprise_ids.blank?
reset_variants_count_on_hand(enterprise_variants_relation)
reset_variants_on_hand(enterprise_variants_relation)
end
private
@@ -29,17 +29,17 @@ module ProductImport
relation.where('spree_variants.id NOT IN (?)', excluded_items_ids)
end
def reset_variants_count_on_hand(variants)
def reset_variants_on_hand(variants)
updated_records_count = 0
variants.each do |variant|
updated_records_count += 1 if reset_variant_count_on_hand(variant)
updated_records_count += 1 if reset_variant_on_hand(variant)
end
updated_records_count
end
def reset_variant_count_on_hand(variant)
variant.count_on_hand = 0
variant.count_on_hand.zero?
def reset_variant_on_hand(variant)
variant.on_hand = 0
variant.on_hand.zero?
end
end
end

View File

@@ -16,7 +16,7 @@ module ProductImport
:distributor_id, :name, :display_name, :sku, :unit_value,
:unit_description, :variant_unit, :variant_unit_scale,
:variant_unit_name, :display_as, :category, :primary_taxon_id,
:price, :on_hand, :count_on_hand, :on_demand,
:price, :on_hand, :on_demand,
:tax_category_id, :shipping_category_id, :description,
:import_date, :enterprise, :enterprise_id

View File

@@ -11,7 +11,6 @@ module Spree
belongs_to :tax_rate, foreign_key: 'originator_id', conditions: "spree_adjustments.originator_type = 'Spree::TaxRate'"
scope :enterprise_fee, where(originator_type: 'EnterpriseFee')
scope :billable_period, where(source_type: 'BillablePeriod')
scope :admin, where(source_type: nil, originator_type: nil)
scope :included_tax, where(originator_type: 'Spree::TaxRate', adjustable_type: 'Spree::LineItem')

View File

@@ -20,21 +20,6 @@ Spree::AppConfiguration.class_eval do
preference :products_require_tax_category, :boolean, default: false
preference :shipping_tax_rate, :decimal, default: 0
# Accounts & Billing Preferences
preference :accounts_distributor_id, :integer, default: nil
preference :default_accounts_payment_method_id, :integer, default: nil
preference :default_accounts_shipping_method_id, :integer, default: nil
preference :auto_update_invoices, :boolean, default: false
preference :auto_finalize_invoices, :boolean, default: false
# Business Model Configuration
preference :account_invoices_monthly_fixed, :decimal, default: 0
preference :account_invoices_monthly_rate, :decimal, default: 0
preference :account_invoices_monthly_cap, :decimal, default: 0
preference :account_invoices_tax_rate, :decimal, default: 0
preference :shop_trial_length_days, :integer, default: 30
preference :minimum_billable_turnover, :integer, default: 0
# Monitoring
preference :last_job_queue_heartbeat_at, :string, default: nil
@@ -52,4 +37,7 @@ Spree::AppConfiguration.class_eval do
# Number localization
preference :enable_localized_number?, :boolean, default: false
# Enable cache
preference :enable_products_cache?, :boolean, default: true
end

View File

@@ -64,6 +64,7 @@ Spree::LineItem.class_eval do
def cap_quantity_at_stock!
scoper.scope(variant)
return if variant.on_demand
update_attributes!(quantity: variant.on_hand) if quantity > variant.on_hand
end

View File

@@ -309,14 +309,9 @@ Spree::Order.class_eval do
not line_items.with_tax.empty?
end
def account_invoice?
distributor_id == Spree::Config.accounts_distributor_id
end
# Overrride of Spree method, that allows us to send separate confirmation emails to user and shop owners
# And separately, to skip sending confirmation email completely for user invoice orders
def deliver_order_confirmation_email
unless account_invoice? || subscription.present?
unless subscription.present?
Delayed::Job.enqueue ConfirmOrderJob.new(id)
end
end

View File

@@ -7,8 +7,6 @@ Spree.user_class.class_eval do
has_many :enterprises, through: :enterprise_roles
has_many :owned_enterprises, class_name: 'Enterprise', foreign_key: :owner_id, inverse_of: :owner
has_many :owned_groups, class_name: 'EnterpriseGroup', foreign_key: :owner_id, inverse_of: :owner
has_many :account_invoices
has_many :billable_periods, foreign_key: :owner_id, inverse_of: :owner
has_many :customers
has_many :credit_cards

View File

@@ -36,9 +36,15 @@ class VariantOverride < ActiveRecord::Base
end
def stock_overridden?
# If count_on_hand is present, it means on_demand is false
# See StockSettingsOverrideValidation for details
count_on_hand.present?
end
def use_producer_stock_settings?
on_demand.nil?
end
def move_stock!(quantity)
unless stock_overridden?
Bugsnag.notify RuntimeError.new "Attempting to move stock of a VariantOverride without a count_on_hand specified."

View File

@@ -1,6 +0,0 @@
# Disabled until this form takes order cycles into account
# Deface::Override.new(:virtual_path => "spree/checkout/edit",
# :insert_after => "[data-hook='checkout_summary_box']",
# :partial => "spree/checkout/other_available_distributors",
# :name => "add_change_distributor_form_to_checkout_address",
# :original => '60b9b1a39079f4efa85ff0425108edf671349d4f')

View File

@@ -1,5 +0,0 @@
Deface::Override.new(:virtual_path => "spree/products/show",
:insert_after => "[data-hook='product_show']",
:text => "<%= javascript_include_tag main_app.distributors_enterprises_path(:format => :js) %>",
:name => "add_distributor_details_js_to_product",
:original => 'b05ac497efeeebd4464f29891fd2c4a0f60c24d9')

View File

@@ -1,5 +0,0 @@
Deface::Override.new(:virtual_path => "spree/products/show",
:insert_before => "[data-hook='cart_form']",
:partial => "spree/products/distributor_details",
:name => "add_distributor_details_to_product",
:original => '789e3f5f6f36a8cd4115d7342752a37735659298')

View File

@@ -1,5 +0,0 @@
Deface::Override.new(:virtual_path => "spree/products/_cart_form",
:replace => "[data-hook='product_price'] .add-to-cart",
:partial => "spree/products/add_to_cart",
:name => "add_distributor_to_add_to_cart_form",
:original => '294014222132c795048fc6c7866971a332672c87')

View File

@@ -1,5 +0,0 @@
Deface::Override.new(:virtual_path => "spree/products/show",
:insert_bottom => "[data-hook='product_left_part_wrap']",
:partial => "spree/products/source",
:name => "add_source_to_product",
:original => 'bce3ba4847b3eac8ae061774a664ac4951d3d9db')

View File

@@ -1,5 +0,0 @@
Deface::Override.new(:virtual_path => "spree/checkout/_payment",
:replace => "code[erb-loud]:contains('submit_tag t(:save_and_continue)')",
:text => "<%= submit_tag I18n.t(:process_my_order), :class => 'continue button primary' %>",
:name => "replace_checkout_payment_button",
:original => 'ce2043a01931b3bc16b045302ebb0e0bb9150b67')

View File

@@ -1,5 +0,0 @@
Deface::Override.new(:virtual_path => "spree/checkout/_address",
:replace => "[data-hook='shipping_fieldset_wrapper']",
:partial => "spree/checkout/distributor",
:name => "replace_shipping_address_form_with_distributor_details",
:original => '53e219f90a2e1ba702a767261d0c2afe100ac751')

View File

@@ -1,4 +0,0 @@
/ insert_bottom "[data-hook='admin_product_sub_tabs']"
-# Commenting out for now, until product import is finished
-# = tab :product_import, label: "Import", url: main_app.admin_product_import_path, match_path: '/product_import'

View File

@@ -1,3 +0,0 @@
/ insert_bottom "[data-hook='admin_product_sub_tabs']"
= tab :variant_overrides, url: main_app.admin_inventory_path, match_path: '/inventory'

View File

@@ -1,5 +0,0 @@
/ replace_contents '#shipping_method p#minstrs'
= form.label :special_instructions, t(:delivery_instructions)
%br/
= form.text_area :special_instructions, :cols => 40, :rows => 7

View File

@@ -1,2 +0,0 @@
/ replace_contents '#shipping_method legend'
= t(:delivery_method)

View File

@@ -1,16 +0,0 @@
<!-- insert_after '[data-hook="checkout_summary_box"]'
sequence :before => 'add_change_distributor_form_to_checkout_address' -->
<% # Add a new 'Save and Continue/Process My Order' button under Order Summary on the checkout pages %>
<div id="add_new_save_checkout_button" class="columns omega four">
<%= submit_tag @order.state == "payment" ? t(:process_my_order) : t(:save_and_continue),
:class => "continue button primary large",
:form=> "checkout_form_#{@order.state}" %>
<script>
//Show additional button only if form attribute is supported
if ($("#add_new_save_checkout_button input[type=submit]")[0].form) {
$("#add_new_save_checkout_button").show();
}
</script>
</div>

View File

@@ -1,16 +0,0 @@
/ replace_contents '#product-variants'
%h6.product-section-title= t(:variants)
%ul
- has_checked = false
- @product.variants.active(current_currency).each_with_index do |v,index|
- next if v.option_values.empty? || (!v.in_stock && !Spree::Config[:show_zero_stock_products])
- next if current_order_cycle.present? && !current_order_cycle.has_variant?(v) # All copied from spree apart from this line
- checked = !has_checked && (v.in_stock || Spree::Config[:allow_backorders])
- has_checked = true if checked
%li
= radio_button_tag "products[#{@product.id}]", v.id, checked, :disabled => !v.in_stock && !Spree::Config[:allow_backorders], 'data-price' => v.price_in(current_currency).display_price
%label{:for => ['products', @product.id, v.id].join('_')}
%span.variant-description= variant_options v
- if variant_price v
%span.price.diff= variant_price v

View File

@@ -1 +0,0 @@
/ remove '#taxon-crumbs'

View File

@@ -25,7 +25,8 @@ class Api::Admin::ProductSerializer < ActiveModel::Serializer
end
def on_hand
object.on_hand.nil? ? 0 : object.on_hand.to_f.finite? ? object.on_hand : I18n.t(:on_demand)
return 0 if object.on_hand.nil?
object.on_hand
end
def price

View File

@@ -4,7 +4,8 @@ class Api::Admin::VariantSerializer < ActiveModel::Serializer
has_many :variant_overrides
def on_hand
object.on_hand.nil? ? 0 : ( object.on_hand.to_f.finite? ? object.on_hand : I18n.t(:on_demand) )
return 0 if object.on_hand.nil?
object.on_hand
end
def price

View File

@@ -1,5 +1,5 @@
class Api::VariantSerializer < ActiveModel::Serializer
attributes :id, :is_master, :count_on_hand, :name_to_display, :unit_to_display, :unit_value
attributes :id, :is_master, :on_hand, :name_to_display, :unit_to_display, :unit_value
attributes :options_text, :on_demand, :price, :fees, :price_with_fees, :product_name
attributes :tag_list

View File

@@ -45,7 +45,7 @@ class OrderFactory
attrs[:line_items].each do |li|
next unless variant = Spree::Variant.find_by_id(li[:variant_id])
scoper.scope(variant)
li[:quantity] = stock_limited_quantity(variant.count_on_hand, li[:quantity])
li[:quantity] = stock_limited_quantity(variant.on_hand, li[:quantity])
li[:price] = variant.price
build_item_from(li)
end

View File

@@ -10,8 +10,8 @@ class VariantsStockLevels
order_variant_ids = variant_stock_levels.keys
missing_variant_ids = requested_variant_ids - order_variant_ids
missing_variant_ids.each do |variant_id|
variant_on_hand = Spree::Variant.find(variant_id).on_hand
variant_stock_levels[variant_id] = { quantity: 0, max_quantity: 0, on_hand: variant_on_hand }
variant = Spree::Variant.find(variant_id)
variant_stock_levels[variant_id] = { quantity: 0, max_quantity: 0, on_hand: variant.on_hand, on_demand: variant.on_demand }
end
# The code above is most probably dead code, this bugsnag notification will confirm it
@@ -37,14 +37,9 @@ class VariantsStockLevels
[line_item.variant.id,
{ quantity: line_item.quantity,
max_quantity: line_item.max_quantity,
on_hand: wrap_json_infinity(line_item.variant.on_hand) }]
on_hand: line_item.variant.on_hand,
on_demand: line_item.variant.on_demand }]
end
]
end
# Rails to_json encodes Float::INFINITY as Infinity, which is not valid JSON
# Return it as a large integer (max 32 bit signed int)
def wrap_json_infinity(number)
number == Float::INFINITY ? 2_147_483_647 : number
end
end

View File

@@ -1,47 +0,0 @@
- content_for :page_title do
= t(:account)
- if @invoices.empty?
%h4= t(:no_invoices_to_display)
- @invoices.order('year DESC, month DESC').each do |invoice|
.row.invoice_title
.two.columns.alpha
%h4= invoice_description_for(invoice)
.two.columns.text-right
%h5
- if invoice.order.andand.complete?
%a{ href: print_admin_order_url(invoice.order), :target => "_blank"}
%i.icon-print
= t(:print)
- else
&nbsp;
.ten.columns
&nbsp;
.two.columns.omega.text-right
%h4.balance= invoice_total_for(invoice)
%table.invoice_summary
%col{ width: '25%' }
%col{ width: '62.5%' }
%col{ width: '12.5%' }
%thead
%th= t('admin.date')
%th= t(:description)
%th= t(:charge)
- if order = invoice.order
- invoice.billable_periods.select{ |bp| bp.adjustment.andand.amount.andand > 0}.each do |billable_period|
%tr
%td.text-center= "#{billable_period.begins_at.strftime("%d/%m/%Y")}"
%td= billable_period.label
-# Using amount from the actual adjustment on the order here so that we avoid recalculating the bill
-# at a future date with different settings to those used at the time the invoice was finalized
%td.text-right= billable_period.adjustment.display_amount
- order.adjustments.where('source_type <> (?)', "BillablePeriod").reject{ |a| a.amount == 0 }.each do |adjustment|
%tr
%td.text-center &nbsp;
%td= adjustment.label
%td.text-right= adjustment.display_amount
%tr.total
%td.text-center &nbsp;
%td= t(:total).upcase
%td.text-right= invoice_total_for(invoice)

View File

@@ -1,10 +0,0 @@
.row
.six.columns.alpha
.field
= label :settings, :default_accounts_payment_method_id, t('.default_accounts_payment_method')
= collection_select(:settings, :default_accounts_payment_method_id, @payment_methods, :id, :name, { include_blank: true, selected: Spree::Config.default_accounts_payment_method_id}, { class: "select2 fullwidth" })
.six.columns.omega
.field
= label :settings, :default_accounts_shipping_method_id, t('.default_accounts_shipping_method')
= collection_select(:settings, :default_accounts_shipping_method_id, @shipping_methods, :id, :name, { include_blank: true, selected: Spree::Config.default_accounts_shipping_method_id}, { class: "select2 fullwidth" })

View File

@@ -1,94 +0,0 @@
= render :partial => 'spree/admin/shared/configuration_menu'
- content_for :page_title do
= t('.accounts_and_billing')
= render 'spree/shared/error_messages', target: @settings
-# - month_options = (0...12).map { |i| Time.zone.now.beginning_of_month - i.months }.map{ |t| [t.strftime("%b %Y"), t.strftime("%b %Y %z")]}
%fieldset.no-border-bottom
%legend
= t('.admin_settings')
= form_for @settings, as: :settings, url: main_app.admin_accounts_and_billing_settings_path, :method => :put do |f|
.row{ ng: { app: 'admin.accounts_and_billing_settings' } }
.twelve.columns.alpha.omega
.field
= f.label :accounts_distributor_id, t('.accounts_administration_distributor')
= f.collection_select(:accounts_distributor_id, @distributors, :id, :name, { include_blank: true }, { class: "select2 fullwidth", 'watch-value-as' => "enterprise_id"})
= f.hidden_field :default_accounts_payment_method_id, value: ''
= f.hidden_field :default_accounts_shipping_method_id, value: ''
%div{ 'method-settings-for' => 'enterprise_id' }
.row
.six.columns.alpha
%fieldset.no-border-bottom
%legend
= t('.update_invoice')
= f.check_box :auto_update_invoices
= f.label :auto_update_invoices, t('.auto_update_invoices')
.six.columns.omega
%fieldset.no-border-bottom
%legend
= t('.finalise_invoice')
= f.check_box :auto_finalize_invoices
= f.label :auto_finalize_invoices, t('.auto_finalise_invoices')
.row
.twelve.columns.alpha.omega.form-buttons{"data-hook" => "buttons"}
= button t(:update), 'icon-refresh', value: "update"
%fieldset.no-border-bottom
%legend
=t('.manually_run_task')
.row
.six.columns.alpha.step.text-center
.form-buttons{"data-hook" => "buttons"}
= link_to_with_icon "icon-undo", t('.update_user_invoices'),
main_app.start_job_admin_accounts_and_billing_settings_path(job: { name: "update_account_invoices" }),
class: "button fullwidth"
%br
- if @update_account_invoices_job
%p.text-center
- if @update_account_invoices_job.run_at < Time.zone.now
= t(:in_progress)
%br
= t(:started_at)
- else
%strong
= t(:queued)
%br
= t(:scheduled_for)
= @update_account_invoices_job.run_at
- else
%p.explanation
= t('.update_user_invoice_explained')
.six.columns.omega.step.text-center
.form-buttons{"data-hook" => "buttons"}
=link_to_with_icon "icon-ok-sign", t('.finalise_user_invoices'),
main_app.start_job_admin_accounts_and_billing_settings_path(job: { name: "finalize_account_invoices" }),
class: "button fullwidth"
%br
- if @finalize_account_invoices_job
%p.text-center
- if @finalize_account_invoices_job.run_at < Time.zone.now
%strong
= t(:in_progress)
%br
= t(:started_at)
- else
%strong
= t(:queued)
%br
= t(:scheduled_for)
= @finalize_account_invoices_job.run_at
- else
%p.explanation
= t('.finalise_user_invoice_explained')

View File

@@ -1,104 +0,0 @@
= render :partial => 'spree/admin/shared/configuration_menu'
- content_for :app_wrapper_attrs do
= "ng-app='admin.businessModelConfiguration'"
- content_for :page_title do
%h1.page-title= t('.business_model_configuration')
%a{ 'ofn-with-tip' => t('.business_model_configuration_tip') }
= t('admin.whats_this')
= render 'spree/shared/error_messages', target: @settings
.row{ ng: { controller: "BusinessModelConfigCtrl" } }
.five.columns.omega
%fieldset.no-border-bottom
%legend=t('.bill_calculation_settings')
%p
= t('.bill_calculation_settings_tip')
%br
= form_for @settings, as: :settings, url: main_app.admin_business_model_configuration_path, :method => :put do |f|
.row
.three.columns.alpha
= f.label :shop_trial_length_days, t('.shop_trial_length')
%span.icon-question-sign{'ofn-with-tip' => t('.shop_trial_length_tip')}
.two.columns.omega
= f.number_field :shop_trial_length_days, min: 0.0, step: 1.0, class: "fullwidth"
.row
.three.columns.alpha
= f.label :account_invoices_monthly_fixed, t('.fixed_monthly_charge')
%span.icon-question-sign{'ofn-with-tip' => t('.fixed_monthly_charge_tip')}
.two.columns.omega
.input-symbol.before
%span= Spree::Money.currency_symbol
= f.number_field :account_invoices_monthly_fixed, min: 0.0, class: "fullwidth", 'watch-value-as' => 'fixed'
.row
.three.columns.alpha
= f.label :account_invoices_monthly_rate, t('.percentage_of_turnover')
%span.icon-question-sign{'ofn-with-tip' => t('.percentage_of_turnover_tip')}
.two.columns.omega
= f.number_field :account_invoices_monthly_rate, min: 0.0, max: 1.0, step: 0.01, class: "fullwidth", 'watch-value-as' => 'rate'
.row
.three.columns.alpha
= f.label :account_invoices_monthly_cap, t('.monthly_cap_excl_tax')
%span.icon-question-sign{'ofn-with-tip' => t('.monthly_cap_excl_tax_tip')}
.two.columns.omega
.input-symbol.before
%span= Spree::Money.currency_symbol
= f.number_field :account_invoices_monthly_cap, min: 0.0, class: "fullwidth", 'watch-value-as' => 'cap'
.row
.three.columns.alpha
= f.label :account_invoices_tax_rate, t('.tax_rate')
%span.icon-question-sign{'ofn-with-tip' => t('.tax_rate_tip')}
.two.columns.omega
= f.number_field :account_invoices_tax_rate, min: 0.0, max: 1.0, step: 0.01, class: "fullwidth", 'watch-value-as' => 'taxRate'
.row
.three.columns.alpha
= f.label :minimum_billable_turnover, t('.minimum_monthly_billable_turnover')
%span.icon-question-sign{'ofn-with-tip' => t('.minimum_monthly_billable_turnover_tip')}
.two.columns.omega
.input-symbol.before
%span= Spree::Money.currency_symbol
= f.number_field :minimum_billable_turnover, min: 0, class: "fullwidth", 'watch-value-as' => 'minBillableTurnover'
.row
.five.columns.alpha.omega.form-buttons{"data-hook" => "buttons"}
= button t(:update), 'icon-refresh', value: "update"
.two.columns
&nbsp;
.five.columns.alpha
%fieldset.no-border-bottom
%legend= t('.example_bill_calculator')
%p
= t('.example_bill_calculator_legend')
%br
.row
.three.columns.alpha
= label_tag :turnover, t('.example_monthly_turnover')
%span.icon-question-sign{'ofn-with-tip' => t('.example_monthly_turnover_tip')}
.two.columns.omega
.input-symbol.before
%span= Spree::Money.currency_symbol
%input.fullwidth{ id: 'turnover', type: "number", ng: { model: 'turnover' } }
.row
.three.columns.alpha
= label_tag :cap_reached, t('.cap_reached?')
%span.icon-question-sign{'ofn-with-tip' => t('.cap_reached?_tip')}
.two.columns.omega
%input.fullwidth{ id: 'cap_reached', type: "text", readonly: true, ng: { value: 'capReached()' } }
.row
.three.columns.alpha
= label_tag :included_tax, t('.included_tax')
%span.icon-question-sign{'ofn-with-tip' => t('.included_tax_tip')}
.two.columns.omega
%span= Spree::Money.currency_symbol
%input.fullwidth{ id: 'included_tax', type: "text", readonly: true, ng: { value: 'includedTax()' } }
.row
.three.columns.alpha
= label_tag :total_incl_tax, t('.total_monthly_bill_incl_tax')
%span.icon-question-sign{'ofn-with-tip' => t('.total_monthly_bill_incl_tax_tip')}
.two.columns.omega
%span= Spree::Money.currency_symbol
%input.fullwidth{ id: 'total_incl_tax', type: "text", readonly: true, ng: { value: 'total()' } }

View File

@@ -1,6 +1,19 @@
- content_for :page_title do
= t(:cache_settings)
= form_tag main_app.admin_cache_settings_path, :method => :put do
.field
= hidden_field_tag 'preferences[enable_products_cache?]', '0'
= check_box_tag 'preferences[enable_products_cache?]', '1', Spree::Config[:enable_products_cache?]
= label_tag nil, t('.enable_products_cache')
.form-buttons
= button t(:update), 'icon-refresh'
%br
%br
%h4= t(:cache_state)
%br
%table.index
%thead
%tr

View File

@@ -1,5 +1,4 @@
= admin_inject_enterprise
= admin_inject_monthly_bill_description
= form_for @enterprise, url: main_app.register_admin_enterprise_path(@enterprise),
html: { name: "change_type", id: "change_type", novalidate: true, "ng-app" => "admin.enterprises", "ng-controller"=> 'changeTypeFormCtrl' } do |change_type_form|
@@ -43,12 +42,6 @@
%p.description
= t('.producer_hub_description_text')
-# %p.description
-# Test out having your own shopfront with full access to all Shopfront features for 30 days.
-# %br
-# %br
-# At the end of your trial, there is a one-off $200 fee to fully activate your account. Then you will be billed for 2% of your actual transactions, capped at $50 a month (so if you dont sell anything you dont pay anything, but you never pay more than $50 a month).
- else
.two.columns.alpha
&nbsp;
@@ -77,14 +70,7 @@
.sixteen.columns.alpha
%span.error{ ng: { show: "(change_type.sells.$error.required || change_type.sells.$error.pattern) && submitted" } }
= t('.choose_option')
- if @enterprise.sells == 'unspecified' && @enterprise.shop_trial_start_date.nil?
-if free_use?
%input.button.big{ type: 'submit', value: t(:select_continue), ng: { click: "submit(change_type)" } }
- else
- trial_length = Spree::Config[:shop_trial_length_days]
%input.button.big{ type: 'submit', value: "Start #{trial_length}-Day Shop Trial", ng: { click: "submit(change_type)", show: "sells=='own' || sells=='any'" } }
%input.button.big{ type: 'submit', value: t(:select_continue), ng: { click: "submit(change_type)", hide: "sells=='own' || sells=='any'" } }
- elsif @enterprise.sells == 'unspecified'
- if @enterprise.sells == 'unspecified'
%input.button.big{ type: 'submit', value: t(:select_continue), ng: { click: "submit(change_type)" } }
- else
%input.button.big{ type: 'submit', value: t('.change_now'), ng: { click: "submit(change_type)" } }

View File

@@ -12,7 +12,6 @@
- modal_message = t('js.admin.enterprise_limit_reached', contact_email: ContentConfig.footer_email)
= button_link_to t('.new_enterprise'), button_href, icon: 'icon-plus', id: 'admin_new_enterprise_link', 'enterprise-limit' => !spree_current_user.can_own_more_enterprises?, 'modal-message' => modal_message
= admin_inject_monthly_bill_description
= admin_inject_column_preferences module: 'admin.enterprises', action: "enterprises_index"
= render 'admin/shared/enterprises_sub_menu'

View File

@@ -2,7 +2,7 @@
#{t('admin.product_import.title')}
= render partial: 'ams_data'
= render partial: 'spree/admin/shared/product_sub_menu'
= render partial: 'admin/shared/product_sub_menu'
.import-wrapper{ng: {app: 'admin.productImport', controller: 'ImportFormCtrl'}}

View File

@@ -1,7 +1,7 @@
- content_for :page_title do
#{t('admin.product_import.title')}
= render partial: 'spree/admin/shared/product_sub_menu'
= render partial: 'admin/shared/product_sub_menu'
= render 'upload_sidebar'

View File

@@ -0,0 +1,8 @@
= content_for :sub_menu do
%ul#sub_nav.inline-menu
= tab :products, match_path: '/products'
= tab :option_types, match_path: '/option_types'
= tab :properties
= tab :prototypes
= tab :variant_overrides, url: main_app.admin_inventory_path, match_path: '/inventory'
= tab :import, url: main_app.admin_product_import_path, match_path: '/product_import'

View File

@@ -5,4 +5,4 @@
%h1.page-title= t("admin.variant_overrides.index.title")
%a.with-tip{ 'data-powertip' => "#{t("admin.variant_overrides.index.description")}" }=t('admin.whats_this')
= render :partial => 'spree/admin/shared/product_sub_menu'
= render partial: 'admin/shared/product_sub_menu'

View File

@@ -4,9 +4,9 @@
.row
.small-12.columns
%header
%h2 {{'enterprise_about_headline' | t}}
%h2= t(".headline")
%h5
{{'enterprise_about_message' | t}}
= t(".message")
%span{ ng: { class: "{brick: !enterprise.is_primary_producer, turquoise: enterprise.is_primary_producer}" } }
{{ enterprise.name }}
@@ -14,33 +14,33 @@
.row
.small-12.columns
.alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } }
%h6{ "ng-bind" => "'enterprise_success' | t:{enterprise: enterprise.name}" }
%span {{'enterprise_registration_exit_message' | t}}
%h6{ "ng-bind" => "'registration.steps.about.success' | t:{enterprise: enterprise.name}" }
%span= t(".registration_exit_message")
%a.close{ ng: { click: "close()" } } &times;
.small-12.large-8.columns
.row
.small-12.columns
.field
%label{ for: 'enterprise_description' } {{'enterprise_description' | t}}:
%input.chunky{ id: 'enterprise_description', placeholder: "{{'enterprise_description_placeholder' | t}}", ng: { model: 'enterprise.description' } }
%label{ for: 'enterprise_description' }= t(".enterprise_description")
%input.chunky{ id: 'enterprise_description', placeholder: "{{'registration.steps.about.enterprise_description_placeholder' | t}}", ng: { model: 'enterprise.description' } }
.row
.small-12.columns
.field
%label{ for: 'enterprise_long_desc' } {{'enterprise_long_desc' | t}}:
%textarea.chunky{ id: 'enterprise_long_desc', rows: 6, placeholder: "{{'enterprise_long_desc_placeholder' | t}}", ng: { model: 'enterprise.long_description' } }
%small{ "ng-bind" => "'enterprise_long_desc_length' | t:{num: enterprise.long_description.length}" }
%label{ for: 'enterprise_long_desc' }= t(".enterprise_long_desc")
%textarea.chunky{ id: 'enterprise_long_desc', rows: 6, placeholder: "{{'registration.steps.about.enterprise_long_desc_placeholder' | t}}", ng: { model: 'enterprise.long_description' } }
%small{ "ng-bind" => "'registration.steps.about.enterprise_long_desc_length' | t:{num: enterprise.long_description.length}" }
.small-12.large-4.columns
.row
.small-12.columns
.field
%label{ for: 'enterprise_abn' } {{'enterprise_abn' | t}}:
%input.chunky{ id: 'enterprise_abn', placeholder: "{{'enterprise_abn_placeholder' | t}}", ng: { model: 'enterprise.abn' } }
%label{ for: 'enterprise_abn' }= t(".enterprise_abn")+":"
%input.chunky{ id: 'enterprise_abn', placeholder: "{{'registration.steps.about.enterprise_abn_placeholder' | t}}", ng: { model: 'enterprise.abn' } }
.row
.small-12.columns
.field
%label{ for: 'enterprise_acn' } {{'enterprise_acn' | t}}:
%input.chunky{ id: 'enterprise_acn', placeholder: "{{'enterprise_acn_placeholder' | t}}", ng: { model: 'enterprise.acn' } }
%label{ for: 'enterprise_acn' }= t(".enterprise_acn")+":"
%input.chunky{ id: 'enterprise_acn', placeholder: "{{'registration.steps.about.enterprise_acn_placeholder' | t}}", ng: { model: 'enterprise.acn' } }
.row
.small-12.columns
.field
@@ -50,7 +50,7 @@
%input{ id: 'enterprise_charges_sales_tax_false', type: 'radio', name: 'charges_sales_tax', value: 'false', required: true, ng: { model: 'enterprise.charges_sales_tax' } }
%label{ for: 'enterprise_charges_sales_tax_false' } {{'say_no' | t}}
%span.error.small-12.columns{ ng: { show: "about.charges_sales_tax.$error.required && submitted" } }
{{'enterprise_tax_required' | t}}
= t(".enterprise_tax_required")
.row.buttons.pad-top
.small-12.columns

View File

@@ -4,26 +4,26 @@
.row
.small-12.columns
%header
%h2 {{'registration_greeting' | t}}
%h5{ "ng-bind" => "'who_is_managing_enterprise' | t:{enterprise: enterprise.name}" }
%h2= t('registration.steps.introduction.registration_greeting')
%h5{ "ng-bind" => "'registration.steps.contact.who_is_managing_enterprise' | t:{enterprise: enterprise.name}" }
%form{ name: 'contact', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "selectIfValid('type',contact)" } }
.row.content
.small-12.medium-12.large-7.columns
.row
.small-12.columns.field
%label{ for: 'enterprise_contact' } {{'enterprise.registration.modal.steps.contact.contact_field' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_contact', name: 'contact_name', required: true, placeholder: "{{'enterprise.registration.modal.steps.contact.contact_field_placeholder' | t}}", ng: { model: 'enterprise.contact_name' } }
%label{ for: 'enterprise_contact' }= t(".contact_field")
%input.chunky.small-12.columns{ id: 'enterprise_contact', name: 'contact_name', required: true, placeholder: "{{'registration.steps.contact.contact_field_placeholder' | t}}", ng: { model: 'enterprise.contact_name' } }
%span.error.small-12.columns{ ng: { show: "contact.contact_name.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.contact.contact_field_required' | t}}
= t(".contact_field_required")
.row
.small-12.columns.field
%label{ for: 'enterprise_email_address' } {{'admin.enterprises.form.contact.email_address' | t}}:
%label{ for: 'enterprise_email_address' }= t("admin.enterprises.form.contact.email_address")+":"
%input.chunky.small-12.columns{ id: 'enterprise_email_address', name: 'email_address', type: 'email', placeholder: t('admin.enterprises.form.contact.email_address_placeholder'), ng: { model: 'enterprise.email_address' } }
.row
.small-12.columns.field
%label{ for: 'enterprise_phone' } {{'enterprise.registration.modal.steps.contact.phone_field' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_phone', name: 'phone', placeholder: "{{'enterprise.registration.modal.steps.contact.phone_field_placeholder' | t}}", ng: { model: 'enterprise.phone' } }
%label{ for: 'enterprise_phone' }= t(".phone_field")+":"
%input.chunky.small-12.columns{ id: 'enterprise_phone', name: 'phone', placeholder: "{{'registration.steps.contact.phone_field_placeholder' | t}}", ng: { model: 'enterprise.phone' } }
.small-12.medium-12.large-5.hide-for-small-only
.row.buttons

View File

@@ -4,60 +4,59 @@
.row
.small-12.columns
%header
%h2 {{'enterprise.registration.modal.steps.details.headline' | t}}
%h5{ ng: { if: "::enterprise.type != 'own'" } } {{'enterprise.registration.modal.steps.details.enterprise' | t}}
%h5{ ng: { if: "::enterprise.type == 'own'" } } {{'enterprise.registration.modal.steps.details.producer' | t}}
%h2= t('.headline')
%h5{ ng: { if: "::enterprise.type != 'own'" } }= t(".enterprise")
%h5{ ng: { if: "::enterprise.type == 'own'" } }= t(".producer")
%form{ name: 'details', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "selectIfValid('contact',details)" } }
.row
.small-12.medium-9.large-12.columns.end
.field
%label{ for: 'enterprise_name', ng: { if: "::enterprise.type != 'own'" } } {{'enterprise.registration.modal.steps.details.enterprise_name_field' | t}}
%label{ for: 'enterprise_name', ng: { if: "::enterprise.type == 'own'" } } {{'enterprise.registration.modal.steps.details.producer_name_field' | t}}
%input.chunky{ id: 'enterprise_name', name: 'name', placeholder: "{{'enterprise.registration.modal.steps.details.producer_name_field_placeholder' | t}}", required: true, ng: { model: 'enterprise.name' } }
%label{ for: 'enterprise_name', ng: { if: "::enterprise.type != 'own'" } }= t(".enterprise_name_field")
%label{ for: 'enterprise_name', ng: { if: "::enterprise.type == 'own'" } }= t(".producer_name_field")
%input.chunky{ id: 'enterprise_name', name: 'name', placeholder: "{{'registration.steps.details.producer_name_field_placeholder' | t}}", required: true, ng: { model: 'enterprise.name' } }
%span.error{ ng: { show: "details.name.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.details.producer_name_field_error' | t}}
= t(".producer_name_field_error")
.row
.small-12.medium-9.large-6.columns
.field
%label{ for: 'enterprise_address' } {{'enterprise.registration.modal.steps.details.address1_field' | t}}
%input.chunky{ id: 'enterprise_address', name: 'address1', required: true, placeholder: "{{'enterprise.registration.modal.steps.details.address1_field_placeholder' | t}}", required: true, ng: { model: 'enterprise.address.address1' } }
%label{ for: 'enterprise_address' }= t(".address1_field")
%input.chunky{ id: 'enterprise_address', name: 'address1', required: true, placeholder: "{{'registration.steps.details.address1_field_placeholder' | t}}", required: true, ng: { model: 'enterprise.address.address1' } }
%span.error{ ng: { show: "details.address1.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.details.address1_field_error' | t}}
= t(".address1_field_error")
.field
%label{ for: 'enterprise_address2' } {{'enterprise.registration.modal.steps.details.address2_field' | t}}
%label{ for: 'enterprise_address2' }= t(".address2_field")
%input.chunky{ id: 'enterprise_address2', name: 'address2', required: false, placeholder: "", required: false, ng: { model: 'enterprise.address.address2' } }
.small-12.medium-9.large-6.columns.end
.row
.small-12.medium-8.large-8.columns
.field
%label{ for: 'enterprise_city' } {{'enterprise.registration.modal.steps.details.suburb_field' | t}}
%input.chunky{ id: 'enterprise_city', name: 'city', required: true, placeholder: "{{'enterprise.registration.modal.steps.details.suburb_field_placeholder' | t}}", ng: { model: 'enterprise.address.city' } }
%label{ for: 'enterprise_city' }= t('.suburb_field')
%input.chunky{ id: 'enterprise_city', name: 'city', required: true, placeholder: "{{'registration.steps.details.suburb_field_placeholder' | t}}", ng: { model: 'enterprise.address.city' } }
%span.error{ ng: { show: "details.city.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.details.suburb_field_error' | t}}
= t(".suburb_field_error")
.small-12.medium-4.large-4.columns
.field
%label{ for: 'enterprise_zipcode' } {{'enterprise.registration.modal.steps.details.postcode_field' | t}}
%input.chunky{ id: 'enterprise_zipcode', name: 'zipcode', required: true, placeholder: "{{'enterprise.registration.modal.steps.details.postcode_field_placeholder' | t}}", ng: { model: 'enterprise.address.zipcode' } }
%label{ for: 'enterprise_zipcode' }= t(".postcode_field")
%input.chunky{ id: 'enterprise_zipcode', name: 'zipcode', required: true, placeholder: "{{'registration.steps.details.postcode_field_placeholder' | t}}", ng: { model: 'enterprise.address.zipcode' } }
%span.error{ ng: { show: "details.zipcode.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.details.postcode_field_error' | t}}
= t(".postcode_field_error")
.row
.small-12.medium-4.large-4.columns
.field
%label{ for: 'enterprise_state' } {{'enterprise.registration.modal.steps.details.state_field' | t}}
%label{ for: 'enterprise_state' }= t(".state_field")
%select.chunky{ id: 'enterprise_state', name: 'state', ng: { model: 'enterprise.address.state_id', options: 's.id as s.abbr for s in enterprise.country.states', show: 'countryHasStates()', required: 'countryHasStates()' } }
%span.error{ ng: { show: "details.state.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.details.state_field_error' | t}}
= t(".state_field_error")
.small-12.medium-8.large-8.columns
.field
%label{ for: 'enterprise_country' } {{'enterprise.registration.modal.steps.details.country_field' | t}}
%label{ for: 'enterprise_country' }= t(".country_field")
%select.chunky{ id: 'enterprise_country', name: 'country', required: true, ng: { init: "setDefaultCountry(#{Spree::Config[:default_country_id]})", model: 'enterprise.country', options: 'c as c.name for c in countries' } }
%span.error{ ng: { show: "details.country.$error.required && submitted" } }
{{'enterprise.registration.modal.steps.details.country_field_error' | t}}
= t(".country_field_error")
.row.buttons
.small-12.columns

View File

@@ -3,10 +3,10 @@
.row
.small-12.columns.pad-top
%header
%h2 {{'registration_finished_headline' | t}}
%h2= t(".headline")
.panel.callout
%p{ "ng-bind" => "'registration_finished_thanks' | t:{enterprise: enterprise.name}" }
%p {{'registration_finished_login' | t}}
%p{ "ng-bind" => "'registration.steps.finished.thanks' | t:{enterprise: enterprise.name}" }
%p= t(".login")
.row
.small-12.columns.text-center
%a.button.primary{ type: "button", href: "/" } {{'registration_finished_action' | t}} &gt;
%a.button.primary{ type: "button", href: "/" }= "#{t(".action")} >"

View File

@@ -2,35 +2,35 @@
.row
.small-12.columns
%header
%h2 {{'registration_greeting' | t}}
%h2= t(".registration_greeting")
%h4
%small
%i.ofn-i_040-hub
{{'registration_intro' | t}}
= t(".registration_intro")
.row{ 'data-equalizer' => true }
.small-12.medium-12.large-6.columns.pad-top{ 'data-equalizer-watch' => true }
%h5 {{'registration_checklist' | t}}:
%h5= t(".registration_checklist")+":"
%ul.check-list
%li
{{'registration_time' | t}}
= t(".registration_time")
%li
{{'registration_enterprise_address' | t}}
= t(".registration_enterprise_address")
%li
{{'registration_contact_details' | t}}
= t(".registration_contact_details")
%li
{{'registration_logo' | t}}
= t(".registration_logo")
%li
{{'registration_promo_image' | t}}
= t(".registration_promo_image")
%li
{{'registration_about_us' | t}}
= t(".registration_about_us")
.small-9.medium-8.large-5.columns.pad-top.end{ 'data-equalizer-watch' => true}
%h5
{{'registration_outcome_headline' | t}}
%p{ "ng-bind-html" => "t('registration_outcome1_html')" }
%p {{'registration_outcome2' | t}}
%p {{'registration_outcome3' | t}}
= t(".registration_outcome_headline")
%p= t(".registration_outcome1_html")
%p= t(".registration_outcome2")
%p= t(".registration_outcome3")
.row{'ng-init' => "tos_required=#{Spree::Config.enterprises_require_tos}" }
%hr
@@ -43,4 +43,4 @@
%label{for: "accept_terms"} #{t(:enterprise_tos_agree)}
.small-12.medium-6.columns
%input.button.primary.left{ type: "button", value: "{{'registration_action' | t}}", ng: { click: "select('details')", disabled: "tos_required && !tos_accepted", model: "tos_accepted"} }
%input.button.primary.left{ type: "button", value: "{{'registration.steps.introduction.registration_action' | t}}", ng: { click: "select('details')", disabled: "tos_required && !tos_accepted", model: "tos_accepted"} }

View File

@@ -2,16 +2,16 @@
.row
.small-12.columns
%header
%h2 {{'limit_reached_headline' | t}}
%h4 {{'limit_reached_message' | t}}
%h2= t(".headline")
%h4= t(".message")
.row
.small-12.medium-3.large-2.columns.text-right.hide-for-small-only
%img{:src => "/assets/potatoes.png"}
.small-12.medium-9.large-10.columns
%p
{{'limit_reached_text' | t}}
= t(".text")
%strong Open Food Network.
.row
.small-12.columns
%hr
%input.button.primary{ type: "button", value: "{{'limit_reached_action' | t}}", ng: { click: "close()" } }
%input.button.primary{ type: "button", value: "{{'registration.steps.limit_reached.action' | t}}", ng: { click: "close()" } }

View File

@@ -5,42 +5,42 @@
.row
.small-12.columns.center
%h4
{{'select_logo' | t}}
= t(".select_logo")
.row
.small-12.columns.center
%span.small
{{'logo_tip' | t}}
= t(".logo_tip")
.row.pad-top
.small-12.columns
.image-select.small-12.columns
%label.small-12.columns.button{ for: 'image-select' } {{'logo_label' | t}}
%label.small-12.columns.button{ for: 'image-select' }= t(".logo_label")
%input#image-select{ type: 'file', hidden: true, 'nv-file-select' => true, uploader: "imageUploader", options: '{ alias: imageStep }' }
.row.show-for-large-up
.large-12.columns
%span#or.large-12.columns
{{'action_or' | t}}
= t("action_or")
.row.show-for-large-up
.large-12.columns
#image-over{ 'nv-file-over' => true, uploader: "imageUploader" }
{{'logo_drag' | t}}
= t(".logo_drag")
.small-12.medium-12.large-6.columns
.row
.small-12.columns.center
.row
.small-12.columns.center
%h4
{{'review_logo' | t}}
= t(".review_logo")
.row
.small-12.columns.center
%span.small
{{'review_logo_tip' | t}}
= t(".review_logo_tip")
.row.pad-top
.small-12.columns.center
#image-placeholder.logo
%img{ ng: { show: "imageSrc() && !imageUploader.isUploading", src: '{{ imageSrc() }}' } }
.message{ ng: { hide: "imageSrc() || imageUploader.isUploading" } }
{{'logo_placeholder' | t}}
= t(".logo_placeholder")
.loading{ ng: { hide: "!imageUploader.isUploading" } }
%img.spinner{ src: "/assets/spinning-circles.svg" }
%br/
{{'uploading' | t}}
= t("registration.steps.images.uploading")

View File

@@ -3,42 +3,42 @@
.row
.small-12.columns.center
%h4
{{'select_promo_image' | t}}
= t(".select_promo_image")
.row
.small-12.medium-12.large-5.columns.center
.row
.small-12.columns.center
%span.small
{{'promo_image_tip' | t}}
= t(".promo_image_tip")
.row.pad-top
.small-12.columns
.image-select.small-12.columns
%label.small-12.columns.button{ for: 'image-select' } {{'promo_image_label' | t}}
%label.small-12.columns.button{ for: 'image-select' }= t(".promo_image_label")
%input#image-select{ type: 'file', hidden: true, 'nv-file-select' => true, uploader: "imageUploader", options: '{ alias: imageStep }' }
.large-2.columns
%span#or.horizontal.large-12.columns
{{'action_or' | t}}
= t("action_or")
.large-5.columns
#image-over{ 'nv-file-over' => true, uploader: "imageUploader" }
{{'promo_image_drag' | t}}
= t(".promo_image_drag")
.small-12.medium-12.large-12.columns.pad-top
.row
.small-12.columns.center
%h4
{{'review_promo_image' | t}}
= t(".review_promo_image")
.row
.small-12.columns.center
.row
.small-12.columns.center
%span.small
{{'review_promo_image_tip' | t}}
= t(".review_promo_image_tip")
.row.pad-top
.small-12.columns.center
#image-placeholder.promo
%img{ ng: { show: "imageSrc() && !imageUploader.isUploading", src: '{{ imageSrc() }}' } }
.message{ ng: { hide: "imageSrc() || imageUploader.isUploading" } }
{{'promo_image_placeholder' | t}}
= t(".promo_image_placeholder")
.loading{ ng: { hide: "!imageUploader.isUploading" } }
%img.spinner{ src: "/assets/spinning-circles.svg" }
%br/
{{'uploading' | t}}
= t("registration.steps.images.uploading")

View File

@@ -5,8 +5,8 @@
.row
.small-12.columns
%header
%h2 {{'enterprise_final_step' | t}}
%h5{ "ng-bind" => "'enterprise_social_text' | t:{enterprise: enterprise.name}" }
%h2= t(".enterprise_final_step")
%h5{ "ng-bind" => "'registration.steps.social.enterprise_social_text' | t:{enterprise: enterprise.name}" }
%form{ name: 'social', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "update('finished',social)" } }
.row.content
@@ -14,29 +14,29 @@
.row
.small-12.columns
.field
%label{ for: 'enterprise_website' } {{'website' | t}}:
%input.chunky{ id: 'enterprise_website', placeholder: "{{'website_placeholder' | t}}", ng: { model: 'enterprise.website' } }
%label{ for: 'enterprise_website' }= t(".website")+":"
%input.chunky{ id: 'enterprise_website', placeholder: "{{'registration.steps.social.website_placeholder' | t}}", ng: { model: 'enterprise.website' } }
.row
.small-12.columns
.field
%label{ for: 'enterprise_facebook' } {{'facebook' | t}}:
%input.chunky{ id: 'enterprise_facebook', placeholder: "{{'facebook_placeholder' | t}}", ng: { model: 'enterprise.facebook' } }
%label{ for: 'enterprise_facebook' }= t(".facebook")+":"
%input.chunky{ id: 'enterprise_facebook', placeholder: "{{'registration.steps.social.facebook_placeholder' | t}}", ng: { model: 'enterprise.facebook' } }
.row
.small-12.columns
.field
%label{ for: 'enterprise_linkedin' } {{'linkedin' | t}}:
%input.chunky{ id: 'enterprise_linkedin', placeholder: "{{'linkedin_placeholder' | t}}", ng: { model: 'enterprise.linkedin' } }
%label{ for: 'enterprise_linkedin' }= t(".linkedin")+":"
%input.chunky{ id: 'enterprise_linkedin', placeholder: "{{'registration.steps.social.linkedin_placeholder' | t}}", ng: { model: 'enterprise.linkedin' } }
.small-12.large-5.columns
.row
.small-12.columns
.field
%label{ for: 'enterprise_twitter' } {{'twitter' | t}}:
%input.chunky{ id: 'enterprise_twitter', placeholder: "{{'twitter_placeholder' | t}}", ng: { model: 'enterprise.twitter' } }
%label{ for: 'enterprise_twitter' }= t(".twitter")+":"
%input.chunky{ id: 'enterprise_twitter', placeholder: "{{'registration.steps.social.twitter_placeholder' | t}}", ng: { model: 'enterprise.twitter' } }
.row
.small-12.columns
.field
%label{ for: 'enterprise_instagram' } {{'instagram' | t}}:
%input.chunky{ id: 'enterprise_instagram', placeholder: "{{'instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } }
%label{ for: 'enterprise_instagram' }= t(".instagram")+":"
%input.chunky{ id: 'enterprise_instagram', placeholder: "{{'registration.steps.social.instagram_placeholder' | t}}", ng: { model: 'enterprise.instagram' } }
.row.buttons
.small-12.columns

View File

@@ -1,5 +1,5 @@
%script{ type: "text/ng-template", id: "registration/steps.html" }
.row#progress-bar
.small-12.medium-2.columns.item{ ng: { repeat: 'step in steps', class: "{active: (currentStep() == step),'show-for-medium-up': (currentStep() != step)}" } }
{{ $index+1 + ". " + ('enterprise.registration.modal.steps.' + step + '.title' | t) }}
{{ $index+1 + ". " + ('registration.steps.' + step + '.title' | t) }}

View File

@@ -31,7 +31,7 @@
%div.pad-top{ "infinite-scroll" => "incrementLimit()", "infinite-scroll-distance" => "1", "infinite-scroll-disabled" => 'filteredProducts.length <= limit' }
%product.animate-repeat{"ng-controller" => "ProductNodeCtrl", "ng-repeat" => "product in visibleProducts track by product.id", "id" => "product-{{ product.id }}"}
= render "shop/products/summary"
%shop-variant{variant: 'variant', "ng-repeat" => "variant in product.variants | orderBy: ['name_to_display','unit_value'] track by variant.id", "id" => "variant-{{ variant.id }}", "ng-class" => "{'out-of-stock': !variant.on_demand && variant.count_on_hand == 0}"}
%shop-variant{variant: 'variant', "ng-repeat" => "variant in product.variants | orderBy: ['name_to_display','unit_value'] track by variant.id", "id" => "variant-{{ variant.id }}", "ng-class" => "{'out-of-stock': !variant.on_demand && variant.on_hand == 0}"}
%product{"ng-show" => "Products.loading"}
.row.summary

View File

@@ -19,9 +19,6 @@
.small-12.medium-10.medium-offset-1.columns.text-center
%h2
= t :shops_signup_pricing
-# %p.text-big
-# If there is a time-sensitive offer you can write it here, e.g.
-# Sign up before 30th June for an extra month free!
%br
= ContentConfig.hub_signup_pricing_table_html.html_safe

View File

@@ -89,5 +89,3 @@
%a.button.bottom{href: main_app.admin_order_cycles_path}
= t "manage_order_cycles"
%span.icon-arrow-right
= render 'spree/admin/shared/trial_progress_bar', enterprise: @enterprise

View File

@@ -1,4 +1,4 @@
= render :partial => 'spree/admin/shared/product_sub_menu'
= render partial: 'admin/shared/product_sub_menu'
= render :partial => 'spree/admin/shared/product_tabs', :locals => { :current => 'Group Buy Options' }
= render :partial => 'spree/shared/error_messages', :locals => { :target => @product }

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