Anchor to newly created comments

This doesn't actually work but I thought I'd leave it in since it's a reproducible case for: https://github.com/hotwired/turbo/issues/211
This commit is contained in:
Jason Zimdars
2024-08-19 14:16:32 -05:00
parent 6860a0ea36
commit 7b2ecf5d1a
3 changed files with 6 additions and 2 deletions
+4
View File
@@ -39,6 +39,10 @@
.comment {
inline-size: 100%;
flex-wrap: wrap;
&:target {
background-color: var(--color-selected);
}
}
.comment__body {
+1 -1
View File
@@ -5,7 +5,7 @@ class CommentsController < ApplicationController
@comment = @splat.comments.create(comment_params)
@comment.save
redirect_to splat_path(@splat)
redirect_to splat_path(@splat, anchor: "comment_#{@comment.id}")
end
private
+1 -1
View File
@@ -1,4 +1,4 @@
<div class="comment flex align-start gap">
<div class="comment flex align-start gap" id="<%= dom_id(comment) %>">
<div class="flex align-center gap full-width">
<span class="avatar fill-black txt-reversed flex-item-no-shrink"><strong><%= comment.creator.initials %></strong></span>
<header class="full-width flex align-center gap">