repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
4015eb8
parent
2b627eb
author
Eric Bower
date
2024-10-22 23:30:51 -0400 EDT
style: pr detail
6 files changed,  +53, -27
M Makefile
+6, -3
 1@@ -26,12 +26,15 @@ bp-setup:
 2 	$(DOCKER_CMD) buildx use pico
 3 .PHONY: bp-setup
 4 
 5-bp: bp-setup
 6-	$(DOCKER_BUILDX_BUILD) -t "ghcr.io/picosh/pico/git-ssh:$(DOCKER_TAG)" --target release-ssh .
 7+bp-web: bp-setup
 8 	$(DOCKER_BUILDX_BUILD) -t "ghcr.io/picosh/pico/git-web:$(DOCKER_TAG)" --target release-web .
 9+.PHONY: bp-web
10+
11+bp: bp-web
12+	$(DOCKER_BUILDX_BUILD) -t "ghcr.io/picosh/pico/git-ssh:$(DOCKER_TAG)" --target release-ssh .
13 .PHONY: bp
14 
15-deploy: bp
16+deploy: bp-web
17 	ssh ppipe pub git-pr-deploy -e
18 .PHONY: deploy
19 
M static/git-pr.css
+24, -0
 1@@ -1,3 +1,8 @@
 2+body {
 3+  padding-left: 1rem;
 4+  padding-right: 1rem;
 5+}
 6+
 7 table, tr {
 8   border-spacing: 0;
 9 }
10@@ -36,8 +41,27 @@ details {
11   padding: 0.5rem 0.75rem;
12 }
13 
14+.max-w {
15+  max-width: calc(100% - 300px);
16+}
17+
18 @media only screen and (max-width: 40em) {
19   .collapse {
20     flex-direction: column;
21   }
22+
23+  .collapse > div {
24+    width: 100% !important;
25+    max-width: 100% !important;
26+  }
27+
28+  body {
29+    padding-top: var(--line-height);
30+    padding-left: 0.5rem;
31+    padding-right: 0.5rem;
32+  }
33+
34+  pre {
35+    padding: var(--grid-height) 0;
36+  }
37 }
M tmpl/base.html
+1, -1
1@@ -14,6 +14,6 @@
2     <link rel="stylesheet" href="/static/vars.css" />
3     <link rel="stylesheet" href="/syntax.css" />
4   </head>
5-  <body class="px-2">{{template "body" .}}</body>
6+  <body>{{template "body" .}}</body>
7 </html>
8 {{end}}
M tmpl/patchset.html
+20, -16
 1@@ -9,23 +9,21 @@
 2       {{range $patch := .Patches}}
 3         <div class="box group">
 4           <div>
 5-            <h3 class="text-lg transform-none m-0 p-0 mb">
 6+            <h3 class="text-lg text-transform-none m-0 p-0 mb">
 7               {{if $patch.Review}}<code class="pill-review">REVIEW</code>{{end}}
 8               <a href="#{{$patch.Url}}">{{$patch.Title}}</a>
 9             </h3>
10 
11-            <div class="group-h text-sm justify-between">
12-              <div class="flex-1">
13-                <code class="pill{{if $patch.Review}}-review{{end}}">{{$patch.AuthorName}} &lt;{{$patch.AuthorEmail}}&gt;</code>
14+            <div class="flex justify-between items-center text-sm">
15+              <div>
16+                <code class="{{if $patch.Review}}pill-review{{end}}">{{$patch.AuthorName}}</code>
17               </div>
18               <date>{{$patch.FormattedAuthorDate}}</date>
19             </div>
20           </div>
21 
22-          {{if $patch.Body}}<pre class="m-0">{{$patch.Body}}</pre>{{end}}
23-
24           {{range $patch.PatchFiles}}
25-            <div class="flex justify-between">
26+            <div class="flex justify-between items-center">
27               <a class="flex-1" href="#patch-{{$patch.ID}}-{{.NewName}}">{{.NewName}}</a>
28               <div class="flex gap">
29                 <code class="pill-success">+{{.Adds}}</code>
30@@ -41,21 +39,27 @@
31       {{end}}
32     </div>
33 
34-    <div class="flex-1">
35+    <div class="max-w flex-1">
36       {{range $patch := .Patches}}
37-        <div id="{{$patch.Url}}">
38-          <h3 class="text-lg transform-none"><a href="#{{$patch.Url}}">{{$patch.Title}}</a></h3>
39+        <div class="group" id="{{$patch.Url}}">
40+          <h3 class="text-lg text-transform-none"><a href="#{{$patch.Url}}">{{$patch.Title}}</a></h3>
41+
42+          {{if $patch.Body}}<pre class="w-full">{{$patch.Body}}</pre>{{end}}
43+
44           {{range $patch.PatchFiles}}
45-            <div class="group-h" id="patch-{{$patch.ID}}-{{.NewName}}">
46-              <a href="#patch-{{$patch.ID}}-{{.NewName}}">{{.NewName}}</a>
47-              <div class="flex gap">
48-                <code class="pill-success">+{{.Adds}}</code>
49-                <code class="pill-admin">-{{.Dels}}</code>
50+            <div>
51+              <div class="group-h" id="patch-{{$patch.ID}}-{{.NewName}}">
52+                <a href="#patch-{{$patch.ID}}-{{.NewName}}">{{.NewName}}</a>
53+                <div class="flex gap">
54+                  <code class="pill-success">+{{.Adds}}</code>
55+                  <code class="pill-admin">-{{.Dels}}</code>
56+                </div>
57               </div>
58+              <div>{{.DiffText}}</div>
59             </div>
60-            <div>{{.DiffText}}</div>
61           {{end}}
62         </div>
63+        <hr class="my" />
64       {{else}}
65         <div class="box">
66           No patches found for patch request.
M tmpl/pr-detail.html
+0, -6
 1@@ -105,10 +105,4 @@
 2 
 3   {{template "patchset" .}}
 4 </main>
 5-
 6-<hr />
 7-
 8-<footer>
 9-  <a href="/prs/{{.Pr.ID}}/rss">rss</a>
10-</footer>
11 {{end}}
M tmpl/pr-header.html
+2, -1
 1@@ -3,9 +3,10 @@
 2   <h1 class="text-2xl mb">
 3     <a href="{{.Repo.Url}}">{{.Repo.Text}}</a>
 4     <span> / {{.Pr.Title}} <a href="/prs/{{.Pr.ID}}"><code>#{{.Pr.ID}}</code></a></span>
 5+    <a class="text-sm" href="/prs/{{.Pr.ID}}/rss">rss</a>
 6   </h1>
 7 
 8-  <div class="text-sm mb">
 9+  <div class="mb">
10     {{template "pr-status" .Pr.Status}}
11     <span>&middot;</span>
12     <span>opened on <date>{{.Pr.Date}}</date> by</span>