Don't reload entire page when creating comment
This commit is contained in:
@@ -4,7 +4,6 @@ class CommentsController < ApplicationController
|
||||
|
||||
def create
|
||||
@bubble.capture new_comment
|
||||
redirect_to @bubble
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module MessagesHelper
|
||||
def messages_tag(bubble, &)
|
||||
turbo_frame_tag dom_id(bubble, :messages),
|
||||
class: "comments align-center center borderless margin flex flex-column gap-half",
|
||||
style: "--bubble-color: <%= bubble.color %>",
|
||||
data: {
|
||||
controller: "created-by-current-user",
|
||||
created_by_current_user_mine_class: "comment--mine"
|
||||
}, &
|
||||
end
|
||||
end
|
||||
@@ -1,10 +1,6 @@
|
||||
<section id="<%= dom_id(bubble, :messages) %>"
|
||||
class="comments align-center center borderless margin flex flex-column gap-half"
|
||||
style="--bubble-color: <%= bubble.color %>"
|
||||
data-controller="created-by-current-user"
|
||||
data-created-by-current-user-mine-class="comment--mine">
|
||||
<%= messages_tag(bubble) do %>
|
||||
<%# Template Dependency: comments/comment %>
|
||||
<%# Template Dependency: event_summaries/event_summary %>
|
||||
<%= render bubble.messages, cached: true %>
|
||||
<%= render "comments/new", bubble: bubble %>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%= render "bubbles/messages", bubble: @bubble %>
|
||||
@@ -10,6 +10,6 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
|
||||
post bucket_bubble_comments_url(buckets(:writebook), bubbles(:logo), params: { comment: { body: "Agreed." } })
|
||||
end
|
||||
|
||||
assert_redirected_to bucket_bubble_url(buckets(:writebook), bubbles(:logo))
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user