mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Add product detail to the modal
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
module Admin
|
||||
class ProductPreviewController < Spree::Admin::BaseController
|
||||
def show
|
||||
@id = params[:id]
|
||||
# TODO load product data based on param
|
||||
@product = Spree::Product.find(params[:id])
|
||||
|
||||
respond_with do |format|
|
||||
format.turbo_stream {
|
||||
render "admin/products_v3/product_preview", status: :ok, locals: { id: @id }
|
||||
render "admin/products_v3/product_preview", status: :ok
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,38 @@
|
||||
= turbo_stream.replace "product-preview" do
|
||||
#product-preview
|
||||
This is where the product preview will be, id:
|
||||
= @id
|
||||
.row
|
||||
.columns.small-12.medium-6.large-6.product-header
|
||||
%h3
|
||||
= @product.name
|
||||
%span
|
||||
%em
|
||||
= t("products_from")
|
||||
%span
|
||||
= @product.variants.first.supplier.name
|
||||
|
||||
%br-
|
||||
|
||||
.filter-shopfront.property-selectors.inline-block
|
||||
%ul
|
||||
- @product.properties_including_inherited.each do |property|
|
||||
%li
|
||||
%span
|
||||
- if property[:value].present?
|
||||
= render partial: "admin/shared/tooltip", locals: { tooltip_text: property[:value], link_text: property[:name], placement: "bottom" }
|
||||
- else
|
||||
%a
|
||||
= property[:name]
|
||||
|
||||
|
||||
- if @product.description
|
||||
.product-description
|
||||
- # TODO description not wrapped properly
|
||||
%p.text-small{ 'data-controller': "add-blank-to-link" }
|
||||
- # description is sanitized in Spree::Product#description method
|
||||
= @product.description.html_safe
|
||||
|
||||
.columns.small-12.medium-6.large-6.product-img
|
||||
- if @product.image
|
||||
%img{ src: @product.image.url(:large) }
|
||||
-else
|
||||
%img.placeholder{ src: Spree::Image.default_image_url(:large) }
|
||||
|
||||
Reference in New Issue
Block a user