Tidy up comments
This commit is contained in:
@@ -2,10 +2,8 @@ class CommentsController < ApplicationController
|
||||
before_action :set_bubble
|
||||
|
||||
def create
|
||||
@comment = @bubble.comments.create(comment_params)
|
||||
@comment.save
|
||||
|
||||
redirect_to bubble_path(@bubble, anchor: "comment_#{@comment.id}")
|
||||
@bubble.comments.create!(comment_params)
|
||||
redirect_to @bubble
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
<strong><%= Current.user.name %></strong>
|
||||
</div>
|
||||
<div class="comment__body txt-align-start">
|
||||
<%= form_with model: [@bubble, @bubble.comments.build], class: "flex flex-column gap full-width" do | form | %>
|
||||
<%= form.text_area :body, class: "input", required: true, placeholder: Current.user == @bubble.creator && @bubble.comments.size == 1 ? "Add some notes…" : "Type your comment…", rows: 4 %>
|
||||
<%= form_with model: Comment.new, url: bubble_comments_path(@bubble), class: "flex flex-column gap full-width" do | form | %>
|
||||
<%= form.text_area :body, class: "input", required: true, rows: 4,
|
||||
placeholder: (@bubble.comments.empty? && @bubble.creator == Current.user) ? "Add some notes…" : "Type your comment…" %>
|
||||
|
||||
<%= form.button class: "btn btn--reversed center" do %>
|
||||
<%= image_tag "check.svg", aria: { hidden: "true" }, size: 24 %>
|
||||
|
||||
Reference in New Issue
Block a user