Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make product modal reusable #10861

Merged
merged 5 commits into from
Mar 9, 2021

Conversation

 SylarRuby
Copy link
Contributor

 @SylarRuby SylarRuby commented Mar 9, 2021

Since product_added_modal.js already inserts the product's name and image alt text, it's pointless to have a product variable inside the modal's HTML. This makes the modal reusable should a client wishes to use the modal on other pages, ie: in a products loop.

 [ . . ]

 $modal . find ( nameSelector ) . text ( name )  // Here
 $modal . find ( priceSelector ) . html ( price )

  if  ( leadImage  !==  null )  {
     $modal
       . removeClass ( modalNoImageClass )
       . find ( imageSelector )
       . attr ( 'src' ,  leadImage . url_product )
       . attr ( 'alt' ,  leadImage . alt  ||  name )  // Here
   }  else  {

 [ . . ]

<% end %>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 col-lg-8">
<%= link_to spree.cart_path, class: 'btn btn-outline-primary w-100 font-weight-bold text-uppercase product-added-modal-button' do %>
<%= Spree.t('pdp.view_cart') %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

@SylarRuby actually this one needs to stay as it is :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

I've reverted.

Daveyon Mayne and others added two commits March 9, 2021 11:09
 @damianlegawiec damianlegawiec merged commit 976bea2 into spree : master Mar 9, 2021
 @SylarRuby SylarRuby deleted the reusable-modal branch March 9, 2021 17:28
 @SylarRuby SylarRuby changed the title Make product model reusable Make product modal reusable Mar 9, 2021
damianlegawiec added a commit that referenced this pull request Mar 12, 2021
 Co-authored-by: Daveyon Mayne < daveyonmayne@daveyons-mbp.home > Co-authored-by: Damian Legawiec < damian@sparksolutions.co >
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants