]> source.dussan.org Git - gitea.git/commitdiff
Add TrN for repository limit (#12492)
authorEV3R4 <63237520+EV3R4@users.noreply.github.com>
Thu, 21 Jan 2021 23:44:37 +0000 (00:44 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Jan 2021 23:44:37 +0000 (00:44 +0100)
* Added TrN for repository limit

* Removed form.reach_limit_of_creation_0

* disable Create Button if user can not create

Co-authored-by: 6543 <6543@obermui.de>
options/locale/locale_en-US.ini
routers/repo/repo.go
templates/repo/create.tmpl

index 69cfb290440b960ef34faec8d1f42ff974a03645..53cee057c97bf6782c9c959df5b71552c04dd729 100644 (file)
@@ -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.
 
index 2614389aaaca86cb2d496ab504f6f0a33b261cb0..3832b8997170dc60896dacd6a060ee4f552f8df1 100644 (file)
@@ -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{}) {
index 7d71043c34b59dcbfbde8114b746fd7771807ddf..ad795387df25cfb0425a4cd62b4e8207e2fc1823 100644 (file)
@@ -9,6 +9,11 @@
                                </h3>
                                <div class="ui attached segment">
                                        {{template "base/alert" .}}
+                                       {{if not .CanCreateRepo}}
+                                               <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">
                                        <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>