Avoid referencing instance variables in templates
This commit is contained in:
@@ -47,7 +47,7 @@ module CommentsHelper
|
||||
|
||||
safe_join(items.chunk_while { |i, j| grouped_item?(i) && grouped_item?(j) }.map do |chunk|
|
||||
if chunk.first.is_a?(Comment)
|
||||
render partial: "comments/comment", object: chunk.first
|
||||
render "comments/comment", comment: chunk.first
|
||||
else
|
||||
render_grouped_items(chunk)
|
||||
end
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
|
||||
<section class="comments align-center center borderless margin flex flex-column gap-half" style="--bubble-color: <%= @bubble.color %>;">
|
||||
<%= render_comments_and_boosts(@bubble) %>
|
||||
<%= render "comments/new" %>
|
||||
<%= render "comments/new", bubble: @bubble %>
|
||||
</section>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="comment__content flex flex-column full-width fill-shade border-radius">
|
||||
<div class="comment__author flex align-center gap-half">
|
||||
<strong><%= comment.creator.name %></strong>
|
||||
<%= link_to project_bubble_path(@bubble.project, @bubble, anchor: "comment_#{comment.id}"), class: "txt-undecorated" do %>
|
||||
<%= link_to project_bubble_path(comment.bubble.project, comment.bubble, anchor: "comment_#{comment.id}"), class: "txt-undecorated" do %>
|
||||
<time class="comment__timestamp"><%= comment.created_at.strftime("%b %d").html_safe %></time>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<strong><%= Current.user.name %></strong>
|
||||
</div>
|
||||
<div class="comment__body txt-align-start margin-block-start-half">
|
||||
<%= form_with model: Comment.new, url: project_bubble_comments_path(@bubble.project, @bubble), class: "flex flex-column gap full-width" do |form| %>
|
||||
<%= form_with model: Comment.new, url: project_bubble_comments_path(bubble.project, 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…" %>
|
||||
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