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.3 KB
Raw Blame
<%= render NeoTitleBoxComponent.new(
  title: t('views.organisations.ticket_attribute_definitions.edit.title'),
  subtitle: @attribute_definition.label_for(I18n.locale),
  variant: :organisation
) do |c| %>
  <% c.with_right_content do %>
    <%= render Neo::Buttons::HeaderButtonComponent.new(
      variant: :secondary,
      icon: "x-lg",
      label: t('views.organisations.ticket_attribute_definitions.edit.cancel'),
      url: organisation_project_ticket_attribute_definitions_path(@current_organisation, @project)
    ) %>
  <% end %>
<% end %>

<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
  <div class="flex gap-6">
    <%# Sidebar: Attribut-Liste %>
    <div class="hidden lg:block w-64 shrink-0">
      <div class="sticky top-4">
        <nav class="space-y-1">
          <% @all_attributes.each do |attr| %>
            <% is_current = attr.id == @attribute_definition.id %>
            <% if attr.active? %>
              <%= link_to edit_organisation_project_ticket_attribute_definition_path(@current_organisation, @project, attr),
                  class: "flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-all #{is_current ? 'bg-cream-200 border-l-2 border-l-ink font-semibold text-cream-900' : 'text-cream-700 hover:bg-cream-100 border-2 border-transparent'}",
                  data: { turbo: false } do %>
                <span class="truncate flex-1"><%= attr.label_for(I18n.locale) %></span>
                <span class="text-xs px-1.5 py-0.5 rounded-full <%= is_current ? 'bg-cream-300 text-cream-900' : 'bg-cream-100 text-cream-600' %>">
                  <%= t("attribute_types.#{attr.field_type}", default: attr.field_type.humanize) %>
                </span>
              <% end %>
            <% else %>
              <%= link_to edit_organisation_project_ticket_attribute_definition_path(@current_organisation, @project, attr),
                  class: "flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-all opacity-50 #{is_current ? 'bg-cream-200 border-l-2 border-l-ink font-semibold text-cream-900' : 'text-cream-500 hover:bg-cream-100 border-2 border-transparent'}",
                  data: { turbo: false } do %>
                <span class="truncate flex-1"><%= attr.label_for(I18n.locale) %></span>
                <span class="text-xs px-1.5 py-0.5 rounded-full bg-cream-100 text-cream-500">
                  <i class="bi bi-eye-slash text-[10px]"></i>
                </span>
              <% end %>
            <% end %>
          <% end %>
        </nav>
        <%= link_to new_organisation_project_ticket_attribute_definition_path(@current_organisation, @project),
            class: "mt-3 w-full py-2 inline-flex items-center justify-center gap-1.5 rounded-lg text-sm text-cream-600 hover:text-cream-900 border border-dashed border-cream-300 hover:border-ink hover:bg-cream-100 transition-colors",
            data: { turbo: false } do %>
          <i class="bi bi-plus-lg text-xs"></i>
          <span><%= t('views.organisations.ticket_attribute_definitions.index.add_field') %></span>
        <% end %>
      </div>
    </div>

    <%# Main: Edit-Formular %>
    <div class="flex-1 min-w-0">
      <div class="bg-cream-50 rounded-lg border border-cream-300 p-6">
        <%= render 'form', attribute: @attribute_definition %>
      </div>
    </div>
  </div>
</div>