Skip to content

Commit 94344b6

Browse files
authored
Merge branch 'main' into lunny/refactor_issue_view
2 parents a884256 + 1518f4e commit 94344b6

File tree

17 files changed

+164
-217
lines changed

17 files changed

+164
-217
lines changed

options/locale/locale_pt-PT.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ confirm_delete_selected=Confirma a exclusão de todos os itens marcados?
145145

146146
name=Nome
147147
value=Valor
148+
readme=Leia-me
148149

149150
filter=Filtro
150151
filter.clear=Retirar filtro
@@ -1045,6 +1046,8 @@ generate_repo=Gerar repositório
10451046
generate_from=Gerar a partir de
10461047
repo_desc=Descrição
10471048
repo_desc_helper=Insira uma descrição curta (opcional)
1049+
repo_no_desc=Descrição não fornecida
1050+
repo_lang=Idiomas
10481051
repo_gitignore_helper=Escolher modelos .gitignore.
10491052
repo_gitignore_helper_desc=Escolha os ficheiros que não são para rastrear, a partir de uma lista de modelos de linguagens comuns. Serão incluídos no ficheiro .gitignore, logo à partida, artefactos típicos gerados pelas ferramentas de construção de cada uma das linguagens.
10501053
issue_labels=Rótulos para as questões
@@ -1942,6 +1945,10 @@ pulls.delete.title=Eliminar este pedido de integração?
19421945
pulls.delete.text=Tem a certeza que quer eliminar este pedido de integração? Isso irá remover todo o conteúdo permanentemente. Como alternativa considere fechá-lo, se pretender mantê-lo em arquivo.
19431946

19441947
pulls.recently_pushed_new_branches=Enviou para o ramo <strong>%[1]s</strong> %[2]s
1948+
pulls.upstream_diverging_prompt_behind_1=Este ramo está %d cometimento atrás de %s
1949+
pulls.upstream_diverging_prompt_behind_n=Este ramo está %d cometimentos atrás de %s
1950+
pulls.upstream_diverging_prompt_base_newer=O ramo base %s tem novas modificações
1951+
pulls.upstream_diverging_merge=Sincronizar derivação
19451952

19461953
pull.deleted_branch=(eliminado):%s
19471954
pull.agit_documentation=Rever a documentação sobre o AGit

routers/web/repo/projects.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ func ViewProject(ctx *context.Context) {
425425
return
426426
}
427427

428+
ctx.Data["Title"] = project.Title
428429
ctx.Data["IsProjectsPage"] = true
429430
ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects)
430431
ctx.Data["Project"] = project

templates/org/settings/labels.tmpl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}}
2-
<div class="org-setting-content">
3-
<div class="tw-flex tw-items-center">
4-
<div class="tw-flex-1">
5-
{{ctx.Locale.Tr "org.settings.labels_desc"}}
6-
</div>
7-
<button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
8-
</div>
9-
<div class="divider"></div>
10-
{{template "repo/issue/labels/label_new" .}}
11-
{{template "repo/issue/labels/label_list" .}}
12-
</div>
13-
{{template "repo/issue/labels/edit_delete_label" .}}
2+
<div class="org-setting-content">
3+
<div class="tw-flex tw-items-center">
4+
<div class="tw-flex-1">
5+
{{ctx.Locale.Tr "org.settings.labels_desc"}}
6+
</div>
7+
<button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
8+
</div>
9+
<div class="divider"></div>
10+
{{template "repo/issue/labels/label_list" .}}
11+
{{template "repo/issue/labels/label_edit_modal" .}}
12+
</div>
1413
{{template "org/settings/layout_footer" .}}
15-

templates/repo/issue/labels.tmpl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88
<button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
99
{{end}}
1010
</div>
11-
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
12-
{{template "repo/issue/labels/label_new" .}}
13-
{{end}}
1411
{{template "base/alert" .}}
1512
{{template "repo/issue/labels/label_list" .}}
1613
</div>
14+
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
15+
{{template "repo/issue/labels/label_edit_modal" .}}
16+
{{end}}
1717
</div>
18-
19-
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
20-
{{template "repo/issue/labels/edit_delete_label" .}}
21-
{{end}}
2218
{{template "base/footer" .}}

templates/repo/issue/labels/edit_delete_label.tmpl renamed to templates/repo/issue/labels/label_edit_modal.tmpl

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
<div class="ui g-modal-confirm delete modal">
2-
<div class="header">
3-
{{svg "octicon-trash"}}
4-
{{ctx.Locale.Tr "repo.issues.label_deletion"}}
5-
</div>
6-
<div class="content">
7-
<p>{{ctx.Locale.Tr "repo.issues.label_deletion_desc"}}</p>
8-
</div>
9-
{{template "base/modal_actions_confirm" .}}
10-
</div>
11-
12-
<div class="ui small edit-label modal">
13-
<div class="header">
14-
{{ctx.Locale.Tr "repo.issues.label_modify"}}
15-
</div>
1+
<div class="ui small modal" id="issue-label-edit-modal"
2+
data-current-page-link="{{$.Link}}"{{/*will be used to construct "new label" and "edit label" URLs*/}}
3+
data-text-new-label="{{ctx.Locale.Tr "repo.issues.new_label"}}"
4+
data-text-edit-label="{{ctx.Locale.Tr "repo.issues.label_modify"}}"
5+
>
6+
<div class="header"></div>
167
<div class="content">
17-
<form class="ui edit-label form ignore-dirty" action="{{$.Link}}/edit" method="post">
8+
<form class="ui form ignore-dirty" method="post">
189
{{.CsrfTokenHtml}}
19-
<input id="label-modal-id" name="id" type="hidden">
10+
<input name="id" type="hidden">
2011
<div class="required field">
2112
<label for="name">{{ctx.Locale.Tr "repo.issues.label_title"}}</label>
2213
<div class="ui small input">

templates/repo/issue/labels/label_list.tmpl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
{{end}}
2828

2929
<ul class="issue-label-list">
30+
{{$canEditLabel := and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
31+
{{$canEditLabel = or $canEditLabel $.PageIsOrgSettingsLabels}}
3032
{{range .Labels}}
3133
<li class="item">
3234
<div class="label-title">
@@ -43,12 +45,16 @@
4345
<div class="label-operation tw-flex">
4446
{{template "repo/issue/labels/label_archived" .}}
4547
<div class="tw-flex tw-ml-auto">
46-
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
47-
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a>
48-
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a>
49-
{{else if $.PageIsOrgSettingsLabels}}
50-
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a>
51-
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a>
48+
{{if $canEditLabel}}
49+
<a class="edit-label-button" href="#"
50+
data-label-id="{{.ID}}" data-label-name="{{.Name}}" data-label-color="{{.Color}}"
51+
data-label-exclusive="{{.Exclusive}}" data-label-is-archived="{{gt .ArchivedUnix 0}}"
52+
data-label-num-issues="{{.NumIssues}}" data-label-description="{{.Description}}"
53+
>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a>
54+
<a class="link-action" href="#" data-url="{{$.Link}}/delete?id={{.ID}}"
55+
data-modal-confirm-header="{{ctx.Locale.Tr "repo.issues.label_deletion"}}"
56+
data-modal-confirm-content="{{ctx.Locale.Tr "repo.issues.label_deletion_desc"}}"
57+
>{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a>
5258
{{end}}
5359
</div>
5460
</div>

templates/repo/issue/labels/label_new.tmpl

Lines changed: 0 additions & 48 deletions
This file was deleted.

web_src/css/repo.css

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,17 +2061,6 @@ td .commit-summary {
20612061
padding: 1em;
20622062
}
20632063

2064-
.edit-label.modal .form .column,
2065-
.new-label.modal .form .column {
2066-
padding-right: 0;
2067-
}
2068-
2069-
.edit-label.modal .form .buttons,
2070-
.new-label.modal .form .buttons {
2071-
margin-left: auto;
2072-
padding-top: 15px;
2073-
}
2074-
20752064
.stats-table {
20762065
display: table;
20772066
width: 100%;

web_src/js/components/DashboardRepoList.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ import {fomanticQuery} from '../modules/fomantic/base.ts';
66
77
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
88
9+
type CommitStatus = 'pending' | 'success' | 'error' | 'failure' | 'warning';
10+
11+
type CommitStatusMap = {
12+
[status in CommitStatus]: {
13+
name: string,
14+
color: string,
15+
};
16+
};
17+
918
// make sure this matches templates/repo/commit_status.tmpl
10-
const commitStatus = {
19+
const commitStatus: CommitStatusMap = {
1120
pending: {name: 'octicon-dot-fill', color: 'yellow'},
1221
success: {name: 'octicon-check', color: 'green'},
1322
error: {name: 'gitea-exclamation', color: 'red'},
@@ -281,18 +290,18 @@ const sfc = {
281290
return 'octicon-repo';
282291
},
283292
284-
statusIcon(status) {
293+
statusIcon(status: CommitStatus) {
285294
return commitStatus[status].name;
286295
},
287296
288-
statusColor(status) {
297+
statusColor(status: CommitStatus) {
289298
return commitStatus[status].color;
290299
},
291300
292301
reposFilterKeyControl(e) {
293302
switch (e.key) {
294303
case 'Enter':
295-
document.querySelector('.repo-owner-name-list li.active a')?.click();
304+
document.querySelector<HTMLAnchorElement>('.repo-owner-name-list li.active a')?.click();
296305
break;
297306
case 'ArrowUp':
298307
if (this.activeIndex > 0) {

web_src/js/components/DiffCommitSelector.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
issueLink: el.getAttribute('data-issuelink'),
1515
locale: {
1616
filter_changes_by_commit: el.getAttribute('data-filter_changes_by_commit'),
17-
},
17+
} as Record<string, string>,
1818
commits: [],
1919
hoverActivated: false,
2020
lastReviewCommitSha: null,
@@ -41,16 +41,16 @@ export default {
4141
this.$el.removeEventListener('keyup', this.onKeyUp);
4242
},
4343
methods: {
44-
onBodyClick(event) {
44+
onBodyClick(event: MouseEvent) {
4545
// close this menu on click outside of this element when the dropdown is currently visible opened
4646
if (this.$el.contains(event.target)) return;
4747
if (this.menuVisible) {
4848
this.toggleMenu();
4949
}
5050
},
51-
onKeyDown(event) {
51+
onKeyDown(event: KeyboardEvent) {
5252
if (!this.menuVisible) return;
53-
const item = document.activeElement;
53+
const item = document.activeElement as HTMLElement;
5454
if (!this.$el.contains(item)) return;
5555
switch (event.key) {
5656
case 'ArrowDown': // select next element
@@ -73,7 +73,7 @@ export default {
7373
if (commitIdx) this.highlight(this.commits[commitIdx]);
7474
}
7575
},
76-
onKeyUp(event) {
76+
onKeyUp(event: KeyboardEvent) {
7777
if (!this.menuVisible) return;
7878
const item = document.activeElement;
7979
if (!this.$el.contains(item)) return;
@@ -95,7 +95,7 @@ export default {
9595
}
9696
},
9797
/** Focus given element */
98-
focusElem(elem, prevElem) {
98+
focusElem(elem: HTMLElement, prevElem: HTMLElement) {
9999
if (elem) {
100100
elem.tabIndex = 0;
101101
if (prevElem) prevElem.tabIndex = -1;
@@ -149,7 +149,7 @@ export default {
149149
window.location.assign(`${this.issueLink}/files/${this.lastReviewCommitSha}..${this.commits.at(-1).id}${this.queryParams}`);
150150
},
151151
/** Clicking on a single commit opens this specific commit */
152-
commitClicked(commitId, newWindow = false) {
152+
commitClicked(commitId: string, newWindow = false) {
153153
const url = `${this.issueLink}/commits/${commitId}${this.queryParams}`;
154154
if (newWindow) {
155155
window.open(url);

0 commit comments

Comments
 (0)