FossilRepo

fossilrepo / templates / fossil / branch_protection_form.html
1
{% extends "base.html" %}
2
{% block title %}{{ form_title }} — {{ 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="mb-4">
9
<a href="{% url 'fossil:branch_protections' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">&larr; Back to Branch Protection</a>
10
</div>
11
12
<div class="mx-auto max-w-3xl">
13
<h2 class="text-xl font-bold text-gray-100 mb-4">{{ form_title }}</h2>
14
15
<form method="post" class="space-y-4 rounded-lg bg-gray-800 p-6 shadow border border-gray-700">
16
{% csrf_token %}
17
18
<div>
19
<label class="block text-sm font-medium text-gray-300 mb-1">Branch Pattern <span class="text-red-400">*</span></label>
20
<input type="text" name="branch_pattern" required
21
placeholder="e.g., trunk, release-*"
22
value="{% if rule %}{{ rule.branch_pattern }}{% endif %}"
23
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono">
24
<p class="mt-1 text-xs text-gray-500">Branch name or glob pattern. Use <code class="text-gray-400">*</code> for wildcards.</p>
25
</div>
26
27
<div class="space-y-3">
28
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
29
<input type="checkbox" name="restrict_push"
30
{% if rule %}{% if rule.restrict_push %}checked{% endif %}{% else %}checked{% endif %}
31
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
32
Restrict push (admin only)
33
</label>
34
<p class="text-xs text-gray-500 ml-6">Only project admins can push to matching branches.</p>
35
36
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
37
<input type="checkbox" name="require_status_checks"
38
{% if rule and rule.require_status_checks %}checked{% endif %}
39
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
40
Require status checks to pass
41
</label>
42
<p class="text-xs text-gray-500 ml-6">All required CI contexts must report success before merging.</p>
43
</div>
44
45
<div>
46
<label class="block text-sm font-medium text-gray-300 mb-1">Required CI Contexts</label>
47
<textarea name="required_contexts" rows="3"
48
placeholder="ci/tests&#10;ci/lint&#10;ci/build"
49
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono">{% if rule %}{{ rule.required_contexts }}{% endif %}</textarea>
50
<p class="mt-1 text-xs text-gray-500">One CI context per line. These must report success before merging is allowed.</p>
51
</div>
52
53
<div class="flex justify-end gap-3 pt-2">
54
<a href="{% url 'fossil:branch_protections' slug=project.slug %}"
55
class="rounded-md bg-gray-700 px-4 py-2 text-sm font-semibold text-gray-100 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-600">
56
Cancel
57
</a>
58
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover">
59
{{ submit_label }}
60
</button>
61
</div>
62
</form>
63
</div>
64
{% endblock %}
65

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button