arche / internal/archesrv/templates/srv_repo_issue.html

commit a22ffc45
  1{{ define "title" }}{{.Repo}} — issue {{.ID}}{{ end }} {{ define "navextra" }}<a
  2  href="/{{.Repo}}"
  3  >{{.Repo}}</a
  4>
  5<a href="/{{.Repo}}/log">log</a> <a href="/{{.Repo}}/tree">tree</a>
  6<a href="/{{.Repo}}/issues">issues</a> <a href="/{{.Repo}}/stacks">stacks</a>
  7<a href="/{{.Repo}}/wiki">wiki</a>{{ end }} {{ define "srv_repo_issue.html" }}{{
  8template "head" . }}
  9<div class="container">
 10  <div style="margin-bottom: 8px">
 11    <a href="/{{.Repo}}/issues" style="font-size: 13px; color: #666"
 12      >← issues</a
 13    >
 14  </div>
 15  <h1 class="repo-name" style="margin-bottom: 6px">{{.Title}}</h1>
 16  <div
 17    class="repo-meta"
 18    style="display: flex; align-items: center; gap: 10px; margin-bottom: 16px"
 19  >
 20    <span>
 21      {{ if eq .Status "open" }}
 22      <span class="badge badge-public">open</span>
 23      {{ else if eq .Status "closed" }}
 24      <span class="badge badge-private">closed</span>
 25      {{ else }}
 26      <span class="badge badge-secret">{{.Status}}</span>
 27      {{ end }}
 28    </span>
 29    <span style="color: #888">{{.ID}}</span>
 30    {{ if .Labels }} {{ range .Labels }}<span class="bookmark-tag">{{.}}</span
 31    >{{ end }} {{ end }} {{ if .User }}
 32    <form method="post" action="/{{.Repo}}/issue/status" style="margin: 0">
 33      <input type="hidden" name="issue_id" value="{{.ID}}" />
 34      {{ if eq .Status "open" }}
 35      <input type="hidden" name="status" value="closed" />
 36      <button
 37        type="submit"
 38        style="background: #c0392b; font-size: 12px; padding: 2px 10px"
 39      >
 40        Close
 41      </button>
 42      {{ else }}
 43      <input type="hidden" name="status" value="open" />
 44      <button
 45        type="submit"
 46        style="background: #27ae60; font-size: 12px; padding: 2px 10px"
 47      >
 48        Reopen
 49      </button>
 50      {{ end }}
 51    </form>
 52    {{ end }}
 53  </div>
 54  {{ if .BodyConflict }}
 55  <div
 56    style="
 57      border: 2px solid #e67e22;
 58      border-radius: 3px;
 59      margin-bottom: 24px;
 60      background: #fef9ec;
 61    "
 62  >
 63    <div
 64      style="
 65        background: #e67e22;
 66        color: #fff;
 67        padding: 6px 14px;
 68        font-size: 13px;
 69        font-weight: bold;
 70      "
 71    >
 72      ⚠ Body conflict — two concurrent edits exist. Choose one to resolve.
 73    </div>
 74    <div style="display: flex; gap: 0">
 75      <div style="flex: 1; border-right: 1px solid #e0c08a; padding: 12px 14px">
 76        <div
 77          style="
 78            font-size: 11px;
 79            font-weight: bold;
 80            color: #888;
 81            margin-bottom: 8px;
 82            text-transform: uppercase;
 83          "
 84        >
 85          Our version
 86        </div>
 87        <pre
 88          style="
 89            margin: 0;
 90            white-space: pre-wrap;
 91            font-size: 13px;
 92            line-height: 1.5;
 93          "
 94        >
 95{{.BodyConflict.OurEdit}}</pre
 96        >
 97        {{ if .User }}
 98        <form
 99          method="post"
100          action="/{{.Repo}}/issue/resolve-body"
101          style="margin-top: 10px"
102        >
103          <input type="hidden" name="issue_id" value="{{.ID}}" />
104          <input type="hidden" name="choice" value="ours" />
105          <button
106            type="submit"
107            style="background: #27ae60; font-size: 12px; padding: 3px 12px"
108          >
109            Use ours
110          </button>
111        </form>
112        {{ end }}
113      </div>
114      <div style="flex: 1; padding: 12px 14px">
115        <div
116          style="
117            font-size: 11px;
118            font-weight: bold;
119            color: #888;
120            margin-bottom: 8px;
121            text-transform: uppercase;
122          "
123        >
124          Their version
125        </div>
126        <pre
127          style="
128            margin: 0;
129            white-space: pre-wrap;
130            font-size: 13px;
131            line-height: 1.5;
132          "
133        >
134{{.BodyConflict.TheirEdit}}</pre
135        >
136        {{ if .User }}
137        <form
138          method="post"
139          action="/{{.Repo}}/issue/resolve-body"
140          style="margin-top: 10px"
141        >
142          <input type="hidden" name="issue_id" value="{{.ID}}" />
143          <input type="hidden" name="choice" value="theirs" />
144          <button
145            type="submit"
146            style="background: #2980b9; font-size: 12px; padding: 3px 12px"
147          >
148            Use theirs
149          </button>
150        </form>
151        {{ end }}
152      </div>
153    </div>
154  </div>
155  {{ else if .Body }}
156  <div
157    style="
158      background: #f8f8f8;
159      border: 1px solid #ddd;
160      border-radius: 3px;
161      padding: 12px 16px;
162      margin-bottom: 24px;
163      white-space: pre-wrap;
164      font-size: 13px;
165      line-height: 1.5;
166    "
167  >
168    {{.Body}}
169  </div>
170  {{ end }} {{ if .Comments }}
171  <h3 style="font-size: 14px; color: #555; margin-bottom: 10px">Comments</h3>
172  {{ range .Comments }}
173  <div
174    style="border: 1px solid #e0e0e0; border-radius: 3px; margin-bottom: 12px"
175  >
176    <div
177      style="
178        background: #f4f4f4;
179        padding: 6px 12px;
180        font-size: 12px;
181        color: #555;
182        border-bottom: 1px solid #e0e0e0;
183      "
184    >
185      <strong>{{.Author}}</strong>
186    </div>
187    <div
188      style="
189        padding: 10px 12px;
190        white-space: pre-wrap;
191        font-size: 13px;
192        line-height: 1.5;
193      "
194    >
195      {{.Text}}
196    </div>
197  </div>
198  {{ end }} {{ end }} {{ if .User }}
199  <h3
200    style="font-size: 14px; color: #555; margin-bottom: 10px; margin-top: 24px"
201  >
202    Add comment
203  </h3>
204  <form method="post" action="/{{.Repo}}/issue/comment">
205    <input type="hidden" name="issue_id" value="{{.ID}}" />
206    <div class="field">
207      <textarea
208        name="text"
209        rows="4"
210        required
211        style="
212          width: 500px;
213          padding: 6px 8px;
214          border: 1px solid #ccc;
215          border-radius: 3px;
216          font-family: monospace;
217          font-size: 13px;
218        "
219        placeholder="Leave a comment…"
220      ></textarea>
221    </div>
222    <button type="submit">Comment</button>
223  </form>
224  {{ end }}
225</div>
226{{ template "foot" . }} {{ end }}