solidus_starter_frontend 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +57 -0
- data/.erb-lint.yml +22 -0
- data/.eslintrc +5 -0
- data/.gem_release.yml +5 -0
- data/.github/pull_request_template.md +28 -0
- data/.github/stale.yml +17 -0
- data/.gitignore +17 -0
- data/.hound.yml +16 -0
- data/.rspec +2 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +229 -0
- data/.scss-lint.yml +4 -0
- data/Gemfile +34 -0
- data/LICENSE +26 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/app/assets/config/solidus_starter_frontend_manifest.js +2 -0
- data/app/assets/javascripts/spree/frontend.js +6 -0
- data/app/assets/javascripts/spree/frontend/cart.js +26 -0
- data/app/assets/javascripts/spree/frontend/checkout.js +34 -0
- data/app/assets/javascripts/spree/frontend/checkout/address.js +124 -0
- data/app/assets/javascripts/spree/frontend/checkout/payment.js +44 -0
- data/app/assets/javascripts/spree/frontend/locale_selector.js +9 -0
- data/app/assets/javascripts/spree/frontend/product.js +21 -0
- data/app/assets/javascripts/spree/frontend/solidus_starter_frontend.js +9 -0
- data/app/assets/javascripts/spree/frontend/utils.js.erb +18 -0
- data/app/assets/stylesheets/spree/frontend.css +8 -0
- data/app/assets/stylesheets/spree/frontend/base/_base.scss +29 -0
- data/app/assets/stylesheets/spree/frontend/base/_reset.scss +179 -0
- data/app/assets/stylesheets/spree/frontend/base/_responsive.scss +21 -0
- data/app/assets/stylesheets/spree/frontend/components/account/_account_order.scss +23 -0
- data/app/assets/stylesheets/spree/frontend/components/account/_account_summary.scss +17 -0
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_container.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_form.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/components/brand/_logo.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_inline.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_primary.scss +26 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_adjustments.scss +6 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_amount_row.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_empty.scss +10 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_footer.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_header.scss +12 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_item.scss +86 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_link.scss +22 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_page.scss +15 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_secondary_actions.scss +19 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_coupon_code.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_item_info.scss +19 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_header.scss +19 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_summary.scss +31 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_existing_cards.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_controls.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_selector.scss +14 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_progress_steps.scss +38 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_proposed_shipment.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipment_items.scss +50 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipping_methods.scss +9 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/payments/_gateway_payment_method.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_address_step.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_confirm_step.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_delivery_step.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_payment_step.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/_address_inputs.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_checkbox_input.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_radio_input.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_select_input.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_text.scss +32 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_textarea_input.scss +25 -0
- data/app/assets/stylesheets/spree/frontend/components/general/_flash.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_aside.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_breadcrumbs.scss +16 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_category_navigation.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_footer.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_header.scss +12 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_horizontal_input_group.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_top_bar.scss +44 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_auth_link.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_categories.scss +29 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_locale_selector.scss +21 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomies.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomy.scss +28 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_address_overview.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_coupon_codes.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_line_items.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_details.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_item.scss +85 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_page.scss +41 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_shipments.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_payment_info.scss +29 -0
- data/app/assets/stylesheets/spree/frontend/components/presentation/_hero.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_card.scss +35 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_image.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_info.scss +14 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_page.scss +31 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_properties.scss +23 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_submit.scss +9 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_taxons.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_thumbnails.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_variants.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_products.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_products_by_taxon.scss +6 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_products_grid.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/search/_filter.scss +32 -0
- data/app/assets/stylesheets/spree/frontend/components/search/_search_bar.scss +34 -0
- data/app/assets/stylesheets/spree/frontend/components/typography/_hero_title.scss +6 -0
- data/app/assets/stylesheets/spree/frontend/components/typography/_subtitle.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/placeholders/main.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/screen.scss +89 -0
- data/app/assets/stylesheets/spree/frontend/solidus_starter_frontend.css +7 -0
- data/app/assets/stylesheets/spree/frontend/variables/_colors.scss +20 -0
- data/app/controllers/concerns/solidus_starter_frontend/auth_views.rb +16 -0
- data/app/controllers/concerns/solidus_starter_frontend/taxonomies.rb +16 -0
- data/app/controllers/spree/checkout_controller.rb +249 -0
- data/app/controllers/spree/coupon_codes_controller.rb +35 -0
- data/app/controllers/spree/home_controller.rb +13 -0
- data/app/controllers/spree/locale_controller.rb +20 -0
- data/app/controllers/spree/orders_controller.rb +126 -0
- data/app/controllers/spree/products_controller.rb +51 -0
- data/app/controllers/spree/store_controller.rb +31 -0
- data/app/controllers/spree/taxons_controller.rb +30 -0
- data/app/helpers/spree/orders_helper.rb +18 -0
- data/app/helpers/spree/taxon_filters_helper.rb +13 -0
- data/app/views/spree/address/_form_hidden.html.erb +12 -0
- data/app/views/spree/checkout/_terms_and_conditions.en.html.erb +1 -0
- data/app/views/spree/checkout/edit.html.erb +16 -0
- data/app/views/spree/checkout/existing_payment/_gateway.html.erb +9 -0
- data/app/views/spree/checkout/payment/_check.html.erb +0 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +43 -0
- data/app/views/spree/components/auth/_change_form.html.erb +40 -0
- data/app/views/spree/components/auth/_forgot_form.html.erb +28 -0
- data/app/views/spree/components/auth/_guest_form.html.erb +31 -0
- data/app/views/spree/components/auth/_login_form.html.erb +42 -0
- data/app/views/spree/components/auth/_signup_form.html.erb +48 -0
- data/app/views/spree/components/brand/_logo.html.erb +3 -0
- data/app/views/spree/components/buttons/_button_inline.html.erb +23 -0
- data/app/views/spree/components/buttons/_button_primary.html.erb +29 -0
- data/app/views/spree/components/cart/_cart_adjustment.html.erb +15 -0
- data/app/views/spree/components/cart/_cart_adjustments.html.erb +47 -0
- data/app/views/spree/components/cart/_cart_amount_row.html.erb +12 -0
- data/app/views/spree/components/cart/_cart_empty.html.erb +9 -0
- data/app/views/spree/components/cart/_cart_footer.html.erb +15 -0
- data/app/views/spree/components/cart/_cart_header.html.erb +17 -0
- data/app/views/spree/components/cart/_cart_item.html.erb +52 -0
- data/app/views/spree/components/cart/_cart_items.html.erb +23 -0
- data/app/views/spree/components/cart/_cart_link.html.erb +9 -0
- data/app/views/spree/components/cart/_cart_secondary_actions.html.erb +17 -0
- data/app/views/spree/components/cart/_item_info.html.erb +26 -0
- data/app/views/spree/components/checkout/_checkout_header.html.erb +8 -0
- data/app/views/spree/components/checkout/_checkout_step.html.erb +21 -0
- data/app/views/spree/components/checkout/_checkout_summary.html.erb +70 -0
- data/app/views/spree/components/checkout/_existing_cards.html.erb +39 -0
- data/app/views/spree/components/checkout/_payment_method_controls.html.erb +10 -0
- data/app/views/spree/components/checkout/_payment_method_selector.html.erb +14 -0
- data/app/views/spree/components/checkout/_proposed_shipment.erb +18 -0
- data/app/views/spree/components/checkout/_shipment_items.html.erb +22 -0
- data/app/views/spree/components/checkout/_shipping_methods.html.erb +20 -0
- data/app/views/spree/components/checkout/_unshippable_items.html.erb +7 -0
- data/app/views/spree/components/checkout/steps/_address_step.html.erb +60 -0
- data/app/views/spree/components/checkout/steps/_confirm_step.html.erb +31 -0
- data/app/views/spree/components/checkout/steps/_delivery_step.html.erb +31 -0
- data/app/views/spree/components/checkout/steps/_payment_step.html.erb +25 -0
- data/app/views/spree/components/forms/_address_inputs.html.erb +152 -0
- data/app/views/spree/components/forms/inputs/_checkbox_input.html.erb +29 -0
- data/app/views/spree/components/forms/inputs/_collection_select.html.erb +42 -0
- data/app/views/spree/components/forms/inputs/_radio_input.html.erb +29 -0
- data/app/views/spree/components/forms/inputs/_select_input.html.erb +31 -0
- data/app/views/spree/components/forms/inputs/_text.html.erb +54 -0
- data/app/views/spree/components/forms/inputs/_textarea_input.html.erb +42 -0
- data/app/views/spree/components/layout/_category_navigation.html.erb +3 -0
- data/app/views/spree/components/layout/_footer.html.erb +7 -0
- data/app/views/spree/components/layout/_header.html.erb +8 -0
- data/app/views/spree/components/layout/_top_bar.html.erb +8 -0
- data/app/views/spree/components/navigation/_auth_link.html.erb +1 -0
- data/app/views/spree/components/navigation/_breadcrumbs.html.erb +47 -0
- data/app/views/spree/components/navigation/_categories.html.erb +12 -0
- data/app/views/spree/components/navigation/_locale_selector.html.erb +25 -0
- data/app/views/spree/components/navigation/_taxonomies.html.erb +17 -0
- data/app/views/spree/components/navigation/_taxons.html.erb +17 -0
- data/app/views/spree/components/navigation/_taxons_tree.html.erb +29 -0
- data/app/views/spree/components/orders/_address_overview.html.erb +40 -0
- data/app/views/spree/components/orders/_coupon_code.html.erb +22 -0
- data/app/views/spree/components/orders/_line_items.html.erb +55 -0
- data/app/views/spree/components/orders/_order_details.html.erb +35 -0
- data/app/views/spree/components/orders/_order_item.html.erb +33 -0
- data/app/views/spree/components/orders/_order_items.html.erb +5 -0
- data/app/views/spree/components/orders/_order_shipments.html.erb +25 -0
- data/app/views/spree/components/orders/_payment_info.html.erb +31 -0
- data/app/views/spree/components/presentation/_hero.html.erb +14 -0
- data/app/views/spree/components/products/_product-card.html.erb +36 -0
- data/app/views/spree/components/products/_product_availability.html.erb +19 -0
- data/app/views/spree/components/products/_product_form.html.erb +21 -0
- data/app/views/spree/components/products/_product_image.html.erb +6 -0
- data/app/views/spree/components/products/_product_info.html.erb +9 -0
- data/app/views/spree/components/products/_product_promotions.html.erb +25 -0
- data/app/views/spree/components/products/_product_properties.html.erb +19 -0
- data/app/views/spree/components/products/_product_submit.html.erb +39 -0
- data/app/views/spree/components/products/_product_taxons.html.erb +15 -0
- data/app/views/spree/components/products/_product_thumbnails.html.erb +19 -0
- data/app/views/spree/components/products/_product_variants.html.erb +36 -0
- data/app/views/spree/components/products/_products-grid.html.erb +13 -0
- data/app/views/spree/components/products/_products.html.erb +28 -0
- data/app/views/spree/components/products/_products_by_taxon.html.erb +7 -0
- data/app/views/spree/components/products/_variants_list.html.erb +12 -0
- data/app/views/spree/components/search/_filter.html.erb +42 -0
- data/app/views/spree/components/search/_filters.html.erb +20 -0
- data/app/views/spree/components/search/_form.html.erb +12 -0
- data/app/views/spree/components/search/_products_search.html.erb +36 -0
- data/app/views/spree/components/search/_search_bar.html.erb +36 -0
- data/app/views/spree/components/typography/_hero_title.html.erb +11 -0
- data/app/views/spree/components/typography/_subtitle.html.erb +11 -0
- data/app/views/spree/home/index.html.erb +7 -0
- data/app/views/spree/layouts/spree_application.html.erb +27 -0
- data/app/views/spree/orders/edit.html.erb +21 -0
- data/app/views/spree/orders/show.html.erb +29 -0
- data/app/views/spree/products/index.html.erb +22 -0
- data/app/views/spree/products/show.html.erb +18 -0
- data/app/views/spree/shared/_image.html.erb +12 -0
- data/app/views/spree/shared/_link_to_cart.html.erb +1 -0
- data/app/views/spree/shared/_login_bar_items.html.erb +1 -0
- data/app/views/spree/shared/_shipment_tracking.html.erb +11 -0
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
- data/app/views/spree/taxons/show.html.erb +17 -0
- data/bin/console +17 -0
- data/bin/r +13 -0
- data/bin/rails +7 -0
- data/bin/rake +7 -0
- data/bin/rspec +29 -0
- data/bin/sandbox +84 -0
- data/bin/sandbox_rails +18 -0
- data/bin/setup +8 -0
- data/bin/solidus_compare +155 -0
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/canonical_rails.rb +16 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +33 -0
- data/config/solidus_compare.yml +33 -0
- data/docs/development.md +28 -0
- data/exe/solidus_starter_frontend +9 -0
- data/lib/generators/solidus_starter_frontend/install/install_generator.rb +15 -0
- data/lib/generators/solidus_starter_frontend/solidus_starter_frontend_generator.rb +30 -0
- data/lib/generators/solidus_starter_frontend/views/override_generator.rb +50 -0
- data/lib/solidus_starter_frontend.rb +12 -0
- data/lib/solidus_starter_frontend/config.rb +7 -0
- data/lib/solidus_starter_frontend/engine.rb +34 -0
- data/lib/solidus_starter_frontend/factories.rb +4 -0
- data/lib/solidus_starter_frontend/solidus_support_extensions.rb +9 -0
- data/lib/solidus_starter_frontend/version.rb +5 -0
- data/lib/solidus_starter_frontend_configuration.rb +8 -0
- data/lib/views/auth/spree/checkout/registration.html.erb +7 -0
- data/lib/views/auth/spree/components/navigation/_auth_link.html.erb +5 -0
- data/lib/views/auth/spree/user_passwords/edit.html.erb +7 -0
- data/lib/views/auth/spree/user_passwords/new.html.erb +5 -0
- data/lib/views/auth/spree/user_registrations/new.html.erb +7 -0
- data/lib/views/auth/spree/user_sessions/guest.html.erb +5 -0
- data/lib/views/auth/spree/user_sessions/new.html.erb +7 -0
- data/lib/views/auth/spree/users/edit.html.erb +45 -0
- data/lib/views/auth/spree/users/show.html.erb +55 -0
- data/solidus_starter_frontend.gemspec +43 -0
- data/spec/controllers/controller_helpers_spec.rb +29 -0
- data/spec/controllers/locale_controller_spec.rb +57 -0
- data/spec/controllers/spree/checkout_controller_spec.rb +563 -0
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +37 -0
- data/spec/controllers/spree/current_order_tracking_spec.rb +33 -0
- data/spec/controllers/spree/home_controller_spec.rb +29 -0
- data/spec/controllers/spree/orders_controller_ability_spec.rb +90 -0
- data/spec/controllers/spree/orders_controller_spec.rb +241 -0
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +33 -0
- data/spec/controllers/spree/products_controller_spec.rb +38 -0
- data/spec/controllers/spree/taxons_controller_spec.rb +14 -0
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/generators/solidus/views/override_generator_spec.rb +50 -0
- data/spec/helpers/base_helper_spec.rb +13 -0
- data/spec/helpers/order_helper_spec.rb +14 -0
- data/spec/helpers/taxon_filters_helper_spec.rb +12 -0
- data/spec/spec_helper.rb +64 -0
- data/spec/support/shared_contexts/checkout_setup.rb +12 -0
- data/spec/support/shared_contexts/custom_products.rb +28 -0
- data/spec/support/shared_contexts/locales.rb +16 -0
- data/spec/system/address_spec.rb +87 -0
- data/spec/system/automatic_promotion_adjustments_spec.rb +49 -0
- data/spec/system/caching/products_spec.rb +48 -0
- data/spec/system/caching/taxons_spec.rb +35 -0
- data/spec/system/cart_spec.rb +81 -0
- data/spec/system/checkout_confirm_insufficient_stock_spec.rb +71 -0
- data/spec/system/checkout_spec.rb +699 -0
- data/spec/system/checkout_unshippable_spec.rb +37 -0
- data/spec/system/coupon_code_spec.rb +267 -0
- data/spec/system/currency_spec.rb +20 -0
- data/spec/system/first_order_promotion_spec.rb +59 -0
- data/spec/system/free_shipping_promotions_spec.rb +60 -0
- data/spec/system/locale_spec.rb +26 -0
- data/spec/system/order_spec.rb +57 -0
- data/spec/system/products_spec.rb +302 -0
- data/spec/system/promotion_code_invalidation_spec.rb +54 -0
- data/spec/system/quantity_promotions_spec.rb +130 -0
- data/spec/system/taxons_spec.rb +158 -0
- data/spec/system/template_rendering_spec.rb +20 -0
- data/spec/views/spree/checkout/_summary_spec.rb +11 -0
- metadata +542 -0
data/Gemfile
ADDED
@@ -0,0 +1,34 @@
|
|
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
ADDED
@@ -0,0 +1,26 @@
|
|
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
ADDED
@@ -0,0 +1,69 @@
|
|
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
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
/* Solidus Dummy app generator creates a vendor manifest in vendor/assets/javascripts/frontend/all
|
2
|
+
that requires this file: spree/frontend.
|
3
|
+
Inside solidus_starter_frontend we don't need anything from spree/frontend,
|
4
|
+
but the file must be there for the dummy application that expects it.
|
5
|
+
This approach is in order to don't have to make changes in the solidus_core
|
6
|
+
dummy app generator in the process of developing this extension. */
|
@@ -0,0 +1,26 @@
|
|
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
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
//= require_self
|
2
|
+
//= require spree/frontend/checkout/address
|
3
|
+
//= require spree/frontend/checkout/payment
|
4
|
+
|
5
|
+
Solidus.disableSaveOnClick = () => {
|
6
|
+
const form = document.querySelector('form.edit_order');
|
7
|
+
form.addEventListener('submit', () => {
|
8
|
+
const elements = form.querySelectorAll('[type="submit"], [type="image"]');
|
9
|
+
elements.forEach(element => {
|
10
|
+
element.setAttribute('disabled', true);
|
11
|
+
element.classList.remove('primary');
|
12
|
+
element.classList.add('disabled');
|
13
|
+
});
|
14
|
+
});
|
15
|
+
};
|
16
|
+
|
17
|
+
window.addEventListener('DOMContentLoaded', () => {
|
18
|
+
const termsCheckbox = document.getElementById('accept_terms_and_conditions');
|
19
|
+
|
20
|
+
if (termsCheckbox) {
|
21
|
+
termsCheckbox.addEventListener('change', () => {
|
22
|
+
const submitButton = termsCheckbox.closest('form')
|
23
|
+
.querySelector('[type="submit"]');
|
24
|
+
|
25
|
+
if (termsCheckbox.checked) {
|
26
|
+
submitButton.removeAttribute('disabled');
|
27
|
+
submitButton.classList.remove('disabled');
|
28
|
+
} else {
|
29
|
+
submitButton.setAttribute('disabled', true);
|
30
|
+
submitButton.classList.add('disabled');
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
});
|
@@ -0,0 +1,124 @@
|
|
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
|
+
});
|
@@ -0,0 +1,44 @@
|
|
1
|
+
window.addEventListener('DOMContentLoaded', () => {
|
2
|
+
const form = document.querySelector('#checkout_form_payment');
|
3
|
+
const existingCards = document.querySelector('#existing_cards');
|
4
|
+
|
5
|
+
if (form) {
|
6
|
+
if (existingCards) {
|
7
|
+
const paymentMethodControls = document.querySelector('.payment-method-controls');
|
8
|
+
const useExistingCardYes = document.querySelector('#use_existing_card_yes');
|
9
|
+
const useExistingCardNo = document.querySelector('#use_existing_card_no');
|
10
|
+
const existingCcRadios = document.querySelectorAll('.existing-cc-radio');
|
11
|
+
|
12
|
+
paymentMethodControls.style.display = 'none';
|
13
|
+
|
14
|
+
useExistingCardYes.addEventListener('click', () => {
|
15
|
+
paymentMethodControls.style.display = 'none';
|
16
|
+
existingCcRadios.forEach(radio => radio.removeAttribute('disabled'));
|
17
|
+
});
|
18
|
+
|
19
|
+
useExistingCardNo.addEventListener('click', () => {
|
20
|
+
paymentMethodControls.style.display = 'block';
|
21
|
+
existingCcRadios.forEach(radio => radio.setAttribute('disabled', true));
|
22
|
+
});
|
23
|
+
}
|
24
|
+
|
25
|
+
const selectors = document
|
26
|
+
.querySelectorAll('input[type="radio"][name="order[payments_attributes][][payment_method_id]"]');
|
27
|
+
|
28
|
+
selectors.forEach(selector => {
|
29
|
+
selector.addEventListener('click', () => {
|
30
|
+
const controls = document.querySelectorAll('.payment-method-controls li');
|
31
|
+
controls.forEach(control => control.style.display = 'none');
|
32
|
+
|
33
|
+
if (selector.checked) {
|
34
|
+
const selectedControl = document.querySelector(`#payment_method_${selector.value}`);
|
35
|
+
selectedControl.style.display = 'block';
|
36
|
+
}
|
37
|
+
});
|
38
|
+
});
|
39
|
+
|
40
|
+
// Activate already checked payment method if form is re-rendered
|
41
|
+
// i.e. if user enters invalid data
|
42
|
+
document.querySelector('input[type="radio"]:checked').click();
|
43
|
+
}
|
44
|
+
});
|
@@ -0,0 +1,21 @@
|
|
1
|
+
window.addEventListener('DOMContentLoaded', () => {
|
2
|
+
function updateVariantPrice(variant) {
|
3
|
+
const variantPrice = variant.dataset.price;
|
4
|
+
if (variantPrice) {
|
5
|
+
document.querySelector('.price.selling').innerHTML = variantPrice;
|
6
|
+
}
|
7
|
+
};
|
8
|
+
|
9
|
+
const radios = document.querySelectorAll('#product-variants input[type="radio"]');
|
10
|
+
|
11
|
+
if (radios.length > 0) {
|
12
|
+
const selectedRadio = document
|
13
|
+
.querySelector('#product-variants input[type="radio"][checked="checked"]');
|
14
|
+
|
15
|
+
updateVariantPrice(selectedRadio);
|
16
|
+
}
|
17
|
+
|
18
|
+
radios.forEach(radio => {
|
19
|
+
radio.addEventListener('click', () => updateVariantPrice(radio));
|
20
|
+
});
|
21
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// Placeholder manifest file.
|
2
|
+
// the installer will append this file to the app vendored assets here: vendor/assets/javascripts/spree/frontend/all.js'
|
3
|
+
|
4
|
+
//= require spree
|
5
|
+
//= require spree/frontend/utils
|
6
|
+
//= require spree/frontend/checkout
|
7
|
+
//= require spree/frontend/product
|
8
|
+
//= require spree/frontend/cart
|
9
|
+
//= require spree/frontend/locale_selector
|
@@ -0,0 +1,18 @@
|
|
1
|
+
window.Solidus = {};
|
2
|
+
|
3
|
+
Solidus.mountedAt = () => {
|
4
|
+
return '<%= Rails.application.routes.url_helpers.spree_path(trailing_slash: true) %>';
|
5
|
+
};
|
6
|
+
|
7
|
+
Solidus.pathFor = (path) => {
|
8
|
+
const hostname = window.location.hostname;
|
9
|
+
const protocol = window.location.protocol;
|
10
|
+
const port = window.location.port;
|
11
|
+
const locationOrigin = protocol + '//' + hostname + (port ? ':' + port : '');
|
12
|
+
return locationOrigin + Solidus.mountedAt() + path;
|
13
|
+
};
|
14
|
+
|
15
|
+
Solidus.routes = {
|
16
|
+
states_search: Solidus.pathFor('api/states'),
|
17
|
+
apply_coupon_code: (order_id) => Solidus.pathFor('api/orders/' + order_id + '/coupon_codes')
|
18
|
+
};
|