The personal finance app for everyone (by everyone)
Ruby
Open the create-a-bill dialog with a GET from a transaction (#4250)
alexcastgonzf61da7846e58
diff --git a/app/views/transactions/_mark_recurring.html.erb b/app/views/transactions/_mark_recurring.html.erbindex 4a738e5ffd..59b97585cc 100644--- a/app/views/transactions/_mark_recurring.html.erb+++ b/app/views/transactions/_mark_recurring.html.erb@@ -22,7 +22,8 @@<%# The declare dialog is part of the preview-gated bills surface, so theaction only appears for someone who has opted into it. %><% if preview_features_enabled? %>- <%= render DS::Button.new(+ <%# A link, not DS::Button: button_to POSTs, and the dialog is GET only. %>+ <%= render DS::Link.new(text: t("transactions.show.create_bill"),variant: "outline",icon: "receipt",diff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rbindex cdfbf33615..3559cfb063 100644--- a/test/controllers/transactions_controller_test.rb+++ b/test/controllers/transactions_controller_test.rb@@ -50,6 +50,24 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTestassert_match(/für die am .* fällige Rechnung/, response.body)end+ # The dialog route is GET only. Rendered as a button_to, "Create a bill"+ # POSTed to it and the modal frame showed "Content Missing".+ test "create a bill opens the prefilled dialog with a GET" do+ @user.update!(preferences: (@user.preferences || {}).merge("preview_features_enabled" => true))++ get transaction_url(@entry), headers: { "Turbo-Frame" => "drawer" }++ assert_response :success+ href = new_recurring_transaction_path(entry_id: @entry.id)+ assert_select "a[href=?][data-turbo-frame=modal]", href, text: /Create a bill/+ assert_select "form[action=?]", href, count: 0++ get href, headers: { "Turbo-Frame" => "modal" }++ assert_response :success+ assert_select "turbo-frame#modal"+ end+test "the bill link-back stays hidden without preview access" doseries = @user.family.recurring_transactions.create!(account: accounts(:depository), name: "Watson Property", amount: 2000,