Skip to content

Commit 20b6ae0

Browse files
yp05327wxiaoguangsilverwind
authored
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>
1 parent 9119750 commit 20b6ae0

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

options/locale/locale_en-US.ini

+5
Original file line numberDiff line numberDiff line change
@@ -3414,3 +3414,8 @@ runs.invalid_workflow_helper = Workflow config file is invalid. Please check you
34143414
runs.no_matching_runner_helper = No matching runner: %s
34153415
34163416
need_approval_desc = Need approval to run workflows for fork pull request.
3417+
3418+
[projects]
3419+
type-1.display_name = Individual Project
3420+
type-2.display_name = Repository Project
3421+
type-3.display_name = Organization Project

templates/repo/issue/view_content/comments.tmpl

+15-7
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,22 @@
732732
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
733733
<span class="text grey muted-links">
734734
{{template "shared/user/authorlink" .Poster}}
735-
{{if gt .OldProjectID 0}}
736-
{{if gt .ProjectID 0}}
737-
{{$.locale.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}}
738-
{{else}}
739-
{{$.locale.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}}
740-
{{end}}
735+
{{$oldProjectDisplayHtml := "Unknown Project"}}
736+
{{if .OldProject}}
737+
{{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}}
738+
{{$oldProjectDisplayHtml = printf `<span data-tooltip-content="%s">%s</span>` ($.locale.Tr $trKey | Escape) (.OldProject.Title | Escape)}}
739+
{{end}}
740+
{{$newProjectDisplayHtml := "Unknown Project"}}
741+
{{if .Project}}
742+
{{$trKey := printf "projects.type-%d.display_name" .Project.Type}}
743+
{{$newProjectDisplayHtml = printf `<span data-tooltip-content="%s">%s</span>` ($.locale.Tr $trKey | Escape) (.Project.Title | Escape)}}
744+
{{end}}
745+
{{if and (gt .OldProjectID 0) (gt .ProjectID 0)}}
746+
{{$.locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr | Safe}}
747+
{{else if gt .OldProjectID 0}}
748+
{{$.locale.Tr "repo.issues.remove_project_at" $oldProjectDisplayHtml $createdStr | Safe}}
741749
{{else if gt .ProjectID 0}}
742-
{{$.locale.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}}
750+
{{$.locale.Tr "repo.issues.add_project_at" $newProjectDisplayHtml $createdStr | Safe}}
743751
{{end}}
744752
</span>
745753
</div>

0 commit comments

Comments
 (0)