Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/admin/org/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/packages/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/repo/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion templates/org/team/repositories.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}">
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
32 changes: 24 additions & 8 deletions templates/repo/icon.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
{{$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: The repo
* 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 .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 if .Repo.IsPrivate}}
{{svg "octicon-repo-locked" $size}}
{{else if .Repo.IsTemplate}}
{{svg "octicon-repo-template" $size}}
{{else}}
{{svg "octicon-repo" 24}}
{{svg "octicon-repo" $size}}
{{end}}
4 changes: 2 additions & 2 deletions templates/repo/pulse.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
8 changes: 2 additions & 6 deletions templates/shared/repo/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
24 changes: 2 additions & 22 deletions templates/user/settings/repos.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down
4 changes: 0 additions & 4 deletions web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion web_src/css/themes/theme-gitea-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion web_src/css/themes/theme-gitea-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 4 additions & 14 deletions web_src/js/components/DashboardRepoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -391,7 +381,7 @@ export default defineComponent({
<div class="ui checkbox" ref="checkboxPrivateFilter" :title="checkboxPrivateFilterTitle">
<input type="checkbox" class="tw-pointer-events-none" v-bind.prop="checkboxPrivateFilterProps">
<label>
<svg-icon name="octicon-lock" :size="16" class="tw-mr-1"/>
<svg-icon name="octicon-repo-locked" :size="16" class="tw-mr-1"/>
{{ textShowPrivate }}
</label>
</div>
Expand Down
2 changes: 2 additions & 0 deletions web_src/js/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions web_src/js/utils/mappings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function getRepoIcon(repo: Record<string, any>) {
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';
}