diff options
author | yp05327 <576951401@qq.com> | 2023-03-19 21:44:48 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-19 14:44:48 +0200 |
commit | 1a4efa0ee9a49d48549be7479a46be133b9bc260 (patch) | |
tree | 8be773cdf4ea88c662196e8e469b50bb997e3307 /templates/repo/issue | |
parent | 0206882e8a9ee226092ffd0d4d39de494d2f9b80 (diff) | |
download | gitea-1a4efa0ee9a49d48549be7479a46be133b9bc260.tar.gz gitea-1a4efa0ee9a49d48549be7479a46be133b9bc260.zip |
Use `project.IconName` instead of repeated unreadable `if-else` chains (#23538)
The project type will be changed in
https://github.com/go-gitea/gitea/pull/23353, so the old fix
https://github.com/go-gitea/gitea/pull/23325 will not work as well.
And I also found that there were some problems in the old fix....
---------
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/list.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 9 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 9 |
3 files changed, 10 insertions, 20 deletions
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 975d659470..726ef25cfe 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -100,8 +100,7 @@ </div> {{range .OpenProjects}} <a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </a> {{end}} {{end}} @@ -112,8 +111,7 @@ </div> {{range .ClosedProjects}} <a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </a> {{end}} {{end}} @@ -273,8 +271,7 @@ </div> {{range .OpenProjects}} <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </div> {{end}} {{end}} @@ -285,8 +282,7 @@ </div> {{range .ClosedProjects}} <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </div> {{end}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index b45a00f781..4945203ca5 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -134,8 +134,7 @@ </div> {{range .OpenProjects}} <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </a> {{end}} {{end}} @@ -146,8 +145,7 @@ </div> {{range .ClosedProjects}} <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </a> {{end}} {{end}} @@ -159,8 +157,7 @@ <div class="selected"> {{if .Project}} <a class="item muted sidebar-item-link" href="{{.Project.Link}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Project.Title}} + {{svg .Project.IconName 18 "gt-mr-3"}}{{.Project.Title}} </a> {{end}} </div> diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 40d87b4178..cef1e3a02e 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -196,8 +196,7 @@ </div> {{range .OpenProjects}} <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </a> {{end}} {{end}} @@ -208,8 +207,7 @@ </div> {{range .ClosedProjects}} <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} </a> {{end}} {{end}} @@ -220,8 +218,7 @@ <div class="selected"> {{if .Issue.ProjectID}} <a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}"> - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Issue.Project.Title}} + {{svg .Issue.Project.IconName 18 "gt-mr-3"}}{{.Issue.Project.Title}} </a> {{end}} </div> |