solidus_starter_frontend 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +30 -514
- data/.circleci/config.yml +0 -57
- data/.erb-lint.yml +0 -22
- data/.eslintrc +0 -5
- data/.gem_release.yml +0 -5
- data/.github/pull_request_template.md +0 -28
- data/.github/stale.yml +0 -17
- data/.gitignore +0 -17
- data/.hound.yml +0 -16
- data/.rspec +0 -2
- data/.rubocop.yml +0 -19
- data/.rubocop_todo.yml +0 -229
- data/.scss-lint.yml +0 -4
- data/Gemfile +0 -34
- data/LICENSE +0 -26
- data/README.md +0 -69
- data/Rakefile +0 -6
- data/app/assets/config/solidus_starter_frontend_manifest.js +0 -2
- data/app/assets/javascripts/spree/frontend/cart.js +0 -26
- data/app/assets/javascripts/spree/frontend/checkout/address.js +0 -124
- data/app/assets/javascripts/spree/frontend/checkout/payment.js +0 -44
- data/app/assets/javascripts/spree/frontend/checkout.js +0 -34
- data/app/assets/javascripts/spree/frontend/locale_selector.js +0 -9
- data/app/assets/javascripts/spree/frontend/product.js +0 -21
- data/app/assets/javascripts/spree/frontend/solidus_starter_frontend.js +0 -9
- data/app/assets/javascripts/spree/frontend/utils.js.erb +0 -18
- data/app/assets/javascripts/spree/frontend.js +0 -6
- data/app/assets/stylesheets/spree/frontend/base/_base.scss +0 -29
- data/app/assets/stylesheets/spree/frontend/base/_reset.scss +0 -179
- data/app/assets/stylesheets/spree/frontend/base/_responsive.scss +0 -21
- data/app/assets/stylesheets/spree/frontend/components/account/_account_order.scss +0 -23
- data/app/assets/stylesheets/spree/frontend/components/account/_account_summary.scss +0 -17
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_container.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_form.scss +0 -5
- data/app/assets/stylesheets/spree/frontend/components/brand/_logo.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_inline.scss +0 -8
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_primary.scss +0 -26
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_adjustments.scss +0 -6
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_amount_row.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_empty.scss +0 -10
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_footer.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_header.scss +0 -12
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_item.scss +0 -86
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_link.scss +0 -22
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_page.scss +0 -15
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_secondary_actions.scss +0 -19
- data/app/assets/stylesheets/spree/frontend/components/cart/_coupon_code.scss +0 -8
- data/app/assets/stylesheets/spree/frontend/components/cart/_item_info.scss +0 -19
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_header.scss +0 -19
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_summary.scss +0 -31
- data/app/assets/stylesheets/spree/frontend/components/checkout/_existing_cards.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_controls.scss +0 -5
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_selector.scss +0 -14
- data/app/assets/stylesheets/spree/frontend/components/checkout/_progress_steps.scss +0 -38
- data/app/assets/stylesheets/spree/frontend/components/checkout/_proposed_shipment.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipment_items.scss +0 -50
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipping_methods.scss +0 -9
- data/app/assets/stylesheets/spree/frontend/components/checkout/payments/_gateway_payment_method.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_address_step.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_confirm_step.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_delivery_step.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_payment_step.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/forms/_address_inputs.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_checkbox_input.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_radio_input.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_select_input.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_text.scss +0 -32
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_textarea_input.scss +0 -25
- data/app/assets/stylesheets/spree/frontend/components/general/_flash.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/layout/_aside.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/components/layout/_breadcrumbs.scss +0 -16
- data/app/assets/stylesheets/spree/frontend/components/layout/_category_navigation.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/components/layout/_footer.scss +0 -8
- data/app/assets/stylesheets/spree/frontend/components/layout/_header.scss +0 -12
- data/app/assets/stylesheets/spree/frontend/components/layout/_horizontal_input_group.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/layout/_top_bar.scss +0 -44
- data/app/assets/stylesheets/spree/frontend/components/navigation/_auth_link.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/navigation/_categories.scss +0 -29
- data/app/assets/stylesheets/spree/frontend/components/navigation/_locale_selector.scss +0 -21
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomies.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomy.scss +0 -28
- data/app/assets/stylesheets/spree/frontend/components/orders/_address_overview.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/orders/_coupon_codes.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/components/orders/_line_items.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_details.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_item.scss +0 -85
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_page.scss +0 -41
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_shipments.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/orders/_payment_info.scss +0 -29
- data/app/assets/stylesheets/spree/frontend/components/presentation/_hero.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/products/_product_card.scss +0 -35
- data/app/assets/stylesheets/spree/frontend/components/products/_product_image.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/products/_product_info.scss +0 -14
- data/app/assets/stylesheets/spree/frontend/components/products/_product_page.scss +0 -31
- data/app/assets/stylesheets/spree/frontend/components/products/_product_properties.scss +0 -23
- data/app/assets/stylesheets/spree/frontend/components/products/_product_submit.scss +0 -9
- data/app/assets/stylesheets/spree/frontend/components/products/_product_taxons.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/products/_product_thumbnails.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/products/_product_variants.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/products/_products.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/products/_products_by_taxon.scss +0 -6
- data/app/assets/stylesheets/spree/frontend/components/products/_products_grid.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/search/_filter.scss +0 -32
- data/app/assets/stylesheets/spree/frontend/components/search/_search_bar.scss +0 -34
- data/app/assets/stylesheets/spree/frontend/components/typography/_hero_title.scss +0 -6
- data/app/assets/stylesheets/spree/frontend/components/typography/_subtitle.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/placeholders/main.scss +0 -5
- data/app/assets/stylesheets/spree/frontend/screen.scss +0 -89
- data/app/assets/stylesheets/spree/frontend/solidus_starter_frontend.css +0 -7
- data/app/assets/stylesheets/spree/frontend/variables/_colors.scss +0 -20
- data/app/assets/stylesheets/spree/frontend.css +0 -8
- data/app/controllers/concerns/solidus_starter_frontend/auth_views.rb +0 -16
- data/app/controllers/concerns/solidus_starter_frontend/taxonomies.rb +0 -16
- data/app/controllers/spree/checkout_controller.rb +0 -249
- data/app/controllers/spree/coupon_codes_controller.rb +0 -35
- data/app/controllers/spree/home_controller.rb +0 -13
- data/app/controllers/spree/locale_controller.rb +0 -20
- data/app/controllers/spree/orders_controller.rb +0 -126
- data/app/controllers/spree/products_controller.rb +0 -51
- data/app/controllers/spree/store_controller.rb +0 -31
- data/app/controllers/spree/taxons_controller.rb +0 -30
- data/app/helpers/spree/orders_helper.rb +0 -18
- data/app/helpers/spree/taxon_filters_helper.rb +0 -13
- data/app/views/spree/address/_form_hidden.html.erb +0 -12
- data/app/views/spree/checkout/_terms_and_conditions.en.html.erb +0 -1
- data/app/views/spree/checkout/edit.html.erb +0 -16
- data/app/views/spree/checkout/existing_payment/_gateway.html.erb +0 -9
- data/app/views/spree/checkout/payment/_check.html.erb +0 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +0 -43
- data/app/views/spree/components/auth/_change_form.html.erb +0 -40
- data/app/views/spree/components/auth/_forgot_form.html.erb +0 -28
- data/app/views/spree/components/auth/_guest_form.html.erb +0 -31
- data/app/views/spree/components/auth/_login_form.html.erb +0 -42
- data/app/views/spree/components/auth/_signup_form.html.erb +0 -48
- data/app/views/spree/components/brand/_logo.html.erb +0 -3
- data/app/views/spree/components/buttons/_button_inline.html.erb +0 -23
- data/app/views/spree/components/buttons/_button_primary.html.erb +0 -29
- data/app/views/spree/components/cart/_cart_adjustment.html.erb +0 -15
- data/app/views/spree/components/cart/_cart_adjustments.html.erb +0 -47
- data/app/views/spree/components/cart/_cart_amount_row.html.erb +0 -12
- data/app/views/spree/components/cart/_cart_empty.html.erb +0 -9
- data/app/views/spree/components/cart/_cart_footer.html.erb +0 -15
- data/app/views/spree/components/cart/_cart_header.html.erb +0 -17
- data/app/views/spree/components/cart/_cart_item.html.erb +0 -52
- data/app/views/spree/components/cart/_cart_items.html.erb +0 -23
- data/app/views/spree/components/cart/_cart_link.html.erb +0 -9
- data/app/views/spree/components/cart/_cart_secondary_actions.html.erb +0 -17
- data/app/views/spree/components/cart/_item_info.html.erb +0 -26
- data/app/views/spree/components/checkout/_checkout_header.html.erb +0 -8
- data/app/views/spree/components/checkout/_checkout_step.html.erb +0 -21
- data/app/views/spree/components/checkout/_checkout_summary.html.erb +0 -70
- data/app/views/spree/components/checkout/_existing_cards.html.erb +0 -39
- data/app/views/spree/components/checkout/_payment_method_controls.html.erb +0 -10
- data/app/views/spree/components/checkout/_payment_method_selector.html.erb +0 -14
- data/app/views/spree/components/checkout/_proposed_shipment.erb +0 -18
- data/app/views/spree/components/checkout/_shipment_items.html.erb +0 -22
- data/app/views/spree/components/checkout/_shipping_methods.html.erb +0 -20
- data/app/views/spree/components/checkout/_unshippable_items.html.erb +0 -7
- data/app/views/spree/components/checkout/steps/_address_step.html.erb +0 -60
- data/app/views/spree/components/checkout/steps/_confirm_step.html.erb +0 -31
- data/app/views/spree/components/checkout/steps/_delivery_step.html.erb +0 -31
- data/app/views/spree/components/checkout/steps/_payment_step.html.erb +0 -25
- data/app/views/spree/components/forms/_address_inputs.html.erb +0 -152
- data/app/views/spree/components/forms/inputs/_checkbox_input.html.erb +0 -29
- data/app/views/spree/components/forms/inputs/_collection_select.html.erb +0 -42
- data/app/views/spree/components/forms/inputs/_radio_input.html.erb +0 -29
- data/app/views/spree/components/forms/inputs/_select_input.html.erb +0 -31
- data/app/views/spree/components/forms/inputs/_text.html.erb +0 -54
- data/app/views/spree/components/forms/inputs/_textarea_input.html.erb +0 -42
- data/app/views/spree/components/layout/_category_navigation.html.erb +0 -3
- data/app/views/spree/components/layout/_footer.html.erb +0 -7
- data/app/views/spree/components/layout/_header.html.erb +0 -8
- data/app/views/spree/components/layout/_top_bar.html.erb +0 -8
- data/app/views/spree/components/navigation/_auth_link.html.erb +0 -1
- data/app/views/spree/components/navigation/_breadcrumbs.html.erb +0 -47
- data/app/views/spree/components/navigation/_categories.html.erb +0 -12
- data/app/views/spree/components/navigation/_locale_selector.html.erb +0 -25
- data/app/views/spree/components/navigation/_taxonomies.html.erb +0 -17
- data/app/views/spree/components/navigation/_taxons.html.erb +0 -17
- data/app/views/spree/components/navigation/_taxons_tree.html.erb +0 -29
- data/app/views/spree/components/orders/_address_overview.html.erb +0 -40
- data/app/views/spree/components/orders/_coupon_code.html.erb +0 -22
- data/app/views/spree/components/orders/_line_items.html.erb +0 -55
- data/app/views/spree/components/orders/_order_details.html.erb +0 -35
- data/app/views/spree/components/orders/_order_item.html.erb +0 -33
- data/app/views/spree/components/orders/_order_items.html.erb +0 -5
- data/app/views/spree/components/orders/_order_shipments.html.erb +0 -25
- data/app/views/spree/components/orders/_payment_info.html.erb +0 -31
- data/app/views/spree/components/presentation/_hero.html.erb +0 -14
- data/app/views/spree/components/products/_product-card.html.erb +0 -36
- data/app/views/spree/components/products/_product_availability.html.erb +0 -19
- data/app/views/spree/components/products/_product_form.html.erb +0 -21
- data/app/views/spree/components/products/_product_image.html.erb +0 -6
- data/app/views/spree/components/products/_product_info.html.erb +0 -9
- data/app/views/spree/components/products/_product_promotions.html.erb +0 -25
- data/app/views/spree/components/products/_product_properties.html.erb +0 -19
- data/app/views/spree/components/products/_product_submit.html.erb +0 -39
- data/app/views/spree/components/products/_product_taxons.html.erb +0 -15
- data/app/views/spree/components/products/_product_thumbnails.html.erb +0 -19
- data/app/views/spree/components/products/_product_variants.html.erb +0 -36
- data/app/views/spree/components/products/_products-grid.html.erb +0 -13
- data/app/views/spree/components/products/_products.html.erb +0 -28
- data/app/views/spree/components/products/_products_by_taxon.html.erb +0 -7
- data/app/views/spree/components/products/_variants_list.html.erb +0 -12
- data/app/views/spree/components/search/_filter.html.erb +0 -42
- data/app/views/spree/components/search/_filters.html.erb +0 -20
- data/app/views/spree/components/search/_form.html.erb +0 -12
- data/app/views/spree/components/search/_products_search.html.erb +0 -36
- data/app/views/spree/components/search/_search_bar.html.erb +0 -36
- data/app/views/spree/components/typography/_hero_title.html.erb +0 -11
- data/app/views/spree/components/typography/_subtitle.html.erb +0 -11
- data/app/views/spree/home/index.html.erb +0 -7
- data/app/views/spree/layouts/spree_application.html.erb +0 -27
- data/app/views/spree/orders/edit.html.erb +0 -21
- data/app/views/spree/orders/show.html.erb +0 -29
- data/app/views/spree/products/index.html.erb +0 -22
- data/app/views/spree/products/show.html.erb +0 -18
- data/app/views/spree/shared/_image.html.erb +0 -12
- data/app/views/spree/shared/_link_to_cart.html.erb +0 -1
- data/app/views/spree/shared/_login_bar_items.html.erb +0 -1
- data/app/views/spree/shared/_shipment_tracking.html.erb +0 -11
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
- data/app/views/spree/taxons/show.html.erb +0 -17
- data/bin/console +0 -17
- data/bin/r +0 -13
- data/bin/rails +0 -7
- data/bin/rake +0 -7
- data/bin/rspec +0 -29
- data/bin/sandbox +0 -84
- data/bin/sandbox_rails +0 -18
- data/bin/setup +0 -8
- data/bin/solidus_compare +0 -155
- data/config/initializers/assets.rb +0 -1
- data/config/initializers/canonical_rails.rb +0 -16
- data/config/locales/en.yml +0 -5
- data/config/routes.rb +0 -33
- data/config/solidus_compare.yml +0 -33
- data/docs/development.md +0 -28
- data/exe/solidus_starter_frontend +0 -9
- data/lib/generators/solidus_starter_frontend/install/install_generator.rb +0 -15
- data/lib/generators/solidus_starter_frontend/solidus_starter_frontend_generator.rb +0 -30
- data/lib/generators/solidus_starter_frontend/views/override_generator.rb +0 -50
- data/lib/solidus_starter_frontend/config.rb +0 -7
- data/lib/solidus_starter_frontend/engine.rb +0 -34
- data/lib/solidus_starter_frontend/factories.rb +0 -4
- data/lib/solidus_starter_frontend/solidus_support_extensions.rb +0 -9
- data/lib/solidus_starter_frontend/version.rb +0 -5
- data/lib/solidus_starter_frontend.rb +0 -12
- data/lib/solidus_starter_frontend_configuration.rb +0 -8
- data/lib/views/auth/spree/checkout/registration.html.erb +0 -7
- data/lib/views/auth/spree/components/navigation/_auth_link.html.erb +0 -5
- data/lib/views/auth/spree/user_passwords/edit.html.erb +0 -7
- data/lib/views/auth/spree/user_passwords/new.html.erb +0 -5
- data/lib/views/auth/spree/user_registrations/new.html.erb +0 -7
- data/lib/views/auth/spree/user_sessions/guest.html.erb +0 -5
- data/lib/views/auth/spree/user_sessions/new.html.erb +0 -7
- data/lib/views/auth/spree/users/edit.html.erb +0 -45
- data/lib/views/auth/spree/users/show.html.erb +0 -55
- data/solidus_starter_frontend.gemspec +0 -43
- data/spec/controllers/controller_helpers_spec.rb +0 -29
- data/spec/controllers/locale_controller_spec.rb +0 -57
- data/spec/controllers/spree/checkout_controller_spec.rb +0 -563
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -37
- data/spec/controllers/spree/current_order_tracking_spec.rb +0 -33
- data/spec/controllers/spree/home_controller_spec.rb +0 -29
- data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -90
- data/spec/controllers/spree/orders_controller_spec.rb +0 -241
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -33
- data/spec/controllers/spree/products_controller_spec.rb +0 -38
- data/spec/controllers/spree/taxons_controller_spec.rb +0 -14
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/generators/solidus/views/override_generator_spec.rb +0 -50
- data/spec/helpers/base_helper_spec.rb +0 -13
- data/spec/helpers/order_helper_spec.rb +0 -14
- data/spec/helpers/taxon_filters_helper_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -64
- data/spec/support/shared_contexts/checkout_setup.rb +0 -12
- data/spec/support/shared_contexts/custom_products.rb +0 -28
- data/spec/support/shared_contexts/locales.rb +0 -16
- data/spec/system/address_spec.rb +0 -87
- data/spec/system/automatic_promotion_adjustments_spec.rb +0 -49
- data/spec/system/caching/products_spec.rb +0 -48
- data/spec/system/caching/taxons_spec.rb +0 -35
- data/spec/system/cart_spec.rb +0 -81
- data/spec/system/checkout_confirm_insufficient_stock_spec.rb +0 -71
- data/spec/system/checkout_spec.rb +0 -699
- data/spec/system/checkout_unshippable_spec.rb +0 -37
- data/spec/system/coupon_code_spec.rb +0 -267
- data/spec/system/currency_spec.rb +0 -20
- data/spec/system/first_order_promotion_spec.rb +0 -59
- data/spec/system/free_shipping_promotions_spec.rb +0 -60
- data/spec/system/locale_spec.rb +0 -26
- data/spec/system/order_spec.rb +0 -57
- data/spec/system/products_spec.rb +0 -302
- data/spec/system/promotion_code_invalidation_spec.rb +0 -54
- data/spec/system/quantity_promotions_spec.rb +0 -130
- data/spec/system/taxons_spec.rb +0 -158
- data/spec/system/template_rendering_spec.rb +0 -20
- data/spec/views/spree/checkout/_summary_spec.rb +0 -11
data/.gem_release.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
<!--- Provide a general summary of your changes in the Title above -->
|
2
|
-
|
3
|
-
## Description
|
4
|
-
<!--- Describe your changes in detail -->
|
5
|
-
|
6
|
-
## Motivation and Context
|
7
|
-
<!--- Why is this change required? What problem does it solve? -->
|
8
|
-
<!--- If it fixes an open issue, please link to the issue here. -->
|
9
|
-
|
10
|
-
## How Has This Been Tested?
|
11
|
-
<!--- Please describe in detail how you tested your changes. -->
|
12
|
-
<!--- Include details of your testing environment, tests ran to see how -->
|
13
|
-
<!--- your change affects other areas of the code, etc. -->
|
14
|
-
|
15
|
-
## Screenshots (if appropriate):
|
16
|
-
|
17
|
-
## Types of changes
|
18
|
-
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
19
|
-
- [ ] Bug fix (non-breaking change which fixes an issue)
|
20
|
-
- [ ] New feature (non-breaking change which adds functionality)
|
21
|
-
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
22
|
-
|
23
|
-
## Checklist:
|
24
|
-
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
25
|
-
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
26
|
-
- [ ] My code follows the code style of this project.
|
27
|
-
- [ ] My change requires a change to the documentation.
|
28
|
-
- [ ] I have updated the documentation accordingly.
|
data/.github/stale.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Number of days of inactivity before an issue becomes stale
|
2
|
-
daysUntilStale: 60
|
3
|
-
# Number of days of inactivity before a stale issue is closed
|
4
|
-
daysUntilClose: 7
|
5
|
-
# Issues with these labels will never be considered stale
|
6
|
-
exemptLabels:
|
7
|
-
- pinned
|
8
|
-
- security
|
9
|
-
# Label to use when marking an issue as stale
|
10
|
-
staleLabel: wontfix
|
11
|
-
# Comment to post when marking an issue as stale. Set to `false` to disable
|
12
|
-
markComment: >
|
13
|
-
This issue has been automatically marked as stale because it has not had
|
14
|
-
recent activity. It will be closed if no further activity occurs. Thank you
|
15
|
-
for your contributions.
|
16
|
-
# Comment to post when closing a stale issue. Set to `false` to disable
|
17
|
-
closeComment: false
|
data/.gitignore
DELETED
data/.hound.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
erblint:
|
2
|
-
enabled: true
|
3
|
-
config_file: .erb-lint.yml
|
4
|
-
|
5
|
-
rubocop:
|
6
|
-
version: 0.75.0
|
7
|
-
config_file: .rubocop.yml
|
8
|
-
|
9
|
-
scss-lint:
|
10
|
-
enabled: true
|
11
|
-
version: 0.57.1
|
12
|
-
config_file: .scss-lint.yml
|
13
|
-
|
14
|
-
eslint:
|
15
|
-
enabled: true
|
16
|
-
config_file: .eslintrc
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- .rubocop_todo.yml
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
Exclude:
|
6
|
-
- sandbox/**/*
|
7
|
-
- spec/dummy/**/*
|
8
|
-
- vendor/**/*
|
9
|
-
|
10
|
-
Documentation:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
Metrics/BlockLength:
|
14
|
-
Exclude:
|
15
|
-
- spec/**/*
|
16
|
-
|
17
|
-
Metrics/LineLength:
|
18
|
-
Enabled: true
|
19
|
-
Max: 175
|
data/.rubocop_todo.yml
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-07-31 10:58:59 +0200 using RuboCop version 0.76.0.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
12
|
-
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
13
|
-
Bundler/OrderedGems:
|
14
|
-
Exclude:
|
15
|
-
- 'Gemfile'
|
16
|
-
|
17
|
-
# Offense count: 2
|
18
|
-
# Cop supports --auto-correct.
|
19
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
20
|
-
# SupportedStyles: with_first_argument, with_fixed_indentation
|
21
|
-
Layout/AlignArguments:
|
22
|
-
Exclude:
|
23
|
-
- 'bin/rspec'
|
24
|
-
- 'lib/generators/solidus_starter_frontend/views/override_generator.rb'
|
25
|
-
|
26
|
-
# Offense count: 3
|
27
|
-
# Cop supports --auto-correct.
|
28
|
-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
29
|
-
# SupportedHashRocketStyles: key, separator, table
|
30
|
-
# SupportedColonStyles: key, separator, table
|
31
|
-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
32
|
-
Layout/AlignHash:
|
33
|
-
Exclude:
|
34
|
-
- 'spec/system/coupon_code_spec.rb'
|
35
|
-
|
36
|
-
# Offense count: 5
|
37
|
-
# Cop supports --auto-correct.
|
38
|
-
# Configuration parameters: EnforcedStyle.
|
39
|
-
# SupportedStyles: leading, trailing
|
40
|
-
Layout/DotPosition:
|
41
|
-
Exclude:
|
42
|
-
- 'app/controllers/spree/products_controller.rb'
|
43
|
-
- 'spec/controllers/spree/orders_controller_spec.rb'
|
44
|
-
|
45
|
-
# Offense count: 1
|
46
|
-
# Cop supports --auto-correct.
|
47
|
-
Layout/EmptyLineAfterGuardClause:
|
48
|
-
Exclude:
|
49
|
-
- 'spec/generators/solidus/views/override_generator_spec.rb'
|
50
|
-
|
51
|
-
# Offense count: 1
|
52
|
-
# Cop supports --auto-correct.
|
53
|
-
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
54
|
-
Layout/ExtraSpacing:
|
55
|
-
Exclude:
|
56
|
-
- 'spec/controllers/spree/checkout_controller_spec.rb'
|
57
|
-
|
58
|
-
# Offense count: 4
|
59
|
-
# Cop supports --auto-correct.
|
60
|
-
# Configuration parameters: IndentationWidth.
|
61
|
-
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
62
|
-
Layout/IndentFirstHashElement:
|
63
|
-
EnforcedStyle: consistent
|
64
|
-
|
65
|
-
# Offense count: 1
|
66
|
-
# Cop supports --auto-correct.
|
67
|
-
# Configuration parameters: Width, IgnoredPatterns.
|
68
|
-
Layout/IndentationWidth:
|
69
|
-
Exclude:
|
70
|
-
- 'spec/system/products_spec.rb'
|
71
|
-
|
72
|
-
# Offense count: 4
|
73
|
-
# Cop supports --auto-correct.
|
74
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
75
|
-
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
76
|
-
Layout/MultilineMethodCallIndentation:
|
77
|
-
Exclude:
|
78
|
-
- 'app/controllers/spree/products_controller.rb'
|
79
|
-
|
80
|
-
# Offense count: 6
|
81
|
-
Lint/AmbiguousBlockAssociation:
|
82
|
-
Exclude:
|
83
|
-
- 'spec/controllers/spree/checkout_controller_spec.rb'
|
84
|
-
- 'spec/controllers/spree/current_order_tracking_spec.rb'
|
85
|
-
|
86
|
-
# Offense count: 1
|
87
|
-
# Configuration parameters: AllowSafeAssignment.
|
88
|
-
Lint/AssignmentInCondition:
|
89
|
-
Exclude:
|
90
|
-
- 'app/controllers/spree/orders_controller.rb'
|
91
|
-
|
92
|
-
# Offense count: 12
|
93
|
-
Metrics/AbcSize:
|
94
|
-
Max: 41
|
95
|
-
|
96
|
-
# Offense count: 1
|
97
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
98
|
-
# ExcludedMethods: refine
|
99
|
-
Metrics/BlockLength:
|
100
|
-
Max: 27
|
101
|
-
|
102
|
-
# Offense count: 1
|
103
|
-
# Configuration parameters: CountComments.
|
104
|
-
Metrics/ClassLength:
|
105
|
-
Max: 186
|
106
|
-
|
107
|
-
# Offense count: 3
|
108
|
-
Metrics/CyclomaticComplexity:
|
109
|
-
Max: 9
|
110
|
-
|
111
|
-
# Offense count: 11
|
112
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
113
|
-
Metrics/MethodLength:
|
114
|
-
Max: 24
|
115
|
-
|
116
|
-
# Offense count: 2
|
117
|
-
Metrics/PerceivedComplexity:
|
118
|
-
Max: 9
|
119
|
-
|
120
|
-
# Offense count: 8
|
121
|
-
# Cop supports --auto-correct.
|
122
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
|
123
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
124
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
125
|
-
# FunctionalMethods: let, let!, subject, watch
|
126
|
-
# IgnoredMethods: lambda, proc, it
|
127
|
-
Style/BlockDelimiters:
|
128
|
-
Exclude:
|
129
|
-
- 'spec/controllers/spree/checkout_controller_spec.rb'
|
130
|
-
- 'spec/controllers/spree/current_order_tracking_spec.rb'
|
131
|
-
- 'spec/controllers/spree/orders_controller_ability_spec.rb'
|
132
|
-
- 'spec/controllers/spree/products_controller_spec.rb'
|
133
|
-
|
134
|
-
# Offense count: 1
|
135
|
-
# Cop supports --auto-correct.
|
136
|
-
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
137
|
-
# SupportedStyles: assign_to_condition, assign_inside_condition
|
138
|
-
Style/ConditionalAssignment:
|
139
|
-
Exclude:
|
140
|
-
- 'app/controllers/spree/products_controller.rb'
|
141
|
-
|
142
|
-
# Offense count: 1
|
143
|
-
# Cop supports --auto-correct.
|
144
|
-
Style/ExpandPathArguments:
|
145
|
-
Exclude:
|
146
|
-
- 'bin/rspec'
|
147
|
-
|
148
|
-
# Offense count: 2
|
149
|
-
# Cop supports --auto-correct.
|
150
|
-
# Configuration parameters: EnforcedStyle.
|
151
|
-
# SupportedStyles: always, never
|
152
|
-
Style/FrozenStringLiteralComment:
|
153
|
-
Exclude:
|
154
|
-
- 'bin/r'
|
155
|
-
- 'config/initializers/assets.rb'
|
156
|
-
|
157
|
-
# Offense count: 8
|
158
|
-
# Configuration parameters: MinBodyLength.
|
159
|
-
Style/GuardClause:
|
160
|
-
Exclude:
|
161
|
-
- 'app/controllers/spree/checkout_controller.rb'
|
162
|
-
- 'app/controllers/spree/coupon_codes_controller.rb'
|
163
|
-
- 'app/controllers/spree/orders_controller.rb'
|
164
|
-
|
165
|
-
# Offense count: 1
|
166
|
-
# Cop supports --auto-correct.
|
167
|
-
Style/IfUnlessModifier:
|
168
|
-
Exclude:
|
169
|
-
- 'app/controllers/spree/checkout_controller.rb'
|
170
|
-
|
171
|
-
# Offense count: 2
|
172
|
-
# Cop supports --auto-correct.
|
173
|
-
# Configuration parameters: PreferredDelimiters.
|
174
|
-
Style/PercentLiteralDelimiters:
|
175
|
-
Exclude:
|
176
|
-
- 'spec/generators/solidus/views/override_generator_spec.rb'
|
177
|
-
|
178
|
-
# Offense count: 2
|
179
|
-
# Cop supports --auto-correct.
|
180
|
-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
|
181
|
-
# Whitelist: present?, blank?, presence, try, try!
|
182
|
-
Style/SafeNavigation:
|
183
|
-
Exclude:
|
184
|
-
- 'app/controllers/spree/checkout_controller.rb'
|
185
|
-
- 'app/controllers/spree/orders_controller.rb'
|
186
|
-
|
187
|
-
# Offense count: 3
|
188
|
-
# Cop supports --auto-correct.
|
189
|
-
# Configuration parameters: EnforcedStyle.
|
190
|
-
# SupportedStyles: use_perl_names, use_english_names
|
191
|
-
Style/SpecialGlobalVars:
|
192
|
-
Exclude:
|
193
|
-
- 'bin/solidus_compare'
|
194
|
-
|
195
|
-
# Offense count: 787
|
196
|
-
# Cop supports --auto-correct.
|
197
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
198
|
-
# SupportedStyles: single_quotes, double_quotes
|
199
|
-
Style/StringLiterals:
|
200
|
-
Enabled: false
|
201
|
-
|
202
|
-
# Offense count: 7
|
203
|
-
# Cop supports --auto-correct.
|
204
|
-
# Configuration parameters: MinSize.
|
205
|
-
# SupportedStyles: percent, brackets
|
206
|
-
Style/SymbolArray:
|
207
|
-
EnforcedStyle: brackets
|
208
|
-
|
209
|
-
# Offense count: 1
|
210
|
-
# Cop supports --auto-correct.
|
211
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
212
|
-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
213
|
-
Style/TrailingCommaInArguments:
|
214
|
-
Exclude:
|
215
|
-
- 'spec/system/free_shipping_promotions_spec.rb'
|
216
|
-
|
217
|
-
# Offense count: 1
|
218
|
-
# Cop supports --auto-correct.
|
219
|
-
Style/WhileUntilModifier:
|
220
|
-
Exclude:
|
221
|
-
- 'spec/controllers/spree/checkout_controller_spec.rb'
|
222
|
-
|
223
|
-
# Offense count: 1
|
224
|
-
# Cop supports --auto-correct.
|
225
|
-
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
|
226
|
-
# SupportedStyles: percent, brackets
|
227
|
-
Style/WordArray:
|
228
|
-
Exclude:
|
229
|
-
- 'spec/controllers/spree/checkout_controller_spec.rb'
|
data/.scss-lint.yml
DELETED
data/Gemfile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
5
|
-
|
6
|
-
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
7
|
-
gem 'solidus_core', github: 'solidusio/solidus', branch: branch
|
8
|
-
gem 'solidus_api', github: 'solidusio/solidus', branch: branch
|
9
|
-
gem 'solidus_backend', github: 'solidusio/solidus', branch: branch
|
10
|
-
gem 'solidus_sample', github: 'solidusio/solidus', branch: branch
|
11
|
-
gem 'solidus_i18n', github: 'solidusio/solidus_i18n', branch: branch
|
12
|
-
|
13
|
-
# Needed to help Bundler figure out how to resolve dependencies,
|
14
|
-
# otherwise it takes forever to resolve them.
|
15
|
-
# See https://github.com/bundler/bundler/issues/6677
|
16
|
-
gem 'rails', '>0.a'
|
17
|
-
|
18
|
-
case ENV['DB']
|
19
|
-
when 'mysql'
|
20
|
-
gem 'mysql2'
|
21
|
-
when 'postgresql'
|
22
|
-
gem 'pg'
|
23
|
-
else
|
24
|
-
gem 'sqlite3'
|
25
|
-
end
|
26
|
-
|
27
|
-
gemspec
|
28
|
-
|
29
|
-
# Use a local Gemfile to include development dependencies that might not be
|
30
|
-
# relevant for the project or for other contributors, e.g. pry-byebug.
|
31
|
-
#
|
32
|
-
# We use `send` instead of calling `eval_gemfile` to work around an issue with
|
33
|
-
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
|
34
|
-
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
|
data/LICENSE
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Copyright (c) 2020 Nebulab SRL
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without modification,
|
5
|
-
are permitted provided that the following conditions are met:
|
6
|
-
|
7
|
-
* Redistributions of source code must retain the above copyright notice,
|
8
|
-
this list of conditions and the following disclaimer.
|
9
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer in the documentation
|
11
|
-
and/or other materials provided with the distribution.
|
12
|
-
* Neither the name Solidus nor the names of its contributors may be used to
|
13
|
-
endorse or promote products derived from this software without specific
|
14
|
-
prior written permission.
|
15
|
-
|
16
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# solidus_starter_frontend
|
2
|
-
|
3
|
-
`solidus_starter_frontend` is a new starter store for [Solidus][solidus]. This
|
4
|
-
extension aims to deliver a modern, minimal, semantic and easy to extend
|
5
|
-
frontend codebase for a more efficient bootstrapping experience.
|
6
|
-
|
7
|
-
**WARNING: this is an experimental extension and still in a very early stage of
|
8
|
-
development.**
|
9
|
-
|
10
|
-
## Objectives
|
11
|
-
|
12
|
-
We aim to deliver:
|
13
|
-
|
14
|
-
- a minimal, semantic and accessible HTML skeleton
|
15
|
-
- a reusable component based architecture
|
16
|
-
- simple SASS styling strictly based on BEM
|
17
|
-
- the elimination of jQuery as a dependency by rewriting frontend functionality
|
18
|
-
in vanilla JavaScript
|
19
|
-
|
20
|
-
All of this while keeping and improving on the functionality of the current
|
21
|
-
[Solidus][solidus] starter store.
|
22
|
-
|
23
|
-
## Installation
|
24
|
-
|
25
|
-
By default, the `solidus` gem also includes the standard frontend via
|
26
|
-
the `solidus_frontend` gem. To make this extension work, you need to
|
27
|
-
exclude it and manually include all the other Solidus componenents.
|
28
|
-
|
29
|
-
You need to replace:
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
gem 'solidus'
|
33
|
-
```
|
34
|
-
|
35
|
-
with:
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
gem 'solidus_core'
|
39
|
-
gem 'solidus_api'
|
40
|
-
gem 'solidus_backend'
|
41
|
-
gem 'solidus_sample'
|
42
|
-
```
|
43
|
-
|
44
|
-
Install our binary in the system: `gem install solidus_starter_frontend`
|
45
|
-
|
46
|
-
Execute our generator that will copy our component files in your project:
|
47
|
-
`solidus_starter_frontend`. Now you can start to customize your local views.
|
48
|
-
|
49
|
-
If Solidus was already installed with solidus_frontend you will have to change
|
50
|
-
all `Spree::Frontend::Config` in `SolidusStarterFrontend::Config`.
|
51
|
-
|
52
|
-
## Development
|
53
|
-
|
54
|
-
For information about contributing to this project please refer to this
|
55
|
-
[document](docs/development.md).
|
56
|
-
|
57
|
-
## About
|
58
|
-
|
59
|
-
[![Nebulab][nebulab-logo]][nebulab]
|
60
|
-
|
61
|
-
`solidus_starter_frontend` is funded and maintained by the [Nebulab][nebulab] team.
|
62
|
-
|
63
|
-
We firmly believe in the power of open-source. [Contact us][contact-us] if you
|
64
|
-
like our work and you need help with your project design or development.
|
65
|
-
|
66
|
-
[solidus]: http://solidus.io/
|
67
|
-
[nebulab]: http://nebulab.it/
|
68
|
-
[nebulab-logo]: http://nebulab.it/assets/images/public/logo.svg
|
69
|
-
[contact-us]: http://nebulab.it/contact-us/
|
data/Rakefile
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
window.addEventListener('DOMContentLoaded', () => {
|
2
|
-
const cartForm = document.getElementById('update-cart');
|
3
|
-
|
4
|
-
if (cartForm) {
|
5
|
-
const deleteButtons = cartForm.querySelectorAll('input.delete');
|
6
|
-
|
7
|
-
deleteButtons.forEach(deleteButton => {
|
8
|
-
deleteButton.addEventListener('click', () => {
|
9
|
-
const lineItem = deleteButton.parentNode.parentNode;
|
10
|
-
lineItem.querySelector('.cart-item__quantity input').setAttribute('value', 0);
|
11
|
-
});
|
12
|
-
});
|
13
|
-
|
14
|
-
cartForm.addEventListener('submit', () => {
|
15
|
-
document.getElementById('update-button').setAttribute('disabled', true);
|
16
|
-
});
|
17
|
-
}
|
18
|
-
});
|
19
|
-
|
20
|
-
Solidus.fetch_cart = (cartLinkUrl) => {
|
21
|
-
fetch(cartLinkUrl || Solidus.pathFor('cart_link'))
|
22
|
-
.then(response => response.text())
|
23
|
-
.then(html => {
|
24
|
-
document.getElementById('link-to-cart').innerHTML = html;
|
25
|
-
});
|
26
|
-
};
|
@@ -1,124 +0,0 @@
|
|
1
|
-
window.addEventListener('DOMContentLoaded', () => {
|
2
|
-
if (document.getElementById('checkout_form_address')) {
|
3
|
-
// Hidden by default to support browsers with javascript disabled
|
4
|
-
document.querySelectorAll('.js-address-fields')
|
5
|
-
.forEach(field => field.style.display = 'block');
|
6
|
-
|
7
|
-
const statesCache = {};
|
8
|
-
|
9
|
-
function updateState(stateContainer, countryId) {
|
10
|
-
if (statesCache[countryId]) {
|
11
|
-
fillStates(stateContainer, countryId);
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
|
15
|
-
fetch(`${Solidus.routes.states_search}?country_id=${countryId}`)
|
16
|
-
.then(response => response.json())
|
17
|
-
.then(data => {
|
18
|
-
statesCache[countryId] = {
|
19
|
-
states: data.states,
|
20
|
-
states_required: data.states_required
|
21
|
-
};
|
22
|
-
fillStates(stateContainer, countryId);
|
23
|
-
});
|
24
|
-
};
|
25
|
-
|
26
|
-
function fillStates(stateContainer, countryId) {
|
27
|
-
const stateData = statesCache[countryId];
|
28
|
-
|
29
|
-
if (!stateData) {
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
|
33
|
-
const statesRequired = stateData.states_required;
|
34
|
-
const states = stateData.states;
|
35
|
-
|
36
|
-
const stateSelect = stateContainer.querySelector('select');
|
37
|
-
const stateInput = stateContainer.querySelector('input');
|
38
|
-
|
39
|
-
if (states.length > 0) {
|
40
|
-
const selected = parseInt(stateSelect.value);
|
41
|
-
stateSelect.innerHTML = '';
|
42
|
-
const statesWithBlank = [{ name: '', id: ''}].concat(states);
|
43
|
-
statesWithBlank.forEach(state => {
|
44
|
-
const selectOption = document.createElement('option');
|
45
|
-
selectOption.value = state.id;
|
46
|
-
selectOption.innerHTML = state.name;
|
47
|
-
if (selected === state.id) {
|
48
|
-
selectOption.setAttribute('selected', true);
|
49
|
-
}
|
50
|
-
stateSelect.appendChild(selectOption);
|
51
|
-
})
|
52
|
-
stateSelect.style.display = 'block';
|
53
|
-
stateSelect.removeAttribute('disabled');
|
54
|
-
stateInput.style.display = 'none';
|
55
|
-
stateInput.setAttribute('disabled', true);
|
56
|
-
stateContainer.style.display = 'block';
|
57
|
-
if (statesRequired) {
|
58
|
-
stateSelect.classList.add('required');
|
59
|
-
stateContainer.classList.add('field-required');
|
60
|
-
} else {
|
61
|
-
stateSelect.classList.remove('required');
|
62
|
-
stateContainer.classList.remove('field-required');
|
63
|
-
}
|
64
|
-
stateInput.classList.remove('required');
|
65
|
-
} else {
|
66
|
-
stateSelect.style.display = 'none';
|
67
|
-
stateSelect.setAttribute('disabled', true);
|
68
|
-
stateInput.style.display = 'block';
|
69
|
-
if (statesRequired) {
|
70
|
-
stateContainer.classList.add('field-required');
|
71
|
-
stateInput.classList.add('required');
|
72
|
-
} else {
|
73
|
-
stateInput.value = '';
|
74
|
-
stateContainer.classList.remove('field-required');
|
75
|
-
stateInput.classList.remove('required');
|
76
|
-
}
|
77
|
-
stateContainer.style.display = !!statesRequired ? 'block' : 'none';
|
78
|
-
if (!statesRequired) {
|
79
|
-
stateInput.setAttribute('disabled', true);
|
80
|
-
} else {
|
81
|
-
stateInput.removeAttribute('disabled');
|
82
|
-
}
|
83
|
-
stateSelect.classList.remove('required');
|
84
|
-
}
|
85
|
-
};
|
86
|
-
|
87
|
-
document.querySelectorAll('.js-trigger-state-change').forEach(element => {
|
88
|
-
element.addEventListener('change', () => {
|
89
|
-
const stateContainer = document.querySelector(element.dataset.stateContainer);
|
90
|
-
if (stateContainer) {
|
91
|
-
const countryId = element.value;
|
92
|
-
updateState(stateContainer, countryId);
|
93
|
-
}
|
94
|
-
});
|
95
|
-
});
|
96
|
-
|
97
|
-
document.querySelectorAll('.js-trigger-state-change:not([hidden])').forEach(element => {
|
98
|
-
element.dispatchEvent(new Event('change'));
|
99
|
-
});
|
100
|
-
|
101
|
-
const orderUseBilling = document.getElementById('order_use_billing');
|
102
|
-
orderUseBilling.addEventListener('change', function() {
|
103
|
-
update_shipping_form_state(orderUseBilling);
|
104
|
-
});
|
105
|
-
|
106
|
-
function update_shipping_form_state(order_use_billing) {
|
107
|
-
const addressInputs = document.querySelectorAll('#shipping .address-inputs');
|
108
|
-
const inputs = document.querySelectorAll('#shipping .address-inputs input');
|
109
|
-
const selects = document.querySelectorAll('#shipping .address-inputs select');
|
110
|
-
if (order_use_billing.checked) {
|
111
|
-
addressInputs.forEach(addressInput => addressInput.style.display = 'none');
|
112
|
-
inputs.forEach(input => input.setAttribute('disabled', true));
|
113
|
-
selects.forEach(sel => sel.setAttribute('disabled', true));
|
114
|
-
} else {
|
115
|
-
addressInputs.forEach(addressInput => addressInput.style.display = 'block');
|
116
|
-
inputs.forEach(input => input.removeAttribute('disabled'));
|
117
|
-
selects.forEach(sel => sel.removeAttribute('disabled'));
|
118
|
-
document.querySelector('#shipping .js-trigger-state-change').dispatchEvent(new Event('change'));
|
119
|
-
}
|
120
|
-
};
|
121
|
-
|
122
|
-
update_shipping_form_state(orderUseBilling);
|
123
|
-
}
|
124
|
-
});
|