From 36f9ee5813beba0fc4b394a5db636f76afc5cc38 Mon Sep 17 00:00:00 2001
From: CodeDoctor <20452814+CodeDoctorDE@users.noreply.github.com>
Date: Tue, 9 Aug 2022 13:30:09 +0200
Subject: [PATCH] Add an option to create new issues from "/issues" page
(#20650)
---
routers/web/user/home.go | 6 ++++++
templates/user/dashboard/issues.tmpl | 3 +++
2 files changed, 9 insertions(+)
diff --git a/routers/web/user/home.go b/routers/web/user/home.go
index 648269980..f338c525b 100644
--- a/routers/web/user/home.go
+++ b/routers/web/user/home.go
@@ -618,6 +618,12 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
shownIssues += int(issueCountByRepo[repoID])
}
}
+ if len(repoIDs) == 1 {
+ repo := showReposMap[repoIDs[0]]
+ if repo != nil {
+ ctx.Data["SingleRepoLink"] = repo.Link()
+ }
+ }
ctx.Data["IsShowClosed"] = isShowClosed
diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl
index b2f4863d6..b6dc00215 100644
--- a/templates/user/dashboard/issues.tmpl
+++ b/templates/user/dashboard/issues.tmpl
@@ -99,6 +99,9 @@
{{.locale.Tr "repo.issues.filter_sort.farduedate"}}
+ {{if .SingleRepoLink}}
+ {{.locale.Tr "repo.issues.new"}}
+ {{end}}
{{template "shared/issuelist" mergeinto . "listType" "dashboard"}}