Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

967 B
Raw Blame
<%# Shared Turbo-Stream tail for the SmartFolder modal actions (create/update/destroy).
    Surfaces the flash, closes the #modal turbo-frame and navigates with Turbo to the
    source list. Callers pass their own `redirect_url`: create/update return to the
    content list they were saved from, destroy returns to a safe list (the folder
    is gone). Single source for the modal-close mechanism so the three actions
    cannot drift. %>
<% if flash.now[:notice].present? %>
  <%= turbo_stream.update "flash" do %>
    <%= render NeoFlashComponent.new(
      type: :notice,
      message: flash.now[:notice],
      dismissible: true,
      auto_hide: true
    ) %>
  <% end %>
<% end %>

<%= turbo_stream.append_all "body" do %>
  <script>
    (function () {
      const modalFrame = document.getElementById('modal');
      if (modalFrame) { modalFrame.replaceChildren(); }
      window.Turbo.visit(<%= raw redirect_url.to_json %>);
    })();
  </script>
<% end %>