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:
@@ -39,6 +39,10 @@
|
||||
.comment {
|
||||
inline-size: 100%;
|
||||
flex-wrap: wrap;
|
||||
|
||||
&:target {
|
||||
background-color: var(--color-selected);
|
||||
}
|
||||
}
|
||||
|
||||
.comment__body {
|
||||
|
||||
@@ -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,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">
|
||||
|
||||
Reference in New Issue
Block a user