mirror of https://github.com/go-gitea/gitea.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
643 B
Go
28 lines
643 B
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package fileicon
|
|
|
|
import (
|
|
"html/template"
|
|
|
|
"code.gitea.io/gitea/modules/git"
|
|
"code.gitea.io/gitea/modules/svg"
|
|
)
|
|
|
|
func BasicThemeIcon(entry *git.TreeEntry) template.HTML {
|
|
svgName := "octicon-file"
|
|
switch {
|
|
case entry.IsLink():
|
|
svgName = "octicon-file-symlink-file"
|
|
if te, err := entry.FollowLink(); err == nil && te.IsDir() {
|
|
svgName = "octicon-file-directory-symlink"
|
|
}
|
|
case entry.IsDir():
|
|
svgName = "octicon-file-directory-fill"
|
|
case entry.IsSubModule():
|
|
svgName = "octicon-file-submodule"
|
|
}
|
|
return svg.RenderHTML(svgName)
|
|
}
|