Skip to content

Convert to octicon SVG library #9258

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

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.13

require (
cloud.google.com/go v0.45.0 // indirect
gitea.com/go-icon/octicon v0.0.0-20191205022335-e79fa0b410f0
gitea.com/lunny/levelqueue v0.1.0
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b
gitea.com/macaron/cache v0.0.0-20190822004001-a6e7fee4ee76
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ cloud.google.com/go v0.45.0 h1:bALuGBSgE+BD4rxsopAYlqjcwqcQtye6pWG4bC3N/k0=
cloud.google.com/go v0.45.0/go.mod h1:452BcPOeI9AZfbvDw0Tbo7D32wA+WX9WME8AZwMEDZU=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
gitea.com/go-icon/octicon v0.0.0-20191205022335-e79fa0b410f0 h1:4K+u3YjKUeGf1a/YCZ3D8u6e0OAaOyx9lDkQjfXPUy8=
gitea.com/go-icon/octicon v0.0.0-20191205022335-e79fa0b410f0/go.mod h1:CHuejQ4qyX5/dSg8w3qkW0uJ8YjQSJYQIQzXVT7TSzE=
gitea.com/lunny/levelqueue v0.1.0 h1:7wMk0VH6mvKN6vZEZCy9nUDgRmdPLgeNrm1NkW8EHNk=
gitea.com/lunny/levelqueue v0.1.0/go.mod h1:G7hVb908t0Bl0uk7zGSg14fyzNtxgtD9Shf04wkMK7s=
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b h1:vXt85uYV17KURaUlhU7v4GbCShkqRZDSfo0TkC0YCjQ=
Expand Down
14 changes: 14 additions & 0 deletions modules/templates/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
"code.gitea.io/gitea/services/gitdiff"
mirror_service "code.gitea.io/gitea/services/mirror"

"gitea.com/go-icon/octicon"

"github.com/editorconfig/editorconfig-core-go/v2"
)

Expand Down Expand Up @@ -266,6 +268,18 @@ func NewFuncMap() []template.FuncMap {
return ""
}
},
"Octicon": func(name string) template.HTML {
icon := octicon.Icon(name)
icon.Class("octicon")
icon.Style("") // Override default convenience style
return icon.HTML()
},
"MegaOcticon": func(name string) template.HTML {
icon := octicon.Icon(name)
icon.Class("mega-octicon")
icon.Style("") // Override default convenience style
return icon.HTML()
},
}}
}

Expand Down
41 changes: 37 additions & 4 deletions templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,47 @@
{{if .RelAvatarLink}}
<img class="ui avatar image" src="{{.RelAvatarLink}}">
{{else}}
<i class="mega-octicon octicon-{{if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else if .IsFork}}repo-forked{{else}}repo{{end}}"></i>
{{if .IsPrivate}}
{{if .IsTemplate}}
{{MegaOcticon "repo-template-private"}}
{{else}}
{{MegaOcticon "lock"}}
{{end}}
{{else if .IsMirror}}
{{MegaOcticon "clone"}}
{{else if .IsFork}}
{{MegaOcticon "repo-forked"}}
{{else}}
{{if .IsTemplate}}
{{MegaOcticon "repo-template"}}
{{else}}
{{MegaOcticon "repo"}}
{{end}}
{{end}}
{{end}}
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
<div class="divider"> / </div>
<a href="{{$.RepoLink}}">{{.Name}}</a>
{{if and .RelAvatarLink .IsPrivate}}<i class="mega-octicon octicon-lock"></i>{{end}}
{{if .IsTemplate}}<i class="icon fa-copy"></i>{{end}}
{{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
{{if .RelAvatarLink}}
{{if .IsPrivate}}
{{if .IsTemplate}}
{{MegaOcticon "repo-template-private"}}
{{else}}
{{MegaOcticon "lock"}}
{{end}}
{{else if .IsMirror}}
{{MegaOcticon "clone"}}
{{else if .IsFork}}
{{MegaOcticon "repo-forked"}}
{{else}}
{{if .IsTemplate}}
{{MegaOcticon "repo-template"}}
{{else}}
{{MegaOcticon "repo"}}
{{end}}
{{end}}
{{end}}
{{if .IsArchived}}{{MegaOcticon "archive"}}{{end}}
{{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{MirrorAddress $.Mirror}}">{{MirrorAddress $.Mirror}}</a></div>{{end}}
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RelLink 1 -1}}</a></div>{{end}}
{{if .IsGenerated}}<div class="fork-flag">{{$.i18n.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{SubStr .TemplateRepo.RelLink 1 -1}}</a></div>{{end}}
Expand Down
2 changes: 2 additions & 0 deletions vendor/gitea.com/go-icon/octicon/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/gitea.com/go-icon/octicon/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/gitea.com/go-icon/octicon/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/gitea.com/go-icon/octicon/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Loading