From 82dc1cdec92791658412111fedead4562e031d22 Mon Sep 17 00:00:00 2001 From: JFronny Date: Sat, 2 Dec 2023 17:31:41 +0100 Subject: [PATCH] Update templates --- templates/repo/issue/list.tmpl | 379 +------------------------ templates/repo/issue/view_content.tmpl | 75 ++--- templates/repo/issue/view_title.tmpl | 52 ++-- 3 files changed, 66 insertions(+), 440 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index f23095d..5cc6730 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -6,61 +6,8 @@ {{if .PinnedIssues}}
{{range .PinnedIssues}} -
- {{if eq $.Project.CardType 1}} -
- {{range (index $.issuesAttachmentMap .ID)}} - {{.Name}} - {{end}} -
- {{end}} -
-
-
- {{template "shared/issueicon" .}} -
- {{.Title | RenderEmoji $.Context | RenderCodeBlock}} - {{if $.IsRepoAdmin}} - - {{svg "octicon-x" 16}} - - {{end}} -
-
- - #{{.Index}} - {{$timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale}} - {{if .OriginalAuthor}} - {{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}} - {{else if gt .Poster.ID 0}} - {{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}} - {{else}} - {{$.locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} - {{end}} - -
- {{- if .MilestoneID}} - - {{- end}} -
- - {{if or .Labels .Assignees}} -
- {{range .Labels}} - {{RenderLabel $.Context .}} - {{end}} -
- {{range .Assignees}} - {{avatar $.Context . 28 "mini gt-mr-3"}} - {{end}} -
-
- {{end}} +
+ {{template "repo/issue/card" (dict "Issue" . "Page" $ "isPinnedIssueCard" true)}}
{{end}}
@@ -71,337 +18,29 @@ {{template "repo/issue/search" .}} {{if not .Repository.IsArchived}} {{if .PageIsIssueList}} - {{.locale.Tr "repo.issues.new"}} - Helpdesk + {{ctx.Locale.Tr "repo.issues.new"}} + Helpdesk {{else}} - {{.locale.Tr "repo.pulls.new"}} + {{ctx.Locale.Tr "repo.pulls.new"}} {{end}} {{else}} {{if not .PageIsIssueList}} - {{$.locale.Tr "action.compare_commits_general"}} + {{ctx.Locale.Tr "action.compare_commits_general"}} {{end}} {{end}}
-
-
- {{if and ($.CanWriteIssuesOrPulls) (gt (len .Issues) 0)}} - - {{end}} - {{template "repo/issue/openclose" .}} -
-
- -
-
+ {{template "repo/issue/filters" .}}
{{template "repo/issue/openclose" .}}
- + {{template "repo/issue/filter_actions" .}}
{{template "shared/issuelist" dict "." . "listType" "repo"}} -{{template "base/footer" .}} \ No newline at end of file +{{template "base/footer" .}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index a9737e5..7ee5241 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -6,7 +6,7 @@ - {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix $.locale}} + {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix ctx.Locale}}
@@ -16,7 +16,7 @@ {{else}} - {{avatar $.Context .Issue.Poster 40}} + {{ctx.AvatarUtils.Avatar .Issue.Poster 40}} {{end}}
@@ -28,38 +28,27 @@ {{.Issue.OriginalAuthor}} - {{.locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} + {{ctx.Locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} - {{if .Repository.OriginalURL}} ({{$.locale.Tr "repo.migrated_from" (.Repository.OriginalURL|Escape) (.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}} + {{if .Repository.OriginalURL}} ({{ctx.Locale.Tr "repo.migrated_from" (.Repository.OriginalURL|Escape) (.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}} {{else}} - {{avatar $.Context .Issue.Poster 24}} + {{ctx.AvatarUtils.Avatar .Issue.Poster 24}} {{template "shared/user/authorlink" .Issue.Poster}} - {{.locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} + {{ctx.Locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} {{end}}
- {{if gt .Issue.ShowRole 0}} - {{if (.Issue.ShowRole.HasRole "Writer")}} -
- {{$.locale.Tr "repo.issues.collaborator"}} -
- {{end}} - {{if (.Issue.ShowRole.HasRole "Owner")}} -
- {{$.locale.Tr "repo.issues.owner"}} -
- {{end}} - {{end}} + {{template "repo/issue/view_content/show_role" dict "ShowRole" .Issue.ShowRole "IgnorePoster" true}} {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} - {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}} {{end}} + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
@@ -67,7 +56,7 @@ {{if .Issue.RenderedContent}} {{.Issue.RenderedContent|Str2html}} {{else}} - {{.locale.Tr "repo.issues.no_content"}} + {{ctx.Locale.Tr "repo.issues.no_content"}} {{end}}
{{.Issue.Content}}
@@ -93,32 +82,31 @@ {{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}}
- {{avatar $.Context .SignedUser 40}} + {{ctx.AvatarUtils.Avatar .SignedUser 40}}
-
+ {{template "repo/issue/comment_tab" .}} {{.CsrfTokenHtml}} - @@ -126,30 +114,30 @@
{{else if .Repository.IsArchived}} -
+
{{if .Issue.IsPull}} - {{.locale.Tr "repo.archive.pull.nocomment"}} + {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} {{else}} - {{.locale.Tr "repo.archive.issue.nocomment"}} + {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} {{end}}
{{end}} {{else}} {{/* not .IsSigned */}} {{if .Repository.IsArchived}} -
+
{{if .Issue.IsPull}} - {{.locale.Tr "repo.archive.pull.nocomment"}} + {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} {{else}} - {{.locale.Tr "repo.archive.issue.nocomment"}} + {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} {{end}}
{{else}} {{if .Issue.IsPull}}
- {{.locale.Tr "repo.issues.sign_in_require_desc" (.SignInLink|Escape) | Safe}} + {{ctx.Locale.Tr "repo.issues.sign_in_require_desc" (.SignInLink|Escape) | Safe}}
{{else}} - {{.locale.Tr "repo.issues.create_comment"}} + {{ctx.Locale.Tr "repo.issues.create_comment"}} {{end}} {{end}} {{end}}{{/* end if: .IsSigned */}} @@ -163,7 +151,6 @@
{{template "shared/combomarkdowneditor" (dict - "locale" $.locale "MarkdownPreviewUrl" (print .Repository.Link "/markup") "MarkdownPreviewContext" .RepoLink "TextareaName" "content" @@ -179,8 +166,8 @@
- - + +
@@ -189,16 +176,16 @@ {{template "repo/issue/view_content/reference_issue_dialog" .}}
- {{.locale.Tr "repo.issues.no_content"}} + {{ctx.Locale.Tr "repo.issues.no_content"}}
\ No newline at end of file +
diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index c05ed48..573dbed 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -14,35 +14,35 @@
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} - + {{end}} {{if not .Issue.IsPull}} {{if .IsSigned}} - {{.locale.Tr "repo.issues.new"}} + {{ctx.Locale.Tr "repo.issues.new"}} {{end}} - Helpdesk + Helpdesk {{end}}
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}}
- - + +
{{end}}
{{if .HasMerged}} -
{{svg "octicon-git-merge" 16 "gt-mr-2"}} {{if eq .Issue.PullRequest.Status 3}}{{.locale.Tr "repo.pulls.manually_merged"}}{{else}}{{.locale.Tr "repo.pulls.merged"}}{{end}}
+
{{svg "octicon-git-merge" 16 "gt-mr-2"}} {{if eq .Issue.PullRequest.Status 3}}{{ctx.Locale.Tr "repo.pulls.manually_merged"}}{{else}}{{ctx.Locale.Tr "repo.pulls.merged"}}{{end}}
{{else if .Issue.IsClosed}} -
{{if .Issue.IsPull}}{{svg "octicon-git-pull-request"}}{{else}}{{svg "octicon-issue-closed"}}{{end}} {{.locale.Tr "repo.issues.closed_title"}}
+
{{if .Issue.IsPull}}{{svg "octicon-git-pull-request"}}{{else}}{{svg "octicon-issue-closed"}}{{end}} {{ctx.Locale.Tr "repo.issues.closed_title"}}
{{else if .Issue.IsPull}} {{if .IsPullWorkInProgress}} -
{{svg "octicon-git-pull-request-draft"}} {{.locale.Tr "repo.issues.draft_title"}}
+
{{svg "octicon-git-pull-request-draft"}} {{ctx.Locale.Tr "repo.issues.draft_title"}}
{{else}} -
{{svg "octicon-git-pull-request"}} {{.locale.Tr "repo.issues.open_title"}}
+
{{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.issues.open_title"}}
{{end}} {{else}} -
{{svg "octicon-issue-opened"}} {{.locale.Tr "repo.issues.open_title"}}
+
{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.open_title"}}
{{end}}
{{if .Issue.IsPull}} @@ -50,45 +50,45 @@ {{if .HeadBranchLink}} {{$headHref = printf `%s` (.HeadBranchLink | Escape) $headHref}} {{end}} - {{$headHref = printf `%s ` $headHref (.locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}} + {{$headHref = printf `%s ` $headHref (ctx.Locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}} {{$baseHref := .BaseTarget|Escape}} {{if .BaseBranchLink}} {{$baseHref = printf `%s` (.BaseBranchLink | Escape) $baseHref}} {{end}} {{if .Issue.PullRequest.HasMerged}} - {{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.locale}} + {{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix ctx.Locale}} {{if .Issue.OriginalAuthor}} {{.Issue.OriginalAuthor}} - {{$.locale.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}} + {{ctx.Locale.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}} {{else}} {{.Issue.PullRequest.Merger.GetDisplayName}} - {{$.locale.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}} + {{ctx.Locale.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}} {{end}} {{else}} {{if .Issue.OriginalAuthor}} - {{.Issue.OriginalAuthor}} {{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} + {{.Issue.OriginalAuthor}} {{ctx.Locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} {{else}} {{.Issue.Poster.GetDisplayName}} - {{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} + {{ctx.Locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} {{end}} {{svg "octicon-arrow-right"}} -