forgejo/templates/repo/create_basic.tmpl

58 lines
2.4 KiB
Go HTML Template
Raw Normal View History

<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 */}}
fix(ui): make limits clearer in create repo form (#7402) Resolves: #7341 Previously, the Create Repository button was only enabled if a user was able to create a repo in their own namespace. However, if they had reached the global repo limit, but were stlll able to create a repo in an org, the button would still be disabled. In this pull request, the create repo form now: 1. Behaves like it always did previously if the user has not reached the repo limit. 2. If the User has reached the repo limit, and they are unable to create a repo in any of their orgs (or they have no orgs), the create repo form is displayed as: ![Screenshot](/attachments/9f22f43d-0036-4c48-b794-54302c0f241c) 3. If the User has reached the repo limit, and the **limit is greater than zero**, an alert appears at the top of the form, and they are only allowed to choose from the orgs that they are allowed to create repos in: ![Screenshot](/attachments/f5508e05-74fd-4858-9e95-967bd7017abd) 4. If the User has reached the repo limit, and the **limit is equal to zero**, no alert is displayed, as no user can create repos on that instance, and they are only allowed to choose from the orgs that they are allowed to create repos in: ![localhost_3000_repo_create (4).png](/attachments/e7a87da8-c19c-47e1-845e-2afc3667ab02) Co-authored-by: 0ko <0ko@noreply.codeberg.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7402 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Ryan Lerch <rlerch@redhat.com> Co-committed-by: Ryan Lerch <rlerch@redhat.com>
2025-05-20 16:37:15 +02:00
{{if .CanCreateRepo}}
<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>
{{else if .Orgs}}
<input type="hidden" id="uid" name="uid" value="{{(index .Orgs 0).ID}}" required>
<span class="text truncated-item-container" title="{{(index .Orgs 0).Name}}">
{{ctx.AvatarUtils.Avatar (index .Orgs 0) 28 "mini"}}
<span class="truncated-item-name">{{(index .Orgs 0).ShortName 40}}</span>
</span>
{{end}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
fix(ui): make limits clearer in create repo form (#7402) Resolves: #7341 Previously, the Create Repository button was only enabled if a user was able to create a repo in their own namespace. However, if they had reached the global repo limit, but were stlll able to create a repo in an org, the button would still be disabled. In this pull request, the create repo form now: 1. Behaves like it always did previously if the user has not reached the repo limit. 2. If the User has reached the repo limit, and they are unable to create a repo in any of their orgs (or they have no orgs), the create repo form is displayed as: ![Screenshot](/attachments/9f22f43d-0036-4c48-b794-54302c0f241c) 3. If the User has reached the repo limit, and the **limit is greater than zero**, an alert appears at the top of the form, and they are only allowed to choose from the orgs that they are allowed to create repos in: ![Screenshot](/attachments/f5508e05-74fd-4858-9e95-967bd7017abd) 4. If the User has reached the repo limit, and the **limit is equal to zero**, no alert is displayed, as no user can create repos on that instance, and they are only allowed to choose from the orgs that they are allowed to create repos in: ![localhost_3000_repo_create (4).png](/attachments/e7a87da8-c19c-47e1-845e-2afc3667ab02) Co-authored-by: 0ko <0ko@noreply.codeberg.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7402 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Ryan Lerch <rlerch@redhat.com> Co-committed-by: Ryan Lerch <rlerch@redhat.com>
2025-05-20 16:37:15 +02:00
{{if .CanCreateRepo}}
<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>
{{end}}
{{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>
</label>
<label {{if .Err_RepoName}}class="field error"{{end}}>
{{ctx.Locale.Tr "repo.repo_name"}}
<input name="repo_name" value="{{.repo_name}}" required maxlength="100">
<span class="help">{{ctx.Locale.Tr "repo.repo_name_helper"}}</span>
</label>
<label>
<input name="private" type="checkbox"
{{if .IsForcedPrivate}}
checked disabled
{{else}}
{{if .private}}checked{{end}}
{{end}}>
{{ctx.Locale.Tr "repo.visibility_helper"}}
{{if .IsForcedPrivate}}
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
{{end}}
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
</label>
<label {{if .Err_Description}}class="field error"{{end}}>
{{ctx.Locale.Tr "repo.repo_desc"}}
<textarea rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea>
</label>