Skip to content

Commit

Permalink
🌸 Marketplace: Begin distinguishing the Cart from the Menu
Browse files Browse the repository at this point in the history
- #2043
- #1326

While we definitely need a `Cart`; treating the `Cart` as the `Menu` is
a clunky ducky way of operating.

I'm going to start driving towards a more `Menu` centric approach so the
Shopping experience looks and feels a bit less nerd-forward.

Theoretically, this will entail:

- [ ] Sprouting `Product#show`
- [ ] Ditching the `Marketplace::Cart` ui almost completely, perhaps?
- [ ] Updating `buying_products_system_spec.rb`
  • Loading branch information
zspencer committed Jan 11, 2024
1 parent f3cae24 commit b9b6a54
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/furniture/marketplace/menu_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="grid grid-cols-3 gap-3">
<%- marketplace.products.each do |product| %>
<%= link_to(product.location, class: "no-underline") do %>
<%= render CardComponent.new do %>
<h3><%= product.name %></h3>
<p><%= product.description %></p>
<%- end %>
<%- end %>
<%- end %>
</div>
14 changes: 14 additions & 0 deletions app/furniture/marketplace/menu_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Marketplace
class MenuComponent < ApplicationComponent
attr_accessor :marketplace

def initialize(marketplace:, **kwargs)
super(**kwargs)
self.marketplace = marketplace
end

def render?
current_person.operator?
end
end
end
3 changes: 3 additions & 0 deletions app/furniture/marketplace/products/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%- breadcrumb :marketplace_product, product %>
<h3><%= product.name %></h3>
<p><%= product.description %></p>
4 changes: 4 additions & 0 deletions app/furniture/marketplace/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def index
skip_authorization
end

def show
authorize(product)
end

def edit
authorize(product)
end
Expand Down

0 comments on commit b9b6a54

Please sign in to comment.