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
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
class ProductsController < Spree::StoreController
|
5
|
+
before_action :load_product, only: :show
|
6
|
+
before_action :load_taxon, only: :index
|
7
|
+
|
8
|
+
helper 'spree/taxons', 'spree/taxon_filters'
|
9
|
+
|
10
|
+
respond_to :html
|
11
|
+
|
12
|
+
def index
|
13
|
+
@searcher = build_searcher(params.merge(include_images: true))
|
14
|
+
@products = @searcher.retrieve_products
|
15
|
+
end
|
16
|
+
|
17
|
+
def show
|
18
|
+
@variants = @product.
|
19
|
+
variants_including_master.
|
20
|
+
display_includes.
|
21
|
+
with_prices(current_pricing_options).
|
22
|
+
includes([:option_values, :images])
|
23
|
+
|
24
|
+
@product_properties = @product.product_properties.includes(:property)
|
25
|
+
@taxon = Spree::Taxon.find(params[:taxon_id]) if params[:taxon_id]
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def accurate_title
|
31
|
+
if @product
|
32
|
+
@product.meta_title.blank? ? @product.name : @product.meta_title
|
33
|
+
else
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def load_product
|
39
|
+
if try_spree_current_user.try(:has_spree_role?, "admin")
|
40
|
+
@products = Spree::Product.with_discarded
|
41
|
+
else
|
42
|
+
@products = Spree::Product.available
|
43
|
+
end
|
44
|
+
@product = @products.friendly.find(params[:id])
|
45
|
+
end
|
46
|
+
|
47
|
+
def load_taxon
|
48
|
+
@taxon = Spree::Taxon.find(params[:taxon]) if params[:taxon].present?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
class StoreController < Spree::BaseController
|
5
|
+
include Spree::Core::ControllerHelpers::Pricing
|
6
|
+
include Spree::Core::ControllerHelpers::Order
|
7
|
+
include SolidusStarterFrontend::Taxonomies
|
8
|
+
|
9
|
+
def unauthorized
|
10
|
+
render 'spree/shared/unauthorized', layout: Spree::Config[:layout], status: 401
|
11
|
+
end
|
12
|
+
|
13
|
+
def cart_link
|
14
|
+
render partial: 'spree/shared/link_to_cart'
|
15
|
+
fresh_when(current_order, template: 'spree/shared/_link_to_cart')
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def config_locale
|
21
|
+
SolidusStarterFrontend::Config[:locale]
|
22
|
+
end
|
23
|
+
|
24
|
+
def lock_order
|
25
|
+
Spree::OrderMutex.with_lock!(@order) { yield }
|
26
|
+
rescue Spree::OrderMutex::LockFailed
|
27
|
+
flash[:error] = t('spree.order_mutex_error')
|
28
|
+
redirect_to spree.cart_path
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
class TaxonsController < Spree::StoreController
|
5
|
+
helper 'spree/products', 'spree/taxon_filters'
|
6
|
+
|
7
|
+
before_action :load_taxon, only: [:show]
|
8
|
+
|
9
|
+
respond_to :html
|
10
|
+
|
11
|
+
def show
|
12
|
+
@searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true))
|
13
|
+
@products = @searcher.retrieve_products
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def load_taxon
|
19
|
+
@taxon = Spree::Taxon.find_by!(permalink: params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
def accurate_title
|
23
|
+
if @taxon
|
24
|
+
@taxon.seo_title
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'truncate_html'
|
4
|
+
require 'app/helpers/truncate_html_helper'
|
5
|
+
|
6
|
+
module Spree
|
7
|
+
module OrdersHelper
|
8
|
+
include TruncateHtmlHelper
|
9
|
+
|
10
|
+
def truncated_product_description(product)
|
11
|
+
truncate_html(raw(product.description))
|
12
|
+
end
|
13
|
+
|
14
|
+
def order_just_completed?(order)
|
15
|
+
flash[:order_completed] && order.present?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spree/core/product_filters'
|
4
|
+
|
5
|
+
module Spree
|
6
|
+
module TaxonFiltersHelper
|
7
|
+
def applicable_filters_for(_taxon)
|
8
|
+
[:brand_filter, :price_filter].map do |filter_name|
|
9
|
+
Spree::Core::ProductFilters.send(filter_name) if Spree::Core::ProductFilters.respond_to?(filter_name)
|
10
|
+
end.compact
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= form.hidden_field :firstname %>
|
2
|
+
<%= form.hidden_field :lastname %>
|
3
|
+
<%= form.hidden_field :company %>
|
4
|
+
<%= form.hidden_field :address1 %>
|
5
|
+
<%= form.hidden_field :address2 %>
|
6
|
+
<%= form.hidden_field :city %>
|
7
|
+
<%= form.hidden_field :country_id %>
|
8
|
+
<%= form.hidden_field :state_id %>
|
9
|
+
<%= form.hidden_field :state_name %>
|
10
|
+
<%= form.hidden_field :zipcode %>
|
11
|
+
<%= form.hidden_field :phone %>
|
12
|
+
<%= form.hidden_field :alternative_phone %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Put your terms and conditions here</p>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<article class="checkout">
|
2
|
+
<%= render "spree/shared/error_messages", target: @order %>
|
3
|
+
<%= render "spree/components/checkout/checkout_header" %>
|
4
|
+
|
5
|
+
<div class="checkout__main">
|
6
|
+
<section class="checkout__step">
|
7
|
+
<%= render "spree/components/checkout/checkout_step" %>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<% if @order.state != "confirm" %>
|
11
|
+
<div class="checkout__summary">
|
12
|
+
<%= render "spree/components/checkout/checkout_summary", order: @order %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</article>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<tr id="<%= dom_id(wallet_payment_source, 'spree')%>">
|
2
|
+
<td><%= wallet_payment_source.payment_source.name %></td>
|
3
|
+
<td><%= wallet_payment_source.payment_source.display_number %></td>
|
4
|
+
<td><%= wallet_payment_source.payment_source.month %></td>
|
5
|
+
<td><%= wallet_payment_source.payment_source.year %></td>
|
6
|
+
<td>
|
7
|
+
<%= radio_button_tag "order[wallet_payment_source_id]", wallet_payment_source.id, default, class: "existing-cc-radio" %>
|
8
|
+
</td>
|
9
|
+
</tr>
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="gateway-payment-method">
|
2
|
+
<% param_prefix = "payment_source[#{payment_method.id}]" %>
|
3
|
+
|
4
|
+
<%= render(
|
5
|
+
"spree/components/forms/inputs/text",
|
6
|
+
autocomplete: "cc-name",
|
7
|
+
id: "name_on_card_#{payment_method.id}",
|
8
|
+
label: t('spree.name_on_card'),
|
9
|
+
name: "#{param_prefix}[name]",
|
10
|
+
value: @order.try(:billing_name) || "#{@order.billing_firstname} #{@order.billing_lastname}"
|
11
|
+
) %>
|
12
|
+
|
13
|
+
<%= render(
|
14
|
+
"spree/components/forms/inputs/text",
|
15
|
+
autocomplete: "cc-number",
|
16
|
+
id: "card_number_#{payment_method.id}",
|
17
|
+
label: t('spree.card_number'),
|
18
|
+
name: "#{param_prefix}[number]"
|
19
|
+
) %>
|
20
|
+
|
21
|
+
<%= render(
|
22
|
+
"spree/components/forms/inputs/text",
|
23
|
+
id: "card_expiry_#{payment_method.id}",
|
24
|
+
label: t('spree.expiration'),
|
25
|
+
name: "#{param_prefix}[expiry]",
|
26
|
+
placeholder: "MM / YY"
|
27
|
+
) %>
|
28
|
+
|
29
|
+
<%= render(
|
30
|
+
"spree/components/forms/inputs/text",
|
31
|
+
id: "card_code_#{payment_method.id}",
|
32
|
+
label: t('spree.card_code'),
|
33
|
+
name: "#{param_prefix}[verification_value]"
|
34
|
+
) %>
|
35
|
+
|
36
|
+
<% if @order.bill_address %>
|
37
|
+
<%= fields_for "#{param_prefix}[address_attributes]", @order.bill_address do |f| %>
|
38
|
+
<%= render partial: 'spree/address/form_hidden', locals: { form: f } %>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<%= hidden_field_tag "#{param_prefix}[cc_type]", '', id: "cc_type", class: 'ccType' %>
|
43
|
+
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
html = { class: "auth-form" }
|
3
|
+
url = spree.update_password_path
|
4
|
+
%>
|
5
|
+
|
6
|
+
<%= form_for @spree_user, as: :spree_user, url: url, method: :put, html: html do |f| %>
|
7
|
+
<div class="auth-form__input-wrapper">
|
8
|
+
<%= render(
|
9
|
+
"spree/components/forms/inputs/text",
|
10
|
+
id: :spree_user_password,
|
11
|
+
label: I18n.t("spree.password"),
|
12
|
+
name: "spree_user[password]",
|
13
|
+
placeholder: "p455w0rd",
|
14
|
+
type: :password
|
15
|
+
) %>
|
16
|
+
</div>
|
17
|
+
<div class="auth-form__input-wrapper">
|
18
|
+
<%= render(
|
19
|
+
"spree/components/forms/inputs/text",
|
20
|
+
id: :spree_user_password_confirmation,
|
21
|
+
label: I18n.t("spree.confirm_password"),
|
22
|
+
name: "spree_user[password_confirmation]",
|
23
|
+
placeholder: "p455w0rd",
|
24
|
+
type: :password
|
25
|
+
) %>
|
26
|
+
</div>
|
27
|
+
<div class="auth-form__input-wrapper">
|
28
|
+
<%= render(
|
29
|
+
"spree/components/buttons/button_primary",
|
30
|
+
content: I18n.t("spree.update"),
|
31
|
+
full_width: true,
|
32
|
+
name: :commit,
|
33
|
+
type: :submit
|
34
|
+
) %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<%= f.hidden_field :reset_password_token %>
|
38
|
+
|
39
|
+
<%= I18n.t("spree.or") %> <%= link_to I18n.t("spree.create_a_new_account"), spree.signup_path %>
|
40
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%
|
2
|
+
html = { class: "auth-form" }
|
3
|
+
url = spree.reset_password_path
|
4
|
+
%>
|
5
|
+
|
6
|
+
<%= form_for Spree::User.new, as: :spree_user, url: url, html: html do |f| %>
|
7
|
+
<div class="auth-form__input-wrapper">
|
8
|
+
<%= render(
|
9
|
+
"spree/components/forms/inputs/text",
|
10
|
+
id: :spree_user_email,
|
11
|
+
label: I18n.t("spree.email"),
|
12
|
+
name: 'spree_user[email]',
|
13
|
+
placeholder: "name@example.com",
|
14
|
+
type: :email
|
15
|
+
) %>
|
16
|
+
</div>
|
17
|
+
<div class="auth-form__input-wrapper">
|
18
|
+
<%= render(
|
19
|
+
"spree/components/buttons/button_primary",
|
20
|
+
content: I18n.t("spree.reset_password"),
|
21
|
+
full_width: true,
|
22
|
+
name: :commit,
|
23
|
+
type: :submit
|
24
|
+
) %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%= I18n.t("spree.or") %> <%= link_to I18n.t("spree.create_a_new_account"), spree.signup_path %>
|
28
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%
|
2
|
+
html = {
|
3
|
+
class: "auth-form",
|
4
|
+
id: "checkout_form_registration"
|
5
|
+
}
|
6
|
+
url = update_checkout_registration_path
|
7
|
+
%>
|
8
|
+
|
9
|
+
<%= form_for @order, url: url, method: :put, html: html do |f| %>
|
10
|
+
<div class="auth-form__input-wrapper">
|
11
|
+
<%= render(
|
12
|
+
"spree/components/forms/inputs/text",
|
13
|
+
id: :spree_user_email,
|
14
|
+
label: I18n.t("spree.email"),
|
15
|
+
name: 'order[email]',
|
16
|
+
placeholder: "name@example.com",
|
17
|
+
type: :email
|
18
|
+
) %>
|
19
|
+
</div>
|
20
|
+
<div class="auth-form__input-wrapper">
|
21
|
+
<%= render(
|
22
|
+
"spree/components/buttons/button_primary",
|
23
|
+
content: I18n.t("spree.continue"),
|
24
|
+
full_width: true,
|
25
|
+
name: :commit,
|
26
|
+
type: :submit
|
27
|
+
) %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<%= I18n.t("spree.or") %> <%= link_to I18n.t("spree.create_a_new_account"), spree.signup_path %>
|
31
|
+
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%
|
2
|
+
html = { class: "auth-form" }
|
3
|
+
url = spree.create_new_session_path
|
4
|
+
%>
|
5
|
+
|
6
|
+
<%= form_for Spree::User.new, as: :spree_user, url: url, html: html do |f| %>
|
7
|
+
<div class="auth-form__input-wrapper">
|
8
|
+
<%= render(
|
9
|
+
"spree/components/forms/inputs/text",
|
10
|
+
id: :spree_user_email,
|
11
|
+
label: I18n.t("spree.email"),
|
12
|
+
name: 'spree_user[email]',
|
13
|
+
placeholder: "name@example.com",
|
14
|
+
type: :email
|
15
|
+
) %>
|
16
|
+
</div>
|
17
|
+
<div class="auth-form__input-wrapper">
|
18
|
+
<%= render(
|
19
|
+
"spree/components/forms/inputs/text",
|
20
|
+
id: :spree_user_password,
|
21
|
+
label: I18n.t("spree.password"),
|
22
|
+
name: 'spree_user[password]',
|
23
|
+
placeholder: "p455w0rd",
|
24
|
+
type: :password
|
25
|
+
) %>
|
26
|
+
</div>
|
27
|
+
<div class="auth-form__input-wrapper">
|
28
|
+
<%= f.check_box :remember_me, tabindex: 3 %>
|
29
|
+
<%= f.label :remember_me, I18n.t("spree.remember_me") %>
|
30
|
+
</div>
|
31
|
+
<div class="auth-form__input-wrapper">
|
32
|
+
<%= render(
|
33
|
+
"spree/components/buttons/button_primary",
|
34
|
+
content: I18n.t("spree.login"),
|
35
|
+
full_width: true,
|
36
|
+
name: :commit,
|
37
|
+
type: :submit
|
38
|
+
) %>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<%= I18n.t("spree.or") %> <%= link_to I18n.t("spree.create_a_new_account"), spree.signup_path %> | <%= link_to I18n.t("spree.forgot_password"), spree.recover_password_path %>
|
42
|
+
<% end %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<%
|
2
|
+
html = { class: "auth-form" }
|
3
|
+
url = spree.registration_path(resource)
|
4
|
+
%>
|
5
|
+
|
6
|
+
<%= form_for resource, as: :spree_user, url: url, html: html do |f| %>
|
7
|
+
<div class="auth-form__input-wrapper">
|
8
|
+
<%= render(
|
9
|
+
"spree/components/forms/inputs/text",
|
10
|
+
id: :spree_user_email,
|
11
|
+
label: I18n.t("spree.email"),
|
12
|
+
name: 'spree_user[email]',
|
13
|
+
placeholder: "name@example.com",
|
14
|
+
type: :email
|
15
|
+
) %>
|
16
|
+
</div>
|
17
|
+
<div class="auth-form__input-wrapper">
|
18
|
+
<%= render(
|
19
|
+
"spree/components/forms/inputs/text",
|
20
|
+
id: :spree_user_password,
|
21
|
+
label: I18n.t("spree.password"),
|
22
|
+
name: 'spree_user[password]',
|
23
|
+
placeholder: "p455w0rd",
|
24
|
+
type: :password
|
25
|
+
) %>
|
26
|
+
</div>
|
27
|
+
<div class="auth-form__input-wrapper">
|
28
|
+
<%= render(
|
29
|
+
"spree/components/forms/inputs/text",
|
30
|
+
id: :spree_user_password_confirmation,
|
31
|
+
label: I18n.t("spree.confirm_password"),
|
32
|
+
name: 'spree_user[password_confirmation]',
|
33
|
+
placeholder: "p455w0rd",
|
34
|
+
type: :password
|
35
|
+
) %>
|
36
|
+
</div>
|
37
|
+
<div class="auth-form__input-wrapper">
|
38
|
+
<%= render(
|
39
|
+
"spree/components/buttons/button_primary",
|
40
|
+
content: I18n.t("spree.create"),
|
41
|
+
full_width: true,
|
42
|
+
name: :commit,
|
43
|
+
type: :submit
|
44
|
+
) %>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<%= I18n.t("spree.or") %> <%= link_to I18n.t("spree.login_as_existing"), spree.login_path %>
|
48
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%
|
2
|
+
base_class = "button-inline".freeze
|
3
|
+
|
4
|
+
# Optional props
|
5
|
+
disabled = local_assigns.fetch(:disabled, false)
|
6
|
+
id = local_assigns.fetch(:id, false)
|
7
|
+
name = local_assigns.fetch(:name, nil)
|
8
|
+
type = local_assigns.fetch(:type, 'button')
|
9
|
+
|
10
|
+
# Classes
|
11
|
+
class_names = [base_class]
|
12
|
+
class_names = class_names.join(" ")
|
13
|
+
%>
|
14
|
+
|
15
|
+
<%= button_tag(
|
16
|
+
class: class_names,
|
17
|
+
disabled: disabled,
|
18
|
+
id: id,
|
19
|
+
name: name,
|
20
|
+
type: type
|
21
|
+
) do %>
|
22
|
+
<%= content %>
|
23
|
+
<% end %>
|