mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-07 21:04:38 +01:00
New repo: Rework advanced and template sections
- make sections collapsible - only offer object format selection when there is an actual choice
This commit is contained in:
parent
81599155e8
commit
4cde56906e
5 changed files with 114 additions and 92 deletions
|
@ -1053,6 +1053,10 @@ admin.failed_to_replace_flags = Failed to replace repository flags
|
|||
admin.flags_replaced = Repository flags replaced
|
||||
|
||||
new_repo_helper = A repository contains all project files, including revision history. Already hosting one elsewhere? <a href="%s">Migrate repository</a>.
|
||||
new_from_template = Use a template
|
||||
new_from_template_description = You can select an existing repository template on this instance and apply its settings.
|
||||
new_advanced = Advanced settings
|
||||
new_advanced_expand = Click to expand
|
||||
owner = Owner
|
||||
owner_helper = Some organizations may not show up in the dropdown due to a maximum repository count limit.
|
||||
repo_name = Repository name
|
||||
|
|
|
@ -20,75 +20,22 @@
|
|||
{{template "repo/create_basic" .}}
|
||||
</fieldset>
|
||||
|
||||
<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>
|
||||
<fieldset>
|
||||
<legend>
|
||||
{{ctx.Locale.Tr "repo.new_from_template"}}
|
||||
<span class="help">{{ctx.Locale.Tr "repo.new_from_template_description"}}</span>
|
||||
</legend>
|
||||
{{template "repo/create_from_template" .}}
|
||||
</fieldset>
|
||||
|
||||
<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>
|
||||
<fieldset>
|
||||
<legend>{{ctx.Locale.Tr "repo.new_advanced"}}</legend>
|
||||
<details><summary>{{ctx.Locale.Tr "repo.new_advanced_expand"}}</summary>
|
||||
{{template "repo/create_advanced" .}}
|
||||
</details>
|
||||
</fieldset>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="inline field">
|
||||
<label>.gitignore</label>
|
||||
|
@ -137,31 +84,6 @@
|
|||
<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">
|
||||
|
|
45
templates/repo/create_advanced.tmpl
Normal file
45
templates/repo/create_advanced.tmpl
Normal file
|
@ -0,0 +1,45 @@
|
|||
<label>
|
||||
{{ctx.Locale.Tr "repo.issue_labels"}}
|
||||
<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>
|
||||
</label>
|
||||
|
||||
{{$supportedFormatsLength := len .SupportedObjectFormats}}
|
||||
{{/* Only offer object format selection if there is an actual choice */}}
|
||||
{{if ge $supportedFormatsLength 2}}
|
||||
<label>
|
||||
{{ctx.Locale.Tr "repo.object_format"}}
|
||||
<div class="ui selection 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>
|
||||
</label>
|
||||
{{else}}
|
||||
<input type="hidden" name="object_format_name" value="{{.DefaultObjectFormat.Name}}" required>
|
||||
{{end}}
|
||||
|
||||
<label>
|
||||
{{ctx.Locale.Tr "repo.default_branch"}}
|
||||
<input name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}">
|
||||
<span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input name="template" type="checkbox">
|
||||
{{ctx.Locale.Tr "repo.template_helper"}}
|
||||
<span class="help">{{ctx.Locale.Tr "repo.template_description"}}</span>
|
||||
</label>
|
|
@ -1,5 +1,7 @@
|
|||
<label id="repo_owner_label" {{if .Err_Owner}}class="field error"{{end}}>{{ctx.Locale.Tr "repo.owner"}}
|
||||
<label id="repo_owner_label" {{if .Err_Owner}}class="field error"{{end}}>
|
||||
{{ctx.Locale.Tr "repo.owner"}}
|
||||
<div class="ui selection required dropdown" aria-labelledby="repo_owner_label">
|
||||
{{/* uid id is used by the repo-template code */}}
|
||||
<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"}}
|
||||
|
|
49
templates/repo/create_from_template.tmpl
Normal file
49
templates/repo/create_from_template.tmpl
Normal file
|
@ -0,0 +1,49 @@
|
|||
<label class="tw-mb-0">
|
||||
{{ctx.Locale.Tr "repo.template"}}
|
||||
</label>
|
||||
{{/* If the dropdown is inside the label, the focus works correctly and it is more accessible.
|
||||
However, the Javascript takes the focus and opens the dropdown again immediately after closing.
|
||||
When the user interacts (via mouse or keyboard), the dropdown closes again.
|
||||
Due to the fieldset legend, this solutions is probably acceptable until the dropdown can be fixed properly. */}}
|
||||
<div id="repo_template_search" class="ui search selection dropdown tw-w-full">
|
||||
<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>
|
||||
|
||||
<fieldset id="template_units" class="tw-hidden simple-grid grid-2">
|
||||
<legend>{{ctx.Locale.Tr "repo.template.items"}}</legend>
|
||||
|
||||
<label>
|
||||
<input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.template.git_content"}}
|
||||
</label>
|
||||
<label>
|
||||
<input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.template.webhooks"}}
|
||||
</label>
|
||||
<label>
|
||||
<input name="topics" type="checkbox" {{if .topics}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.template.topics"}}
|
||||
</label>
|
||||
<label>
|
||||
<input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.template.avatar"}}
|
||||
</label>
|
||||
<label>
|
||||
<input name="labels" type="checkbox" {{if .labels}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.template.issue_labels"}}
|
||||
</label>
|
||||
<label>
|
||||
<input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.settings.protected_branch"}}
|
||||
</label>
|
||||
<label>
|
||||
<input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}>
|
||||
{{ctx.Locale.Tr "repo.template.git_hooks"}}
|
||||
{{if not .SignedUser.CanEditGitHook}}
|
||||
<span class="help">{{ctx.Locale.Tr "repo.template.git_hooks_tooltip"}}</span>
|
||||
{{end}}
|
||||
</label>
|
||||
</fieldset>
|
Loading…
Reference in a new issue