tenseleyflow/shithub / 8452fc6

Browse files

S33: new webhook form template

Authored by espadonne
SHA
8452fc66bdbbb6e516d2b5945097cde7291996ad
Parents
354d828
Tree
b729ce1

1 changed file

StatusFile+-
A internal/web/templates/repo/settings_webhook_new.html 49 0
internal/web/templates/repo/settings_webhook_new.htmladded
@@ -0,0 +1,49 @@
1
+{{ define "page" -}}
2
+<div class="shithub-settings-page">
3
+  {{ template "repo-settings-nav" . }}
4
+  <div class="shithub-settings-content">
5
+    <h1>Add webhook</h1>
6
+    {{ with .Error }}<p class="shithub-flash shithub-flash-error" role="alert">{{ . }}</p>{{ end }}
7
+
8
+    <section class="shithub-settings-section">
9
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks">
10
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
11
+        <label>
12
+          <span>Payload URL</span>
13
+          <input type="text" name="url" required maxlength="2048" value="{{ .Form.URL }}" placeholder="https://example.com/webhook">
14
+          <small>HTTP/HTTPS only. Private/loopback IPs are rejected.</small>
15
+        </label>
16
+        <label>
17
+          <span>Content type</span>
18
+          <select name="content_type">
19
+            <option value="json" {{ if eq .Form.ContentType "json" }}selected{{ end }}>application/json</option>
20
+            <option value="form" {{ if eq .Form.ContentType "form" }}selected{{ end }}>application/x-www-form-urlencoded</option>
21
+          </select>
22
+        </label>
23
+        <label>
24
+          <span>Secret (optional)</span>
25
+          <input type="text" name="secret" maxlength="200" placeholder="auto-generated when blank">
26
+          <small>Used to sign each delivery via HMAC-SHA256.</small>
27
+        </label>
28
+        <label>
29
+          <span>Events (comma-separated; blank = all)</span>
30
+          <input type="text" name="events" value="{{ .EventsCSV }}" placeholder="push, issues, pull_request">
31
+        </label>
32
+        <fieldset class="shithub-settings-fieldset">
33
+          <legend>Options</legend>
34
+          <label class="shithub-settings-checkbox">
35
+            <input type="checkbox" name="active" {{ if .Form.Active }}checked{{ end }}>
36
+            <span>Active</span>
37
+          </label>
38
+          <label class="shithub-settings-checkbox">
39
+            <input type="checkbox" name="ssl_verification" {{ if .Form.SSL }}checked{{ end }}>
40
+            <span>Verify SSL</span>
41
+          </label>
42
+        </fieldset>
43
+        <button type="submit" class="shithub-button shithub-button-primary">Add webhook</button>
44
+        <a href="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks" class="shithub-button">Cancel</a>
45
+      </form>
46
+    </section>
47
+  </div>
48
+</div>
49
+{{- end }}