| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-repo-page"> |
| 3 | {{ template "repo-header" . }} |
| 4 | <section class="shithub-issue-view"> |
| 5 | <header class="shithub-issue-view-head"> |
| 6 | <div class="shithub-issue-title-row"> |
| 7 | <h1 class="shithub-issue-title"> |
| 8 | <span>{{ .Issue.Title }}</span> |
| 9 | <span class="shithub-issue-num">#{{ .Issue.Number }}</span> |
| 10 | </h1> |
| 11 | <div class="shithub-issue-head-actions"> |
| 12 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/issues/new" class="shithub-button shithub-button-primary">New issue</a> |
| 13 | </div> |
| 14 | </div> |
| 15 | <div class="shithub-issue-meta"> |
| 16 | <span class="shithub-pill shithub-issues-state-{{ printf "%s" .Issue.State }}"> |
| 17 | {{ if eq (printf "%s" .Issue.State) "open" }}{{ octicon "issue-opened" }} Open{{ else }}{{ octicon "issue-closed" }} Closed{{ end }} |
| 18 | </span> |
| 19 | {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 20 | opened this issue |
| 21 | <time datetime="{{ .Issue.CreatedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .Issue.CreatedAt.Time }}</time> |
| 22 | · {{ .CommentCount }} comment{{ if ne .CommentCount 1 }}s{{ end }} |
| 23 | {{ if .Issue.Locked }}<span class="shithub-pill">{{ octicon "lock" }} locked</span>{{ end }} |
| 24 | </div> |
| 25 | </header> |
| 26 | |
| 27 | <div class="shithub-issue-grid"> |
| 28 | <article class="shithub-issue-thread"> |
| 29 | <div class="shithub-comment shithub-issue-body-comment"> |
| 30 | <div class="shithub-comment-head"> |
| 31 | {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 32 | opened |
| 33 | <time datetime="{{ .Issue.CreatedAt.Time.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .Issue.CreatedAt.Time }}</time> |
| 34 | </div> |
| 35 | <div class="shithub-comment-body markdown-body"> |
| 36 | {{ if .Issue.BodyHtmlCached.Valid }}{{ safeHTML .Issue.BodyHtmlCached.String }}{{ else }}<p>{{ .Issue.Body }}</p>{{ end }} |
| 37 | </div> |
| 38 | </div> |
| 39 | |
| 40 | {{ range .Timeline }} |
| 41 | {{ if eq .Type "comment" }} |
| 42 | <div class="shithub-comment"> |
| 43 | <div class="shithub-comment-head"> |
| 44 | {{ if .AuthorName }}<a href="/{{ .AuthorName }}">{{ .AuthorName }}</a>{{ end }} |
| 45 | commented |
| 46 | <time datetime="{{ .CreatedAt.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .CreatedAt }}</time> |
| 47 | </div> |
| 48 | <div class="shithub-comment-body markdown-body"> |
| 49 | {{ if .C.BodyHtmlCached.Valid }}{{ safeHTML .C.BodyHtmlCached.String }}{{ else }}<p>{{ .C.Body }}</p>{{ end }} |
| 50 | </div> |
| 51 | </div> |
| 52 | {{ else }} |
| 53 | <div class="shithub-event {{ if .LinkedState }}shithub-event-linked{{ end }}"> |
| 54 | <span class="shithub-event-icon" aria-hidden="true"> |
| 55 | {{ if eq .E.Kind "closed" }}{{ octicon "issue-closed" }} |
| 56 | {{ else if eq .E.Kind "reopened" }}{{ octicon "issue-opened" }} |
| 57 | {{ else if eq .E.Kind "locked" }}{{ octicon "lock" }} |
| 58 | {{ else if eq .E.Kind "unlocked" }}{{ octicon "unlock" }} |
| 59 | {{ else if or (eq .E.Kind "labeled") (eq .E.Kind "unlabeled") }}{{ octicon "tag" }} |
| 60 | {{ else if or (eq .E.Kind "assigned") (eq .E.Kind "unassigned") }}{{ octicon "person" }} |
| 61 | {{ else if or (eq .E.Kind "milestoned") (eq .E.Kind "demilestoned") }}{{ octicon "milestone" }} |
| 62 | {{ else }}{{ octicon "comment" }}{{ end }} |
| 63 | </span> |
| 64 | <span> |
| 65 | {{ if .ActorName }}<a href="/{{ .ActorName }}">{{ .ActorName }}</a>{{ else }}Someone{{ end }} |
| 66 | {{ if .LabelName }} |
| 67 | {{ if eq .E.Kind "labeled" }}added the{{ else }}removed the{{ end }} |
| 68 | <span class="shithub-label" style="background-color: #{{ .LabelColor }}">{{ .LabelName }}</span> |
| 69 | label |
| 70 | {{ else }} |
| 71 | {{ .Message }} |
| 72 | {{ end }} |
| 73 | <time datetime="{{ .CreatedAt.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .CreatedAt }}</time> |
| 74 | </span> |
| 75 | </div> |
| 76 | {{ end }} |
| 77 | {{ end }} |
| 78 | |
| 79 | {{ if .CanComment }} |
| 80 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/comments" class="shithub-comment-form"> |
| 81 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 82 | <label> |
| 83 | <span>Add a comment</span> |
| 84 | <textarea name="body" rows="6" maxlength="65535" placeholder="Leave a comment"></textarea> |
| 85 | </label> |
| 86 | <div class="shithub-form-actions"> |
| 87 | {{ if .CanSetIssueState }} |
| 88 | {{ if eq (printf "%s" .Issue.State) "open" }} |
| 89 | <button type="submit" name="state" value="closed" class="shithub-button">Close issue</button> |
| 90 | {{ else }} |
| 91 | <button type="submit" name="state" value="open" class="shithub-button">Reopen issue</button> |
| 92 | {{ end }} |
| 93 | {{ end }} |
| 94 | <button type="submit" class="shithub-button shithub-button-primary">Comment</button> |
| 95 | </div> |
| 96 | </form> |
| 97 | {{ else if .CanSetIssueState }} |
| 98 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/state" class="shithub-comment-form"> |
| 99 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 100 | <div class="shithub-form-actions"> |
| 101 | {{ if eq (printf "%s" .Issue.State) "open" }} |
| 102 | <button type="submit" name="state" value="closed" class="shithub-button">Close issue</button> |
| 103 | {{ else }} |
| 104 | <button type="submit" name="state" value="open" class="shithub-button">Reopen issue</button> |
| 105 | {{ end }} |
| 106 | </div> |
| 107 | </form> |
| 108 | {{ else if .Viewer.ID }} |
| 109 | {{ if .Issue.Locked }}<p class="shithub-issue-signedout">This conversation is locked.</p>{{ end }} |
| 110 | {{ else }} |
| 111 | <p class="shithub-issue-signedout"><a href="/login">Sign in</a> to comment.</p> |
| 112 | {{ end }} |
| 113 | </article> |
| 114 | |
| 115 | <aside class="shithub-issue-sidebar"> |
| 116 | <section> |
| 117 | <div class="shithub-sidebar-heading"> |
| 118 | <h3>Assignees</h3> |
| 119 | {{ if .CanEditIssueAssignees }} |
| 120 | <details class="shithub-sidebar-editor"> |
| 121 | <summary aria-label="Edit assignees">{{ octicon "gear" }}</summary> |
| 122 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/assignees" class="shithub-popover"> |
| 123 | <strong>Select assignees</strong> |
| 124 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 125 | <input type="text" name="username" placeholder="Filter assignees" required> |
| 126 | <div class="shithub-form-actions shithub-form-actions-start"> |
| 127 | <button type="submit" name="mode" value="add" class="shithub-button">Add</button> |
| 128 | <button type="submit" name="mode" value="remove" class="shithub-button">Remove</button> |
| 129 | </div> |
| 130 | </form> |
| 131 | </details> |
| 132 | {{ end }} |
| 133 | </div> |
| 134 | {{ if .Assignees }} |
| 135 | {{ range .Assignees }}<a href="/{{ .Username }}">@{{ .Username }}</a>{{ end }} |
| 136 | {{ else }} |
| 137 | <p class="shithub-muted">No one</p> |
| 138 | {{ if and .CanEditIssueAssignees .Viewer.ID }} |
| 139 | {{ if not .ViewerAssigned }} |
| 140 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/assignees" class="shithub-inline-form"> |
| 141 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 142 | <input type="hidden" name="username" value="{{ .Viewer.Username }}"> |
| 143 | <button type="submit" name="mode" value="add" class="shithub-link-button">Assign yourself</button> |
| 144 | </form> |
| 145 | {{ end }} |
| 146 | {{ end }} |
| 147 | {{ end }} |
| 148 | </section> |
| 149 | |
| 150 | <section> |
| 151 | <div class="shithub-sidebar-heading"> |
| 152 | <h3>Labels</h3> |
| 153 | {{ if .CanEditIssueLabels }} |
| 154 | <details class="shithub-sidebar-editor"> |
| 155 | <summary aria-label="Edit labels">{{ octicon "gear" }}</summary> |
| 156 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/labels" class="shithub-popover"> |
| 157 | <strong>Select labels</strong> |
| 158 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 159 | {{ $current := .Labels }} |
| 160 | {{ range .AllLabels }} |
| 161 | {{ $id := .ID }} |
| 162 | <label class="shithub-label-pick"> |
| 163 | <input type="checkbox" name="label_ids" value="{{ .ID }}" |
| 164 | {{ range $current }}{{ if eq .ID $id }}checked{{ end }}{{ end }}> |
| 165 | <span class="shithub-label" style="background-color: #{{ .Color }}">{{ .Name }}</span> |
| 166 | </label> |
| 167 | {{ end }} |
| 168 | <button type="submit" class="shithub-button">Apply</button> |
| 169 | </form> |
| 170 | </details> |
| 171 | {{ end }} |
| 172 | </div> |
| 173 | {{ if .Labels }} |
| 174 | {{ range .Labels }}<span class="shithub-label" style="background-color: #{{ .Color }}">{{ .Name }}</span>{{ end }} |
| 175 | {{ else }}<p class="shithub-muted">No labels</p>{{ end }} |
| 176 | </section> |
| 177 | |
| 178 | <section> |
| 179 | <div class="shithub-sidebar-heading"><h3>Type</h3><span class="shithub-sidebar-icon">{{ octicon "gear" }}</span></div> |
| 180 | <p class="shithub-muted">No type</p> |
| 181 | </section> |
| 182 | |
| 183 | <section> |
| 184 | <div class="shithub-sidebar-heading"><h3>Projects</h3><span class="shithub-sidebar-icon">{{ octicon "gear" }}</span></div> |
| 185 | <p class="shithub-muted">No projects</p> |
| 186 | </section> |
| 187 | |
| 188 | <section> |
| 189 | <div class="shithub-sidebar-heading"> |
| 190 | <h3>Milestone</h3> |
| 191 | {{ if .CanEditIssueMilestone }} |
| 192 | <details class="shithub-sidebar-editor"> |
| 193 | <summary aria-label="Edit milestone">{{ octicon "gear" }}</summary> |
| 194 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/milestone" class="shithub-popover"> |
| 195 | <strong>Select milestone</strong> |
| 196 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 197 | <select name="milestone_id"> |
| 198 | <option value="0">No milestone</option> |
| 199 | {{ range .Milestones }}<option value="{{ .ID }}">{{ .Title }}</option>{{ end }} |
| 200 | </select> |
| 201 | <button type="submit" class="shithub-button">Apply</button> |
| 202 | </form> |
| 203 | </details> |
| 204 | {{ end }} |
| 205 | </div> |
| 206 | {{ if .Issue.MilestoneID.Valid }} |
| 207 | {{ $mid := .Issue.MilestoneID.Int64 }} |
| 208 | {{ range .Milestones }}{{ if eq .ID $mid }}<a href="/{{ $.Owner }}/{{ $.Repo.Name }}/milestones">{{ .Title }}</a>{{ end }}{{ end }} |
| 209 | {{ else }}<p class="shithub-muted">No milestone</p>{{ end }} |
| 210 | </section> |
| 211 | |
| 212 | <section> |
| 213 | <div class="shithub-sidebar-heading"><h3>Relationships</h3><span class="shithub-sidebar-icon">{{ octicon "gear" }}</span></div> |
| 214 | <p class="shithub-muted">None yet</p> |
| 215 | </section> |
| 216 | |
| 217 | <section> |
| 218 | <div class="shithub-sidebar-heading"><h3>Development</h3><span class="shithub-sidebar-icon">{{ octicon "gear" }}</span></div> |
| 219 | <p><a href="#">Create a branch</a> for this issue or link a pull request.</p> |
| 220 | </section> |
| 221 | |
| 222 | <section> |
| 223 | <div class="shithub-sidebar-heading"><h3>Notifications</h3><a href="#" class="shithub-muted">Customize</a></div> |
| 224 | <button type="button" class="shithub-button shithub-sidebar-button">{{ octicon "bell" }} Unsubscribe</button> |
| 225 | </section> |
| 226 | |
| 227 | <section> |
| 228 | <h3>Participants</h3> |
| 229 | {{ if .Participants }} |
| 230 | {{ range .Participants }}<a href="/{{ . }}" class="shithub-participant">@{{ . }}</a>{{ end }} |
| 231 | {{ else }}<p class="shithub-muted">None yet</p>{{ end }} |
| 232 | </section> |
| 233 | |
| 234 | {{ if .CanLockIssue }} |
| 235 | <section class="shithub-issue-actions"> |
| 236 | <form method="post" action="/{{ .Owner }}/{{ .Repo.Name }}/issues/{{ .Issue.Number }}/lock"> |
| 237 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 238 | {{ if .Issue.Locked }} |
| 239 | <button type="submit" name="lock" value="false" class="shithub-link-button">{{ octicon "unlock" }} Unlock conversation</button> |
| 240 | {{ else }} |
| 241 | <button type="submit" name="lock" value="true" class="shithub-link-button">{{ octicon "lock" }} Lock conversation</button> |
| 242 | {{ end }} |
| 243 | </form> |
| 244 | </section> |
| 245 | {{ end }} |
| 246 | </aside> |
| 247 | </div> |
| 248 | </section> |
| 249 | </section> |
| 250 | {{- end }} |