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.

2.8 KB
Raw Blame
<div id="save_analysis_<%= @chatpost.analysis_answer_key %>" data-turbo-permanent class="mt-3 text-sm" data-controller="assistant-analysis" data-assistant-analysis-error-value="<%= t('assistant_analysis.error') %>">
  <button type="button" class="text-cobalt-700 underline hover:text-ink focus-visible:outline" data-action="assistant-analysis#revise" data-chat-id="<%= @chatpost.chat_id %>" data-answer-id="<%= @chatpost.id %>" data-answer-key="<%= @chatpost.analysis_answer_key %>"><%= t('assistant_analysis.revise') %></button>
  <details <%= 'hidden' if saved_analysis %> data-assistant-analysis-target="disclosure" data-action="toggle->assistant-analysis#reveal">
    <summary class="cursor-pointer text-cobalt-700 py-1"><%= t('assistant_analysis.action') %></summary>
    <%= form_with url: path, namespace: "analysis_#{@chatpost.id}", data: { action: 'submit->assistant-analysis#save', assistant_analysis_target: 'form' }, class: 'mt-2 rounded-lg border border-cream-300 p-3 space-y-2' do |form| %>
      <p class="font-semibold"><%= t('assistant_analysis.heading') %></p>
      <%= form.hidden_field :answer_key, value: @chatpost.analysis_answer_key %>
      <label class="block">
        <span><%= t('assistant_analysis.meeting') %></span>
        <%= form.select :meeting_id, meetings.map { |m| [m.one_line_title(max: 120), m.id] },
                        { include_blank: meetings.size > 1 ? t('assistant_analysis.choose_meeting') : false },
                        required: meetings.size > 1, class: 'block w-full rounded border border-cream-300 text-base md:text-sm' %>
      </label>
      <label class="block">
        <span><%= t('assistant_analysis.title') %></span>
        <%= form.text_field :title, value: title, required: true, class: 'block w-full rounded border border-cream-300 text-base md:text-sm' %>
      </label>
      <p class="text-xs text-muted"><%= t('assistant_analysis.visibility') %></p>
      <p role="alert" class="text-xs text-red-700" data-assistant-analysis-target="error"></p>
      <div class="flex flex-wrap items-center gap-3">
        <%= form.submit t('assistant_analysis.save'), class: 'rounded border border-cream-300 bg-btn-primary hover:brightness-95 focus-visible:outline px-3 py-1.5 cursor-pointer' %>
        <button type="button" class="text-muted" data-action="assistant-analysis#cancel"><%= t('assistant_analysis.cancel') %></button>
      </div>
    <% end %>
  </details>
  <p <%= 'hidden' unless saved_analysis %> data-assistant-analysis-target="success" role="status">
    <span data-assistant-analysis-target="message"><%= t('assistant_analysis.saved') if saved_analysis %></span> ·
    <a href="<%= saved_path %>" data-assistant-analysis-target="link" data-turbo-frame="_top" class="text-cobalt-700 underline"><%= t('assistant_analysis.open') %></a>
  </p>
</div>