Skip to content

Commit ae41379

Browse files
authored
Merge branch 'go-gitea:main' into fullname-search
2 parents d43597f + 6ff5400 commit ae41379

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+719
-886
lines changed

docs/content/doc/features/localization.zh-cn.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,18 @@ menu:
1515

1616
# 本地化
1717

18-
## TBD
18+
Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/gitea)进行的。
19+
20+
对于对**英语翻译**的更改,可以发出pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini)中合适的关键字。
21+
22+
有关对**非英语**翻译的更改,请参阅上面的 Crowdin 项目。
23+
24+
## 支持的语言
25+
26+
上述 Crowdin 项目中列出的任何语言一旦翻译了 25% 或更多都将得到支持。
27+
28+
翻译被接受后,它将在下一次 Crowdin 同步后反映在主存储库中,这通常是在任何 PR 合并之后。
29+
30+
在撰写本文时,这意味着更改后的翻译可能要到 Gitea 的下一个版本才会出现。
31+
32+
如果使用开发版本,则在同步更改内容后,它应该会在更新后立即显示。

modules/context/pagination.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ type Pagination struct {
1818
urlParams []string
1919
}
2020

21-
// NewPagination creates a new instance of the Pagination struct
22-
func NewPagination(total, page, issueNum, numPages int) *Pagination {
21+
// NewPagination creates a new instance of the Pagination struct.
22+
// "pagingNum" is "page size" or "limit", "current" is "page"
23+
func NewPagination(total, pagingNum, current, numPages int) *Pagination {
2324
p := &Pagination{}
24-
p.Paginater = paginator.New(total, page, issueNum, numPages)
25+
p.Paginater = paginator.New(total, pagingNum, current, numPages)
2526
return p
2627
}
2728

public/img/svg/fontawesome-save.svg

Lines changed: 1 addition & 0 deletions
Loading

routers/web/repo/branch.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"errors"
99
"fmt"
1010
"net/http"
11+
"net/url"
1112
"strings"
1213

1314
"code.gitea.io/gitea/models"
@@ -65,21 +66,17 @@ func Branches(ctx *context.Context) {
6566
if page <= 1 {
6667
page = 1
6768
}
69+
pageSize := setting.Git.BranchesRangeSize
6870

69-
limit := ctx.FormInt("limit")
70-
if limit <= 0 || limit > setting.Git.BranchesRangeSize {
71-
limit = setting.Git.BranchesRangeSize
72-
}
73-
74-
skip := (page - 1) * limit
75-
log.Debug("Branches: skip: %d limit: %d", skip, limit)
76-
defaultBranchBranch, branches, branchesCount := loadBranches(ctx, skip, limit)
71+
skip := (page - 1) * pageSize
72+
log.Debug("Branches: skip: %d limit: %d", skip, pageSize)
73+
defaultBranchBranch, branches, branchesCount := loadBranches(ctx, skip, pageSize)
7774
if ctx.Written() {
7875
return
7976
}
8077
ctx.Data["Branches"] = branches
8178
ctx.Data["DefaultBranchBranch"] = defaultBranchBranch
82-
pager := context.NewPagination(branchesCount, setting.Git.BranchesRangeSize, page, 5)
79+
pager := context.NewPagination(branchesCount, pageSize, page, 5)
8380
pager.SetDefaultParams(ctx)
8481
ctx.Data["Page"] = pager
8582

@@ -165,7 +162,7 @@ func RestoreBranchPost(ctx *context.Context) {
165162

166163
func redirect(ctx *context.Context) {
167164
ctx.JSON(http.StatusOK, map[string]interface{}{
168-
"redirect": ctx.Repo.RepoLink + "/branches",
165+
"redirect": ctx.Repo.RepoLink + "/branches?page=" + url.QueryEscape(ctx.FormString("page")),
169166
})
170167
}
171168

templates/admin/auth/edit.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@
433433

434434
<div class="field">
435435
<button class="ui green button">{{.locale.Tr "admin.auths.update"}}</button>
436-
<div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.locale.Tr "admin.auths.delete"}}</div>
436+
<button class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.locale.Tr "admin.auths.delete"}}</button>
437437
</div>
438438
</form>
439439
</div>

templates/admin/emails/list.tmpl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
{{.locale.Tr "admin.emails.change_email_header"}}
7979
</div>
8080
<div class="content center">
81-
<p>{{.locale.Tr "admin.emails.change_email_text"}}</p>
81+
<p class="center">{{.locale.Tr "admin.emails.change_email_text"}}</p>
8282

8383
<form class="ui form" id="email-action-form" action="{{AppSubUrl}}/admin/emails/activate" method="post">
8484
{{$.CsrfTokenHtml}}
@@ -93,11 +93,9 @@
9393
<input type="hidden" id="form-primary" name="primary" value="" required>
9494
<input type="hidden" id="form-activate" name="activate" value="" required>
9595

96-
<div class="center actions">
97-
<div class="ui basic cancel inverted button">{{$.locale.Tr "settings.cancel"}}</div>
98-
<button class="ui basic inverted yellow button">{{$.locale.Tr "modal.yes"}}</button>
96+
<div class="center">
97+
{{template "base/delete_modal_actions" .}}
9998
</div>
100-
10199
</form>
102100
</div>
103101
</div>

templates/admin/notice.tmpl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<tr>
2424
<td class="collapsing">
2525
<div class="ui fitted checkbox" data-id="{{.ID}}">
26-
<input type="checkbox"> <label></label>
26+
<input type="checkbox">
2727
</div>
2828
</td>
2929
<td>{{.ID}}</td>
@@ -39,13 +39,11 @@
3939
<tr>
4040
<th></th>
4141
<th colspan="5">
42-
<div class="ui right">
43-
<form method="post" action="{{AppSubUrl}}/admin/notices/empty">
44-
{{.CsrfTokenHtml}}
45-
<button type="submit" class="ui red small button">{{.locale.Tr "admin.notices.delete_all"}}</button>
46-
</form>
47-
</div>
48-
<div class="ui floating upward dropdown small button">
42+
<form class="ui right" method="post" action="{{AppSubUrl}}/admin/notices/empty">
43+
{{.CsrfTokenHtml}}
44+
<button type="submit" class="ui red small button">{{.locale.Tr "admin.notices.delete_all"}}</button>
45+
</form>
46+
<div class="ui floating upward dropdown small button">{{/* TODO: Make this dropdown accessible */}}
4947
<span class="text">{{.locale.Tr "admin.notices.operations"}}</span>
5048
<div class="menu">
5149
<div class="item select action" data-action="select-all">
@@ -59,9 +57,9 @@
5957
</div>
6058
</div>
6159
</div>
62-
<div class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="{{.Link}}?page={{.Page.Paginater.Current}}">
60+
<button class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="{{.Link}}?page={{.Page.Paginater.Current}}">
6361
{{.locale.Tr "admin.notices.delete_selected"}}
64-
</div>
62+
</button>
6563
</th>
6664
</tr>
6765
</tfoot>

templates/admin/repo/unadopted.tmpl

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,7 @@
4343
<input type="hidden" name="action" value="adopt">
4444
<input type="hidden" name="q" value="{{$.Keyword}}">
4545
<input type="hidden" name="page" value="{{$.CurrentPage}}">
46-
<div class="actions">
47-
<div class="ui red basic inverted cancel button">
48-
{{svg "octicon-trash" 16 "gt-mr-2"}}
49-
{{$.locale.Tr "modal.no"}}
50-
</div>
51-
<button class="ui green basic inverted ok button">
52-
{{svg "octicon-check" 16 "gt-mr-2"}}
53-
{{$.locale.Tr "modal.yes"}}
54-
</button>
55-
</div>
46+
{{template "base/delete_modal_actions" .}}
5647
</form>
5748
</div>
5849
<button class="ui button submit tiny red delete show-modal" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{$.locale.Tr "repo.delete_preexisting_label"}}</span></button>
@@ -70,16 +61,7 @@
7061
<input type="hidden" name="action" value="delete">
7162
<input type="hidden" name="q" value="{{$.Keyword}}">
7263
<input type="hidden" name="page" value="{{$.CurrentPage}}">
73-
<div class="actions">
74-
<div class="ui red basic inverted cancel button">
75-
{{svg "octicon-trash" 16 "gt-mr-2"}}
76-
{{$.locale.Tr "modal.no"}}
77-
</div>
78-
<button class="ui green basic inverted ok button">
79-
{{svg "octicon-check" 16 "gt-mr-2"}}
80-
{{$.locale.Tr "modal.yes"}}
81-
</button>
82-
</div>
64+
{{template "base/delete_modal_actions" .}}
8365
</form>
8466
</div>
8567
</div>

templates/admin/user/edit.tmpl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151

152152
<div class="field">
153153
<button class="ui green button">{{.locale.Tr "admin.users.update_profile"}}</button>
154-
<div class="ui red button show-modal" data-modal="#delete-user-modal">{{.locale.Tr "admin.users.delete_account"}}</div>
154+
<button class="ui red button show-modal" data-modal="#delete-user-modal">{{.locale.Tr "admin.users.delete_account"}}</button>
155155
</div>
156156
</form>
157157
</div>
@@ -189,7 +189,7 @@
189189

190190
<div class="field">
191191
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
192-
<a class="ui red button delete-post" data-request-url="{{.Link}}/avatar/delete" data-done-url="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</a>
192+
<a class="ui red button delete-post" data-request-url="{{.Link}}/avatar/delete" data-done-url="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</a>{{/* TODO: Convert links without href to buttons for a11y */}}
193193
</div>
194194
</form>
195195
</div>
@@ -213,16 +213,7 @@
213213
</div>
214214
<p class="help">{{.locale.Tr "admin.users.purge_help"}}</p>
215215
</div>
216-
<div class="actions">
217-
<div class="ui red basic inverted cancel button">
218-
{{svg "octicon-x"}}
219-
{{.locale.Tr "modal.no"}}
220-
</div>
221-
<button class="ui green basic inverted ok button">
222-
{{svg "octicon-check"}}
223-
{{.locale.Tr "modal.yes"}}
224-
</button>
225-
</div>
216+
{{template "base/delete_modal_actions" .}}
226217
</form>
227218
</div>
228219
{{template "base/footer" .}}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div class="actions">
2-
<div class="ui red basic inverted cancel button">
2+
<button class="ui red basic inverted cancel button">
33
{{svg "octicon-x"}}
44
{{.locale.Tr "modal.no"}}
5-
</div>
6-
<div class="ui green basic inverted ok button">
5+
</button>
6+
<button class="ui green basic inverted ok button">
77
{{svg "octicon-check"}}
88
{{.locale.Tr "modal.yes"}}
9-
</div>
9+
</button>
1010
</div>

templates/org/settings/delete.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<label for="org_name">{{.locale.Tr "org.org_name_holder"}}</label>
2020
<input id="org_name" name="org_name" value="" autocomplete="off" autofocus required>
2121
</div>
22-
<div class="ui red button delete-button" data-type="form" data-form="#delete-form">
22+
<button class="ui red button delete-button" data-type="form" data-form="#delete-form">
2323
{{.locale.Tr "org.settings.confirm_delete_account"}}
24-
</div>
24+
</button>
2525
</form>
2626
</div>
2727
</div>

templates/org/settings/labels.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212
<div class="right floated three wide column">
1313
<div class="ui right">
14-
<div class="ui green new-label button">{{.locale.Tr "repo.issues.new_label"}}</div>
14+
<button class="ui green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button>
1515
</div>
1616
</div>
1717
</div>

templates/package/settings.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@
5757
<form class="ui form" action="{{.Link}}" method="post">
5858
{{.CsrfTokenHtml}}
5959
<input type="hidden" name="action" value="delete">
60-
<div class="text right actions">
61-
<div class="ui cancel button">{{.locale.Tr "cancel"}}</div>
62-
<button class="ui red button">{{.locale.Tr "ok"}}</button>
63-
</div>
60+
{{template "base/delete_modal_actions" .}}
6461
</form>
6562
</div>
6663
</div>

templates/projects/list.tmpl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,6 @@
8484
<div class="content">
8585
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
8686
</div>
87-
<div class="actions">
88-
<div class="ui red basic inverted cancel button">
89-
<i class="remove icon"></i>
90-
{{.locale.Tr "modal.no"}}
91-
</div>
92-
<div class="ui green basic inverted ok button">
93-
<i class="checkmark icon"></i>
94-
{{.locale.Tr "modal.yes"}}
95-
</div>
96-
</div>
87+
{{template "base/delete_modal_actions" .}}
9788
</div>
9889
{{end}}

templates/projects/view.tmpl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</div>
3030

3131
<div class="text right actions">
32-
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
32+
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
3333
<button data-url="{{$.Link}}" class="ui primary button" id="new_board_submit">{{$.locale.Tr "repo.projects.column.new_submit"}}</button>
3434
</div>
3535
</form>
@@ -127,7 +127,7 @@
127127
</div>
128128

129129
<div class="text right actions">
130-
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
130+
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
131131
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
132132
</div>
133133
</form>
@@ -144,7 +144,7 @@
144144
</label>
145145
</div>
146146
<div class="text right actions">
147-
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
147+
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
148148
<button class="ui primary button set-default-project-board" data-url="{{$.Link}}/{{.ID}}/default">{{$.locale.Tr "repo.projects.column.set_default"}}</button>
149149
</div>
150150
</div>
@@ -158,8 +158,8 @@
158158
{{$.locale.Tr "repo.projects.column.deletion_desc"}}
159159
</label>
160160
</div>
161-
<div class="text right actions">
162-
<div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
161+
<div class="text right actions">{{/* TODO: convert to base/delete_modal_actions.tmpl */}}
162+
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
163163
<button class="ui red button delete-project-board" data-url="{{$.Link}}/{{.ID}}">{{$.locale.Tr "repo.projects.column.delete"}}</button>
164164
</div>
165165
</div>
@@ -265,15 +265,6 @@
265265
<div class="content">
266266
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
267267
</div>
268-
<div class="actions">
269-
<div class="ui red basic inverted cancel button">
270-
<i class="remove icon"></i>
271-
{{.locale.Tr "modal.no"}}
272-
</div>
273-
<div class="ui green basic inverted ok button">
274-
<i class="checkmark icon"></i>
275-
{{.locale.Tr "modal.yes"}}
276-
</div>
277-
</div>
268+
{{template "base/delete_modal_actions" .}}
278269
</div>
279270
{{end}}

templates/repo/branch/list.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@
8181
<td class="three wide right aligned">
8282
{{if not .LatestPullRequest}}
8383
{{if .IsIncluded}}
84-
<a class="ui tooltip orange large label" data-content="{{$.locale.Tr "repo.branch.included_desc"}}" data-position="top right">
84+
<span class="ui tooltip orange large label" data-content="{{$.locale.Tr "repo.branch.included_desc"}}" data-position="top right">
8585
{{svg "octicon-git-pull-request"}} {{$.locale.Tr "repo.branch.included"}}
86-
</a>
86+
</span>
8787
{{else if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
8888
<a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranch}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .Name}}">
8989
<button id="new-pull-request" class="ui compact basic button gt-mr-0">{{if $.CanPull}}{{$.locale.Tr "repo.pulls.compare_changes"}}{{else}}{{$.locale.Tr "action.compare_branch"}}{{end}}</button>
@@ -123,13 +123,13 @@
123123
{{end}}
124124
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}}
125125
{{if .IsDeleted}}
126-
<button class="ui basic jump button icon tooltip undo-button" data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID}}&name={{.DeletedBranch.Name}}" data-content="{{$.locale.Tr "repo.branch.restore" (.Name)}}" data-position="top right">
126+
<button class="ui basic jump button icon tooltip undo-button" data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID}}&name={{.DeletedBranch.Name}}&page={{$.Page.Paginater.Current}}" data-content="{{$.locale.Tr "repo.branch.restore" (.Name)}}" data-position="top right">
127127
<span class="text blue">
128128
{{svg "octicon-reply"}}
129129
</span>
130130
</button>
131131
{{else}}
132-
<button class="ui basic jump button icon tooltip delete-button delete-branch-button" data-url="{{$.Link}}/delete?name={{.Name}}" data-content="{{$.locale.Tr "repo.branch.delete" (.Name)}}" data-position="top right" data-name="{{.Name}}">
132+
<button class="ui basic jump button icon tooltip delete-button delete-branch-button" data-url="{{$.Link}}/delete?name={{.Name}}&page={{$.Page.Paginater.Current}}" data-content="{{$.locale.Tr "repo.branch.delete" (.Name)}}" data-position="top right" data-name="{{.Name}}">
133133
{{svg "octicon-trash"}}
134134
</button>
135135
{{end}}
@@ -176,7 +176,7 @@
176176
</div>
177177

178178
<div class="text right actions">
179-
<div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
179+
<button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
180180
<button class="ui green button">{{.locale.Tr "repo.branch.confirm_create_branch"}}</button>
181181
</div>
182182
</form>

templates/repo/cite/cite_modal.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</div>
1616
</div>
1717
<div class="actions">
18-
<div class="ui black deny button">
18+
<button class="ui black cancel button">
1919
{{.locale.Tr "cancel"}}
20-
</div>
20+
</button>
2121
</div>
2222
</div>

0 commit comments

Comments
 (0)