mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-09 00:21:31 +01:00
Merge fd5cc7dfcade8c4f7ed30af8951592338de10ac4 into 98ef79d73a6a546241dd02959ae17f136369b604
This commit is contained in:
commit
49df3313d3
@ -77,7 +77,6 @@ linters:
|
||||
- name: identical-branches
|
||||
- name: if-return
|
||||
- name: increment-decrement
|
||||
- name: indent-error-flow
|
||||
- name: modifies-value-receiver
|
||||
- name: package-comments
|
||||
- name: range
|
||||
|
||||
@ -406,7 +406,7 @@ export default defineConfig([
|
||||
'no-dupe-keys': [2],
|
||||
'no-duplicate-case': [2],
|
||||
'no-duplicate-imports': [0],
|
||||
'no-else-return': [2],
|
||||
'no-else-return': [0],
|
||||
'no-empty-character-class': [2],
|
||||
'no-empty-function': [0],
|
||||
'no-empty-pattern': [2],
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
<td>
|
||||
<a href="{{.HomeLink}}">{{if and DefaultShowFullName .FullName}}{{.FullName}} ({{.Name}}){{else}}{{.Name}}{{end}}</a>
|
||||
{{if .Visibility.IsPrivate}}
|
||||
<span class="text gold">{{svg "octicon-lock"}}</span>
|
||||
{{svg "octicon-lock"}}
|
||||
{{end}}
|
||||
{{if eq .Type 3}}{{/* Reserved organization */}}
|
||||
<span class="ui mini label">{{ctx.Locale.Tr "admin.users.reserved"}}</span>
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
<td>
|
||||
<a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
|
||||
{{if .Owner.Visibility.IsPrivate}}
|
||||
<span class="text gold">{{svg "octicon-lock"}}</span>
|
||||
{{svg "octicon-lock"}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td>{{.Package.Type.Name}}</td>
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
<td>
|
||||
<a class="tw-break-anywhere" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
|
||||
{{if .Owner.Visibility.IsPrivate}}
|
||||
<span class="text gold">{{svg "octicon-lock"}}</span>
|
||||
{{svg "octicon-lock"}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
{{range $.TeamRepos}}
|
||||
<div class="flex-item tw-items-center">
|
||||
<div class="flex-item-leading">
|
||||
{{template "repo/icon" .}}
|
||||
{{template "repo/icon" (dict "Repo" . "Size" 24)}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<a class="flex-item-title text primary" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}">
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<div class="repo-header">
|
||||
<div class="flex-item tw-items-center">
|
||||
<div class="flex-item-leading">
|
||||
{{template "repo/icon" .}}
|
||||
{{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoAvatar" true)}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<div class="flex-item-title tw-text-18">
|
||||
|
||||
@ -1,10 +1,20 @@
|
||||
{{$avatarLink := (.RelAvatarLink ctx)}}
|
||||
{{if $avatarLink}}
|
||||
<img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt aria-hidden="true">
|
||||
{{else if $.IsMirror}}
|
||||
{{svg "octicon-mirror" 24}}
|
||||
{{else if $.IsFork}}
|
||||
{{svg "octicon-repo-forked" 24}}
|
||||
{{/* Template Attributes:
|
||||
* Repo (string, required): The repo
|
||||
* Size (int, required): Icon size in pixels
|
||||
* ShowRepoAvatar (boolean, optional): Render the repo's avatar, if one is set
|
||||
* ShowRepoOwnerAvatar (boolean, optional): Render the repo's owner avatar
|
||||
*
|
||||
* Note: Keep the icon logic in sync with web_src/js/utils/mappings.ts
|
||||
*/}}
|
||||
{{$avatarLink := (.Repo.RelAvatarLink ctx)}}
|
||||
{{if .ShowRepoOwnerAvatar}}
|
||||
{{ctx.AvatarUtils.Avatar .Repo.Owner .Size}}
|
||||
{{else if and $avatarLink .ShowRepoAvatar}}
|
||||
<img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="{{.Size}}" height="{{.Size}}" alt aria-hidden="true">
|
||||
{{else if .Repo.IsMirror}}
|
||||
{{svg "octicon-mirror" .Size}}
|
||||
{{else if .Repo.IsFork}}
|
||||
{{svg "octicon-repo-forked" .Size}}
|
||||
{{else}}
|
||||
{{svg "octicon-repo" 24}}
|
||||
{{svg "octicon-repo" .Size}}
|
||||
{{end}}
|
||||
|
||||
@ -59,11 +59,11 @@
|
||||
<div class="ui attached segment horizontal segments">
|
||||
{{if .Permission.CanRead ctx.Consts.RepoUnitTypePullRequests}}
|
||||
<a href="#merged-pull-requests" class="ui attached segment text center">
|
||||
<span class="text purple">{{svg "octicon-git-pull-request"}}</span> <strong>{{.Activity.MergedPRCount}}</strong><br>
|
||||
<span class="text purple">{{svg "octicon-git-merge"}}</span> <strong>{{.Activity.MergedPRCount}}</strong><br>
|
||||
{{ctx.Locale.TrN .Activity.MergedPRCount "repo.activity.merged_prs_count_1" "repo.activity.merged_prs_count_n"}}
|
||||
</a>
|
||||
<a href="#proposed-pull-requests" class="ui attached segment text center">
|
||||
<span class="text green">{{svg "octicon-git-branch"}}</span> <strong>{{.Activity.OpenedPRCount}}</strong><br>
|
||||
<span class="text green">{{svg "octicon-git-pull-request"}}</span> <strong>{{.Activity.OpenedPRCount}}</strong><br>
|
||||
{{ctx.Locale.TrN .Activity.OpenedPRCount "repo.activity.opened_prs_count_1" "repo.activity.opened_prs_count_n"}}
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
@ -2,11 +2,7 @@
|
||||
{{range .Repos}}
|
||||
<div class="flex-item">
|
||||
<div class="flex-item-leading">
|
||||
{{if $.ShowRepoOwnerAvatar}}
|
||||
{{ctx.AvatarUtils.Avatar .Owner 24}}
|
||||
{{else}}
|
||||
{{template "repo/icon" .}}
|
||||
{{end}}
|
||||
{{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoOwnerAvatar" $.ShowRepoOwnerAvatar "ShowRepoAvatar" true)}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<div class="flex-item-header">
|
||||
@ -48,7 +44,7 @@
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="flex-text-inline" href="{{.Link}}/forks">
|
||||
<span class="tw-contents" aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span>
|
||||
<span class="tw-contents" aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-repo-forked" 16}}</span>
|
||||
<span {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}>{{CountFmt .NumForks}}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -12,17 +12,7 @@
|
||||
<div class="item {{if not $repo}}tw-py-1{{end}}">{{/* if not repo, then there are "adapt" buttons, so the padding shouldn't be that default large*/}}
|
||||
<div class="content">
|
||||
{{if $repo}}
|
||||
{{if $repo.IsPrivate}}
|
||||
<span class="text gold icon">{{svg "octicon-lock"}}</span>
|
||||
{{else if $repo.IsFork}}
|
||||
<span class="icon">{{svg "octicon-repo-forked"}}</span>
|
||||
{{else if $repo.IsMirror}}
|
||||
<span class="icon">{{svg "octicon-mirror"}}</span>
|
||||
{{else if $repo.IsTemplate}}
|
||||
<span class="icon">{{svg "octicon-repo-template"}}</span>
|
||||
{{else}}
|
||||
<span class="icon">{{svg "octicon-repo"}}</span>
|
||||
{{end}}
|
||||
{{template "repo/icon" (dict "Repo" $repo "Size" 16)}}
|
||||
<a class="muted name" href="{{$repo.Link}}">{{$repo.OwnerName}}/{{$repo.Name}}</a>
|
||||
<span class="text light-3" {{if not (eq $repo.Size 0)}} data-tooltip-content="{{$repo.SizeDetailsString}}"{{end}}>{{FileSize $repo.Size}}</span>
|
||||
{{if $repo.IsFork}}
|
||||
@ -85,17 +75,7 @@
|
||||
{{range .Repos}}
|
||||
<div class="item">
|
||||
<div class="content flex-text-block">
|
||||
{{if .IsPrivate}}
|
||||
{{svg "octicon-lock" 16 "text gold"}}
|
||||
{{else if .IsFork}}
|
||||
{{svg "octicon-repo-forked"}}
|
||||
{{else if .IsMirror}}
|
||||
{{svg "octicon-mirror"}}
|
||||
{{else if .IsTemplate}}
|
||||
{{svg "octicon-repo-template"}}
|
||||
{{else}}
|
||||
{{svg "octicon-repo"}}
|
||||
{{end}}
|
||||
{{template "repo/icon" (dict "Repo" . "Size" 16)}}
|
||||
<a class="name" href="{{.Link}}">{{.OwnerName}}/{{.Name}}</a>
|
||||
<span>{{FileSize .Size}}</span>
|
||||
{{if .IsFork}}
|
||||
|
||||
@ -584,10 +584,6 @@ img.ui.avatar,
|
||||
color: var(--color-grey-light) !important;
|
||||
}
|
||||
|
||||
.text.gold {
|
||||
color: var(--color-gold) !important;
|
||||
}
|
||||
|
||||
.text.small {
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
@ -146,7 +146,6 @@ gitea-theme-meta-info {
|
||||
/* other colors */
|
||||
--color-grey: #384149;
|
||||
--color-grey-light: #818f9e;
|
||||
--color-gold: #b1983b;
|
||||
--color-white: #ffffff;
|
||||
--color-diff-added-linenum-bg: #274227;
|
||||
--color-diff-added-row-bg: #203224;
|
||||
|
||||
@ -146,7 +146,6 @@ gitea-theme-meta-info {
|
||||
/* other colors */
|
||||
--color-grey: #697077;
|
||||
--color-grey-light: #7c838a;
|
||||
--color-gold: #a1882b;
|
||||
--color-white: #ffffff;
|
||||
--color-diff-added-linenum-bg: #d1f8d9;
|
||||
--color-diff-added-row-bg: #e6ffed;
|
||||
|
||||
@ -3,6 +3,7 @@ import {nextTick, defineComponent} from 'vue';
|
||||
import {SvgIcon} from '../svg.ts';
|
||||
import {GET} from '../modules/fetch.ts';
|
||||
import {fomanticQuery} from '../modules/fomantic/base.ts';
|
||||
import {getRepoIcon} from '../utils/mappings.ts';
|
||||
|
||||
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
|
||||
|
||||
@ -283,19 +284,8 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
repoIcon(repo: any) {
|
||||
if (repo.fork) {
|
||||
return 'octicon-repo-forked';
|
||||
} else if (repo.mirror) {
|
||||
return 'octicon-mirror';
|
||||
} else if (repo.template) {
|
||||
return `octicon-repo-template`;
|
||||
} else if (repo.private) {
|
||||
return 'octicon-lock';
|
||||
} else if (repo.internal) {
|
||||
return 'octicon-repo';
|
||||
}
|
||||
return 'octicon-repo';
|
||||
repoIcon(repo: Record<string, any>) {
|
||||
return getRepoIcon(repo);
|
||||
},
|
||||
|
||||
statusIcon(status: CommitStatus) {
|
||||
|
||||
10
web_src/js/utils/mappings.ts
Normal file
10
web_src/js/utils/mappings.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// repo icon, keep in sync with templates/repo/icon.tmpl
|
||||
export function getRepoIcon(repo: Record<string, any>) {
|
||||
if (repo.mirror) {
|
||||
return 'octicon-mirror';
|
||||
} else if (repo.fork) {
|
||||
return 'octicon-repo-forked';
|
||||
} else {
|
||||
return 'octicon-repo';
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user