-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧹
Marketplace
: Simplify changing Product
quantities in Cart
- #2155 - #1326 This gets rid of a bunch of nonsense from the `CartProductComponent`, and tees up some parts that I use in the `Menu::ProductComponent` Extracted from: #2072
- Loading branch information
Showing
7 changed files
with
43 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Marketplace | ||
class CartProduct::QuantityPicker < Model | ||
attr_accessor :cart_product | ||
delegate :location, :quantity, to: :cart_product | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
app/furniture/marketplace/cart_product/quantity_pickers/_quantity_picker.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="flex flex-row justify-between items-center"> | ||
<%- if quantity_picker.quantity < 1%> | ||
<span></span> | ||
<%- elsif quantity_picker.quantity == 1 %> | ||
<%= button_to("🗑️", quantity_picker.location, method: :delete) %> | ||
<%- else %> | ||
<%= button_to("➖", quantity_picker.location, method: :put, params: { cart_product: { quantity: quantity_picker.quantity - 1 } }) %> | ||
<%- end %> | ||
|
||
<span class="py-2 px-2 my-1 text-lg"><%= quantity_picker.quantity %></span> | ||
|
||
<%= button_to("➕", quantity_picker.location, method: :put, params: { cart_product: { quantity: quantity_picker.quantity + 1 } }) %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters