tabletop-companion/app/views/character_sheet_sections/create.turbo_stream.erb

16 lines
798 B
Plaintext

<% content_target = @section.parent_section.present? ? "#{dom_id(@section.parent_section)}_subsections"
: "character_sheet" %>
<%= turbo_stream.append(content_target) do %>
<%= render @section %>
<% end %>
<% form_target = @section.parent_section.present? ? "#{dom_id(@section.parent_section)}_add_section"
: "character_sheet_add_section" %>
<%= turbo_stream.replace(form_target) do %>
<% id = @section.parent_section.present? ? "#{dom_id(@section.parent_section)}_add_section"
: "character_sheet_add_section" %>
<div id=<%= id %>>
<%= render partial: "edit_links", locals: { section: @section, parent: @section, id: } %>
</div>
<% end %>