tenseleyflow/shithub / ce07b86

Browse files

S11: templates for repo/new + repo/empty (clone URLs, quick-setup snippet)

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
ce07b8679c34ce4df98348bc9ac4f5c5bcb57e74
Parents
6341769
Tree
0914194

3 changed files

StatusFile+-
M internal/web/static/css/shithub.css 112 0
A internal/web/templates/repo/empty.html 40 0
A internal/web/templates/repo/new.html 78 0
internal/web/static/css/shithub.cssmodified
@@ -640,3 +640,115 @@ code {
640640
 }
641641
 .shithub-session-meta dt { color: var(--fg-muted); font-weight: 500; }
642642
 .shithub-session-meta dd { margin: 0; word-break: break-all; }
643
+
644
+/* ----- repo create + empty home (S11) ----- */
645
+.shithub-repo-new {
646
+  max-width: 56rem;
647
+  margin: 2rem auto;
648
+  padding: 0 1rem;
649
+}
650
+.shithub-repo-new h1 {
651
+  margin: 0 0 0.5rem;
652
+  font-size: 1.5rem;
653
+  font-weight: 400;
654
+}
655
+.shithub-repo-new-lede {
656
+  margin: 0 0 1.5rem;
657
+  color: var(--fg-muted);
658
+  padding-bottom: 1rem;
659
+  border-bottom: 1px solid var(--border-default);
660
+}
661
+.shithub-repo-new-form {
662
+  display: grid;
663
+  gap: 1.25rem;
664
+  max-width: 36rem;
665
+}
666
+.shithub-repo-new-form label { display: grid; gap: 0.25rem; font-weight: 500; font-size: 0.9rem; }
667
+.shithub-repo-new-form input[type=text],
668
+.shithub-repo-new-form select {
669
+  font: inherit;
670
+  padding: 0.5rem 0.75rem;
671
+  border: 1px solid var(--border-default);
672
+  border-radius: 6px;
673
+  background: var(--canvas-subtle);
674
+}
675
+.shithub-repo-new-form em { color: #cf222e; font-style: normal; }
676
+.shithub-repo-new-form small { font-weight: 400; color: var(--fg-muted); font-size: 0.8rem; }
677
+
678
+.shithub-repo-new-visibility, .shithub-repo-new-init {
679
+  border: none;
680
+  padding: 0;
681
+  margin: 0;
682
+  display: grid;
683
+  gap: 0.5rem;
684
+}
685
+.shithub-repo-new-visibility legend, .shithub-repo-new-init legend {
686
+  padding: 0;
687
+  font-size: 0.85rem;
688
+  font-weight: 600;
689
+  margin-bottom: 0.5rem;
690
+}
691
+.shithub-repo-new-vis-card,
692
+.shithub-repo-new-init-row {
693
+  display: grid;
694
+  grid-template-columns: max-content 1fr;
695
+  gap: 0.75rem;
696
+  padding: 0.75rem 1rem;
697
+  border: 1px solid var(--border-default);
698
+  border-radius: 6px;
699
+  background: var(--canvas-subtle);
700
+}
701
+.shithub-repo-new-vis-card.active { border-color: var(--accent-emphasis); }
702
+.shithub-repo-new-vis-card strong,
703
+.shithub-repo-new-init-row strong { display: block; font-size: 0.95rem; }
704
+.shithub-repo-new-vis-card small,
705
+.shithub-repo-new-init-row small { display: block; color: var(--fg-muted); font-size: 0.85rem; }
706
+
707
+.shithub-repo-empty {
708
+  max-width: 56rem;
709
+  margin: 2rem auto;
710
+  padding: 0 1rem;
711
+}
712
+.shithub-repo-empty-head h1 {
713
+  margin: 0 0 0.5rem;
714
+  font-size: 1.4rem;
715
+  font-weight: 400;
716
+  display: flex;
717
+  align-items: center;
718
+  gap: 0.4rem;
719
+}
720
+.shithub-repo-empty-sep { color: var(--fg-muted); }
721
+.shithub-repo-empty-desc {
722
+  margin: 0 0 1rem;
723
+  color: var(--fg-muted);
724
+}
725
+.shithub-pill-private { background: rgba(187, 128, 9, 0.15); border-color: rgba(187, 128, 9, 0.4); }
726
+.shithub-repo-empty-quickstart {
727
+  margin-top: 1rem;
728
+  padding: 1.25rem;
729
+  border: 1px solid var(--border-default);
730
+  border-radius: 8px;
731
+  background: var(--canvas-subtle);
732
+}
733
+.shithub-repo-empty-quickstart h2 { margin: 0 0 0.5rem; font-size: 1rem; }
734
+.shithub-repo-empty-quickstart h3 { margin: 1.25rem 0 0.5rem; font-size: 0.9rem; font-weight: 600; }
735
+.shithub-repo-empty-clone { display: grid; gap: 0.5rem; margin: 0.75rem 0; }
736
+.shithub-repo-empty-clone label { display: grid; grid-template-columns: 70px 1fr; gap: 0.5rem; align-items: center; }
737
+.shithub-repo-empty-clone span { font-size: 0.8rem; color: var(--fg-muted); font-weight: 600; }
738
+.shithub-repo-empty-clone input {
739
+  font: inherit;
740
+  font-family: monospace;
741
+  font-size: 0.85rem;
742
+  padding: 0.5rem 0.75rem;
743
+  border: 1px solid var(--border-default);
744
+  border-radius: 6px;
745
+  background: var(--canvas-default);
746
+}
747
+.shithub-repo-empty-quickstart pre {
748
+  padding: 0.75rem 1rem;
749
+  border: 1px solid var(--border-default);
750
+  border-radius: 6px;
751
+  background: var(--canvas-default);
752
+  font-size: 0.85rem;
753
+  overflow-x: auto;
754
+}
internal/web/templates/repo/empty.htmladded
@@ -0,0 +1,40 @@
1
+{{ define "page" -}}
2
+<section class="shithub-repo-empty">
3
+  <header class="shithub-repo-empty-head">
4
+    <h1>
5
+      <a href="/{{ .Owner }}">{{ .Owner }}</a>
6
+      <span class="shithub-repo-empty-sep">/</span>
7
+      <a href="/{{ .Owner }}/{{ .Repo.Name }}">{{ .Repo.Name }}</a>
8
+      {{ if eq (printf "%s" .Repo.Visibility) "private" }}
9
+        <span class="shithub-pill shithub-pill-private">private</span>
10
+      {{ else }}
11
+        <span class="shithub-pill">public</span>
12
+      {{ end }}
13
+    </h1>
14
+    {{ if .Repo.Description }}<p class="shithub-repo-empty-desc">{{ .Repo.Description }}</p>{{ end }}
15
+  </header>
16
+
17
+  <div class="shithub-repo-empty-quickstart">
18
+    <h2>Quick setup — if you've done this kind of thing before</h2>
19
+    <p>Get started by setting up a new repository on your machine and pushing it here.</p>
20
+
21
+    <div class="shithub-repo-empty-clone">
22
+      <label>
23
+        <span>HTTPS</span>
24
+        <input type="text" readonly value="{{ .HTTPSCloneURL }}" onclick="this.select()">
25
+      </label>
26
+      {{ if .SSHEnabled }}
27
+      <label>
28
+        <span>SSH</span>
29
+        <input type="text" readonly value="{{ .SSHCloneURL }}" onclick="this.select()">
30
+      </label>
31
+      {{ end }}
32
+    </div>
33
+
34
+    <h3>…or push an existing repository from the command line</h3>
35
+    <pre><code>git remote add origin {{ .HTTPSCloneURL }}
36
+git branch -M {{ .DefaultBranch }}
37
+git push -u origin {{ .DefaultBranch }}</code></pre>
38
+  </div>
39
+</section>
40
+{{- end }}
internal/web/templates/repo/new.htmladded
@@ -0,0 +1,78 @@
1
+{{ define "page" -}}
2
+<section class="shithub-repo-new">
3
+  <h1>Create a new repository</h1>
4
+  <p class="shithub-repo-new-lede">A repository contains all project files, including the revision history.</p>
5
+
6
+  {{ with .Error }}<p class="shithub-flash shithub-flash-error" role="alert">{{ . }}</p>{{ end }}
7
+
8
+  <form method="POST" action="/new" novalidate class="shithub-repo-new-form">
9
+    <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
10
+
11
+    <div class="shithub-repo-new-row">
12
+      <label class="shithub-repo-new-name">
13
+        <span>Repository name <em>*</em></span>
14
+        <input type="text" name="name" required maxlength="100" autocomplete="off"
15
+               spellcheck="false" pattern="^[a-z0-9](?:[a-z0-9._-]{0,98}[a-z0-9_])?$"
16
+               value="{{ .Form.Name }}">
17
+        <small>Lowercase letters, digits, dots, hyphens, underscores. 1–100 characters.</small>
18
+      </label>
19
+    </div>
20
+
21
+    <label>
22
+      <span>Description <small>(optional)</small></span>
23
+      <input type="text" name="description" maxlength="350" value="{{ .Form.Description }}">
24
+    </label>
25
+
26
+    <fieldset class="shithub-repo-new-visibility">
27
+      <legend>Visibility</legend>
28
+      <label class="shithub-repo-new-vis-card{{ if eq .Form.Visibility "public" }} active{{ end }}">
29
+        <input type="radio" name="visibility" value="public"{{ if eq .Form.Visibility "public" }} checked{{ end }}>
30
+        <span>
31
+          <strong>Public</strong>
32
+          <small>Anyone on the internet can see this repository. You choose who can commit.</small>
33
+        </span>
34
+      </label>
35
+      <label class="shithub-repo-new-vis-card{{ if eq .Form.Visibility "private" }} active{{ end }}">
36
+        <input type="radio" name="visibility" value="private"{{ if eq .Form.Visibility "private" }} checked{{ end }}>
37
+        <span>
38
+          <strong>Private</strong>
39
+          <small>You choose who can see and commit to this repository.</small>
40
+        </span>
41
+      </label>
42
+    </fieldset>
43
+
44
+    <fieldset class="shithub-repo-new-init">
45
+      <legend>Initialize this repository with</legend>
46
+      <label class="shithub-repo-new-init-row">
47
+        <input type="checkbox" name="init_readme" value="on"{{ if .Form.InitReadme }} checked{{ end }}>
48
+        <span>
49
+          <strong>Add a README file</strong>
50
+          <small>This is where you can write a long description for your project.</small>
51
+        </span>
52
+      </label>
53
+      <label>
54
+        <span>Add .gitignore</span>
55
+        <select name="gitignore">
56
+          <option value="">None</option>
57
+          {{ $picked := .Form.Gitignore }}
58
+          {{ range .Gitignores }}
59
+          <option value="{{ . }}"{{ if eq . $picked }} selected{{ end }}>{{ . }}</option>
60
+          {{ end }}
61
+        </select>
62
+      </label>
63
+      <label>
64
+        <span>Choose a license</span>
65
+        <select name="license">
66
+          <option value="">None</option>
67
+          {{ $picked := .Form.License }}
68
+          {{ range .Licenses }}
69
+          <option value="{{ . }}"{{ if eq . $picked }} selected{{ end }}>{{ . }}</option>
70
+          {{ end }}
71
+        </select>
72
+      </label>
73
+    </fieldset>
74
+
75
+    <button type="submit" class="shithub-button shithub-button-primary">Create repository</button>
76
+  </form>
77
+</section>
78
+{{- end }}