internal/web/templates/new.html

54 lines · 3233 bytes

 1{{define "width"}}bounded{{end}}
 2{{define "title"}}new repository · {{.Site}}{{end}}
 3{{define "content"}}
 4<h1>New</h1>
 5<h2>Repository</h2>
 6{{if .Error}}<p class="error" role="alert">{{.Error}}</p>{{end}}
 7<form method="post" action="/new">
 8<p><label>Owner <select name="owner">
 9  <option value="{{.Viewer}}">{{.Viewer}}</option>
10  {{range .Orgs}}<option value="{{.}}">{{.}}</option>{{end}}
11</select></label>
12<label>/ Name <input name="name" required maxlength="63" pattern="[a-z0-9][a-z0-9._\-]{0,62}" aria-describedby="namehint" autocomplete="off" spellcheck="false"></label>
13<span class="hint" id="namehint">Lowercase letters, digits, dot, dash and underscore; must start with a letter or digit; up to 63 characters.</span></p>
14<fieldset class="segmented">
15  <legend>Visibility</legend>
16  <div class="options">
17    <label><input type="radio" name="visibility" value="public" checked><span>Public</span></label>
18    <label><input type="radio" name="visibility" value="private"><span>Private</span></label>
19  </div>
20</fieldset>
21<p><button type="submit">Create repository</button></p>
22</form>
23
24<h2 id="import">Import</h2>
25<p class="meta">Copies a repository from another host, over http or https. A private source needs an access token; it is sent to the remote for this one fetch and not stored.</p>
26<form method="post" action="/new" autocomplete="off">
27<input type="hidden" name="field" value="import">
28<p><label>Owner <select name="owner">
29  {{$o := index .Submitted "owner"}}<option value="{{.Viewer}}">{{.Viewer}}</option>
30  {{range .Orgs}}<option value="{{.}}"{{if eq . $o}} selected{{end}}>{{.}}</option>{{end}}
31</select></label>
32<label>/ Name <input name="name" value="{{index .Submitted "name"}}" required maxlength="63" pattern="[a-z0-9][a-z0-9._\-]{0,62}" autocomplete="off" spellcheck="false"></label></p>
33<p><label>From <input type="text" name="from" value="{{index .Submitted "from"}}" required placeholder="https://github.com/owner/repo.git" spellcheck="false" size="48"></label></p>
34<p><label>Access token <input type="password" name="token" autocomplete="new-password"></label> <span class="hint">Optional.</span></p>
35<fieldset class="segmented">
36  <legend>Visibility</legend>
37  <div class="options">
38    <label><input type="radio" name="visibility" value="public"{{if ne (index .Submitted "visibility") "private"}} checked{{end}}><span>Public</span></label>
39    <label><input type="radio" name="visibility" value="private"{{if eq (index .Submitted "visibility") "private"}} checked{{end}}><span>Private</span></label>
40  </div>
41</fieldset>
42<p><button type="submit">Import repository</button></p>
43</form>
44
45<h2 id="org">Organization</h2>
46<p class="meta">An organization owns repositories, labels and milestones, and
47grants access through teams. You are its first admin.</p>
48<form method="post" action="/new">
49<input type="hidden" name="field" value="org-create">
50<p><label>Name <input name="name" required maxlength="63" pattern="[a-z0-9][a-z0-9._\-]{0,62}" aria-describedby="orghint" autocomplete="off" spellcheck="false"></label>
51<span class="hint" id="orghint">The same rules as a repository name, and it becomes a top-level path.</span></p>
52<p><button type="submit">Create organization</button></p>
53</form>
54{{end}}