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.

1.5 KB
Raw Blame
<%# Collapses the content column after a ticket delete. Moved out of the controller
    heredoc (S4). The success notice is NOT built here any more: tickets#destroy streams
    the standard layouts/flash (NeoFlashComponent), which carries position and auto-hide.
    The column is closed through the layout-toggle Stimulus controller: it owns the
    hide-content/show-content classes, deselects the list row and drops ticket_id
    from the URL (a reload must not try to reopen the deleted ticket). The former
    direct class toggling targeted #layout, an id that no longer exists. The class
    fallback only runs when the controller is not mounted (e.g. in view specs). %>
<script>
  (function() {
    const layoutToggleElement = document.querySelector('[data-controller~="layout-toggle"]');
    const layoutToggle = layoutToggleElement && window.Stimulus
      ? window.Stimulus.getControllerForElementAndIdentifier(layoutToggleElement, 'layout-toggle')
      : null;

    if (layoutToggle) {
      layoutToggle.closeContent();
    } else {
      // Mirrors layout-toggle#updateLayout: the grid carries hide-content/show-content,
      // the outer view only show-content.
      document.querySelectorAll('.layout.two-column').forEach(element => {
        element.classList.add('hide-content');
        element.classList.remove('show-content');
      });
      document.querySelectorAll('.labor-layout-view').forEach(element => element.classList.remove('show-content'));
    }
  })();
</script>