仰望星辰工作室

gitcat

gitcat/ webroot/templates/issue_new.html 3.2 KB · 62 行 原始文件
1{{define "content"}}
2{{$repo := .Data.Repo}}
3<header class="repo-head compact">
4 <div class="repo-title">
5 <span class="repo-icon lg" aria-hidden="true">
6 <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="8.5"/><circle cx="12" cy="12" r="3.6"/><path d="M12 3.5v4.9M12 15.6v4.9M3.5 12h4.9M15.6 12h4.9"/></svg>
7 </span>
8 <div><h1>提交议题</h1></div>
9 </div>
10</header>
11{{template "repotabs" (dict "Repo" $repo "Ref" .Data.Ref "Tab" "issues" "CanManage" .Data.CanManage "CommitCount" .Data.CommitCount "BranchCount" .Data.BranchCount "ReleaseCount" .Data.ReleaseCount "IssueCount" .Data.IssueCount)}}
12
13<div class="col-main" style="max-width: 780px;">
14 <div class="card">
15 {{if .Error}}<div class="flash err" role="alert"><span class="flash-ico">!</span><span>{{.Error}}</span><button class="flash-x" type="button" aria-label="关闭">×</button></div>{{end}}
16 <form method="post" action="/{{$repo.Name}}/issues/new" autocomplete="off">
17 {{if .User}}<input type="hidden" name="csrf" value="{{.CSRF}}">{{end}}
18 <label class="field">
19 <span>标题 <em class="muted">必填,最多 120 字</em></span>
20 <input type="text" name="title" value="{{.Data.Title}}" maxlength="120" placeholder="一句话概括问题或建议" required>
21 </label>
22 <label class="field">
23 <span>详细描述 <em class="muted">选填,支持 Markdown,最多 5000 字</em></span>
24 <textarea name="content" rows="8" maxlength="5000" placeholder="复现步骤、期望行为、实际行为、相关版本信息……">{{.Data.Content}}</textarea>
25 </label>
26
27 {{if not .User}}
28 <label class="field">
29 <span>称呼 <em class="muted">选填,最多 30 字</em></span>
30 <input type="text" name="nickname" maxlength="30" placeholder="访客">
31 </label>
32 <div class="field">
33 <span>验证码 <em class="muted">图片中的 5 位数字</em></span>
34 <div class="captcha-row">
35 <img class="captcha-img" id="captcha-img" src="/{{$repo.Name}}/issues/captcha.png" alt="验证码图片" width="150" height="52">
36 <button type="button" class="btn btn-ghost btn-mini" id="captcha-refresh" title="看不清?换一张">换一张</button>
37 <input type="text" name="captcha" maxlength="8" inputmode="numeric" pattern="[0-9 ]*" placeholder="输入 5 位数字" required>
38 </div>
39 <em class="field-hint">未登录用户提交前需完成验证;<a href="/login">登录</a>后免验证码。</em>
40 </div>
41 {{end}}
42
43 <div class="row-actions">
44 <button class="btn btn-primary" type="submit">提交议题</button>
45 <a class="btn btn-ghost" href="/{{$repo.Name}}/issues">取消</a>
46 </div>
47 </form>
48 </div>
49</div>
50<script>
51(function () {
52 var img = document.getElementById('captcha-img');
53 var btn = document.getElementById('captcha-refresh');
54 if (!img || !btn) return;
55 function refresh() {
56 img.src = '/{{$repo.Name}}/issues/captcha.png?t=' + Date.now();
57 }
58 btn.addEventListener('click', refresh);
59 img.addEventListener('click', refresh);
60})();
61</script>
62{{end}}