Files
fizzy/app/views/bubbles/_bubble.html.erb
T
2024-09-05 20:15:04 -05:00

59 lines
2.9 KiB
Plaintext

<div class="bubble" data-controller="upload-preview" style="view-transition-name: bubble-<%= bubble.id -%>; --bubble-color: <%= bubble.color %>; --bubble-rotate: <%= bubble_rotation(bubble) -%>deg; <%= bubble_size(bubble) %>">
<h1 class="bubble__title"><%= bubble.title %></h1>
<svg class="bubble__svg" viewBox="0 0 990 990" xmlns="http://www.w3.org/2000/svg" transform="rotate(<%= bubble_rotation(bubble) -%>)"><path d="m0 0h990v990h-990z" fill="none" stroke="none" /><path d="m391.65 879.47c-110.52-15.95-212.21-91.86-255.92-191.23-66.78-143.65-41.62-347.61 48.08-481.17 368.33-516.3 1252.97 520.2 451.03 660.78-44.07 8.84-88.98 13.49-133.01 15.68-36.69 2-73.37 1.91-109.99-4.03z"/></svg>
<%= link_to bubble, class: "bubble__link" do %>
<span class="for-screen-reader"><%= bubble.title %></span>
<% end %>
<div class="bubble__image">
<%= image_tag bubble.image.attached? ? bubble.image : "", data: { upload_preview_target: "image" } %>
</div>
<%= form_with model: bubble, data: { controller: "form" } do | form | %>
<div class="bubble__bubble bubble__meta bubble__attachment">
<% if bubble.image.attached? %>
<%= tag.label class:"btn btn--negative", data: { action: "click->upload-preview#clear click->form#submit", upload_preview_target: "button" } do %>
<%= image_tag "minus.svg", aria: { hidden: "true" }, size: 24 %>
<%= form.hidden_field :bubble, value: bubble.id %>
<%= check_box_tag "remove_image", "true" %>
<span class="for-screen-reader">Remove imagee</span>
<% end %>
<% else %>
<label class="btn btn--plain input--file">
<%= image_tag "camera.svg", aria: { hidden: "true" }, size: 20 %>
<%= form.file_field :image, class: "input", accept: "image/*",
data: { action: "upload-preview#previewImage change->form#submit" } %>
<span class="for-screen-reader">Upload an image</span>
</label>
<% end %>
</div>
<% end %>
<time class="bubble__bubble bubble__meta bubble__date">
<%= bubble.created_at.strftime("%b <br> %d").html_safe %>
</time>
<% bubble.tags.each do |tag| %>
<%= link_to "##{tag.title}", bubbles_path(tag_id: tag), class: "bubble__bubble bubble__meta bubble__tag" %>
<% end %>
<% if bubble.tags.size < 3 %>
<span class="bubble__bubble bubble__meta bubble__tag">
<%= turbo_frame_tag :new_tag do %>
<%= link_to "#", new_bubble_tag_path(bubble), class: "bubble__tag--new" %>
<% end %>
</span>
<% end %>
<%= tag.div class: "bubble__bubble bubble__meta bubble__boosts",
data: {
controller: "animation toggle-class",
animation_play_class: "boosting",
toggle_class_toggle_class: "boosting",
action: "animationend->toggle-class#toggle" } do %>
<%= turbo_frame_tag dom_id(bubble, :boosts), src: bubble_boosts_path(bubble) %>
<% end %>
</div>