From 1a97030017cd09b75f6c8d484e075f4eced1e001 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 1 May 2018 21:05:28 +0200 Subject: Issue due date (#3794) * Started adding deadline to ui * Implemented basic issue due date managing * Improved UI for due date managing * Added at least write access to the repo in order to modify issue due dates * Ui improvements * Added issue comments creation when adding/modifying/removing a due date * Show due date in issue list * Added api support for issue due dates * Fixed lint suggestions * Added deadline to sdk * Updated css * Added support for adding/modifiying deadlines for pull requests via api * Fixed comments not created when updating or removing a deadline * update sdk (will do properly once go-gitea/go-sdk#103 is merged) * enhanced updateIssueDeadline * Removed unnessecary Issue.DeadlineString * UI improvements * Small improvments to comment creation + ui & validation improvements * Check if an issue is overdue is now a seperate function * Updated go-sdk with govendor as it was merged * Simplified isOverdue method * removed unessecary deadline to 0 set * Update swagger definitions * Added missing return * Added an explanary comment * Improved updateIssueDeadline method so it'll only update `deadline_unix` * Small changes and improvements * no need to explicitly load the issue when updating a deadline, just use whats already there * small optimisations * Added check if a deadline was modified before updating it * Moved comment creating logic into its own function * Code cleanup for creating deadline comment * locale improvement * When modifying a deadline, the old deadline is saved with the comment * small improvments to xorm session handling when updating an issue deadline + style nitpicks * style nitpicks * Moved checking for if the user has write acces to middleware --- templates/repo/issue/list.tmpl | 4 +++ templates/repo/issue/milestones.tmpl | 2 +- templates/repo/issue/view_content/comments.tmpl | 32 +++++++++++++++++++++- templates/repo/issue/view_content/sidebar.tmpl | 36 +++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 2 deletions(-) (limited to 'templates/repo') diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 180a5dea6c..d8e42df12c 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -216,6 +216,10 @@ {{.Milestone.Name}} {{end}} + {{if ne .DeadlineUnix 0}} + + {{.DeadlineUnix.FormatShort}} + {{end}} {{if .Assignee}} diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl index 369da2e630..75bd8db8ed 100644 --- a/templates/repo/issue/milestones.tmpl +++ b/templates/repo/issue/milestones.tmpl @@ -56,7 +56,7 @@ {{else}} {{if .DeadlineString}} - {{.DeadlineString}} + {{.DeadlineString}} {{else}} {{$.i18n.Tr "repo.milestones.no_due_date"}} {{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 662155144f..b6d2c96bb5 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -1,7 +1,7 @@ {{range .Issue.Comments}} {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} - + {{if eq .Type 0}}
@@ -189,5 +189,35 @@ {{.Poster.Name}} {{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
+ {{else if eq .Type 16}} +
+ + + + + {{.Poster.Name}} + {{$.i18n.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}} + +
+ {{else if eq .Type 17}} +
+ + + + + {{.Poster.Name}} + {{$.i18n.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}} + +
+ {{else if eq .Type 18}} +
+ + + + + {{.Poster.Name}} + {{$.i18n.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}} + +
{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index dc16ba7499..648533fca1 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -191,5 +191,41 @@ {{end}} {{end}} + +
+ {{.i18n.Tr "repo.issues.due_date"}} + {{if gt .Issue.DeadlineUnix 0}} +

+ + {{.Issue.DeadlineUnix.FormatShort}} + {{if .Issue.IsOverdue}} + {{.i18n.Tr "repo.issues.due_date_overdue"}} + {{end}} + {{if and .IsSigned .IsRepositoryWriter}} +
+ Edit - + Remove + {{end}} +

+ {{else}} +

{{.i18n.Tr "repo.issues.due_date_not_set"}}

+ {{end}} + + {{if and .IsSigned .IsRepositoryWriter}} +
+ {{$.CsrfTokenHtml}} +
+ + +
+
+ {{end}} + -- cgit v1.2.3