Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TrN for repository limit #12492

Merged
merged 6 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,8 @@ archive.title = This repo is archived. You can view files and clone it, but cann
archive.issue.nocomment = This repo is archived. You cannot comment on issues.
archive.pull.nocomment = This repo is archived. You cannot comment on pull requests.

form.reach_limit_of_creation = You have already reached your limit of %d repositories.
form.reach_limit_of_creation_1 = You have already reached your limit of %d repository.
form.reach_limit_of_creation_n = You have already reached your limit of %d repositories.
form.name_reserved = The repository name '%s' is reserved.
form.name_pattern_not_allowed = The pattern '%s' is not allowed in a repository name.

Expand Down
9 changes: 4 additions & 5 deletions routers/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,10 @@ func Create(ctx *context.Context) {
}
}

if !ctx.User.CanCreateRepo() {
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", ctx.User.MaxCreationLimit()), tplCreate, nil)
} else {
ctx.HTML(200, tplCreate)
}
ctx.Data["CanCreateRepo"] = ctx.User.CanCreateRepo()
ctx.Data["MaxCreationLimit"] = ctx.User.MaxCreationLimit()

ctx.HTML(200, tplCreate)
}

func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) {
Expand Down
7 changes: 6 additions & 1 deletion templates/repo/create.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
</h3>
<div class="ui attached segment">
{{template "base/alert" .}}
6543 marked this conversation as resolved.
Show resolved Hide resolved
{{if not .CanCreateRepo}}
6543 marked this conversation as resolved.
Show resolved Hide resolved
<div class="ui negative message">
<p>{{.i18n.Tr (TrN .i18n.Lang .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>{{.i18n.Tr "repo.owner"}}</label>
<div class="ui selection owner dropdown">
Expand Down Expand Up @@ -193,7 +198,7 @@
<br/>
<div class="inline field">
<label></label>
<button class="ui green button">
<button class="ui green button{{if not .CanCreateRepo}} disabled{{end}}">
{{.i18n.Tr "repo.create_repo"}}
</button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a>
Expand Down