diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9d3b96e3d..9db15bd21 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -17,6 +17,9 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception, unless: -> { api_request? } + # @see https://til.hashrocket.com/posts/3exmhtwqy6-setting-the-urloptions-hash-in-the-controller + include ActiveStorage::SetCurrent + # Referenced in application layout to display page title # Override on a per-controller basis to display different title # @return [String] diff --git a/app/furniture/marketplace/cart_products/_cart_product.html.erb b/app/furniture/marketplace/cart_products/_cart_product.html.erb index ad0b7c30b..7cbdacc56 100644 --- a/app/furniture/marketplace/cart_products/_cart_product.html.erb +++ b/app/furniture/marketplace/cart_products/_cart_product.html.erb @@ -1,8 +1,19 @@ <%- product = cart_product.product %> <%- cart = cart_product.cart %> - + - <%= product.name %> + <%- if product.photo.present? %> +
+ <%= image_tag product.photo.variant(resize_to_limit: [550, 550]).processed.url, class: "rounded-lg" + %> +
+ <%=product.name%> +
+
+ <%- else %> + <%= product.name %> + <%- end %> +
<%= product.class.human_attribute_name(:price) %>
<%= humanized_money_with_symbol(product.price) %>
@@ -17,17 +28,19 @@ <%= humanized_money_with_symbol(product.price) %> - - <%# TODO: Extract minus and plus buttons into components %> - <%- minus_quantity = [cart_product.quantity - 1, 0].max %> - <%- minus_method = minus_quantity.zero? ? :delete : :put %> - <%= render "buttons/minus", disabled: cart_product.quantity.zero?, method: minus_method, title: t('.remove'), disabled: cart_product.quantity.zero?, href: [cart.space, cart.room, cart.marketplace, cart, cart_product, { cart_product: { quantity: minus_quantity, product_id: product.id} }] %> + +
+ <%# TODO: Extract minus and plus buttons into components %> + <%- minus_quantity = [cart_product.quantity - 1, 0].max %> + <%- minus_method = minus_quantity.zero? ? :delete : :put %> + <%= render "buttons/minus", disabled: cart_product.quantity.zero?, method: minus_method, title: t('.remove'), disabled: cart_product.quantity.zero?, href: [cart.space, cart.room, cart.marketplace, cart, cart_product, { cart_product: { quantity: minus_quantity, product_id: product.id} }] %> - <%= cart_product.quantity %> + <%= cart_product.quantity %> - <%- add_quantity = cart_product.quantity + 1 %> - <%- add_method = add_quantity == 1 ? :post : :put %> - <%= render "buttons/plus", method: add_method, title: t('.add'), href: [cart.space, cart.room, cart.marketplace, cart, cart_product, { cart_product: {quantity: add_quantity, product_id: product.id} }] %> + <%- add_quantity = cart_product.quantity + 1 %> + <%- add_method = add_quantity == 1 ? :post : :put %> + <%= render "buttons/plus", method: add_method, title: t('.add'), href: [cart.space, cart.room, cart.marketplace, cart, cart_product, { cart_product: {quantity: add_quantity, product_id: product.id} }] %> +