Files
once-campfire/app/views/messages/_actions.html.erb
Kevin McConnell df76a227dc Hello world
First open source release of Campfire 🎉
2025-08-21 09:31:59 +01:00

59 lines
3.8 KiB
Plaintext

<%# Be sure to check/update messages/_template.html.erb when changing this file %>
<div class="message__actions" data-controller="soft-keyboard">
<%= tag.details class: "position-relative",
data: { controller: "popup", action: "keydown.esc->popup#close toggle->popup#toggle click@document->popup#closeOnClickOutside", popup_orientation_top_class: "popup-orientation-top" } do %>
<summary class="btn message__action-btn message__options-btn">
<%= image_tag "menu-dots-horizontal.svg", size: 20, class: "colorize--black", aria: { hidden: "true" } %>
<span class="for-screen-reader">Message options</span>
</summary>
<div class="message__actions-menu border shadow" data-popup-target="menu">
<div class="quick-boosts">
<% EmojiHelper::REACTIONS.each do |character, title| %>
<%= form_with model: [ message, Boost.new ], data: { turbo_frame: dom_id(message, :boosting), action: "popup#close"} do |form| %>
<%= hidden_field_tag "boost[content]", character %>
<%= form.button type: "submit", title: title, class: "btn message__action-btn", data: { emoji: character } do %>
<figure class="margin-none boost-character"><%= character %></figure>
<span class="for-screen-reader"><%= title %></span>
<% end %>
<% end %>
<% end %>
<%= link_to new_message_boost_path(message),
class: "btn message__action-btn message__boost-btn",
data: { turbo_frame: dom_id(message, :new_boost), action: "soft-keyboard#open popup#close" } do %>
<%= image_tag "boost.svg", class: "colorize--black", size: 20, aria: { hidden: "true" } %>
<span class="for-screen-reader">New boost</span>
<% end %>
</div>
<div class="flex flex-wrap border-top margin-block-start-half pad-block-start-half message__actions-grid">
<% if message.content_type.attachment? %>
<%= link_to rails_blob_path(message.attachment, disposition: "attachment", only_path: true), class: "btn message__action-btn center full-width hide-in-ios-pwa", title: "Download", aria: { label: "Download" } do %>
<%= image_tag "download.svg", class: "colorize--black", size: 20, aria: { hidden: "true" } %>
<% end %>
<%= tag.button class: "btn message__action-btn center full-width",
data: { controller: "web-share", action: "web-share#share", web_share_files_value: rails_blob_path(message.attachment, only_path: true), web_share_title_value: message.attachment.filename.to_s }, title: "Share", aria: { label: "Share" } do %>
<%= image_tag "share.svg", class: "colorize--black", size: 20, aria: { hidden: "true" } %>
<% end %>
<% else %>
<%= tag.button class: "btn message__action-btn center full-width", data: { action: "reply#reply" }, title: "Reply", aria: { label: "Reply" } do %>
<%= image_tag "reply.svg", class: "colorize--black", size: 20, aria: { hidden: "true" } %>
<% end %>
<% end %>
<%= tag.button class: "btn message__action-btn center full-width", title: "Copy link", aria: { label: "Copy link" }, data: { controller: "copy-to-clipboard", action: "copy-to-clipboard#copy", copy_to_clipboard_success_class: "btn--success", copy_to_clipboard_content_value: url } do %>
<%= image_tag "link.svg", class: "colorize--black", size: 20, aria: { hidden: "true" } %>
<% end %>
<%= link_to edit_room_message_path(message.room, message), class: "btn message__action-btn center full-width message__edit-btn",
data: { turbo_frame: dom_id(message, :edit) }, title: "Edit", aria: { label: "Edit"} do %>
<%= image_tag "pencil.svg", class: "colorize--black", size: 20, aria: { hidden: "true" } %>
<% end %>
</div>
</div>
<% end %>
</div>