aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-05-07 17:49:46 +0800
committerGitHub <noreply@github.com>2023-05-07 09:49:46 +0000
commit56ae853ca0f7255cc669d802b741922fd8670c3b (patch)
tree132ba83a8a238e1119738416083f17c668ee3442 /modules
parent377e0139b0233f2b5419af42ad783f82cf9ce0ba (diff)
downloadgitea-56ae853ca0f7255cc669d802b741922fd8670c3b.tar.gz
gitea-56ae853ca0f7255cc669d802b741922fd8670c3b.zip
Simplify template helper functions (#24570)
To avoid bloating the template helper functions, some functions could be provided by type methods. And the new code `data-line-type="{{.GetHTMLDiffLineType}}"` reads better than `data-line-type="{{DiffLineTypeToStr .GetType}}"` After the fix, screenshots (the same as before): <details> ![image](https://user-images.githubusercontent.com/2114189/236657918-20ce01e0-1192-443e-aeb4-6b3fe1aa2102.png) ![image](https://user-images.githubusercontent.com/2114189/236657950-ee19727f-a1fc-4133-afc7-e5d1a8c1783f.png) </details>
Diffstat (limited to 'modules')
-rw-r--r--modules/templates/helper.go1
-rw-r--r--modules/templates/util_misc.go13
2 files changed, 0 insertions, 14 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 4abd94d46e..7460f99fea 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -179,7 +179,6 @@ func NewFuncMap() template.FuncMap {
// -----------------------------------------------------------------
// misc
- "DiffLineTypeToStr": DiffLineTypeToStr,
"ShortSha": base.ShortSha,
"ActionContent2Commits": ActionContent2Commits,
"IsMultilineCommitMessage": IsMultilineCommitMessage,
diff --git a/modules/templates/util_misc.go b/modules/templates/util_misc.go
index 599a0942ce..d11251fcdf 100644
--- a/modules/templates/util_misc.go
+++ b/modules/templates/util_misc.go
@@ -122,19 +122,6 @@ func ActionContent2Commits(act Actioner) *repository.PushCommits {
return push
}
-// DiffLineTypeToStr returns diff line type name
-func DiffLineTypeToStr(diffType int) string {
- switch diffType {
- case 2:
- return "add"
- case 3:
- return "del"
- case 4:
- return "tag"
- }
- return "same"
-}
-
// MigrationIcon returns a SVG name matching the service an issue/comment was migrated from
func MigrationIcon(hostname string) string {
switch hostname {