From 2e85e70e38d421c9d0b643c7dbd2b0f4c5ed0cbc Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Fri, 8 Feb 2019 08:53:58 +0100 Subject: [PATCH] Enhance closed PR and Issue status in the list (#6000) * working version * Update options/locale/locale_en-US.ini Co-Authored-By: adelowo * update templates --- options/locale/locale_en-US.ini | 2 ++ templates/repo/issue/list.tmpl | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index f83ad15b3a8e..5001247e6cb2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -733,6 +733,8 @@ issues.action_milestone_no_select = No milestone issues.action_assignee = Assignee issues.action_assignee_no_select = No assignee issues.opened_by = opened %[1]s by %[3]s +pulls.merged_by = merged %[1]s by %[3]s +issues.closed_by = closed %[1]s by %[3]s issues.opened_by_fake = opened %[1]s by %[2]s issues.previous = Previous issues.next = Next diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 10925a741d22..f42492455c7d 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -205,7 +205,23 @@ {{end}}

- {{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}} + {{ $textToTranslate := "repo.issues.opened_by" }} + {{ if not .IsClosed }} + {{ $timeStr = TimeSinceUnix .CreatedUnix $.Lang }} + {{ else if and .IsClosed .IsPull }} + {{ $timeStr = TimeSinceUnix .ClosedUnix $.Lang }} + {{ if .PullRequest.HasMerged }} + {{ $textToTranslate = "repo.pulls.merged_by"}} + {{ else }} + {{ $textToTranslate = "repo.issues.closed_by"}} + {{ end }} + {{ else }} + {{ $timeStr = TimeSinceUnix .ClosedUnix $.Lang }} + {{ $textToTranslate = "repo.issues.closed_by"}} + {{ end }} + + {{$.i18n.Tr $textToTranslate $timeStr .Poster.HomeLink .Poster.Name | Safe}} + {{$tasks := .GetTasks}} {{if gt $tasks 0}} {{$tasksDone := .GetTasksDone}}