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.6 KB
Raw Blame
<%# Two shapes, one body. Without a clamp the prose block IS the component; with
    one it gets a wrapper that carries the Stimulus controller plus the toggle.

    ⚠️ The server always emits the FULL text and a HIDDEN button — the clamp is
    added by clamp_toggle_controller on connect. Progressive enhancement: without
    JavaScript the reader gets everything instead of a cut-off block with no way
    to open it. The controller also keeps the button hidden when the text fits
    inside the clamp anyway, so a short summary never offers a "weiterlesen" with
    nothing behind it. %>
<% if clamp? %>
  <div data-controller="clamp-toggle"
       data-clamp-toggle-clamped-class="<%= Neo::MarkdownPreviewComponent::CLAMPED_CLASS %>"
       class="<%= wrapper_classes %>">
    <div data-clamp-toggle-target="content" class="<%= body_classes %>"><%= rendered_markdown %></div>
    <button type="button"
            data-clamp-toggle-target="toggle"
            data-action="clamp-toggle#toggle"
            class="hidden mt-2 inline-flex items-center gap-1 text-xs font-mono text-cream-600 hover:text-ink transition-colors">
      <span data-clamp-toggle-target="moreLabel" class="inline-flex items-center gap-1">
        <i class="bi bi-chevron-down text-[11px]" aria-hidden="true"></i><%= more_label %>
      </span>
      <span data-clamp-toggle-target="lessLabel" class="hidden inline-flex items-center gap-1">
        <i class="bi bi-chevron-up text-[11px]" aria-hidden="true"></i><%= less_label %>
      </span>
    </button>
  </div>
<% else %>
  <div class="<%= body_classes %>"><%= rendered_markdown %></div>
<% end %>