-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Misc icon tweaks, relax lint rules #36046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c982031
a7e54b7
092b7fd
11ed040
fd0d451
ef1a146
80e06d2
45c1769
5d1676d
b2db8c0
5625d99
a2cf45d
180e482
60790fe
038b4e2
efdc304
fd5cc7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)}} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to have labels(private, template & etc.) for this repository
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean adding labels in this specific place (and below)?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, it appears that the labels are only shown on the repository detail page. They could also be displayed on the list page, but I’m not sure whether we should enable that.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In lists we can add them, yes. |
||
| <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)}} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the above |
||
| <a class="name" href="{{.Link}}">{{.OwnerName}}/{{.Name}}</a> | ||
| <span>{{FileSize .Size}}</span> | ||
| {{if .IsFork}} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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'; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsTemplateis missing inicon.tmplIf intentionally, should the comment #36046 (comment) be added to the template code? ps: I don't understand why
IsTemplateis in a separate "group".Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both mirror repositories and regular repositories(public or private) could be template repositories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If intentionally, should the comment #36046 (comment) be added to the template code?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add it. And yes I've implemented that only group 1 is represented with the icon, all other groups are represented with tags in places that have enough room to display them (not on frontpage repo list).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought maybe we should make an exception for templates. I think it's highly unlikely that a repo is both a mirror and a template, so I guess showing a template icon in such a case would make more sense.