diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index ab1404cfb..bc0d4a9c5 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -15,7 +15,6 @@ class CommentsController < ApplicationController def update @comment.update! comment_params - render :show end def destroy diff --git a/app/views/comments/_body.html.erb b/app/views/comments/_body.html.erb new file mode 100644 index 000000000..d2a060192 --- /dev/null +++ b/app/views/comments/_body.html.erb @@ -0,0 +1,22 @@ +<%= turbo_frame_tag dom_id(comment) do %> +
+
+ <%= link_to comment.creator.name, user_path(comment.creator), class: "txt-ink btn btn--plain", data: { turbo_frame: "_top" } %> + <%= link_to bucket_bubble_path(comment.bubble.bucket, comment.bubble, anchor: "comment_#{comment.id}"), class: "txt-undecorated" do %> + <%= tag.time comment.created_at, class: "comment__timestamp" do %> + <%= comment.created_at.strftime("%b %d") %> + <% end %> + <% end %> + + <% if comment.creator == Current.user %> + <%= link_to edit_bucket_bubble_comment_path(comment.bubble.bucket, comment.bubble, comment), class: "btn txt-small btn--plain", style: "font-size: 0.4em; opacity: 0.5;" do %> + <%= image_tag "menu-dots-horizontal.svg", class: "icon" %> + Edit + <% end %> + <% end %> +
+
+ <%= sanitize comment.body_html %> +
+
+<% end %> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 878fdd9f4..74d7cb6c1 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -3,5 +3,5 @@ <%= avatar_tag comment.creator, loading: :lazy %> - <%= turbo_frame_tag dom_id(comment), src: bucket_bubble_comment_path(comment.bubble.bucket, comment.bubble, comment) %> + <%= render "comments/body", comment: comment %> <% end %> diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb index 56d287418..815881610 100644 --- a/app/views/comments/show.html.erb +++ b/app/views/comments/show.html.erb @@ -1,22 +1 @@ -<%= turbo_frame_tag dom_id(@comment) do %> -
-
- <%= link_to @comment.creator.name, user_path(@comment.creator), class: "txt-ink btn btn--plain", data: { turbo_frame: "_top" } %> - <%= link_to bucket_bubble_path(@comment.bubble.bucket, @comment.bubble, anchor: "comment_#{@comment.id}"), class: "txt-undecorated" do %> - <%= tag.time @comment.created_at, class: "comment__timestamp" do %> - <%= @comment.created_at.strftime("%b %d") %> - <% end %> - <% end %> - - <% if @comment.creator == Current.user %> - <%= link_to edit_bucket_bubble_comment_path(@comment.bubble.bucket, @comment.bubble, @comment), class: "btn txt-small btn--plain", style: "font-size: 0.4em; opacity: 0.5;" do %> - <%= image_tag "menu-dots-horizontal.svg", class: "icon" %> - Edit - <% end %> - <% end %> -
-
- <%= sanitize @comment.body_html %> -
-
-<% end %> +<%= render "comments/body", comment: @comment %> diff --git a/app/views/comments/update.html.erb b/app/views/comments/update.html.erb new file mode 100644 index 000000000..815881610 --- /dev/null +++ b/app/views/comments/update.html.erb @@ -0,0 +1 @@ +<%= render "comments/body", comment: @comment %>