Skip to content

Commit

Permalink
Marketplace: The Back button works! (#1981)
Browse files Browse the repository at this point in the history
- #831

So, TIL about `data-turbo-action=advance` which tells turbo to update
the URL when moving from spot to spot.

Now, when navigating through the Marketplace Management and Checkout
flow the URL bar actually update! Magic! Ponies! Sparkles! Hooray!
  • Loading branch information
zspencer authored Nov 30, 2023
1 parent 393fa8b commit 1f86ba3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/furniture/marketplace/checkouts/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= turbo_frame_tag(checkout.marketplace) do %>
<%= turbo_frame_tag(checkout.marketplace, data: { turbo_action: :advance }) do %>
<%= link_to(t("marketplace.marketplaces.show.link_to"), marketplace.location) %>
<h1>Checkout</h2>
<%= render CardComponent.new do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= turbo_frame_tag(marketplace) do %>
<%= turbo_frame_tag(marketplace, data: { turbo_action: :advance }) do %>
<%= render Marketplace::MarketplaceComponent.new(marketplace: marketplace) %>
<%- end %>
2 changes: 1 addition & 1 deletion app/furniture/marketplace/marketplaces/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%- breadcrumb :marketplace, marketplace %>
<%= turbo_frame_tag(marketplace) do %>
<%= turbo_frame_tag(marketplace, data: { turbo_action: :advance }) do %>
<%= render Marketplace::MarketplaceComponent.new(marketplace: marketplace) %>
<%- end %>
3 changes: 3 additions & 0 deletions spec/furniture/marketplace/buying_products_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ def url_options
expect(page).to have_content("Total: #{humanized_money_with_symbol(marketplace.products.first.price + marketplace.delivery_areas.first.price)}")

click_link("Checkout")
expect(page).to have_current_path(polymorphic_path(marketplace.carts.first.location(child: :checkout)))

set_delivery_details(delivery_address: "123 N West St Oakland, CA",
contact_email: "[email protected]",
contact_phone_number: "1234567890")

expect(page).to have_current_path(polymorphic_path(marketplace.carts.first.location(child: :checkout)))

pay(card_number: "4000000000000077", card_expiry: "1240", card_cvc: "123", billing_name: "Ahsoka Tano", email: "[email protected]", billing_postal_code: "12345")

expect(page).to have_content("Order History", wait: 30)
Expand Down

0 comments on commit 1f86ba3

Please sign in to comment.