From c982031b15db413a73835ee36e113b894c8bfe28 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Nov 2025 00:50:59 +0100 Subject: [PATCH 1/5] Misc icon tweaks --- templates/admin/org/list.tmpl | 2 +- templates/admin/packages/list.tmpl | 2 +- templates/admin/repo/list.tmpl | 2 +- templates/repo/icon.tmpl | 2 ++ templates/repo/pulse.tmpl | 4 ++-- templates/shared/repo/list.tmpl | 2 +- templates/user/settings/repos.tmpl | 4 ++-- web_src/css/base.css | 4 ---- web_src/css/themes/theme-gitea-dark.css | 1 - web_src/css/themes/theme-gitea-light.css | 1 - web_src/js/components/DashboardRepoList.vue | 4 ++-- web_src/js/svg.ts | 2 ++ 12 files changed, 14 insertions(+), 16 deletions(-) diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl index 137c42b45d610..ea2e026fcf496 100644 --- a/templates/admin/org/list.tmpl +++ b/templates/admin/org/list.tmpl @@ -54,7 +54,7 @@ {{if and DefaultShowFullName .FullName}}{{.FullName}} ({{.Name}}){{else}}{{.Name}}{{end}} {{if .Visibility.IsPrivate}} - {{svg "octicon-lock"}} + {{svg "octicon-lock"}} {{end}} {{if eq .Type 3}}{{/* Reserved organization */}} {{ctx.Locale.Tr "admin.users.reserved"}} diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index 4817f2681b4d6..83b07bcdef19b 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -58,7 +58,7 @@ {{.Owner.Name}} {{if .Owner.Visibility.IsPrivate}} - {{svg "octicon-lock"}} + {{svg "octicon-lock"}} {{end}} {{.Package.Type.Name}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index 767d00fa741d7..07e0c9b4265e5 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -49,7 +49,7 @@ {{.Owner.Name}} {{if .Owner.Visibility.IsPrivate}} - {{svg "octicon-lock"}} + {{svg "octicon-lock"}} {{end}} diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index e4a904c46b8ad..5ee7c08adeb90 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -5,6 +5,8 @@ {{svg "octicon-mirror" 24}} {{else if $.IsFork}} {{svg "octicon-repo-forked" 24}} +{{else if $.IsPrivate}} + {{svg "octicon-repo-locked" 24}} {{else}} {{svg "octicon-repo" 24}} {{end}} diff --git a/templates/repo/pulse.tmpl b/templates/repo/pulse.tmpl index cbafee9ba9d9e..a33b76f321638 100644 --- a/templates/repo/pulse.tmpl +++ b/templates/repo/pulse.tmpl @@ -59,11 +59,11 @@
{{if .Permission.CanRead ctx.Consts.RepoUnitTypePullRequests}} - {{svg "octicon-git-pull-request"}} {{.Activity.MergedPRCount}}
+ {{svg "octicon-git-merge"}} {{.Activity.MergedPRCount}}
{{ctx.Locale.TrN .Activity.MergedPRCount "repo.activity.merged_prs_count_1" "repo.activity.merged_prs_count_n"}}
- {{svg "octicon-git-branch"}} {{.Activity.OpenedPRCount}}
+ {{svg "octicon-git-pull-request"}} {{.Activity.OpenedPRCount}}
{{ctx.Locale.TrN .Activity.OpenedPRCount "repo.activity.opened_prs_count_1" "repo.activity.opened_prs_count_n"}}
{{end}} diff --git a/templates/shared/repo/list.tmpl b/templates/shared/repo/list.tmpl index 2c8af14f9c70e..ef7d7a540d6fc 100644 --- a/templates/shared/repo/list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -48,7 +48,7 @@ {{end}} - {{svg "octicon-git-branch" 16}} + {{svg "octicon-repo-forked" 16}} {{CountFmt .NumForks}}
diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl index 4aed8070de04b..cd1c9d8e25dce 100644 --- a/templates/user/settings/repos.tmpl +++ b/templates/user/settings/repos.tmpl @@ -13,7 +13,7 @@
{{if $repo}} {{if $repo.IsPrivate}} - {{svg "octicon-lock"}} + {{svg "octicon-repo-locked"}} {{else if $repo.IsFork}} {{svg "octicon-repo-forked"}} {{else if $repo.IsMirror}} @@ -86,7 +86,7 @@
{{if .IsPrivate}} - {{svg "octicon-lock" 16 "text gold"}} + {{svg "octicon-lock"}} {{else if .IsFork}} {{svg "octicon-repo-forked"}} {{else if .IsMirror}} diff --git a/web_src/css/base.css b/web_src/css/base.css index be28cd6fea954..20e0b5d59db49 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -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; } diff --git a/web_src/css/themes/theme-gitea-dark.css b/web_src/css/themes/theme-gitea-dark.css index 1718a1f06b723..37ff3b2d98765 100644 --- a/web_src/css/themes/theme-gitea-dark.css +++ b/web_src/css/themes/theme-gitea-dark.css @@ -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; diff --git a/web_src/css/themes/theme-gitea-light.css b/web_src/css/themes/theme-gitea-light.css index db54f5e5fbfd6..2798d76583ee2 100644 --- a/web_src/css/themes/theme-gitea-light.css +++ b/web_src/css/themes/theme-gitea-light.css @@ -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; diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index e938814ec6c1b..5d0d66e4b3374 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -291,7 +291,7 @@ export default defineComponent({ } else if (repo.template) { return `octicon-repo-template`; } else if (repo.private) { - return 'octicon-lock'; + return 'octicon-repo-locked'; } else if (repo.internal) { return 'octicon-repo'; } @@ -391,7 +391,7 @@ export default defineComponent({
diff --git a/web_src/js/svg.ts b/web_src/js/svg.ts index 3d3e6530728d4..b1953b0446942 100644 --- a/web_src/js/svg.ts +++ b/web_src/js/svg.ts @@ -63,6 +63,7 @@ import octiconProject from '../../public/assets/img/svg/octicon-project.svg'; import octiconQuote from '../../public/assets/img/svg/octicon-quote.svg'; import octiconRepo from '../../public/assets/img/svg/octicon-repo.svg'; import octiconRepoForked from '../../public/assets/img/svg/octicon-repo-forked.svg'; +import octiconRepoLocked from '../../public/assets/img/svg/octicon-repo-locked.svg'; import octiconRepoTemplate from '../../public/assets/img/svg/octicon-repo-template.svg'; import octiconRss from '../../public/assets/img/svg/octicon-rss.svg'; import octiconScreenFull from '../../public/assets/img/svg/octicon-screen-full.svg'; @@ -144,6 +145,7 @@ const svgs = { 'octicon-quote': octiconQuote, 'octicon-repo': octiconRepo, 'octicon-repo-forked': octiconRepoForked, + 'octicon-repo-locked': octiconRepoLocked, 'octicon-repo-template': octiconRepoTemplate, 'octicon-rss': octiconRss, 'octicon-screen-full': octiconScreenFull, From 092b7fd19328743f4595e143fc70dc4895c0cf23 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Nov 2025 18:12:12 +0100 Subject: [PATCH 2/5] improve repo/icon template, extract js function --- routers/web/repo/view.go | 1 - templates/org/team/repositories.tmpl | 2 +- templates/repo/header.tmpl | 2 +- templates/repo/icon.tmpl | 30 ++++++++++++++------- templates/shared/repo/list.tmpl | 6 +---- templates/user/settings/repos.tmpl | 24 ++--------------- web_src/js/components/DashboardRepoList.vue | 16 +++-------- web_src/js/utils/mappings.ts | 12 +++++++++ 8 files changed, 40 insertions(+), 53 deletions(-) create mode 100644 web_src/js/utils/mappings.ts diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 09ac33cff43f0..cfd256855e996 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -412,7 +412,6 @@ func Forks(ctx *context.Context) { } pager := context.NewPagination(int(total), pageSize, page, 5) - ctx.Data["ShowRepoOwnerAvatar"] = true ctx.Data["ShowRepoOwnerOnList"] = true ctx.Data["Page"] = pager ctx.Data["Repos"] = forks diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index 2f38071e89f4e..721dd0b6443b1 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -30,7 +30,7 @@ {{range $.TeamRepos}}
- {{template "repo/icon" .}} + {{template "repo/icon" (dict "Repo" . "Size" 24)}}
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index b61076ff4637e..0fe24564d301a 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -4,7 +4,7 @@
- {{template "repo/icon" .}} + {{template "repo/icon" (dict "Repo" . "EnableRepoAvatar" "true" "Size" 24)}}
diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index 5ee7c08adeb90..0411bc84e42bd 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -1,12 +1,22 @@ -{{$avatarLink := (.RelAvatarLink ctx)}} -{{if $avatarLink}} - -{{else if $.IsMirror}} - {{svg "octicon-mirror" 24}} -{{else if $.IsFork}} - {{svg "octicon-repo-forked" 24}} -{{else if $.IsPrivate}} - {{svg "octicon-repo-locked" 24}} +{{/* Template Attributes: +* Repo: The repo +* EnableRepoAvatar: Enable repo avatars when non-nil +* Size: Icon size in pixels, default is 16 +* +* Note: Keep the icon logic in sync with web_src/js/utils/mappings.ts +*/}} +{{$size := or .Size 16}} +{{$avatarLink := (.Repo.RelAvatarLink ctx)}} +{{if and $avatarLink .EnableRepoAvatar}} + +{{else if .Repo.IsMirror}} + {{svg "octicon-mirror" $size}} +{{else if .Repo.IsPrivate}} + {{svg "octicon-repo-locked" $size}} +{{else if .Repo.IsTemplate}} + {{svg "octicon-repo-template" $size}} +{{else if .Repo.IsFork}} + {{svg "octicon-repo-forked" $size}} {{else}} - {{svg "octicon-repo" 24}} + {{svg "octicon-repo" $size}} {{end}} diff --git a/templates/shared/repo/list.tmpl b/templates/shared/repo/list.tmpl index ef7d7a540d6fc..6bcd0a4d8d4dc 100644 --- a/templates/shared/repo/list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -2,11 +2,7 @@ {{range .Repos}}
- {{if $.ShowRepoOwnerAvatar}} - {{ctx.AvatarUtils.Avatar .Owner 24}} - {{else}} - {{template "repo/icon" .}} - {{end}} + {{template "repo/icon" (dict "Repo" . "Size" 24 "EnableRepoAvatar" "true")}}
diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl index cd1c9d8e25dce..d119f79bd39f9 100644 --- a/templates/user/settings/repos.tmpl +++ b/templates/user/settings/repos.tmpl @@ -12,17 +12,7 @@
{{/* if not repo, then there are "adapt" buttons, so the padding shouldn't be that default large*/}}
{{if $repo}} - {{if $repo.IsPrivate}} - {{svg "octicon-repo-locked"}} - {{else if $repo.IsFork}} - {{svg "octicon-repo-forked"}} - {{else if $repo.IsMirror}} - {{svg "octicon-mirror"}} - {{else if $repo.IsTemplate}} - {{svg "octicon-repo-template"}} - {{else}} - {{svg "octicon-repo"}} - {{end}} + {{template "repo/icon" (dict "Repo" $repo "Size" 16)}} {{$repo.OwnerName}}/{{$repo.Name}} {{FileSize $repo.Size}} {{if $repo.IsFork}} @@ -85,17 +75,7 @@ {{range .Repos}}
- {{if .IsPrivate}} - {{svg "octicon-lock"}} - {{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)}} {{.OwnerName}}/{{.Name}} {{FileSize .Size}} {{if .IsFork}} diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index 5d0d66e4b3374..e4aa11dea9e32 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -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-repo-locked'; - } else if (repo.internal) { - return 'octicon-repo'; - } - return 'octicon-repo'; + repoIcon(repo: Record) { + return getRepoIcon(repo); }, statusIcon(status: CommitStatus) { diff --git a/web_src/js/utils/mappings.ts b/web_src/js/utils/mappings.ts new file mode 100644 index 0000000000000..d99fe9aa29f83 --- /dev/null +++ b/web_src/js/utils/mappings.ts @@ -0,0 +1,12 @@ +export function getRepoIcon(repo: Record) { + if (repo.mirror) { + return 'octicon-mirror'; + } else if (repo.fork) { + return 'octicon-repo-forked'; + } else if (repo.private) { + return 'octicon-repo-locked'; + } else if (repo.template) { + return `octicon-repo-template`; + } + return 'octicon-repo'; +} From 11ed040990949d8fe0a4a787672cbd63ce96e82c Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Nov 2025 18:27:27 +0100 Subject: [PATCH 3/5] fixes --- routers/web/repo/view.go | 1 + templates/repo/header.tmpl | 2 +- templates/repo/icon.tmpl | 8 ++++++-- templates/shared/repo/list.tmpl | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index cfd256855e996..09ac33cff43f0 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -412,6 +412,7 @@ func Forks(ctx *context.Context) { } pager := context.NewPagination(int(total), pageSize, page, 5) + ctx.Data["ShowRepoOwnerAvatar"] = true ctx.Data["ShowRepoOwnerOnList"] = true ctx.Data["Page"] = pager ctx.Data["Repos"] = forks diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 0fe24564d301a..8a96af117b416 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -4,7 +4,7 @@
- {{template "repo/icon" (dict "Repo" . "EnableRepoAvatar" "true" "Size" 24)}} + {{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoAvatar" true)}}
diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index 0411bc84e42bd..f7dd4e5b50237 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -1,13 +1,17 @@ {{/* Template Attributes: * Repo: The repo -* EnableRepoAvatar: Enable repo avatars when non-nil +* ShowRepoAvatar: Enable repo avatar when `true` +* ShowRepoOwnerAvatar: Enable owner avatars when `true` * Size: Icon size in pixels, default is 16 * * Note: Keep the icon logic in sync with web_src/js/utils/mappings.ts */}} {{$size := or .Size 16}} {{$avatarLink := (.Repo.RelAvatarLink ctx)}} -{{if and $avatarLink .EnableRepoAvatar}} + +{{if .ShowRepoOwnerAvatar}} + {{ctx.AvatarUtils.Avatar .Repo.Owner 24}} +{{else if and $avatarLink .ShowRepoAvatar}} {{else if .Repo.IsMirror}} {{svg "octicon-mirror" $size}} diff --git a/templates/shared/repo/list.tmpl b/templates/shared/repo/list.tmpl index 6bcd0a4d8d4dc..7f30805e88bdc 100644 --- a/templates/shared/repo/list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -2,7 +2,7 @@ {{range .Repos}}
- {{template "repo/icon" (dict "Repo" . "Size" 24 "EnableRepoAvatar" "true")}} + {{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoOwnerAvatar" $.ShowRepoOwnerAvatar)}}
From fd0d451d18f658183defbc4ffd839d2472a92b5a Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Nov 2025 18:33:26 +0100 Subject: [PATCH 4/5] sync order between js and template --- templates/repo/icon.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index f7dd4e5b50237..05d32d371f441 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -15,12 +15,12 @@ {{else if .Repo.IsMirror}} {{svg "octicon-mirror" $size}} +{{else if .Repo.IsFork}} + {{svg "octicon-repo-forked" $size}} {{else if .Repo.IsPrivate}} {{svg "octicon-repo-locked" $size}} {{else if .Repo.IsTemplate}} {{svg "octicon-repo-template" $size}} -{{else if .Repo.IsFork}} - {{svg "octicon-repo-forked" $size}} {{else}} {{svg "octicon-repo" $size}} {{end}} From ef1a146becd122b186ddaafec19eab4919f4a0ab Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Nov 2025 18:39:38 +0100 Subject: [PATCH 5/5] enable ShowRepoAvatar on repo lists --- templates/repo/icon.tmpl | 2 +- templates/shared/repo/list.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index 05d32d371f441..68959317c0ea4 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -10,7 +10,7 @@ {{$avatarLink := (.Repo.RelAvatarLink ctx)}} {{if .ShowRepoOwnerAvatar}} - {{ctx.AvatarUtils.Avatar .Repo.Owner 24}} + {{ctx.AvatarUtils.Avatar .Repo.Owner $size}} {{else if and $avatarLink .ShowRepoAvatar}} {{else if .Repo.IsMirror}} diff --git a/templates/shared/repo/list.tmpl b/templates/shared/repo/list.tmpl index 7f30805e88bdc..46e0c5b8fe2c6 100644 --- a/templates/shared/repo/list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -2,7 +2,7 @@ {{range .Repos}}
- {{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoOwnerAvatar" $.ShowRepoOwnerAvatar)}} + {{template "repo/icon" (dict "Repo" . "Size" 24 "ShowRepoOwnerAvatar" $.ShowRepoOwnerAvatar "ShowRepoAvatar" true)}}