tenseleyflow/shithub / fd19ea2

Browse files

S32: refactor danger-zone settings into the new shell

Authored by espadonne
SHA
fd19ea2c9bad067b18468e825fc4099e631e50e2
Parents
741419c
Tree
2d8220d

1 changed file

StatusFile+-
M internal/web/templates/repo/settings.html 73 72
internal/web/templates/repo/settings.htmlmodified
@@ -1,81 +1,82 @@
11
 {{ define "page" -}}
2
-<section class="shithub-repo-settings">
3
-  <header>
4
-    <h1>Settings · <a href="/{{ .Owner }}/{{ .Repo.Name }}">{{ .Owner }}/{{ .Repo.Name }}</a></h1>
5
-    <p class="shithub-repo-settings-note">Danger-zone actions only. Full settings UI ships in a later sprint.</p>
6
-  </header>
2
+<div class="shithub-settings-page">
3
+  {{ template "repo-settings-nav" . }}
4
+  <div class="shithub-settings-content">
5
+    <h1>Danger zone</h1>
6
+    <p class="shithub-repo-settings-note">Repo-wide actions that change ownership, visibility, or destroy data.</p>
77
 
8
-  <section class="shithub-danger-zone">
9
-    <h2>Rename</h2>
10
-    <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/rename">
11
-      <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
12
-      <label>New name <input type="text" name="new_name" pattern="[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9_])?" required></label>
13
-      <button type="submit" class="shithub-button shithub-button-primary">Rename</button>
14
-    </form>
15
-    <p class="shithub-hint">5 renames allowed per 30 days. Old URLs 301-redirect.</p>
16
-  </section>
8
+    <section class="shithub-danger-zone">
9
+      <h2>Rename</h2>
10
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/rename">
11
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
12
+        <label>New name <input type="text" name="new_name" pattern="[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9_])?" required></label>
13
+        <button type="submit" class="shithub-button shithub-button-primary">Rename</button>
14
+      </form>
15
+      <p class="shithub-hint">5 renames allowed per 30 days. Old URLs 301-redirect.</p>
16
+    </section>
1717
 
18
-  <section class="shithub-danger-zone">
19
-    <h2>Visibility</h2>
20
-    <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/visibility">
21
-      <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
22
-      <label><input type="radio" name="visibility" value="public" {{ if eq (printf "%s" .Repo.Visibility) "public" }}checked{{ end }}> Public</label>
23
-      <label><input type="radio" name="visibility" value="private" {{ if eq (printf "%s" .Repo.Visibility) "private" }}checked{{ end }}> Private</label>
24
-      <button type="submit" class="shithub-button">Update visibility</button>
25
-    </form>
26
-    <p class="shithub-hint">Existing clones already pulled stay where they are; visibility flips affect future clones.</p>
27
-  </section>
18
+    <section class="shithub-danger-zone">
19
+      <h2>Visibility</h2>
20
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/visibility">
21
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
22
+        <label><input type="radio" name="visibility" value="public" {{ if eq (printf "%s" .Repo.Visibility) "public" }}checked{{ end }}> Public</label>
23
+        <label><input type="radio" name="visibility" value="private" {{ if eq (printf "%s" .Repo.Visibility) "private" }}checked{{ end }}> Private</label>
24
+        <button type="submit" class="shithub-button">Update visibility</button>
25
+      </form>
26
+      <p class="shithub-hint">Existing clones already pulled stay where they are; visibility flips affect future clones.</p>
27
+    </section>
2828
 
29
-  <section class="shithub-danger-zone">
30
-    <h2>Archive</h2>
31
-    {{ if .Repo.IsArchived }}
32
-    <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/unarchive">
33
-      <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
34
-      <button type="submit" class="shithub-button">Unarchive</button>
35
-    </form>
36
-    {{ else }}
37
-    <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/archive">
38
-      <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
39
-      <button type="submit" class="shithub-button">Archive (read-only)</button>
40
-    </form>
41
-    {{ end }}
42
-  </section>
29
+    <section class="shithub-danger-zone">
30
+      <h2>Archive</h2>
31
+      {{ if .Repo.IsArchived }}
32
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/unarchive">
33
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
34
+        <button type="submit" class="shithub-button">Unarchive</button>
35
+      </form>
36
+      {{ else }}
37
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/archive">
38
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
39
+        <button type="submit" class="shithub-button">Archive (read-only)</button>
40
+      </form>
41
+      {{ end }}
42
+    </section>
4343
 
44
-  <section class="shithub-danger-zone">
45
-    <h2>Transfer ownership</h2>
46
-    <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/transfer">
47
-      <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
48
-      <label>Recipient username <input type="text" name="to_user" required></label>
49
-      <label>Type <code>{{ .Owner }}/{{ .Repo.Name }}</code> to confirm
50
-        <input type="text" name="confirm" required></label>
51
-      <button type="submit" class="shithub-button shithub-button-danger">Send transfer offer</button>
52
-    </form>
53
-    {{ if .Transfers }}
54
-    <h3>Transfer history</h3>
55
-    <ul>
56
-      {{ range .Transfers }}
57
-      <li>#{{ .ID }} · status {{ .Status }} · expires {{ relativeTime .ExpiresAt.Time }}
58
-        {{ if eq (printf "%s" .Status) "pending" }}
59
-        <form method="POST" action="/transfers/{{ .ID }}/cancel" style="display:inline">
60
-          <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
61
-          <button type="submit" class="shithub-button">Cancel</button>
62
-        </form>
44
+    <section class="shithub-danger-zone">
45
+      <h2>Transfer ownership</h2>
46
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/transfer">
47
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
48
+        <label>Recipient username <input type="text" name="to_user" required></label>
49
+        <label>Type <code>{{ .Owner }}/{{ .Repo.Name }}</code> to confirm
50
+          <input type="text" name="confirm" required></label>
51
+        <button type="submit" class="shithub-button shithub-button-danger">Send transfer offer</button>
52
+      </form>
53
+      {{ if .Transfers }}
54
+      <h3>Transfer history</h3>
55
+      <ul>
56
+        {{ range .Transfers }}
57
+        <li>#{{ .ID }} · status {{ .Status }} · expires {{ relativeTime .ExpiresAt.Time }}
58
+          {{ if eq (printf "%s" .Status) "pending" }}
59
+          <form method="POST" action="/transfers/{{ .ID }}/cancel" style="display:inline">
60
+            <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
61
+            <button type="submit" class="shithub-button">Cancel</button>
62
+          </form>
63
+          {{ end }}
64
+        </li>
6365
         {{ end }}
64
-      </li>
66
+      </ul>
6567
       {{ end }}
66
-    </ul>
67
-    {{ end }}
68
-  </section>
68
+    </section>
6969
 
70
-  <section class="shithub-danger-zone shithub-danger-zone-final">
71
-    <h2>Delete repository</h2>
72
-    <p>Soft-delete with 7-day grace. Until the grace expires you can restore from <a href="/settings/repositories">Restore deleted repositories</a>.</p>
73
-    <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/delete">
74
-      <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
75
-      <label>Type <code>{{ .Owner }}/{{ .Repo.Name }}</code> to confirm
76
-        <input type="text" name="confirm" required></label>
77
-      <button type="submit" class="shithub-button shithub-button-danger">Delete</button>
78
-    </form>
79
-  </section>
80
-</section>
70
+    <section class="shithub-danger-zone shithub-danger-zone-final">
71
+      <h2>Delete repository</h2>
72
+      <p>Soft-delete with 7-day grace. Until the grace expires you can restore from <a href="/settings/repositories">Restore deleted repositories</a>.</p>
73
+      <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/delete">
74
+        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
75
+        <label>Type <code>{{ .Owner }}/{{ .Repo.Name }}</code> to confirm
76
+          <input type="text" name="confirm" required></label>
77
+        <button type="submit" class="shithub-button shithub-button-danger">Delete</button>
78
+      </form>
79
+    </section>
80
+  </div>
81
+</div>
8182
 {{- end }}