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.

3.0 KB
Raw Blame
<%# S3 §4.6: semantic search degraded to full-text (AI off / quota exhausted). %>
<% if @semantic_degraded %>
  <div class="mb-4 border border-cream-300 rounded-lg bg-cream-100 p-3 text-sm text-cream-700">
    <i class="bi bi-info-circle mr-1"></i><%= t('shared.ai.quota.search_degraded') %>
  </div>
<% end %>
<% if @results_with_type.present? %>
  <div class="posts-container space-y-6">
    <% @results_with_type.each do |result| %>
      <div class="border-b border-gray-200 pb-6">
        <p class="mb-1 flex flex-wrap items-center gap-2">
          <span class="inline-block px-2 py-1 text-xs font-semibold text-gray-600 border border-gray-200 rounded">
            <%= t("views.organisations.power_search.power_search_results.types.#{result[:type]}") %>
          </span>

          <% if result[:project_name].present? %>
            <% if result[:project_link].present? %>
              <%= link_to result[:project_name], result[:project_link], class: "inline-block px-2 py-1 text-xs font-semibold text-gray-600 border border-gray-200 rounded hover:border-gray-400 hover:text-gray-900" %>
            <% else %>
              <span class="inline-block px-2 py-1 text-xs font-semibold text-gray-600 border border-gray-200 rounded"><%= result[:project_name] %></span>
            <% end %>
          <% end %>

          <% if result[:date].present? %>
            <time datetime="<%= result[:date].to_date.iso8601 %>" class="inline-block px-2 py-1 text-xs font-semibold text-gray-600 border border-gray-200 rounded"><%= l(result[:date].to_date) %></time>
          <% end %>

          <% result[:match_types].each do |match_type| %>
            <% if match_type == :fulltext %>
              <span class="inline-block px-2 py-1 text-xs font-semibold text-on-fill bg-green-500 rounded"><%= t('views.organisations.power_search.power_search_results.fulltext_match') %></span>
            <% elsif match_type == :semantic %>
              <span class="inline-block px-2 py-1 text-xs font-semibold text-on-fill bg-blue-500 rounded"><%= t('views.organisations.power_search.power_search_results.semantic_match') %></span>
            <% else %>
              <span class="inline-block px-2 py-1 text-xs font-semibold text-on-fill bg-gray-500 rounded"><%= t('views.organisations.power_search.power_search_results.unknown_match') %></span>
            <% end %>
          <% end %>
        </p>
        <div class="space-y-2">
          <div>
            <h3 class="text-lg font-semibold">
              <%= link_to result[:title], result[:link], class: "text-gray-900 underline decoration-gray-300 hover:decoration-gray-600" %>
            </h3>
          </div>
        </div>

        <div class="mt-2 text-gray-700">
          <!-- Render the highlighted result or the unmarked text -->
          <p><%= result[:highlighted_content].present? ? sanitize(result[:highlighted_content], tags: %w[b mark]) : result[:content] %></p>
        </div>
      </div>
    <% end %>
  </div>
<% else %>
  <p class="text-gray-700"><%= t('views.organisations.power_search.power_search_results.no_results') %></p>
<% end %>