summaryrefslogtreecommitdiffstats
path: root/templates/repo/issue
diff options
context:
space:
mode:
authorJonas Franz <info@jonasfranz.software>2018-04-29 07:58:47 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2018-04-29 13:58:47 +0800
commit8d5f58d8347196fca04fdf3a22d021d09d15e37f (patch)
tree4db9aabfec9a274b945dc3835d261c3267440ee3 /templates/repo/issue
parente3028d124f864b0ed2563cd0fea8b24612eb64bb (diff)
downloadgitea-8d5f58d8347196fca04fdf3a22d021d09d15e37f.tar.gz
gitea-8d5f58d8347196fca04fdf3a22d021d09d15e37f.zip
Shows total tracked time in issue and milestone list (#3341)
* Show total tracked time in issue and milestone list Show total tracked time at issue page Signed-off-by: Jonas Franz <info@jonasfranz.software> * Optimizing TotalTimes by using SumInt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fixing wrong total times for milestones caused by a missing JOIN Adding unit tests for total times Signed-off-by: Jonas Franz <info@jonasfranz.software> * Logging error instead of ignoring it Signed-off-by: Jonas Franz <info@jonasfranz.software> * Correcting spelling mistakes Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change error message to a short version Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add error handling to TotalTimes Add variable for totalTimes Signed-off-by: Jonas Franz <info@jonasfranz.de> * Introduce TotalTrackedTimes as variable of issue Load TotalTrackedTimes by loading attributes of IssueList Load TotalTrackedTimes by loading attributes of single issue Add Sec2Time as helper to use it in templates Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fixed test + gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Load TotalTrackedTimes via MilestoneList instead of single requests Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add documentation for MilestoneList Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add documentation for MilestoneList Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change comment from SQL query to description Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit test by using int64 instead of int Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit test by using int64 instead of int Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if timetracker is enabled Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test by enabling timetracking Signed-off-by: Jonas Franz <info@jonasfranz.de>
Diffstat (limited to 'templates/repo/issue')
-rw-r--r--templates/repo/issue/list.tmpl4
-rw-r--r--templates/repo/issue/milestones.tmpl1
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl2
3 files changed, 6 insertions, 1 deletions
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl
index 04a11ca5cc..180a5dea6c 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -198,6 +198,10 @@
<span class="comment ui right"><i class="octicon octicon-comment"></i> {{.NumComments}}</span>
{{end}}
+ {{if .TotalTrackedTime}}
+ <span class="comment ui right"><i class="octicon octicon-clock"></i> {{.TotalTrackedTime | Sec2Time}}</span>
+ {{end}}
+
<p class="desc">
{{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}}
{{$tasks := .GetTasks}}
diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl
index de52bd42f0..369da2e630 100644
--- a/templates/repo/issue/milestones.tmpl
+++ b/templates/repo/issue/milestones.tmpl
@@ -64,6 +64,7 @@
<span class="issue-stats">
<i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_tab" .NumOpenIssues}}
<i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.close_tab" .NumClosedIssues}}
+ {{if .TotalTrackedTime}}<i class="octicon octicon-clock"></i> {{.TotalTrackedTime|Sec2Time}}{{end}}
</span>
</div>
{{if $.IsRepositoryWriter}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index dff064f777..dc16ba7499 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -172,7 +172,7 @@
{{if gt (len .WorkingUsers) 0}}
<div class="ui divider"></div>
<div class="ui participants comments">
- <span class="text"><strong>{{.i18n.Tr "repo.issues.time_spent_total"}}</strong></span>
+ <span class="text"><strong>{{.i18n.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time) | Safe}}</strong></span>
<div>
{{range $user, $trackedtime := .WorkingUsers}}
<div class="comment">