|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}Custom Ticket Fields — {{ project.name }} — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1> |
|
6
|
{% include "fossil/_project_nav.html" %} |
|
7
|
|
|
8
|
<div class="flex items-center justify-between mb-6"> |
|
9
|
<h2 class="text-lg font-semibold text-gray-200">Custom Ticket Fields</h2> |
|
10
|
<div class="flex items-center gap-3"> |
|
11
|
<span class="search-wrap"> |
|
12
|
<input type="search" |
|
13
|
name="search" |
|
14
|
value="{{ search }}" |
|
15
|
placeholder="Search fields..." |
|
16
|
aria-label="Search custom fields" |
|
17
|
class="rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand text-sm px-3 py-1.5" |
|
18
|
hx-get="{% url 'fossil:ticket_fields' slug=project.slug %}" |
|
19
|
hx-trigger="input changed delay:300ms, search" |
|
20
|
hx-target="#fields-content" |
|
21
|
hx-swap="innerHTML" |
|
22
|
hx-push-url="true" |
|
23
|
hx-indicator="closest .search-wrap" /> |
|
24
|
<svg class="search-spinner animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg> |
|
25
|
</span> |
|
26
|
<a href="{% url 'fossil:ticket_field_create' slug=project.slug %}" |
|
27
|
class="inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
28
|
Add Field |
|
29
|
</a> |
|
30
|
</div> |
|
31
|
</div> |
|
32
|
|
|
33
|
<div id="fields-content"> |
|
34
|
{% if fields %} |
|
35
|
<div class="space-y-3"> |
|
36
|
{% for field in fields %} |
|
37
|
<div class="rounded-lg bg-gray-800 border border-gray-700"> |
|
38
|
<div class="px-5 py-4"> |
|
39
|
<div class="flex items-start justify-between gap-4"> |
|
40
|
<div class="flex-1 min-w-0"> |
|
41
|
<div class="flex items-center gap-3 mb-1"> |
|
42
|
<span class="text-sm font-medium text-gray-100">{{ field.label }}</span> |
|
43
|
<span class="inline-flex rounded-full bg-gray-700 px-2 py-0.5 text-xs font-semibold text-gray-400">{{ field.get_field_type_display }}</span> |
|
44
|
{% if field.is_required %} |
|
45
|
<span class="inline-flex rounded-full bg-red-900/50 px-2 py-0.5 text-xs font-semibold text-red-300">Required</span> |
|
46
|
{% endif %} |
|
47
|
</div> |
|
48
|
<div class="flex items-center gap-3 text-xs text-gray-500 mt-1"> |
|
49
|
<span>Name: <code class="text-gray-400">{{ field.name }}</code></span> |
|
50
|
<span>Order: {{ field.sort_order }}</span> |
|
51
|
{% if field.choices %} |
|
52
|
<span>{{ field.choices_list|length }} choice{{ field.choices_list|length|pluralize }}</span> |
|
53
|
{% endif %} |
|
54
|
</div> |
|
55
|
</div> |
|
56
|
<div class="flex items-center gap-2 flex-shrink-0"> |
|
57
|
<a href="{% url 'fossil:ticket_field_edit' slug=project.slug pk=field.pk %}" |
|
58
|
class="text-xs text-gray-400 hover:text-brand-light">Edit</a> |
|
59
|
<form method="post" action="{% url 'fossil:ticket_field_delete' slug=project.slug pk=field.pk %}" |
|
60
|
class="inline" onsubmit="return confirm('Delete this custom field?')"> |
|
61
|
{% csrf_token %} |
|
62
|
<button type="submit" class="text-xs text-red-400 hover:text-red-300">Delete</button> |
|
63
|
</form> |
|
64
|
</div> |
|
65
|
</div> |
|
66
|
</div> |
|
67
|
</div> |
|
68
|
{% endfor %} |
|
69
|
</div> |
|
70
|
{% else %} |
|
71
|
<div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center"> |
|
72
|
<p class="text-sm text-gray-500">{% if search %}No fields matching "{{ search }}".{% else %}No custom ticket fields defined.{% endif %}</p> |
|
73
|
{% if not search %} |
|
74
|
<p class="text-xs text-gray-600 mt-1">Custom fields extend the Fossil ticket schema with project-specific data.</p> |
|
75
|
<a href="{% url 'fossil:ticket_field_create' slug=project.slug %}" |
|
76
|
class="mt-3 inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
77
|
Add the first field |
|
78
|
</a> |
|
79
|
{% endif %} |
|
80
|
</div> |
|
81
|
{% endif %} |
|
82
|
{% include "includes/_pagination.html" %} |
|
83
|
</div> |
|
84
|
{% endblock %} |
|
85
|
|