{% extends "base.html" %}

{% block title %}
	{{ _("Configure Git Update Detection") }} - {{ package.title }}
{% endblock %}

{% block content %}
	<a class="btn btn-secondary float-end" href="/help/update_config/">{{ _("Help") }}</a>
	<h1>{{ _("Configure Git Update Detection") }}</h1>

	<p>
		{{ _("When you push a change to your Git repository, ContentDB can create a new release automatically or send you a reminder.") }}
	</p>

	<p>
		{{ _("ContentDB will poll your Git repository every day, if your package is approved.") }}
		{{ _("You should consider using webhooks or the API for faster releases.") }}
		{{ _("Git Update Detection is clever enough to not create a release again if you've already created it manually or using webhooks/the API.") }}
	</p>

	{% from "macros/forms.html" import render_field, render_submit_field, render_radio_field %}
	<form method="POST" action="">
		{{ form.hidden_tag() }}

		<h3 class="mt-5">{{ _("Trigger") }}</h3>

		<p class="text-muted">
			{{ _("The trigger is the event that triggers the action.") }}
		</p>

		{{ render_radio_field(form.trigger, label_visible=false) }}

		{{ render_field(form.ref, placeholder=_("Leave blank to use default branch"),
				pattern="[A-Za-z0-9/._-]+", class_="mt-3",
				hint=_("Currently, the branch name field is only used by the New Commit trigger.")) }}


		<h3 class="mt-5">{{ _("Action") }}</h3>

		<p class="text-muted">
			{{ _("The action to perform when the trigger happens.") }}
			{{ _("Once a package is marked as outdated, you won't receive any more notifications until it is marked up to date.") }}
		</p>

		{{ render_radio_field(form.action, label_visible=false) }}

		<p class="mt-5 pt-4">
			{{ render_submit_field(form.submit) }}
			{{ render_submit_field(form.disable, class_="btn btn-secondary ms-2") }}
		</p>
	</form>
{% endblock %}
