forgejo/templates/repo/create_init.tmpl
Otto Richter 8d32ca32c2 New repo: Rework initialization
- only show settings when ticked
- only offer README selection when there are multiple options
2024-12-29 13:05:30 +01:00

56 lines
1.9 KiB
Go HTML Template

<label>
<input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}>
{{ctx.Locale.Tr "repo.auto_init"}}
<span class="help">{{ctx.Locale.Tr "repo.auto_init_description"}}</span>
</label>
<div class="hide-unless-checked">
<label>
.gitignore
<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>
</label>
<label>
{{ctx.Locale.Tr "repo.license"}}
<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>
</label>
{{$supportedReadmesLength := len .Readmes}}
{{/* Only offer README selection if there is an actual choice */}}
{{if ge $supportedReadmesLength 2}}
<label>
{{ctx.Locale.Tr "repo.readme"}}
<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>
</label>
{{else}}
<input type="hidden" name="readme" value="Default">
{{end}}
</div>