summaryrefslogtreecommitdiffstats
path: root/templates/repo/create.tmpl
blob: df4288a2f2dd21c24d32fae09cb2df1d2743349a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository new repo">
	<div class="ui middle very relaxed page one column grid">
		<div class="column">
			<form class="ui form" action="{{.Link}}" method="post">
				{{.CsrfTokenHtml}}
				<h3 class="ui top attached header">
					{{ctx.Locale.Tr "new_repo.title"}}
				</h3>
				<div class="ui attached segment">
					{{template "base/alert" .}}
					{{template "repo/create_helper" .}}

					{{if not .CanCreateRepo}}
						<div class="ui negative message">
							<p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p>
						</div>
					{{end}}
					<div class="inline required field {{if .Err_Owner}}error{{end}}">
						<label>{{ctx.Locale.Tr "repo.owner"}}</label>
						<div class="ui selection owner dropdown">
							<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
							<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
								{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
								<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
							</span>
							{{svg "octicon-triangle-down" 14 "dropdown icon"}}
							<div class="menu">
								<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
									{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
									<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
								</div>
								{{range .Orgs}}
									<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
										{{ctx.AvatarUtils.Avatar . 28 "mini"}}
										<span class="truncated-item-name">{{.ShortName 40}}</span>
									</div>
								{{end}}
							</div>
						</div>
						<span class="help">{{ctx.Locale.Tr "repo.owner_helper"}}</span>
					</div>

					<div class="inline required field {{if .Err_RepoName}}error{{end}}">
						<label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
						<input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100">
						<span class="help">{{ctx.Locale.Tr "repo.repo_name_helper"}}</span>
					</div>
					<div class="inline field">
						<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
						<div class="ui checkbox">
							<input name="private" type="checkbox"
								{{if .IsForcedPrivate}}
									checked disabled
								{{else}}
									{{if .private}}checked{{end}}
								{{end}}>
							<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
						</div>
						{{if .IsForcedPrivate}}
							<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
						{{end}}
						<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
					</div>
					<div class="inline field {{if .Err_Description}}error{{end}}">
						<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
						<textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea>
					</div>
					<div class="inline field">
						<label>{{ctx.Locale.Tr "repo.template"}}</label>
						<div id="repo_template_search" class="ui search selection dropdown">
							<input type="hidden" id="repo_template" name="repo_template" value="{{if ne .repo_template 0}}{{.repo_template}}{{end}}">
							<div class="default text">{{.repo_template_name}}</div>
							<div class="menu">
							</div>
						</div>
					</div>

					<div id="template_units" class="tw-hidden">
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.template.items"}}</label>
							<div class="ui checkbox">
								<input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.template.git_content"}}</label>
							</div>
							<div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{ctx.Locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}>
								<input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.template.git_hooks"}}</label>
							</div>
						</div>
						<div class="inline field">
							<label></label>
							<div class="ui checkbox">
								<input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.template.webhooks"}}</label>
							</div>
							<div class="ui checkbox">
								<input name="topics" type="checkbox" {{if .topics}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.template.topics"}}</label>
							</div>
						</div>
						<div class="inline field">
							<label></label>
							<div class="ui checkbox">
								<input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.template.avatar"}}</label>
							</div>
							<div class="ui checkbox">
								<input name="labels" type="checkbox" {{if .labels}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.template.issue_labels"}}</label>
							</div>
						</div>
						<div class="inline field">
							<label></label>
							<div class="ui checkbox">
								<input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.settings.protected_branch"}}</label>
							</div>
						</div>
					</div>

					<div id="non_template">
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.issue_labels"}}</label>
							<div class="ui search selection dropdown">
								<input type="hidden" name="issue_labels" value="{{.issueLabels}}">
								<div class="default text">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div>
								<div class="menu">
									<div class="item" data-value="">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div>
									{{range .LabelTemplateFiles}}
										<div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><p>({{.Description}})</p></div>
									{{end}}
								</div>
							</div>
						</div>

						<div class="divider"></div>

						<div class="inline field">
							<label>.gitignore</label>
							<div class="ui multiple search selection dropdown">
								<input type="hidden" name="gitignores" value="{{.gitignores}}">
								<div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div>
								<div class="menu">
									{{range .Gitignores}}
										<div class="item" data-value="{{.}}">{{.}}</div>
									{{end}}
								</div>
							</div>
							<span class="help">{{ctx.Locale.Tr "repo.repo_gitignore_helper_desc"}}</span>
						</div>
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.license"}}</label>
							<div class="ui search selection dropdown">
								<input type="hidden" name="license" value="{{.license}}">
								<div class="default text">{{ctx.Locale.Tr "repo.license_helper"}}</div>
								<div class="menu">
									<div class="item" data-value="">{{ctx.Locale.Tr "repo.license_helper"}}</div>
									{{range .Licenses}}
										<div class="item" data-value="{{.}}">{{.}}</div>
									{{end}}
								</div>
							</div>
							<span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/"}}</span>
						</div>

						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.readme"}}</label>
							<div class="ui selection dropdown">
								<input type="hidden" name="readme" value="{{.readme}}">
								<div class="default text">{{ctx.Locale.Tr "repo.readme_helper"}}</div>
								<div class="menu">
									{{range .Readmes}}
										<div class="item" data-value="{{.}}">{{.}}</div>
									{{end}}
								</div>
							</div>
							<span class="help">{{ctx.Locale.Tr "repo.readme_helper_desc"}}</span>
						</div>
						<div class="inline field">
							<div class="ui checkbox" id="auto-init">
								<input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.auto_init"}}</label>
							</div>
						</div>
						<div class="inline field">
							<label for="default_branch">{{ctx.Locale.Tr "repo.default_branch"}}</label>
							<input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}">
							<span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span>
						</div>
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.object_format"}}</label>
							<div class="ui selection owner dropdown">
								<input type="hidden" id="object_format_name" name="object_format_name" value="{{.DefaultObjectFormat.Name}}" required>
								<div class="default text">{{.DefaultObjectFormat.Name}}</div>
								<div class="menu">
									{{range .SupportedObjectFormats}}
										<div class="item" data-value="{{.Name}}">{{.Name}}</div>
									{{end}}
								</div>
							</div>
							<span class="help">{{ctx.Locale.Tr "repo.object_format_helper"}}</span>
						</div>
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.template"}}</label>
							<div class="ui checkbox">
								<input name="template" type="checkbox">
								<label>{{ctx.Locale.Tr "repo.template_helper"}}</label>
							</div>
						</div>
					</div>
					<br>
					<div class="inline field">
						<label></label>
						<button class="ui primary button{{if not .CanCreateRepo}} disabled{{end}}">
							{{ctx.Locale.Tr "repo.create_repo"}}
						</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
{{template "base/footer" .}}