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.4 KB
Raw Blame
<% if @time_session.grouped? %>
  <% if @show_link && @time_session.time_session_group %>
    <%#
      helpers., not the bare route helper: a component picks the route set up from
      the view context in a request, but ViewComponent::Base._routes is nil under
      rspec -- and the test environment mixes ActionDispatch::Routing::UrlFor into
      Object, so the bare call lands on its one-argument #url_for and raises
      "given 4, expected 0..1". The page was never broken; it simply could not be
      rendered by a spec. Same route through helpers as SubjectTimeSummaryComponent.
    %>
    <%= link_to helpers.organisation_time_session_group_path(
          @time_session.organisation,
          @time_session.time_session_group
        ),
        class: badge_classes,
        title: tooltip_text,
        data: {
          turbo_frame: "_top",
          tooltip: tooltip_text
        } do %>
      <% if @time_session.billed? %>
        <i class="bi bi-check-circle mr-1"></i>
      <% else %>
        <i class="bi bi-folder2 mr-1"></i>
      <% end %>
      <%= status_text %>
    <% end %>
  <% else %>
    <span class="<%= badge_classes %>" title="<%= tooltip_text %>">
      <% if @time_session.billed? %>
        <i class="bi bi-check-circle mr-1"></i>
      <% else %>
        <i class="bi bi-folder2 mr-1"></i>
      <% end %>
      <%= status_text %>
    </span>
  <% end %>
<% end %>