summaryrefslogtreecommitdiffstats
path: root/templates/repo/issue
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-04-22 06:15:17 +0900
committerGitHub <noreply@github.com>2023-04-21 17:15:17 -0400
commit20b6ae0e5399cfc22c6a0989d8e520194e920bdd (patch)
tree8ba34ab9d59aac454e4d03dff2aa469af9168e62 /templates/repo/issue
parent911975059a50e71632d33567da7000a97aa28f22 (diff)
downloadgitea-20b6ae0e5399cfc22c6a0989d8e520194e920bdd.tar.gz
gitea-20b6ae0e5399cfc22c6a0989d8e520194e920bdd.zip
Add project type descriptions in issue badge and improve project icons (#23437)
Changes: - ~~Add project icons to issue badge~~ ~~After:~~ ![image](https://user-images.githubusercontent.com/18380374/224633165-9d899176-03dc-4c36-94f8-b2fd9583856c.png) Use `tooltip` to add a description of project type to the project name. ![image](https://user-images.githubusercontent.com/18380374/224923685-77201b5a-1c1f-4d37-b867-23299649df3f.png) - improve project icons we can use `project.icon` to get the svg name, which looks better and is easy to change all of them in templates. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/repo/issue')
-rw-r--r--templates/repo/issue/view_content/comments.tmpl22
1 files changed, 15 insertions, 7 deletions
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 116c02b8b5..45077e91ba 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -732,14 +732,22 @@
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
- {{if gt .OldProjectID 0}}
- {{if gt .ProjectID 0}}
- {{$.locale.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}}
- {{else}}
- {{$.locale.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}}
- {{end}}
+ {{$oldProjectDisplayHtml := "Unknown Project"}}
+ {{if .OldProject}}
+ {{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}}
+ {{$oldProjectDisplayHtml = printf `<span data-tooltip-content="%s">%s</span>` ($.locale.Tr $trKey | Escape) (.OldProject.Title | Escape)}}
+ {{end}}
+ {{$newProjectDisplayHtml := "Unknown Project"}}
+ {{if .Project}}
+ {{$trKey := printf "projects.type-%d.display_name" .Project.Type}}
+ {{$newProjectDisplayHtml = printf `<span data-tooltip-content="%s">%s</span>` ($.locale.Tr $trKey | Escape) (.Project.Title | Escape)}}
+ {{end}}
+ {{if and (gt .OldProjectID 0) (gt .ProjectID 0)}}
+ {{$.locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr | Safe}}
+ {{else if gt .OldProjectID 0}}
+ {{$.locale.Tr "repo.issues.remove_project_at" $oldProjectDisplayHtml $createdStr | Safe}}
{{else if gt .ProjectID 0}}
- {{$.locale.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.add_project_at" $newProjectDisplayHtml $createdStr | Safe}}
{{end}}
</span>
</div>