wip: Forging new SEO friendly routes
This commit is contained in:
@@ -16,7 +16,7 @@ export default class extends Controller {
|
||||
// Initialize the controller and update the cart summary
|
||||
connect() {
|
||||
console.log("TicketSelectionController connected");
|
||||
console.log("Target URL: ", this.target);
|
||||
console.log("Target URL: ", this.targetUrlValue);
|
||||
|
||||
this.updateCartSummary();
|
||||
this.bindFormSubmission();
|
||||
@@ -124,7 +124,7 @@ export default class extends Controller {
|
||||
|
||||
// Redirect to event-scoped orders/new page
|
||||
// const orderNewUrl = `/orders/new/events/${this.eventSlugValue}.${this.eventIdValue}`;
|
||||
const orderNewUrl = `/orders/new/events/${this.eventSlugValue}.${this.eventIdValue}`;
|
||||
const orderNewUrl = this.targetUrlValue;
|
||||
window.location.href = orderNewUrl;
|
||||
} catch (error) {
|
||||
console.error("Error storing cart:", error);
|
||||
|
||||
@@ -198,11 +198,11 @@
|
||||
<!-- Right Column: Ticket Selection -->
|
||||
<div class="lg:col-span-1">
|
||||
<%= form_with url: order_new_path(@event.slug, @event.id), method: :get, id: "checkout_form", local: true, data: {
|
||||
target: order_new_path(@event.slug, @event.id),
|
||||
controller: "ticket-selection",
|
||||
ticket_selection_target: "form",
|
||||
ticket_selection_event_slug_value: @event.slug,
|
||||
ticket_selection_event_id_value: @event.id
|
||||
ticket_selection_event_id_value: @event.id,
|
||||
ticket_selection_target_url_value: order_new_path(@event.slug, @event.id)
|
||||
} do |form| %>
|
||||
|
||||
<div class="">
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to retry_payment_order_path(order), method: :post,
|
||||
<%= link_to payment_retry_path(order), method: :post,
|
||||
class: "inline-flex items-center px-4 py-2 bg-orange-600 text-white text-sm font-medium rounded-lg hover:bg-orange-700 transition-colors duration-200" do %>
|
||||
Reprendre le paiement (<%= order.total_amount_euros %>€)
|
||||
<% end %>
|
||||
|
||||
@@ -44,12 +44,14 @@ Rails.application.routes.draw do
|
||||
|
||||
get "orders/:order_id", to: "orders#show", as: "order"
|
||||
get "orders/:order_id/checkout", to: "orders#checkout", as: "order_checkout"
|
||||
post "orders/:order_id/retry_payment", to: "orders#retry_payment", as: "order_retry_payment"
|
||||
post "orders/:order_id/increment_payment_attempt", to: "orders#increment_payment_attempt", as: "order_increment_payment_attempt"
|
||||
|
||||
|
||||
# === Payments ===
|
||||
get "payments/success", to: "orders#payment_success", as: "payment_success"
|
||||
get "payments/cancel", to: "orders#payment_cancel", as: "payment_cancel"
|
||||
post "orders/:order_id/retry_payment", to: "orders#retry_payment", as: "payment_retry"
|
||||
post "orders/:order_id/increment_payment_attempt", to: "orders#increment_payment_attempt", as: "order_increment_payment_attempt"
|
||||
|
||||
|
||||
# === Tickets ===
|
||||
get "tickets/:ticket_id", to: "tickets#show", as: "ticket"
|
||||
|
||||
@@ -222,7 +222,7 @@ class OrdersControllerTest < ActionDispatch::IntegrationTest
|
||||
# === Retry Payment Tests ===
|
||||
|
||||
test "should allow retry payment for retryable order" do
|
||||
post order_retry_payment_path(@order)
|
||||
post payment_retry_path(@order)
|
||||
assert_redirected_to order_checkout_path(@order)
|
||||
end
|
||||
|
||||
@@ -230,7 +230,7 @@ class OrdersControllerTest < ActionDispatch::IntegrationTest
|
||||
# Make order non-retryable (too many attempts)
|
||||
@order.update!(payment_attempts: Order::MAX_PAYMENT_ATTEMPTS)
|
||||
|
||||
post order_retry_payment_path(@order)
|
||||
post payment_retry_path(@order)
|
||||
assert_redirected_to event_path(@event.slug, @event)
|
||||
assert_match /ne peut plus être payée/, flash[:alert]
|
||||
end
|
||||
@@ -302,7 +302,7 @@ class OrdersControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_not_nil order_create_path(@event.slug, @event.id)
|
||||
assert_not_nil order_path(@order)
|
||||
assert_not_nil order_checkout_path(@order)
|
||||
assert_not_nil order_retry_payment_path(@order)
|
||||
assert_not_nil payment_retry_path(@order)
|
||||
assert_not_nil order_increment_payment_attempt_path(@order)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user