Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed PDP Waitlist Modal

Damian Legawiec8b5e262f0b65
diff --git a/storefront/app/views/themes/default/spree/page_sections/_product_details.html.erb b/storefront/app/views/themes/default/spree/page_sections/_product_details.html.erb
index 776cc3b83c..4b878fbfd3 100644
--- a/storefront/app/views/themes/default/spree/page_sections/_product_details.html.erb
+++ b/storefront/app/views/themes/default/spree/page_sections/_product_details.html.erb
@@ -64,31 +64,16 @@
<%= render 'spree/products/add_to_cart_button', product: product, selected_variant: @selected_variant, sticky_button_classes: "w-full" %>
<%= render 'spree/products/add_to_wishlist', variant: current_variant, css_classes: 'btn-secondary ml-5 h-12 !py-0 !px-3 border-default', icon_size: 24 %>
</div>
- <%= render 'spree/products/add_to_waitlist', variant: current_variant if show_waitlist_modal %>
<% when 'Spree::PageBlocks::Products::Description' %>
<%= render 'spree/products/description', product: product, block: block, section: section %>
<% when 'Spree::PageBlocks::Metafields' %>
- <div class="st-accordion" data-controller="accordion">
- <% metafields_by_definition = @product.metafields.index_by { |m| m.metafield_definition.id.to_s } %>
- <% block.preferred_metafield_definition_ids.each do |definition_id| %>
- <% metafield = metafields_by_definition[definition_id.to_s] %>
- <% next unless metafield %>
-
- <details class="product-metafield border-b border-default group" id="metafield_<%= metafield.id %>">
- <summary class="text-sm uppercase tracking-widest inline-flex w-full justify-between items-center py-4 cursor-pointer focus:outline-none">
- <span><%= metafield.name %></span>
- <span class="ml-2 transition-transform group-open:rotate-180">
- <%= render 'spree/shared/icons/chevron_down' %>
- </span>
- </summary>
- <%= render "spree/metafields/#{metafield.type.demodulize.underscore}", metafield: metafield %>
- </details>
- <% end %>
- </div>
+ <%= render 'spree/products/metafields', product: product, block: block, section: section %>
<% end %>
</div>
<% end %>
<% end %>
+
+ <%= render 'spree/products/add_to_waitlist', variant: current_variant if show_waitlist_modal %>
</div>
</div>
</div>
diff --git a/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erb b/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erb
index 38c356831b..030e3a328e 100644
--- a/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erb
+++ b/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erb
@@ -3,7 +3,7 @@
data-action="waitlist:created@window->modal#close click->modal#closeBackground keyup@window->modal#closeWithKeyboard"
class="hidden animate-fadeIn fixed inset-0 overflow-y-auto flex items-end md:items-center justify-center z-[9999] h-dvh w-full"
style="animation-duration: 150ms;">
- <div class="w-full lg:w-[600px] relative h-auto lg:max-h-screen flex justify-center flex-col gap-4 bg-background p-5 ">
+ <div class="w-full lg:w-[600px] relative h-auto lg:max-h-screen flex justify-center flex-col gap-4 bg-background p-5 border border-default">
<button
type="button"
data-waitlist-close-button
@@ -21,8 +21,8 @@
</div>
<%= form_for :waitlist, url: spree.waitlists_path, method: :post, class: "flex w-full gap-4 flex-col", data: { product_form_target: 'addToWaitlistForm', controller: 'turbo-stream-form enable-button' } do |f| %>
<div class="w-full">
- <%= f.hidden_field :variant_id, value: variant.id %>
- <%= f.email_field :email, value: try_spree_current_user&.email, class: 'w-full', required: true, placeholder: Spree.t(:email), data: { enable_button_target: 'input' } %>
+ <%= f.hidden_field :variant_id, value: variant&.id %>
+ <%= f.email_field :email, value: try_spree_current_user&.email, class: 'w-full', required: true, placeholder: Spree.t(:email), data: { enable_button_target: 'input' }, autofocus: true %>
</div>
<div class="flex flex-col gap-2">
<label class="flex items-center gap-2 cursor-pointer group text-sm">
diff --git a/storefront/app/views/themes/default/spree/products/_metafields.html.erb b/storefront/app/views/themes/default/spree/products/_metafields.html.erb
new file mode 100644
index 0000000000..f048a9c50b
--- /dev/null
+++ b/storefront/app/views/themes/default/spree/products/_metafields.html.erb
@@ -0,0 +1,17 @@
+<div class="st-accordion" data-controller="accordion">
+ <% metafields_by_definition = @product.metafields.index_by { |m| m.metafield_definition.id.to_s } %>
+ <% block.preferred_metafield_definition_ids.each do |definition_id| %>
+ <% metafield = metafields_by_definition[definition_id.to_s] %>
+ <% next unless metafield %>
+
+ <details class="product-metafield border-b border-default group" id="metafield_<%= metafield.id %>">
+ <summary class="text-sm uppercase tracking-widest inline-flex w-full justify-between items-center py-4 cursor-pointer focus:outline-none">
+ <span><%= metafield.name %></span>
+ <span class="ml-2 transition-transform group-open:rotate-180">
+ <%= render 'spree/shared/icons/chevron_down' %>
+ </span>
+ </summary>
+ <%= render "spree/metafields/#{metafield.type.demodulize.underscore}", metafield: metafield %>
+ </details>
+ <% end %>
+</div>