tabletop-companion/app/views/text_fields/_text_field.html.erb

26 lines
943 B
Plaintext

<div class="text-field" id="<%= dom_id(text_field) %>">
<% if @editable %>
<div class="feature-edit-buttons">
<%= icon_link_to("cod-triangle_left", reorder_down_character_sheet_feature_path(text_field),
data: { turbo_method: :patch }) %>
<%= icon_link_to("md-delete", text_field,
data: { turbo_method: :delete, turbo_confirm: t(".confirm_delete", name: text_field.name) }) %>
<%= icon_link_to("cod-triangle_right", reorder_up_character_sheet_feature_path(text_field),
data: { turbo_method: :patch }) %>
</div>
<% end %>
<h6><%= text_field.name %></h6>
<% if @editable %>
<%= form_with model: text_field, class: "text-field-form" do |f| %>
<%= f.rich_text_area :content %>
<%= f.submit t(".save") %>
<% end %>
<% else %>
<%= link_to text_field, data: { turbo_frame: :modal } do %>
<%= text_field.content %>
<% end %>
<% end %>
</div>