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
<%# Links are navigation (nav); buttons are a control group. %>
<%= content_tag(links_only? ? :nav : :div, class: container_classes, role: (links_only? ? nil : 'group'), 'aria-label': label) do %>
  <% items.each do |item| %>
    <% if item[:method] == :get %>
      <%= link_to item[:path], **segment_attributes(item), 'aria-current': (item[:active] ? 'page' : nil) do %>
        <% if icon_pair? %>
          <%= icon_svg(item) %>
        <% elsif item[:label].present? %>
          <span><%= item[:label] %></span>
        <% else %>
          <i class="bi <%= item[:icon] %>" aria-hidden="true"></i>
          <span class="sr-only"><%= item[:title] %></span>
        <% end %>
      <% end %>
    <% else %>
      <%= button_to item[:path],
                    params: item[:params],
                    method: item[:method],
                    form: { data: { turbo: false }, class: 'h-full' },
                    disabled: item[:disabled],
                    'aria-pressed': item[:active].to_s,
                    **segment_attributes(item) do %>
        <% if icon_pair? %>
          <%= icon_svg(item) %>
        <% elsif item[:label].present? %>
          <span><%= item[:label] %></span>
        <% else %>
          <i class="bi <%= item[:icon] %>" aria-hidden="true"></i>
          <span class="sr-only"><%= item[:title] %></span>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>