Fix undo and tone down flash styling
Return 204 from DELETE instead of redirecting — fetch follows redirects
silently so the reload never saw the undo take effect. The client-side
reload now fires after a successful 204.
Restyle flash bar: light background with subtle border instead of the
dark #1a1a1a banner, matching the app's quiet aesthetic.
https://claude.ai/code/session_01NLGBcJgbiyWGDBGFh8DRas
diff --git a/lib/ketchup/web.rb b/lib/ketchup/web.rb
index f0341f8..c69edb1 100644
--- a/lib/ketchup/web.rb
+++ b/lib/ketchup/web.rb
@@ -164,7 +164,8 @@ class Web < Roda
r.delete do
r.halt 422 if @task[:completed_at].nil?
@task.undo_complete!
- r.redirect "/"
+ response.status = 204
+ ""
end
end
diff --git a/public/css/app.css b/public/css/app.css
index 904bf91..c47b29c 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -112,27 +112,19 @@ h2 { font-size: var(--step-0); font-weight: 600; }
justify-content: center;
gap: var(--space-xs);
padding: var(--space-2xs) var(--space-l);
- background: #1a1a1a;
- color: #fff;
font-size: var(--step--1);
-}
-
-.flash-undo-form {
- display: inline;
- padding: 0;
- gap: 0;
+ color: #666;
+ border-block-end: 1px solid #eee;
}
.flash-undo-btn {
all: unset;
- text-decoration: underline;
+ color: #c00;
cursor: pointer;
- font-weight: 600;
- color: #fff;
}
.flash-undo-btn:hover {
- opacity: 0.8;
+ text-decoration: underline;
}
/* -------------------- */
diff --git a/test/test_web.rb b/test/test_web.rb
index d738d10..63c1dbc 100644
--- a/test/test_web.rb
+++ b/test/test_web.rb
@@ -625,7 +625,7 @@ class TestWeb < Minitest::Test
refute_nil DB[:tasks].first(id: task[:id])[:completed_at]
delete "/series/#{series[:id]}/tasks/#{task[:id]}/complete", {}, auth_headers
- assert last_response.redirect?
+ assert_equal 204, last_response.status
assert_nil DB[:tasks].first(id: task[:id])[:completed_at]
assert_equal 1, DB[:tasks].where(series_id: series[:id]).count