@@ -83,5 +83,54 @@
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{# Notification preferences #}
|
||||
<div class="mb-12">
|
||||
<h2 class="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4">Notification preferences</h2>
|
||||
<p class="text-sm text-gray-500 mb-4">Choose which events trigger notifications on each channel.</p>
|
||||
<div class="border border-gray-200 rounded-lg overflow-hidden">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="bg-gray-50 border-b border-gray-200">
|
||||
<th class="text-left px-4 py-3 font-medium text-gray-700">Event</th>
|
||||
<th class="text-center px-4 py-3 font-medium text-gray-700 w-24">CLI</th>
|
||||
<th class="text-center px-4 py-3 font-medium text-gray-700 w-24">Slack</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
{% set event_types = [
|
||||
{"key": "NOTIFICATION_TYPE_RELEASE_ANNOTATED", "label": "Release annotated"},
|
||||
{"key": "NOTIFICATION_TYPE_RELEASE_STARTED", "label": "Release started"},
|
||||
{"key": "NOTIFICATION_TYPE_RELEASE_SUCCEEDED", "label": "Release succeeded"},
|
||||
{"key": "NOTIFICATION_TYPE_RELEASE_FAILED", "label": "Release failed"},
|
||||
] %}
|
||||
{% set channels = [
|
||||
{"key": "NOTIFICATION_CHANNEL_CLI", "label": "CLI"},
|
||||
{"key": "NOTIFICATION_CHANNEL_SLACK", "label": "Slack"},
|
||||
] %}
|
||||
{% for event in event_types %}
|
||||
<tr>
|
||||
<td class="px-4 py-3 text-gray-700">{{ event.label }}</td>
|
||||
{% for ch in channels %}
|
||||
{% set pref_key = event.key ~ "|" ~ ch.key %}
|
||||
{% set is_enabled = pref_key in enabled_prefs %}
|
||||
<td class="text-center px-4 py-3">
|
||||
<form method="POST" action="/settings/account/notifications" class="inline">
|
||||
<input type="hidden" name="_csrf" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="notification_type" value="{{ event.key }}">
|
||||
<input type="hidden" name="channel" value="{{ ch.key }}">
|
||||
<input type="hidden" name="enabled" value="{{ 'false' if is_enabled else 'true' }}">
|
||||
<button type="submit" class="w-8 h-5 rounded-full relative transition-colors {{ 'bg-gray-900' if is_enabled else 'bg-gray-300' }}" title="{{ 'Disable' if is_enabled else 'Enable' }} {{ event.label | lower }} via {{ ch.label }}">
|
||||
<span class="block w-3.5 h-3.5 rounded-full bg-white shadow-sm absolute top-0.5 transition-all {{ 'left-[calc(100%-1.125rem)]' if is_enabled else 'left-0.5' }}"></span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user