Move bubble stagings out from double nesting

This commit is contained in:
David Heinemeier Hansson
2025-04-07 14:00:30 +02:00
parent 59ae5b36cd
commit bcd6c6dd66
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
module WorkflowsHelper
def button_to_set_stage(bubble, stage)
button_to bucket_bubble_stagings_path(bubble.bucket, bubble, stage_id: stage),
button_to bubble_stagings_path(bubble, stage_id: stage),
method: :post, class: [ "btn full-width justify-start workflow-stage txt-uppercase", { "workflow-stage--current": stage == bubble.stage } ],
form_class: "flex align-center gap-half",
data: { turbo_frame: "_top" } do
+1 -1
View File
@@ -20,6 +20,7 @@ Rails.application.routes.draw do
resources :assignments
resources :boosts
resources :stagings
resources :taggings
end
end
@@ -52,7 +53,6 @@ Rails.application.routes.draw do
resource :readings, only: :create
scope module: :bubbles do
resources :stagings
end
end
end
+2 -2
View File
@@ -34,14 +34,14 @@ class BubbleMessagesTest < ActionDispatch::IntegrationTest
assert_equal "assigned", bubble.messages.last.messageable.events.last.action
# Stage it
post bucket_bubble_stagings_url(buckets(:writebook), bubble), params: { stage_id: workflow_stages(:qa_triage).id }
post bubble_stagings_url(bubble), params: { stage_id: workflow_stages(:qa_triage).id }
assert_equal 3, bubble.messages.count
assert_predicate bubble.messages.last, :event_summary?
assert_equal 2, bubble.messages.last.event_summary.events.count
assert_equal "staged", bubble.messages.last.messageable.events.last.action
# Unstage it
post bucket_bubble_stagings_url(buckets(:writebook), bubble), params: { stage_id: workflow_stages(:qa_triage).id }
post bubble_stagings_url(bubble), params: { stage_id: workflow_stages(:qa_triage).id }
assert_equal 3, bubble.messages.count
assert_predicate bubble.messages.last, :event_summary?
assert_equal 3, bubble.messages.last.event_summary.events.count