Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  Update documentation for the new YAML label file format  (go-gitea#23020)
  Remove unnecessary space on link (go-gitea#23334)
  Fix incorrect redirect link of delete org project (go-gitea#23327)
  Fix incorrect project links and use symlink icon for org-wide projects (go-gitea#23325)
  Fix PR view misalignment caused by long name file (go-gitea#23321)
  Add ActionRunStatus component (go-gitea#23259)
  Scoped labels: don't require holding alt key to remove (go-gitea#23303)
  • Loading branch information
zjjhot committed Mar 7, 2023
2 parents 306ba96 + 84a2993 commit 9d14e78
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 43 deletions.
15 changes: 14 additions & 1 deletion docs/content/doc/advanced/customizing-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,22 @@ To add custom .gitignore, add a file with existing [.gitignore rules](https://gi

### Labels

To add a custom label set, add a file that follows the [label format](https://github.com/go-gitea/gitea/blob/main/options/label/Default) to `$GITEA_CUSTOM/options/label`
Starting with Gitea 1.19, you can add a file that follows the [YAML label format](https://github.com/go-gitea/gitea/blob/main/options/label/Advanced.yaml) to `$GITEA_CUSTOM/options/label`:

```yaml
labels:
- name: "foo/bar" # name of the label that will appear in the dropdown
exclusive: true # whether to use the exclusive namespace for scoped labels. scoped delimiter is /
color: aabbcc # hex colour coding
description: Some label # long description of label intent
```
The [legacy file format](https://github.com/go-gitea/gitea/blob/main/options/label/Default) can still be used following the format below, however we strongly recommend using the newer YAML format instead.
`#hex-color label name ; label description`

For more information, see the [labels documentation]({{< relref "doc/usage/labels.en-us.md" >}}).

### Licenses

To add a custom license, add a file with the license text to `$GITEA_CUSTOM/options/license`
Expand Down
2 changes: 1 addition & 1 deletion routers/web/org/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func DeleteProject(ctx *context.Context) {
}

ctx.JSON(http.StatusOK, map[string]interface{}{
"redirect": ctx.Repo.RepoLink + "/projects",
"redirect": ctx.ContextUser.HomeLink() + "/-/projects",
})
}

Expand Down
2 changes: 1 addition & 1 deletion templates/org/menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
</a>
<a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects">
{{svg "octicon-project"}} {{.locale.Tr "user.projects"}}
{{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}}
</a>
{{if .IsPackageEnabled}}
<a class="item" href="{{$.Org.HomeLink}}/-/packages">
Expand Down
4 changes: 2 additions & 2 deletions templates/projects/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{template "base/alert" .}}
<div class="ui compact tiny menu">
<a class="item{{if not .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=open">
{{svg "octicon-project" 16 "gt-mr-3"}}
{{svg "octicon-project-symlink" 16 "gt-mr-3"}}
{{JsPrettyNumber .OpenCount}}&nbsp;{{.locale.Tr "repo.issues.open_title"}}
</a>
<a class="item{{if .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=closed">
Expand All @@ -38,7 +38,7 @@
<div class="milestone list">
{{range .Projects}}
<li class="item">
{{svg "octicon-project"}} <a href="{{$.Link}}/{{.ID}}">{{.Title}}</a>
{{svg "octicon-project-symlink"}} <a href="{{.Link}}">{{.Title}}</a>
<div class="meta">
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
{{if .IsClosed}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/actions/runs_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="issue-item-main gt-f1 gt-fc gt-df">
<div class="issue-item-top-row">
<a class="index gt-ml-0 gt-mr-2" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
{{.Title}}
{{- .Title -}}
</a>
<span class="ui label">
{{if .RefLink}}
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} gt-mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}>
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header gt-df gt-ac gt-sb">
<div class="gt-df gt-ac">
<div class="diff-file-name gt-df gt-ac gt-mr-3">
<a role="button" class="fold-file muted gt-mr-2" {{if not $isExpandable}}style="visibility: hidden"{{end}}>
{{if $file.ShouldBeHidden}}
{{svg "octicon-chevron-right" 18}}
Expand All @@ -96,7 +96,7 @@
{{template "repo/diff/stats" dict "file" . "root" $}}
{{end}}
</div>
<span class="file gt-mono"><a class="muted" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}</a>{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}</span>
<span class="file gt-mono"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}</a>{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}</span>
{{if $file.IsGenerated}}
<span class="ui label gt-ml-3">{{$.locale.Tr "repo.diff.generated"}}</span>
{{end}}
Expand Down
12 changes: 6 additions & 6 deletions templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@
{{.locale.Tr "repo.issues.new.open_projects"}}
</div>
{{range .OpenProjects}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{$.RepoLink}}/projects/{{.ID}}">
{{svg "octicon-project" 18 "gt-mr-3"}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{.Title}}
</a>
{{end}}
Expand All @@ -188,8 +188,8 @@
{{.locale.Tr "repo.issues.new.closed_projects"}}
</div>
{{range .ClosedProjects}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{$.RepoLink}}/projects/{{.ID}}">
{{svg "octicon-project" 18 "gt-mr-3"}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{.Title}}
</a>
{{end}}
Expand All @@ -201,8 +201,8 @@
<span class="no-select item {{if .Project}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span>
<div class="selected">
{{if .Project}}
<a class="item muted sidebar-item-link" href="{{.RepoLink}}/projects/{{.Project.ID}}">
{{svg "octicon-project" 18 "gt-mr-3"}}
<a class="item muted sidebar-item-link" href="{{.Project.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{.Project.Title}}
</a>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/projects/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="milestone list">
{{range .Projects}}
<li class="item">
{{svg "octicon-project"}} <a href="{{$.RepoLink}}/projects/{{.ID}}">{{.Title}}</a>
{{svg "octicon-project"}} <a href="{{.Link}}">{{.Title}}</a>
<div class="meta">
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
{{if .IsClosed}}
Expand Down
4 changes: 2 additions & 2 deletions templates/shared/issuelist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
</a>
{{end}}
{{if .Project}}
<a class="project" {{if $.RepoLink}}href="{{$.RepoLink}}/projects/{{.Project.ID}}"{{else}}href="{{.Repo.Link}}/projects/{{.Project.ID}}"{{end}}>
{{svg "octicon-project" 14 "gt-mr-2"}}{{.Project.Title}}
<a class="project" href="{{.Project.Link}}">
{{if .Project.IsOrganizationProject}}{{svg "octicon-project-symlink" 14 "gt-mr-2"}}{{else}}{{svg "octicon-project" 14 "gt-mr-2"}}{{end}}{{.Project.Title}}
</a>
{{end}}
{{if .Ref}}
Expand Down
2 changes: 1 addition & 1 deletion templates/user/overview/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
</a>
<a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item">
{{svg "octicon-project"}} {{.locale.Tr "user.projects"}}
{{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}}
</a>
{{if (not .UnitPackagesGlobalDisabled)}}
<a href="{{.ContextUser.HomeLink}}/-/packages" class="{{if .IsPackagesPage}}active {{end}}item">
Expand Down
2 changes: 1 addition & 1 deletion templates/user/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
</a>
<a href="{{.Owner.HomeLink}}/-/projects" class="{{if eq .TabName "projects"}}active {{end}}item">
{{svg "octicon-project"}} {{.locale.Tr "user.projects"}}
{{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}}
</a>
{{if .IsPackageEnabled}}
<a class='{{if eq .TabName "packages"}}active {{end}}item' href="{{.Owner.HomeLink}}/-/packages">
Expand Down
30 changes: 30 additions & 0 deletions web_src/js/components/ActionRunStatus.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<SvgIcon name="octicon-check-circle-fill" class="green" :size="size" :class-name="className" v-if="status === 'success'"/>
<SvgIcon name="octicon-skip" class="ui text grey" :size="size" :class-name="className" v-else-if="status === 'skipped'"/>
<SvgIcon name="octicon-clock" class="ui text yellow" :size="size" :class-name="className" v-else-if="status === 'waiting'"/>
<SvgIcon name="octicon-blocked" class="ui text yellow" :size="size" :class-name="className" v-else-if="status === 'blocked'"/>
<SvgIcon name="octicon-meter" class="ui text yellow" :size="size" :class-name="'job-status-rotate ' + className" v-else-if="status === 'running'"/>
<SvgIcon name="octicon-x-circle-fill" class="red" :size="size" v-else/>
</template>

<script>
import {SvgIcon} from '../svg.js';
export default {
components: {SvgIcon},
props: {
status: {
type: String,
required: true
},
size: {
type: Number,
default: 16
},
className: {
type: String,
default: ''
}
},
};
</script>
21 changes: 5 additions & 16 deletions web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
<div class="action-view-container">
<div class="action-view-header">
<div class="action-info-summary">
<SvgIcon name="octicon-check-circle-fill" size="20" class="green" v-if="run.status === 'success'"/>
<SvgIcon name="octicon-clock" size="20" class="ui text yellow" v-else-if="run.status === 'waiting'"/>
<SvgIcon name="octicon-meter" size="20" class="ui text yellow" class-name="job-status-rotate" v-else-if="run.status === 'running'"/>
<SvgIcon name="octicon-x-circle-fill" size="20" class="red" v-else/>
<ActionRunStatus :status="run.status" :size="20"/>
<div class="action-title">
{{ run.title }}
</div>
Expand All @@ -23,12 +20,7 @@
<div class="job-brief-list">
<div class="job-brief-item" v-for="(job, index) in run.jobs" :key="job.id">
<a class="job-brief-link" :href="run.link+'/jobs/'+index">
<SvgIcon name="octicon-check-circle-fill" class="green" v-if="job.status === 'success'"/>
<SvgIcon name="octicon-skip" class="ui text grey" v-else-if="job.status === 'skipped'"/>
<SvgIcon name="octicon-clock" class="ui text yellow" v-else-if="job.status === 'waiting'"/>
<SvgIcon name="octicon-blocked" class="ui text yellow" v-else-if="job.status === 'blocked'"/>
<SvgIcon name="octicon-meter" class="ui text yellow" class-name="job-status-rotate" v-else-if="job.status === 'running'"/>
<SvgIcon name="octicon-x-circle-fill" class="red" v-else/>
<ActionRunStatus :status="job.status"/>
<span class="ui text">{{ job.name }}</span>
</a>
<button class="job-brief-rerun" @click="rerunJob(index)" v-if="job.canRerun">
Expand All @@ -54,12 +46,7 @@
<SvgIcon name="octicon-chevron-down" class="gt-mr-3" v-show="currentJobStepsStates[i].expanded"/>
<SvgIcon name="octicon-chevron-right" class="gt-mr-3" v-show="!currentJobStepsStates[i].expanded"/>

<SvgIcon name="octicon-check-circle-fill" class="green gt-mr-3" v-if="jobStep.status === 'success'"/>
<SvgIcon name="octicon-skip" class="ui text grey gt-mr-3" v-else-if="jobStep.status === 'skipped'"/>
<SvgIcon name="octicon-clock" class="ui text yellow gt-mr-3" v-else-if="jobStep.status === 'waiting'"/>
<SvgIcon name="octicon-blocked" class="ui text yellow gt-mr-3" v-else-if="jobStep.status === 'blocked'"/>
<SvgIcon name="octicon-meter" class="ui text yellow gt-mr-3" class-name="job-status-rotate" v-else-if="jobStep.status === 'running'"/>
<SvgIcon name="octicon-x-circle-fill" class="red gt-mr-3 " v-else/>
<ActionRunStatus :status="jobStep.status" class="gt-mr-3"/>

<span class="step-summary-msg">{{ jobStep.summary }}</span>
<span class="step-summary-dur">{{ jobStep.duration }}</span>
Expand All @@ -76,6 +63,7 @@

<script>
import {SvgIcon} from '../svg.js';
import ActionRunStatus from './ActionRunStatus.vue';
import {createApp} from 'vue';
import AnsiToHTML from 'ansi-to-html';
Expand All @@ -85,6 +73,7 @@ const sfc = {
name: 'RepoActionView',
components: {
SvgIcon,
ActionRunStatus,
},
props: {
runIndex: String,
Expand Down
7 changes: 1 addition & 6 deletions web_src/js/features/repo-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,14 @@ export function initRepoCommentForm() {

const clickedItem = $(this);
const scope = $(this).attr('data-scope');
const canRemoveScope = e.altKey;

$(this).parent().find('.item').each(function () {
if (scope) {
// Enable only clicked item for scoped labels
if ($(this).attr('data-scope') !== scope) {
return true;
}
if ($(this).is(clickedItem)) {
if (!canRemoveScope && $(this).hasClass('checked')) {
return true;
}
} else if (!$(this).hasClass('checked')) {
if (!$(this).is(clickedItem) && !$(this).hasClass('checked')) {
return true;
}
} else if (!$(this).is(clickedItem)) {
Expand Down
19 changes: 17 additions & 2 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1670,8 +1670,14 @@
align-items: center;

.file {
flex: 1;
word-break: break-all;
min-width: 0;
.file-link {
max-width: fit-content;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
}

.button {
Expand Down Expand Up @@ -3283,6 +3289,15 @@ td.blob-excerpt {
position: static;
}
}

.diff-file-header-actions {
flex-shrink: 0;
}

.diff-file-name {
flex: auto;
min-width: 100px;
}
}

.diff-file-body {
Expand Down

0 comments on commit 9d14e78

Please sign in to comment.