47 lines
1.8 KiB
Plaintext
47 lines
1.8 KiB
Plaintext
<% content_for :header do %>
|
|
<nav>
|
|
<%= link_to bubbles_path, class: "btn flex-item-justify-start" do %>
|
|
<%= image_tag "arrow-left.svg", aria: { hidden: true }, size: 24 %>
|
|
<span class="for-screen-reader">All Bubbles</span>
|
|
<% end %>
|
|
|
|
<div class="flex-item-justify-end" data-controller="dialog">
|
|
<%= tag.button class: "btn flex-item-justify-end", popovertarget: "bubble-edit-panel" do %>
|
|
<%= image_tag "pencil.svg", aria: { hidden: true }, size: 24 %>
|
|
<span class="for-screen-reader">Edit <%= @bubble.title %></span>
|
|
<% end %>
|
|
|
|
<dialog class="panel" id="bubble-edit-panel" data-dialog-target="dialog" popover>
|
|
<div class="flex pad">
|
|
<%= turbo_frame_tag @bubble, :edit, src: edit_bubble_path(@bubble), target: "_top" %>
|
|
</div>
|
|
</dialog>
|
|
</div>
|
|
</nav>
|
|
<% end %>
|
|
|
|
<div class="bubble__perma flex justify-center center margin-block-end-double">
|
|
<%= render @bubble %>
|
|
</div>
|
|
|
|
<section class="comments align-center panel center borderless margin-block flex flex-wrap gap-half" style="--bubble-color: <%= @bubble.color %>;">
|
|
<% comments = (@bubble.comments + @bubble.boosts).sort_by(&:updated_at) %>
|
|
<% boosts = [] %>
|
|
|
|
<% comments.each_with_index do |comment, index| %>
|
|
<% if comment.is_a?(Boost) %>
|
|
<% boosts << comment %>
|
|
<% if comments[index + 1].nil? || !comments[index + 1].is_a?(Boost) %>
|
|
<% user_boosts = boosts.group_by(&:creator).transform_values(&:count) %>
|
|
<div class="boost flex-inline align-start gap fill-white border-radius center position-relative">
|
|
<%= user_boosts.map { |user, count| "#{user.name} +#{count}" }.to_sentence %>
|
|
</div>
|
|
<% boosts.clear %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= render partial: "comments/comment", object: comment %>
|
|
<% end %>
|
|
<% end %>
|
|
<%= render "comments/new" %>
|
|
</section>
|