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.9 KB
Raw Blame
<div>
  <% missing_status = !project.ticket_attribute_definitions.exists?(name: 'status') %>
  <% missing_priority = !project.ticket_attribute_definitions.exists?(name: 'priority') %>

  <% if missing_status || missing_priority %>
    <%# D5 callout (info): warm info panel (S5), cobalt only for text/icon meaning. %>
    <div class="mb-4 p-4 bg-cream-100 border border-cream-300 rounded-lg">
      <div class="flex items-start gap-2 mb-2">
        <i class="bi bi-info-circle text-cobalt-700 mt-0.5"></i>
        <span class="text-sm font-medium text-cobalt-900"><%= t('organisations.projects.edit.default_attributes_available') %></span>
      </div>
      <ul class="ml-6 text-sm text-cobalt-800 space-y-0.5 mb-3">
        <% if missing_status %>
          <li><i class="bi bi-check2-square text-xs"></i> <%= t('organisations.projects.edit.default_status') %></li>
        <% end %>
        <% if missing_priority %>
          <li><i class="bi bi-check2-square text-xs"></i> <%= t('organisations.projects.edit.default_priority') %></li>
        <% end %>
      </ul>
      <%# "Create defaults" action → ButtonComponent secondary (size :small, compact in the hint box). %>
      <%= render Neo::Buttons::ButtonComponent.new(
            variant: :secondary,
            size: :small,
            form: {
              action: create_default_attributes_organisation_project_path(@current_organisation, project),
              method: :post
            }
          ) do %>
        <%= t('organisations.projects.edit.create_defaults_button') %>
      <% end %>
    </div>
  <% end %>

  <div class="flex items-center justify-between mb-3">
    <h3 class="text-sm font-bold uppercase text-cream-600"><%= t('views.organisations.projects.edit.ticket_fields') %></h3>
  </div>

  <p class="text-sm text-cream-600 mb-3"><%= t('views.organisations.projects.edit.ticket_fields_description') %></p>

  <% active_count = project.ticket_attribute_definitions.where(active: true).count %>
  <% inactive_count = project.ticket_attribute_definitions.where(active: false).count %>

  <% if active_count > 0 || inactive_count > 0 %>
    <div class="text-sm text-cream-600 mb-4 space-y-0.5">
      <p><%= t('views.organisations.projects.edit.active_fields_count', count: active_count) %></p>
      <% if inactive_count > 0 %>
        <p class="text-cream-500"><%= t('views.organisations.projects.edit.inactive_fields_count', count: inactive_count) %></p>
      <% end %>
    </div>
  <% end %>

  <%# Navigation link to the ticket fields → ButtonComponent secondary, arrow-right (leads elsewhere, P3). %>
  <%= render Neo::Buttons::ButtonComponent.new(
        variant: :secondary,
        icon: "arrow-right",
        icon_position: :right,
        url: organisation_project_ticket_attribute_definitions_path(@current_organisation, project)
      ) do %>
    <%= t('views.organisations.projects.edit.manage_ticket_fields') %>
  <% end %>
</div>