diff options
author | Anthony Wang | 2023-03-12 23:17:11 +0000 |
---|---|---|
committer | Anthony Wang | 2023-03-12 23:19:57 +0000 |
commit | dbc3eb7fa071307e623fde961bfdff0894856948 (patch) | |
tree | 8961dc6a935d9ee89f5adf680a142d36900aaebb /templates | |
parent | b4640101f3c8938ed689743606a79601201141ca (diff) | |
parent | e72290fd9aeb77a47311483d1d565e428ce40cd9 (diff) |
Merge remote-tracking branch 'origin/main' into forgejo-federation
Diffstat (limited to 'templates')
54 files changed, 543 insertions, 317 deletions
diff --git a/templates/admin/auth/source/oauth.tmpl b/templates/admin/auth/source/oauth.tmpl index b7ee00822..1080937f9 100644 --- a/templates/admin/auth/source/oauth.tmpl +++ b/templates/admin/auth/source/oauth.tmpl @@ -24,7 +24,7 @@ <label for="oauth2_icon_url">{{.locale.Tr "admin.auths.oauth2_icon_url"}}</label> <input id="oauth2_icon_url" name="oauth2_icon_url" value="{{.oauth2_icon_url}}"> </div> - <div class="open_id_connect_auto_discovery_url required field"> + <div class="open_id_connect_auto_discovery_url required field{{if .Err_DiscoveryURL}} error{{end}}"> <label for="open_id_connect_auto_discovery_url">{{.locale.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label> <input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{.open_id_connect_auto_discovery_url}}"> </div> diff --git a/templates/admin/user/new.tmpl b/templates/admin/user/new.tmpl index e5ca864cb..2bf1d0ace 100644 --- a/templates/admin/user/new.tmpl +++ b/templates/admin/user/new.tmpl @@ -50,7 +50,7 @@ </div> </div> - <div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .login_type "0-0"}}hide{{end}}"> + <div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .login_type "0-0"}}gt-hidden{{end}}"> <label for="login_name">{{.locale.Tr "admin.users.auth_login_name"}}</label> <input id="login_name" name="login_name" value="{{.login_name}}"> </div> @@ -62,12 +62,12 @@ <label for="email">{{.locale.Tr "email"}}</label> <input id="email" name="email" type="email" value="{{.email}}" required> </div> - <div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}hide{{end}}"> + <div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}gt-hidden{{end}}"> <label for="password">{{.locale.Tr "password"}}</label> <input id="password" name="password" type="password" autocomplete="new-password" value="{{.password}}" {{if eq .login_type "0-0"}}required{{end}}> </div> - <div class="inline field local{{if ne .login_type "0-0"}} hide{{end}}"> + <div class="inline field local {{if ne .login_type "0-0"}}gt-hidden{{end}}"> <div class="ui checkbox"> <label><strong>{{.locale.Tr "auth.allow_password_change"}}</strong></label> <input name="must_change_password" type="checkbox" checked> diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index c552dcfd2..d179140b2 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}}{{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}}</title> - <link rel="manifest" href="data:{{.ManifestData}}"> + {{if .ManifestData}}<link rel="manifest" href="data:{{.ManifestData}}">{{end}} <meta name="theme-color" content="{{ThemeColorMetaTag}}"> <meta name="default-theme" content="{{DefaultTheme}}"> <meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}"> diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl index 232a41b56..05bed6902 100644 --- a/templates/mail/issue/assigned.tmpl +++ b/templates/mail/issue/assigned.tmpl @@ -8,7 +8,7 @@ <title>{{.Subject}}</title> </head> -{{$repo_url := printf "<a href='%s'>%s</a>" (Escape .Issue.Repo.Link) (Escape .Issue.Repo.FullName)}} +{{$repo_url := printf "<a href='%s'>%s</a>" (Escape .Issue.Repo.HTMLURL) (Escape .Issue.Repo.FullName)}} {{$link := printf "<a href='%s'>#%d</a>" (Escape .Link) .Issue.Index}} <body> <p> diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl index 3bda408a0..64dbb3df6 100644 --- a/templates/mail/issue/default.tmpl +++ b/templates/mail/issue/default.tmpl @@ -20,11 +20,11 @@ {{if eq .ActionName "push"}} <p> {{if .Comment.IsForcePush}} - {{$oldCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.Link .Comment.OldCommit}} + {{$oldCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.OldCommit}} {{$oldShortSha := ShortSha .Comment.OldCommit}} {{$oldCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" (Escape $oldCommitUrl) (Escape $oldShortSha)}} - {{$newCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.Link .Comment.NewCommit}} + {{$newCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.NewCommit}} {{$newShortSha := ShortSha .Comment.NewCommit}} {{$newCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" (Escape $newCommitUrl) (Escape $newShortSha)}} @@ -72,7 +72,7 @@ <ul> {{range .Comment.Commits}} <li> - <a href="{{$.Comment.Issue.PullRequest.BaseRepo.Link}}/commit/{{.ID}}"> + <a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.ID}}"> {{ShortSha .ID.String}} </a> - {{.Summary}} </li> diff --git a/templates/mail/release.tmpl b/templates/mail/release.tmpl index 425043352..b2acdce8b 100644 --- a/templates/mail/release.tmpl +++ b/templates/mail/release.tmpl @@ -11,8 +11,8 @@ </head> -{{$release_url := printf "<a href='%s'>%s</a>" (.Release.Link | Escape) (.Release.TagName | Escape)}} -{{$repo_url := printf "<a href='%s'>%s</a>" (.Release.Repo.Link | Escape) (.Release.Repo.FullName | Escape)}} +{{$release_url := printf "<a href='%s'>%s</a>" (.Release.HTMLURL | Escape) (.Release.TagName | Escape)}} +{{$repo_url := printf "<a href='%s'>%s</a>" (.Release.Repo.HTMLURL | Escape) (.Release.Repo.FullName | Escape)}} <body> <p> {{.locale.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}} diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl index 7ca47cd32..2a359d811 100644 --- a/templates/org/menu.tmpl +++ b/templates/org/menu.tmpl @@ -3,16 +3,18 @@ <a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}"> {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} </a> + {{if and .IsProjectEnabled .CanReadProjects}} <a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects"> - {{svg "octicon-project"}} {{.locale.Tr "user.projects"}} + {{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}} </a> - {{if .IsPackageEnabled}} + {{end}} + {{if and .IsPackageEnabled .CanReadPackages}} <a class="item" href="{{$.Org.HomeLink}}/-/packages"> {{svg "octicon-package"}} {{.locale.Tr "packages.title"}} </a> {{end}} - {{if .IsRepoIndexerEnabled}} - <a class="{{if $.PageIsOrgCode}}active {{end}}item" href="{{$.Org.HomeLink}}/-/code"> + {{if and .IsRepoIndexerEnabled .CanReadCode}} + <a class="item" href="{{$.Org.HomeLink}}/-/code"> {{svg "octicon-code"}} {{$.locale.Tr "org.code"}} </a> {{end}} diff --git a/templates/post-install.tmpl b/templates/post-install.tmpl index 0d6cd3082..f237a6e01 100644 --- a/templates/post-install.tmpl +++ b/templates/post-install.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content install"> +<div role="main" aria-label="{{.Title}}" class="page-content install post-install"> <div class="ui container"> <div class="ui grid"> <div class="sixteen wide column content"> @@ -13,7 +13,7 @@ </div> <div class="ui stackable middle very relaxed page grid"> <div class="sixteen wide center aligned centered column"> - <p><a href="{{AppSubUrl}}/user/login">{{AppSubUrl}}/user/login</a></p> + <p><a id="goto-user-login" href="{{AppSubUrl}}/user/login">{{.locale.Tr "loading"}}</a></p> </div> </div> </div> diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index 8d9594e2b..489189ec4 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -12,7 +12,7 @@ {{template "base/alert" .}} <div class="ui compact tiny menu"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=open"> - {{svg "octicon-project" 16 "gt-mr-3"}} + {{svg "octicon-project-symlink" 16 "gt-mr-3"}} {{JsPrettyNumber .OpenCount}} {{.locale.Tr "repo.issues.open_title"}} </a> <a class="item{{if .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=closed"> @@ -38,7 +38,7 @@ <div class="milestone list"> {{range .Projects}} <li class="item"> - {{svg "octicon-project"}} <a href="{{$.Link}}/{{.ID}}">{{.Title}}</a> + {{svg "octicon-project-symlink"}} <a href="{{.Link}}">{{.Title}}</a> <div class="meta"> {{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} diff --git a/templates/projects/new.tmpl b/templates/projects/new.tmpl index c96f948de..826869ac5 100644 --- a/templates/projects/new.tmpl +++ b/templates/projects/new.tmpl @@ -21,6 +21,7 @@ <form class="ui form grid" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} <div class="eleven wide column"> + <input type="hidden" id="redirect" name="redirect" value="{{.redirect}}"> <div class="field {{if .Err_Title}}error{{end}}"> <label>{{.locale.Tr "repo.projects.title"}}</label> <input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required> diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl index 3d0bea35d..06192f630 100644 --- a/templates/projects/view.tmpl +++ b/templates/projects/view.tmpl @@ -46,7 +46,7 @@ {{if or $.CanWriteIssues $.CanWritePulls}} <div class="column right aligned"> <div class="ui compact right small menu"> - <a class="item" href="{{$.Link}}/edit" data-id={{$.Project.ID}} data-title={{$.Project.Title}}> + <a class="item" href="{{$.Link}}/edit?redirect=project" data-id={{$.Project.ID}} data-title={{$.Project.Title}}> {{svg "octicon-pencil"}} <span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span> </a> @@ -128,7 +128,7 @@ <div class="text right actions"> <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div> - <button data-url="{{$.Link}}/{{.ID}}" class="ui primary button">{{$.locale.Tr "repo.projects.column.edit"}}</button> + <button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button> </div> </form> </div> @@ -234,11 +234,11 @@ {{if or .Labels .Assignees}} <div class="extra content labels-list gt-p-0 gt-pt-2"> {{range .Labels}} - <a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel .}}</a> + <a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel $.Context .}}</a> {{end}} <div class="right floated"> {{range .Assignees}} - <a class="tooltip" target="_blank" href="{{.HomeLink}}" data-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{avatar . 28 "mini gt-mr-3"}}</a> + <a class="tooltip" target="_blank" href="{{.HomeLink}}" data-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{avatar $.Context . 28 "mini gt-mr-3"}}</a> {{end}} </div> </div> diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl index a01d21657..ffabe534c 100644 --- a/templates/repo/actions/runs_list.tmpl +++ b/templates/repo/actions/runs_list.tmpl @@ -7,7 +7,7 @@ <div class="issue-item-main gt-f1 gt-fc gt-df"> <div class="issue-item-top-row"> <a class="index gt-ml-0 gt-mr-2" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> - {{.Title}} + {{- .Title -}} </a> <span class="ui label"> {{if .RefLink}} diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl index 255951824..ae1d426bc 100644 --- a/templates/repo/activity.tmpl +++ b/templates/repo/activity.tmpl @@ -129,7 +129,7 @@ <span class="ui green label">{{$.locale.Tr "repo.activity.published_release_label"}}</span> {{.TagName}} {{if not .IsTag}} - <a class="title" href="{{$.RepoLink}}/src/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji}}</a> + <a class="title" href="{{$.RepoLink}}/src/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji $.Context}}</a> {{end}} {{TimeSinceUnix .CreatedUnix $.locale}} </p> @@ -149,7 +149,7 @@ {{range .Activity.MergedPRs}} <p class="desc"> <span class="ui purple label">{{$.locale.Tr "repo.activity.merged_prs_label"}}</span> - #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji}}</a> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji $.Context}}</a> {{TimeSinceUnix .MergedUnix $.locale}} </p> {{end}} @@ -168,7 +168,7 @@ {{range .Activity.OpenedPRs}} <p class="desc"> <span class="ui green label">{{$.locale.Tr "repo.activity.opened_prs_label"}}</span> - #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji}}</a> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji $.Context}}</a> {{TimeSinceUnix .Issue.CreatedUnix $.locale}} </p> {{end}} @@ -187,7 +187,7 @@ {{range .Activity.ClosedIssues}} <p class="desc"> <span class="ui red label">{{$.locale.Tr "repo.activity.closed_issue_label"}}</span> - #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a> {{TimeSinceUnix .ClosedUnix $.locale}} </p> {{end}} @@ -206,7 +206,7 @@ {{range .Activity.OpenedIssues}} <p class="desc"> <span class="ui green label">{{$.locale.Tr "repo.activity.new_issue_label"}}</span> - #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a> {{TimeSinceUnix .CreatedUnix $.locale}} </p> {{end}} @@ -227,9 +227,9 @@ <span class="ui green label">{{$.locale.Tr "repo.activity.unresolved_conv_label"}}</span> #{{.Index}} {{if .IsPull}} - <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Title | RenderEmoji}}</a> + <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a> {{else}} - <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji}}</a> + <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a> {{end}} {{TimeSinceUnix .UpdatedUnix $.locale}} </p> diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index 89d65146a..8e81373ae 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -2,101 +2,111 @@ {{$defaultBranch := $.root.BranchName}}{{if and .root.IsViewTag (not .noTag)}}{{$defaultBranch = .root.TagName}}{{end}}{{if eq $defaultBranch ""}}{{$defaultBranch = $.root.Repository.DefaultBranch}}{{end}} {{$type := ""}}{{if and .root.IsViewTag (not .noTag)}}{{$type = "tag"}}{{else if .root.IsViewBranch}}{{$type = "branch"}}{{else}}{{$type = "tree"}}{{end}} {{$showBranchesInDropdown := not .root.HideBranchesInDropdown}} + +<script type="module"> + const data = { + 'textReleaseCompare': {{.root.locale.Tr "repo.release.compare"}}, + 'textCreateTag': {{.root.locale.Tr "repo.tag.create_tag"}}, + 'textCreateBranch': {{.root.locale.Tr "repo.branch.create_branch"}}, + 'textCreateBranchFrom': {{.root.locale.Tr "repo.branch.create_from"}}, + 'textBranches': {{.root.locale.Tr "repo.branches"}}, + 'textTags': {{.root.locale.Tr "repo.tags"}}, + + 'mode': '{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}', + 'showBranchesInDropdown': {{$showBranchesInDropdown}}, + 'searchFieldPlaceholder': '{{if $.noTag}}{{.root.locale.Tr "repo.pulls.filter_branch"}}{{else if $showBranchesInDropdown}}{{.root.locale.Tr "repo.filter_branch_and_tag"}}{{else}}{{.root.locale.Tr "repo.find_tag"}}{{end}}...', + 'branchForm': {{$.branchForm}}, + 'disableCreateBranch': {{if .disableCreateBranch}}{{.disableCreateBranch}}{{else}}{{not .root.CanCreateBranch}}{{end}}, + 'setAction': {{.setAction}}, + 'submitForm': {{.submitForm}}, + 'viewType': {{$type}}, + 'refName': {{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}, + 'commitIdShort': {{ShortSha .root.CommitID}}, + 'tagName': {{.root.TagName}}, + 'branchName': {{.root.BranchName}}, + 'noTag': {{.noTag}}, + 'branches': {{.root.Branches}}, + 'tags': {{.root.Tags}}, + 'defaultBranch': {{$defaultBranch}}, + 'branchURLPrefix': '{{if .branchURLPrefix}}{{.branchURLPrefix}}{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/branch/{{end}}', + 'branchURLSuffix': '{{if .branchURLSuffix}}{{.branchURLSuffix}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', + 'tagURLPrefix': '{{if .tagURLPrefix}}{{.tagURLPrefix}}{{else if $release}}{{$.root.RepoLink}}/compare/{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{end}}', + 'tagURLSuffix': '{{if .tagURLSuffix}}{{.tagURLSuffix}}{{else if $release}}...{{if $release.IsDraft}}{{PathEscapeSegments $release.Target}}{{else}}{{if $release.TagName}}{{PathEscapeSegments $release.TagName}}{{else}}{{PathEscapeSegments $release.Sha1}}{{end}}{{end}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', + 'repoLink': {{.root.RepoLink}}, + 'treePath': {{.root.TreePath}}, + 'branchNameSubURL': {{.root.BranchNameSubURL}}, + 'noResults': {{.root.locale.Tr "repo.pulls.no_results"}}, + }; + {{if .release}} + data.release = { + 'tagName': {{.release.TagName}}, + }; + {{end}} + window.config.pageData.branchDropdownDataList = window.config.pageData.branchDropdownDataList || []; + window.config.pageData.branchDropdownDataList.push(data); +</script> + <div class="fitted item choose reference"> - <div class="ui floating filter dropdown custom" - data-branch-form="{{if $.branchForm}}{{$.branchForm}}{{end}}" - data-can-create-branch="{{if .canCreateBranch}}{{.canCreateBranch}}{{else}}{{.root.CanCreateBranch}}{{end}}" - data-no-results="{{.root.locale.Tr "repo.pulls.no_results"}}" - data-set-action="{{.setAction}}" data-submit-form="{{.submitForm}}" - data-view-type="{{$type}}" - data-ref-name="{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}" - data-branch-url-prefix="{{if .branchURLPrefix}}{{.branchURLPrefix}}{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/branch/{{end}}" - data-branch-url-suffix="{{if .branchURLSuffix}}{{.branchURLSuffix}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}" - data-tag-url-prefix="{{if .tagURLPrefix}}{{.tagURLPrefix}}{{else if $release}}{{$.root.RepoLink}}/compare/{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{end}}" - data-tag-url-suffix="{{if .tagURLSuffix}}{{.tagURLSuffix}}{{else if $release}}...{{if $release.IsDraft}}{{PathEscapeSegments $release.Target}}{{else}}{{if $release.TagName}}{{PathEscapeSegments $release.TagName}}{{else}}{{PathEscapeSegments $release.Sha1}}{{end}}{{end}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}"> + <div class="ui floating filter dropdown custom"> <button class="branch-dropdown-button gt-ellipsis ui basic small compact button gt-df" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible"> <span class="text gt-df gt-ac gt-mr-2"> - {{if $release}} - {{.root.locale.Tr "repo.release.compare"}} - {{else}} - <span :class="{visible: isViewTag}" v-if="isViewTag" {{if not (eq $type "tag")}}v-cloak{{end}}>{{svg "octicon-tag"}}</span> - <span :class="{visible: isViewBranch}" v-if="isViewBranch" {{if not (eq $type "branch")}}v-cloak{{end}}>{{svg "octicon-git-branch"}}</span> - <span :class="{visible: isViewTree}" v-if="isViewTree" {{if not (eq $type "tree")}}v-cloak{{end}}>{{svg "octicon-git-branch"}}</span> - <strong ref="dropdownRefName" class="gt-ml-3">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong> - {{end}} + {{/* v-cloak is used to hide unnecessary elements before Vue componment is mounted */}} + <span v-cloak v-if="release">${ textReleaseCompare }</span> + <span :class="{visible: isViewTag}" v-if="isViewTag" {{if not (eq $type "tag")}}v-cloak{{end}}>{{svg "octicon-tag"}}</span> + <span :class="{visible: isViewBranch}" v-if="isViewBranch" {{if not (eq $type "branch")}}v-cloak{{end}}>{{svg "octicon-git-branch"}}</span> + <span :class="{visible: isViewTree}" v-if="isViewTree" {{if not (eq $type "tree")}}v-cloak{{end}}>{{svg "octicon-git-branch"}}</span> + <strong ref="dropdownRefName" class="gt-ml-3">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong> </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </button> - <div class="data gt-hidden" data-mode="{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}"> - {{if $showBranchesInDropdown}} - {{range .root.Branches}} - <div class="item branch {{if eq $defaultBranch .}}selected{{end}}" data-url="{{PathEscapeSegments .}}">{{.}}</div> - {{end}} - {{end}} - {{if (not .noTag)}} - {{range .root.Tags}} - {{if $release}} - <div class="item tag {{if eq $release.TagName .}}selected{{end}}" data-url="{{PathEscapeSegments .}}">{{.}}</div> - {{else}} - <div class="item tag {{if eq $defaultBranch .}}selected{{end}}" data-url="{{PathEscapeSegments .}}">{{.}}</div> - {{end}} - {{end}} - {{end}} - </div> <div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak> <div class="ui icon search input"> <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i> - <input name="search" ref="searchField" autocomplete="off" v-model="searchTerm" @keydown="keydown($event)" placeholder="{{if $.noTag}}{{.root.locale.Tr "repo.pulls.filter_branch"}}{{else if $showBranchesInDropdown}}{{.root.locale.Tr "repo.filter_branch_and_tag"}}{{else}}{{.root.locale.Tr "repo.find_tag"}}{{end}}..."> + <input name="search" ref="searchField" autocomplete="off" v-model="searchTerm" @keydown="keydown($event)" :placeholder="searchFieldPlaceholder"> </div> - {{if $showBranchesInDropdown}} + <template v-if="showBranchesInDropdown"> <div class="header branch-tag-choice"> <div class="ui grid"> <div class="two column row"> <a class="reference column" href="#" @click="createTag = false; mode = 'branches'; focusSearchField()"> - <span class="text" :class="{black: mode == 'branches'}"> - {{svg "octicon-git-branch" 16 "gt-mr-2"}}{{.root.locale.Tr "repo.branches"}} + <span class="text" :class="{black: mode === 'branches'}"> + {{svg "octicon-git-branch" 16 "gt-mr-2"}}${ textBranches } </span> </a> - {{if not .noTag}} + <template v-if="!noTag"> <a class="reference column" href="#" @click="createTag = true; mode = 'tags'; focusSearchField()"> - <span class="text" :class="{black: mode == 'tags'}"> - {{svg "octicon-tag" 16 "gt-mr-2"}}{{.root.locale.Tr "repo.tags"}} + <span class="text" :class="{black: mode === 'tags'}"> + {{svg "octicon-tag" 16 "gt-mr-2"}}${ textTags } </span> </a> - {{end}} + </template> </div> </div> </div> - {{end}} + </template> <div class="scrolling menu" ref="scrollContainer"> - <div v-for="(item, index) in filteredItems" :key="item.name" class="item" :class="{selected: item.selected, active: active == index}" @click="selectItem(item)" :ref="'listItem' + index">${ item.name }</div> - <div class="item" v-if="showCreateNewBranch" :class="{active: active == filteredItems.length}" :ref="'listItem' + filteredItems.length"> + <div v-for="(item, index) in filteredItems" :key="item.name" class="item" :class="{selected: item.selected, active: active === index}" @click="selectItem(item)" :ref="'listItem' + index">${ item.name }</div> + <div class="item" v-if="showCreateNewBranch" :class="{active: active === filteredItems.length}" :ref="'listItem' + filteredItems.length"> <a href="#" @click="createNewBranch()"> <div v-show="createTag"> <i class="reference tags icon"></i> - {{.root.locale.Tr "repo.tag.create_tag" `${ searchTerm }` | Safe}} + <span v-html="textCreateTag.replace('%s', searchTerm)"></span> </div> <div v-show="!createTag"> {{svg "octicon-git-branch"}} - {{.root.locale.Tr "repo.branch.create_branch" `${ searchTerm }` | Safe}} + <span v-html="textCreateBranch.replace('%s', searchTerm)"></span> </div> <div class="text small"> - {{if or .root.IsViewBranch $release}} - {{.root.locale.Tr "repo.branch.create_from" .root.BranchName}} - {{else if .root.IsViewTag}} - {{.root.locale.Tr "repo.branch.create_from" .root.TagName}} - {{else}} - {{.root.locale.Tr "repo.branch.create_from" (ShortSha .root.CommitID)}} - {{end}} + <span v-if="isViewBranch || release">${ textCreateBranchFrom.replace('%s', branchName) }</span> + <span v-else-if="isViewTag">${ textCreateBranchFrom.replace('%s', tagName) }</span> + <span v-else>${ textCreateBranchFrom.replace('%s', commitIdShort) }</span> </div> </a> <form ref="newBranchForm" action="{{.root.RepoLink}}/branches/_new/{{.root.BranchNameSubURL}}" method="post"> - {{.root.CsrfTokenHtml}} + <input type="hidden" name="_csrf" :value="csrfToken"> <input type="hidden" name="new_branch_name" v-model="searchTerm"> <input type="hidden" name="create_tag" v-model="createTag"> - {{if $.root.TreePath}} - <input type="hidden" name="current_path" value="{{.root.TreePath}}"> - {{end}} + <input type="hidden" name="current_path" v-model="treePath" v-if="treePath"> </form> </div> </div> diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 028fdc7e5..f19a4d422 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -52,13 +52,13 @@ data-modal-cherry-pick-type="revert" data-modal-cherry-pick-header="{{$.locale.Tr "repo.commit.revert-header" (ShortSha .CommitID)}}" data-modal-cherry-pick-content="{{$.locale.Tr "repo.commit.revert-content"}}" - data-modal-cherry-pick-submit="{{.locale.Tr "repo.commit.revert"}}">{{.locale.Tr "repo.commit.revert"}}</a></div> + data-modal-cherry-pick-submit="{{.locale.Tr "repo.commit.revert"}}">{{.locale.Tr "repo.commit.revert"}}</div> <div class="item cherry-pick-button show-modal" data-modal="#cherry-pick-modal" data-modal-cherry-pick-type="cherry-pick" data-modal-cherry-pick-header="{{$.locale.Tr "repo.commit.cherry-pick-header" (ShortSha .CommitID)}}" data-modal-cherry-pick-content="{{$.locale.Tr "repo.commit.cherry-pick-content"}}" - data-modal-cherry-pick-submit="{{.locale.Tr "repo.commit.cherry-pick"}}">{{.locale.Tr "repo.commit.cherry-pick"}}</a></div> + data-modal-cherry-pick-submit="{{.locale.Tr "repo.commit.cherry-pick"}}">{{.locale.Tr "repo.commit.cherry-pick"}}</div> <div class="ui basic modal" id="cherry-pick-modal"> <div class="ui icon header"> <span id="cherry-pick-header"></span> @@ -66,10 +66,10 @@ <div class="content center"> <p id="cherry-pick-content" class="branch-dropdown"></p> {{template "repo/branch_dropdown" dict "root" . - "noTag" "true" "canCreateBranch" "false" + "noTag" true "disableCreateBranch" true "branchForm" "branch-dropdown-form" "branchURLPrefix" (printf "%s/_cherrypick/%s/" $.RepoLink .CommitID) "branchURLSuffix" "" - "setAction" "true" "submitForm" "true"}} + "setAction" true "submitForm" true}} <form method="GET" action="{{$.RepoLink}}/_cherrypick/{{.CommitID}}/{{if $.BranchName}}{{PathEscapeSegments $.BranchName}}{{else}}{{PathEscapeSegments $.Repository.DefaultBranch}}{{end}}" id="branch-dropdown-form"> <input type="hidden" name="ref" value="{{if $.BranchName}}{{$.BranchName}}{{else}}{{$.Repository.DefaultBranch}}{{end}}"> <input type="hidden" name="refType" value="branch"> diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index eaf86ab4e..36333c554 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -61,7 +61,7 @@ <td class="message"> <span class="message-wrapper"> {{if $.PageIsWiki}} - <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji}}</span> + <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji $.Context}}</span> {{else}} {{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}} <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject $.Context .Message $commitRepoLink $commitLink $.Repository.ComposeMetas}}</span> diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 4e6879650..afd471368 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -79,7 +79,7 @@ {{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}} <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} gt-mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}> <h4 class="diff-file-header sticky-2nd-row ui top attached normal header gt-df gt-ac gt-sb"> - <div class="gt-df gt-ac"> + <div class="diff-file-name gt-df gt-ac gt-mr-3"> <a role="button" class="fold-file muted gt-mr-2" {{if not $isExpandable}}style="visibility: hidden"{{end}}> {{if $file.ShouldBeHidden}} {{svg "octicon-chevron-right" 18}} @@ -96,7 +96,7 @@ {{template "repo/diff/stats" dict "file" . "root" $}} {{end}} </div> - <span class="file gt-mono"><a class="muted" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a>{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}</span> + <span class="file gt-mono"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a>{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}</span> {{if $file.IsGenerated}} <span class="ui label gt-ml-3">{{$.locale.Tr "repo.diff.generated"}}</span> {{end}} diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 407f84e5c..225e40f7f 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -1,5 +1,5 @@ {{if and $.root.SignedUserID (not $.Repository.IsArchived)}} - <form class="ui form {{if $.hidden}}gt-hidden comment-form comment-form-reply{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post"> + <form class="ui form {{if $.hidden}}gt-hidden comment-form{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post"> {{$.root.CsrfTokenHtml}} <input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}"> <input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}"/> @@ -29,15 +29,10 @@ <input type="hidden" name="reply" value="{{$.reply}}"> {{else}} {{if $.root.CurrentReview}} - {{/* if there is only one "Add comment" button, the quick-submit should submit the form with is_review=true even if the "Add comment" button is not really clicked */}} - <input type="hidden" name="is_review" value="true"> - <button name="is_review" value="true" type="submit" - class="ui submit green tiny button btn-add-comment">{{$.root.locale.Tr "repo.diff.comment.add_review_comment"}}</button> + <button name="pending_review" type="submit" class="ui submit green tiny button btn-add-comment">{{$.root.locale.Tr "repo.diff.comment.add_review_comment"}}</button> {{else}} - <button name="is_review" value="true" type="submit" - class="ui submit green tiny button btn-start-review">{{$.root.locale.Tr "repo.diff.comment.start_review"}}</button> - <button type="submit" - class="ui submit tiny basic button btn-add-single">{{$.root.locale.Tr "repo.diff.comment.add_single_comment"}}</button> + <button name="pending_review" type="submit" class="ui submit green tiny button btn-start-review">{{$.root.locale.Tr "repo.diff.comment.start_review"}}</button> + <button name="single_review" value="true" type="submit" class="ui submit tiny basic button btn-add-single">{{$.root.locale.Tr "repo.diff.comment.add_single_comment"}}</button> {{end}} {{end}} {{if or (not $.HasComments) $.hidden}} diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 985ad0655..f28a3c5b5 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -42,8 +42,8 @@ </div> {{end}} {{end}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/add_reaction" Dict "ctxData" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctxData" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} </div> </div> <div class="ui attached segment comment-body"> @@ -60,7 +60,7 @@ {{$reactions := .Reactions.GroupByType}} {{if $reactions}} <div class="ui attached segment reactions"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}} + {{template "repo/issue/view_content/reactions" Dict "ctxData" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}} </div> {{end}} </div> diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 63cd51022..e0ec85f9a 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -1,9 +1,9 @@ {{$file := .file}} {{range $j, $section := $file.Sections}} {{range $k, $line := $section.Lines}} - {{if or $.root.AfterCommitID (ne .GetType 4)}} - <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}"> - {{if eq .GetType 4}} + <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}"> + {{if eq .GetType 4}} + {{if $.root.AfterCommitID}} <td colspan="2" class="lines-num"> {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} <a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}" data-anchor="diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> @@ -22,35 +22,38 @@ {{end}} </td> {{else}} - <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> - <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td> + {{/* for code file preview page or comment diffs on pull comment pages, do not show the expansion arrows */}} + <td colspan="2" class="lines-num"></td> {{end}} - {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale -}} - <td class="lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.root.locale}}"></a>{{end}}</td> - <td class="lines-type-marker"><span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> - {{if eq .GetType 4}} - <td class="chroma lines-code blob-hunk">{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* - */}}</td> - {{else}} - <td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{/* - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}<a class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">{{/* - */}}{{svg "octicon-plus"}}{{/* - */}}</a>{{/* - */}}{{end}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* - */}}</td> - {{end}} - </tr> - {{if gt (len $line.Comments) 0}} - <tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}"> - <td colspan="3" class="lines-num"></td> - <td class="add-comment-left add-comment-right" colspan="5"> - {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} - </td> - </tr> + {{else}} + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> + <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td> + {{end}} + {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale -}} + <td class="lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<a href="" class="toggle-escape-button" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff "locale" $.root.locale}}"></a>{{end}}</td> + <td class="lines-type-marker"><span class="gt-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> + {{if eq .GetType 4}} + <td class="chroma lines-code blob-hunk">{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* + */}}</td> + {{else}} + <td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{/* + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* + */}}<a class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">{{/* + */}}{{svg "octicon-plus"}}{{/* + */}}</a>{{/* + */}}{{end}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* + */}}</td> {{end}} + </tr> + {{if gt (len $line.Comments) 0}} + <tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}"> + <td colspan="3" class="lines-num"></td> + <td class="add-comment-left add-comment-right" colspan="5"> + {{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}} + </td> + </tr> {{end}} {{end}} {{end}} diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index c6c48c5a8..7ac0ed3df 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -58,7 +58,7 @@ </label> </div> </div> - <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}hide{{end}}"> + <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}gt-hidden{{end}}"> <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}"> {{svg "octicon-git-branch"}} <input type="text" name="new_branch_name" value="{{.new_branch_name}}" class="input-contrast gt-mr-2 js-quick-pull-new-branch-name" placeholder="{{.locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{.locale.Tr "repo.editor.new_branch_name"}}"> diff --git a/templates/repo/editor/diff_preview.tmpl b/templates/repo/editor/diff_preview.tmpl index e6956648c..e2e922be3 100644 --- a/templates/repo/editor/diff_preview.tmpl +++ b/templates/repo/editor/diff_preview.tmpl @@ -1,6 +1,6 @@ <div class="diff-file-box"> <div class="ui attached table segment"> - <div class="file-body file-code code-view code-diff-unified unicode-escaped"> + <div class="file-body file-code code-diff code-diff-unified unicode-escaped"> <table> <tbody> {{template "repo/diff/section_unified" dict "file" .File "root" $}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 2a79c51dd..73afbd663 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -63,7 +63,7 @@ {{end}} {{template "repo/sub_menu" .}} <div class="repo-button-row gt-df gt-ac gt-sb gt-fw"> - <div class="gt-df gt-ac"> + <div class="gt-df gt-ac gt-fw gt-gap-y-3"> {{template "repo/branch_dropdown" dict "root" .}} {{$n := len .TreeNames}} {{$l := Subtract $n 1}} @@ -99,20 +99,16 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} </button> {{end}} + {{if and (eq $n 0) (.Repository.IsTemplate)}} + <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> + {{.locale.Tr "repo.use_template"}} + </a> + {{end}} {{if ne $n 0}} <span class="ui breadcrumb repo-path gt-ml-2"><a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section" title="{{$v}}">{{EllipsisString $v 30}}</span>{{else}}{{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span> {{end}} </div> <div class="gt-df gt-ac"> - {{if eq $n 0}} - {{if .Repository.IsTemplate}} - <div class="ui tiny primary buttons"> - <a href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}" class="ui button"> - {{.locale.Tr "repo.use_template"}} - </a> - </div> - {{end}} - {{end}} <!-- Only show clone panel in repository home page --> {{if eq $n 0}} <div class="ui action tiny input" id="clone-panel"> diff --git a/templates/repo/issue/labels/label.tmpl b/templates/repo/issue/labels/label.tmpl index 6e9177aec..01016281a 100644 --- a/templates/repo/issue/labels/label.tmpl +++ b/templates/repo/issue/labels/label.tmpl @@ -3,5 +3,5 @@ id="label_{{.label.ID}}" href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}} > - {{RenderLabel .label}} + {{RenderLabel $.Context .label}} </a> diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl index e8f00fa25..2c8ace8d7 100644 --- a/templates/repo/issue/labels/label_list.tmpl +++ b/templates/repo/issue/labels/label_list.tmpl @@ -31,8 +31,8 @@ <li class="item"> <div class="ui grid middle aligned"> <div class="nine wide column"> - {{RenderLabel .}} - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}} + {{RenderLabel $.Context .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} </div> <div class="four wide column"> {{if $.PageIsOrgSettingsLabels}} @@ -70,8 +70,8 @@ <li class="item"> <div class="ui grid middle aligned"> <div class="nine wide column"> - {{RenderLabel .}} - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}} + {{RenderLabel $.Context .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} </div> <div class="four wide column"> <a class="ui left open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a> diff --git a/templates/repo/issue/labels/labels_sidebar.tmpl b/templates/repo/issue/labels/labels_sidebar.tmpl index bd878d6f5..89fe26b75 100644 --- a/templates/repo/issue/labels/labels_sidebar.tmpl +++ b/templates/repo/issue/labels/labels_sidebar.tmpl @@ -1,10 +1,10 @@ <div class="ui labels list"> - <span class="no-select item {{if .ctx.HasSelectedLabel}}gt-hidden{{end}}">{{.ctx.locale.Tr "repo.issues.new.no_label"}}</span> + <span class="no-select item {{if .root.HasSelectedLabel}}gt-hidden{{end}}">{{.root.locale.Tr "repo.issues.new.no_label"}}</span> <span class="labels-list"> - {{range .ctx.Labels}} + {{range .root.Labels}} {{template "repo/issue/labels/label" dict "root" $.root "label" .}} {{end}} - {{range .ctx.OrgLabels}} + {{range .root.OrgLabels}} {{template "repo/issue/labels/label" dict "root" $.root "label" .}} {{end}} </span> diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 23a8a1d0e..ca05264e7 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -57,7 +57,7 @@ <div class="ui divider"></div> {{end}} {{$previousExclusiveScope = $exclusiveScope}} - <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel .}}</a> + <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}}</a> {{end}} </div> </div> @@ -232,7 +232,7 @@ {{end}} {{$previousExclusiveScope = $exclusiveScope}} <div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> - {{if contain $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel .}} + {{if contain $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}} </div> {{end}} </div> diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index d73fb56fb..2918c4359 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -58,7 +58,7 @@ <span class="info">{{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}</span> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_label_no_select"}}</a> {{range .Labels}} - <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}} {{RenderLabel .}}</a> + <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}} {{RenderLabel $.Context .}}</a> {{end}} </div> </div> @@ -162,7 +162,7 @@ <div class="menu"> {{range .Labels}} <div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> - {{if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}} {{RenderLabel .}} + {{if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}} {{RenderLabel $.Context .}} </div> {{end}} </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 8346d07a1..9fd6c99a5 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -60,8 +60,8 @@ <div class="ui divider"></div> {{end}} {{$previousExclusiveScope = $exclusiveScope}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a> {{end}} <div class="ui divider"></div> @@ -72,15 +72,15 @@ <div class="ui divider"></div> {{end}} {{$previousExclusiveScope = $exclusiveScope}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a> {{end}} {{else}} <div class="header" style="text-transform: none;font-size:14px;">{{.locale.Tr "repo.issues.new.no_items"}}</div> {{end}} </div> </div> - {{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}} + {{template "repo/issue/labels/labels_sidebar" dict "root" $}} <div class="ui divider"></div> @@ -176,8 +176,8 @@ {{.locale.Tr "repo.issues.new.open_projects"}} </div> {{range .OpenProjects}} - <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{$.RepoLink}}/projects/{{.ID}}"> - {{svg "octicon-project" 18 "gt-mr-3"}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}"> + {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} {{.Title}} </a> {{end}} @@ -188,8 +188,8 @@ {{.locale.Tr "repo.issues.new.closed_projects"}} </div> {{range .ClosedProjects}} - <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{$.RepoLink}}/projects/{{.ID}}"> - {{svg "octicon-project" 18 "gt-mr-3"}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}"> + {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} {{.Title}} </a> {{end}} @@ -201,8 +201,8 @@ <span class="no-select item {{if .Project}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span> <div class="selected"> {{if .Project}} - <a class="item muted sidebar-item-link" href="{{.RepoLink}}/projects/{{.Project.ID}}"> - {{svg "octicon-project" 18 "gt-mr-3"}} + <a class="item muted sidebar-item-link" href="{{.Project.Link}}"> + {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} {{.Project.Title}} </a> {{end}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 08ba50904..6aec6e315 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -64,8 +64,8 @@ {{end}} {{end}} {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}} + {{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}} </div> </div> @@ -80,13 +80,13 @@ <div id="issue-{{.Issue.ID}}-raw" class="raw-content gt-hidden">{{.Issue.Content}}</div> <div class="edit-content-zone gt-hidden" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div> {{if .Issue.Attachments}} - {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}} + {{template "repo/issue/view_content/attachments" Dict "ctxData" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}} {{end}} </div> {{$reactions := .Issue.Reactions.GroupByType}} {{if $reactions}} <div class="ui attached segment reactions" role="note"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} + {{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} </div> {{end}} </div> diff --git a/templates/repo/issue/view_content/add_reaction.tmpl b/templates/repo/issue/view_content/add_reaction.tmpl index bfa8a7e12..692d09e67 100644 --- a/templates/repo/issue/view_content/add_reaction.tmpl +++ b/templates/repo/issue/view_content/add_reaction.tmpl @@ -1,10 +1,10 @@ -{{if .ctx.IsSigned}} +{{if .ctxData.IsSigned}} <div class="item action ui pointing select-reaction dropdown top right" data-action-url="{{.ActionURL}}"> <a class="add-reaction"> {{svg "octicon-smiley"}} </a> <div class="menu"> - <div class="header">{{.ctx.locale.Tr "repo.pick_reaction"}}</div> + <div class="header">{{.ctxData.locale.Tr "repo.pick_reaction"}}</div> <div class="divider"></div> {{range $value := AllowedReactions}} <a class="item reaction tooltip" data-content="{{$value}}">{{ReactionToEmoji $value}}</a> diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index 86696ec62..3c0190b7d 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -6,7 +6,7 @@ {{$hasThumbnails := false}} {{- range .Attachments -}} <div class="twelve wide column" style="padding: 6px;"> - <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'> + <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctxData.locale.Tr "repo.issues.attachment.open_tab" .Name}}'> {{if FilenameIsImage .Name}} {{if not (containGeneric $.Content .UUID)}} {{$hasThumbnails = true}} @@ -31,7 +31,7 @@ {{if FilenameIsImage .Name}} {{if not (containGeneric $.Content .UUID)}} <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}"> - <img src="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'> + <img src="{{.DownloadURL}}" title='{{$.ctxData.locale.Tr "repo.issues.attachment.open_tab" .Name}}'> </a> {{end}} {{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 94b46bd9f..9f2b7ec2d 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -64,8 +64,8 @@ </div> {{end}} {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} {{end}} </div> </div> @@ -80,13 +80,13 @@ <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> <div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> {{if .Attachments}} - {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} + {{template "repo/issue/view_content/attachments" Dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}} {{end}} </div> {{$reactions := .Reactions.GroupByType}} {{if $reactions}} <div class="ui attached segment reactions" role="note"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + {{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} </div> {{end}} </div> @@ -180,11 +180,11 @@ <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} {{if and .AddedLabels (not .RemovedLabels)}} - {{$.locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels $.RepoLink) $createdStr | Safe}} + {{$.locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels $.Context .AddedLabels $.RepoLink) $createdStr | Safe}} {{else if and (not .AddedLabels) .RemovedLabels}} - {{$.locale.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels .RemovedLabels $.RepoLink) $createdStr | Safe}} + {{$.locale.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels $.Context .RemovedLabels $.RepoLink) $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels $.RepoLink) (RenderLabels .RemovedLabels $.RepoLink) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.add_remove_labels" (RenderLabels $.Context .AddedLabels $.RepoLink) (RenderLabels $.Context .RemovedLabels $.RepoLink) $createdStr | Safe}} {{end}} </span> </div> @@ -231,7 +231,7 @@ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}} <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} - {{$.locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji $.Context) (.NewTitle|RenderEmoji $.Context) $createdStr | Safe}} </span> </div> {{else if eq .Type 11}} @@ -260,7 +260,7 @@ {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}} </span> - {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}} + {{template "repo/issue/view_content/comments_delete_time" Dict "ctxData" $ "comment" .}} <div class="detail"> {{svg "octicon-clock"}} <span class="text grey muted-links">{{.Content}}</span> @@ -274,7 +274,7 @@ {{template "shared/user/authorlink" .Poster}} {{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}} </span> - {{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}} + {{template "repo/issue/view_content/comments_delete_time" Dict "ctxData" $ "comment" .}} <div class="detail"> {{svg "octicon-clock"}} <span class="text grey muted-links">{{.Content}}</span> @@ -436,8 +436,8 @@ </div> {{end}} {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} {{end}} </div> </div> @@ -452,13 +452,13 @@ <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> <div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> {{if .Attachments}} - {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} + {{template "repo/issue/view_content/attachments" Dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}} {{end}} </div> {{$reactions := .Reactions.GroupByType}} {{if $reactions}} <div class="ui attached segment reactions"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + {{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} </div> {{end}} </div> @@ -563,8 +563,8 @@ </div> {{end}} {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} {{end}} </div> </div> @@ -582,7 +582,7 @@ {{$reactions := .Reactions.GroupByType}} {{if $reactions}} <div class="ui attached segment reactions"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + {{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} </div> {{end}} </div> @@ -697,6 +697,10 @@ </span> </div> {{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}} + <!-- If PR is closed, the comments whose type is CommentTypePullRequestPush(29) after latestCloseCommentID won't be rendered. //--> + {{if and .Issue.IsClosed (gt .ID $.LatestCloseCommentID)}} + {{continue}} + {{end}} <div class="timeline-item event" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-repo-push"}}</span> <span class="text grey muted-links"> @@ -707,6 +711,11 @@ {{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}} {{end}} </span> + {{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}} + <span class="ui float right comparebox"> + <a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{$.locale.Tr "repo.issues.force_push_compare"}}</a> + </span> + {{end}} </div> {{if not .IsForcePush}} {{template "repo/commits_list_small" dict "comment" . "root" $}} diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl index e01d2602f..bc08d7fde 100644 --- a/templates/repo/issue/view_content/comments_delete_time.tmpl +++ b/templates/repo/issue/view_content/comments_delete_time.tmpl @@ -1,18 +1,18 @@ {{if .comment.Time}} {{/* compatibility with time comments made before v1.14 */}} {{if (not .comment.Time.Deleted)}} - {{if (or .ctx.IsAdmin (and .ctx.IsSigned (eq .ctx.SignedUserID .comment.PosterID)))}} + {{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}} <span class="ui float right"> <div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}"> - <form method="POST" class="delete-time-form" action="{{.ctx.RepoLink}}/issues/{{.ctx.Issue.Index}}/times/{{.comment.TimeID}}/delete"> - {{.ctx.CsrfTokenHtml}} + <form method="POST" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete"> + {{.ctxData.CsrfTokenHtml}} </form> - <div class="header">{{.ctx.locale.Tr "repo.issues.del_time"}}</div> + <div class="header">{{.ctxData.locale.Tr "repo.issues.del_time"}}</div> <div class="actions"> - <div class="ui red approve button">{{.ctx.locale.Tr "repo.issues.context.delete"}}</div> - <div class="ui cancel button">{{.ctx.locale.Tr "repo.issues.add_time_cancel"}}</div> + <div class="ui red approve button">{{.ctxData.locale.Tr "repo.issues.context.delete"}}</div> + <div class="ui cancel button">{{.ctxData.locale.Tr "repo.issues.add_time_cancel"}}</div> </div> </div> - <button class="ui icon button compact mini issue-delete-time tooltip" data-id="{{.comment.Time.ID}}" data-content="{{.ctx.locale.Tr "repo.issues.del_time"}}" data-position="top right"> + <button class="ui icon button compact mini issue-delete-time tooltip" data-id="{{.comment.Time.ID}}" data-content="{{.ctxData.locale.Tr "repo.issues.del_time"}}" data-position="top right"> {{svg "octicon-trash"}} </button> </span> diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl index b4b9403b2..c073c74ea 100644 --- a/templates/repo/issue/view_content/context_menu.tmpl +++ b/templates/repo/issue/view_content/context_menu.tmpl @@ -1,4 +1,4 @@ -{{if .ctx.IsSigned}} +{{if .ctxData.IsSigned}} <div class="item action ui pointing custom dropdown top right context-dropdown"> <a class="context-menu"> {{svg "octicon-kebab-horizontal"}} @@ -6,20 +6,20 @@ <div class="menu"> {{$referenceUrl := ""}} {{if .issue}} - {{$referenceUrl = Printf "%s#%s" .ctx.Issue.Link .item.HashTag}} + {{$referenceUrl = Printf "%s#%s" .ctxData.Issue.Link .item.HashTag}} {{else}} - {{$referenceUrl = Printf "%s/files#%s" .ctx.Issue.Link .item.HashTag}} + {{$referenceUrl = Printf "%s/files#%s" .ctxData.Issue.Link .item.HashTag}} {{end}} - <a class="item context" data-clipboard-text-type="url" data-clipboard-text="{{AppSubUrl}}{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.copy_link"}}</a> - <a class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.HashTag}}-raw">{{.ctx.locale.Tr "repo.issues.context.quote_reply"}}</a> - {{if not .ctx.UnitIssuesGlobalDisabled}} - <a class="item context reference-issue" data-target="{{.item.HashTag}}-raw" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.reference_issue"}}</a> + <div class="item context js-aria-clickable" data-clipboard-text-type="url" data-clipboard-text="{{AppSubUrl}}{{$referenceUrl}}">{{.ctxData.locale.Tr "repo.issues.context.copy_link"}}</div> + <div class="item context js-aria-clickable quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.HashTag}}-raw">{{.ctxData.locale.Tr "repo.issues.context.quote_reply"}}</div> + {{if not .ctxData.UnitIssuesGlobalDisabled}} + <div class="item context js-aria-clickable reference-issue" data-target="{{.item.HashTag}}-raw" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{.ctxData.locale.Tr "repo.issues.context.reference_issue"}}</div> {{end}} - {{if or .ctx.Permission.IsAdmin .IsCommentPoster .ctx.HasIssuesOrPullsWritePermission}} + {{if or .ctxData.Permission.IsAdmin .IsCommentPoster .ctxData.HasIssuesOrPullsWritePermission}} <div class="divider"></div> - <a class="item context edit-content">{{.ctx.locale.Tr "repo.issues.context.edit"}}</a> + <div class="item context js-aria-clickable edit-content">{{.ctxData.locale.Tr "repo.issues.context.edit"}}</div> {{if .delete}} - <a class="item context delete-comment" data-comment-id={{.item.HashTag}} data-url="{{.ctx.RepoLink}}/comments/{{.item.ID}}/delete" data-locale="{{.ctx.locale.Tr "repo.issues.delete_comment_confirm"}}">{{.ctx.locale.Tr "repo.issues.context.delete"}}</a> + <div class="item context js-aria-clickable delete-comment" data-comment-id={{.item.HashTag}} data-url="{{.ctxData.RepoLink}}/comments/{{.item.ID}}/delete" data-locale="{{.ctxData.locale.Tr "repo.issues.delete_comment_confirm"}}">{{.ctxData.locale.Tr "repo.issues.context.delete"}}</div> {{end}} {{end}} </div> diff --git a/templates/repo/issue/view_content/reactions.tmpl b/templates/repo/issue/view_content/reactions.tmpl index c0a925d18..8e7eabd4b 100644 --- a/templates/repo/issue/view_content/reactions.tmpl +++ b/templates/repo/issue/view_content/reactions.tmpl @@ -1,9 +1,9 @@ {{range $key, $value := .Reactions}} - <a class="ui label basic{{if $value.HasUser $.ctx.SignedUserID}} primary{{end}}{{if not $.ctx.IsSigned}} disabled{{end}}" data-title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{$.ctx.locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-content="{{$key}}" data-action-url="{{$.ActionURL}}"> + <a class="ui label basic{{if $value.HasUser $.ctxData.SignedUserID}} primary{{end}}{{if not $.ctxData.IsSigned}} disabled{{end}}" data-title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{$.ctxData.locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-content="{{$key}}" data-action-url="{{$.ActionURL}}"> <span class="reaction">{{ReactionToEmoji $key}}</span> <span class="reaction-count">{{len $value}}</span> </a> {{end}} {{if AllowedReactions}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $.ctx "ActionURL" .ActionURL}} + {{template "repo/issue/view_content/add_reaction" Dict "ctxData" $.ctxData "ActionURL" .ActionURL}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index d9c506243..29bfac7c2 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -130,8 +130,8 @@ <div class="ui divider"></div> {{end}} {{$previousExclusiveScope = $exclusiveScope}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a> {{end}} <div class="ui divider"></div> {{$previousExclusiveScope := "_no_scope"}} @@ -141,15 +141,15 @@ <div class="ui divider"></div> {{end}} {{$previousExclusiveScope = $exclusiveScope}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a> {{end}} {{else}} <div class="header" style="text-transform: none;font-size:14px;">{{.locale.Tr "repo.issues.new.no_items"}}</div> {{end}} </div> </div> - {{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}} + {{template "repo/issue/labels/labels_sidebar" dict "root" $}} <div class="ui divider"></div> @@ -487,8 +487,8 @@ {{range .BlockingDependencies}} <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} gt-df gt-ac gt-sb"> <div class="item-left gt-df gt-jc gt-fc gt-f1"> - <a class="title tooltip" href="{{.Issue.Link}}" data-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji}}"> - #{{.Issue.Index}} {{.Issue.Title | RenderEmoji}} + <a class="title tooltip" href="{{.Issue.Link}}" data-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}"> + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} </a> <div class="text small"> {{.Repository.OwnerName}}/{{.Repository.Name}} @@ -514,8 +514,8 @@ {{range .BlockedByDependencies}} <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} gt-df gt-ac gt-sb"> <div class="item-left gt-df gt-jc gt-fc gt-f1"> - <a class="title tooltip" href="{{.Issue.Link}}" data-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji}}"> - #{{.Issue.Index}} {{.Issue.Title | RenderEmoji}} + <a class="title tooltip" href="{{.Issue.Link}}" data-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}"> + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} </a> <div class="text small"> {{.Repository.OwnerName}}/{{.Repository.Name}} diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index fc4770e5d..929a1b4c6 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -40,7 +40,7 @@ <div class="milestone list"> {{range .Projects}} <li class="item"> - {{svg "octicon-project"}} <a href="{{$.RepoLink}}/projects/{{.ID}}">{{.Title}}</a> + {{svg "octicon-project"}} <a href="{{.Link}}">{{.Title}}</a> <div class="meta"> {{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} diff --git a/templates/repo/projects/new.tmpl b/templates/repo/projects/new.tmpl index b65601c15..b53a47dc5 100644 --- a/templates/repo/projects/new.tmpl +++ b/templates/repo/projects/new.tmpl @@ -24,6 +24,7 @@ <form class="ui form grid" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} <div class="eleven wide column"> + <input type="hidden" id="redirect" name="redirect" value="{{.redirect}}"> <div class="field {{if .Err_Title}}error{{end}}"> <label>{{.locale.Tr "repo.projects.title"}}</label> <input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required> diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index 1450fdac1..bef9cb9bf 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -50,7 +50,7 @@ {{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}} <div class="column right aligned"> <div class="ui compact right small menu"> - <a class="item" href="{{$.RepoLink}}/projects/{{.Project.ID}}/edit" data-id={{$.Project.ID}} data-title={{$.Project.Title}}> + <a class="item" href="{{$.RepoLink}}/projects/{{.Project.ID}}/edit?redirect=project" data-id={{$.Project.ID}} data-title={{$.Project.Title}}> {{svg "octicon-pencil"}} <span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span> </a> @@ -245,7 +245,7 @@ {{if or .Labels .Assignees}} <div class="extra content labels-list gt-p-0 gt-pt-2"> {{range .Labels}} - <a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel .}}</a> + <a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel $.Context .}}</a> {{end}} <div class="right floated"> {{range .Assignees}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index 37d7ca032..d7c580fed 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -20,22 +20,27 @@ <b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong> {{else}} <input id="tag-name" name="tag_name" value="{{.tag_name}}" placeholder="{{.locale.Tr "repo.release.tag_name"}}" autofocus required maxlength="255"> - <span class="at">@</span> - <div class="ui selection dropdown"> - <input type="hidden" name="tag_target" value="{{.tag_target}}"/> - {{svg "octicon-git-branch"}} - <div class="text"> - {{.locale.Tr "repo.release.target"}} : - <strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong> - </div> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - {{range .Branches}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} + <input id="tag-name-editor" type="hidden" data-existing-tags={{Json .Tags}} data-tag-helper={{.locale.Tr "repo.release.tag_helper"}} data-tag-helper-new={{.locale.Tr "repo.release.tag_helper_new"}} data-tag-helper-existing={{.locale.Tr "repo.release.tag_helper_existing"}} /> + <div id="tag-target-selector" class="gt-dib"> + <span class="at">@</span> + <div class="ui selection dropdown"> + <input type="hidden" name="tag_target" value="{{.tag_target}}"/> + {{svg "octicon-git-branch"}} + <div class="text"> + {{.locale.Tr "repo.release.target"}} : + <strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong> + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .Branches}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> </div> </div> - <span class="help">{{.locale.Tr "repo.release.tag_helper"}}</span> + <div> + <span id="tag-helper" class="help gt-mt-2">{{.locale.Tr "repo.release.tag_helper"}}</span> + </div> {{end}} </div> </div> diff --git a/templates/repo/settings/lfs_file_find.tmpl b/templates/repo/settings/lfs_file_find.tmpl index d5983ca1c..81cb64983 100644 --- a/templates/repo/settings/lfs_file_find.tmpl +++ b/templates/repo/settings/lfs_file_find.tmpl @@ -19,7 +19,7 @@ <td class="message"> <span class="truncate"> <a href="{{$.RepoLink}}/commit/{{.SHA}}" title="{{.Summary | RenderEmojiPlain}}"> - {{.Summary | RenderEmoji}} + {{.Summary | RenderEmoji $.Context}} </a> </span> </td> diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index bf7fe05de..f76cdb147 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -40,7 +40,7 @@ <span class="ui label">N/A</span> {{end}} </a> - {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin}} + {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}} <div class="right menu"> <form class="item" action="{{$.Link}}/replay/{{.UUID}}" method="post"> {{$.CsrfTokenHtml}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index a43047c79..16bb3c1ec 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -34,7 +34,7 @@ </div> <div class="issue-item-main gt-f1 gt-fc gt-df"> <div class="issue-item-top-row"> - <a class="title gt-tdn issue-title" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji .Title | RenderCodeBlock}}</a> + <a class="title gt-tdn issue-title" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji $.Context .Title | RenderCodeBlock}}</a> {{if .IsPull}} {{if (index $.CommitStatuses .PullRequest.ID)}} {{template "repo/commit_statuses" dict "Status" (index $.CommitLastStatus .PullRequest.ID) "Statuses" (index $.CommitStatuses .PullRequest.ID) "root" $}} @@ -42,7 +42,7 @@ {{end}} <span class="labels-list gt-ml-2"> {{range .Labels}} - <a href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{RenderLabel .}}</a> + <a href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{RenderLabel $.Context .}}</a> {{end}} </span> </div> @@ -87,8 +87,8 @@ </a> {{end}} {{if .Project}} - <a class="project" {{if $.RepoLink}}href="{{$.RepoLink}}/projects/{{.Project.ID}}"{{else}}href="{{.Repo.Link}}/projects/{{.Project.ID}}"{{end}}> - {{svg "octicon-project" 14 "gt-mr-2"}}{{.Project.Title}} + <a class="project" href="{{.Project.Link}}"> + {{if .Project.IsOrganizationProject}}{{svg "octicon-project-symlink" 14 "gt-mr-2"}}{{else}}{{svg "octicon-project" 14 "gt-mr-2"}}{{end}}{{.Project.Title}} </a> {{end}} {{if .Ref}} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index d1c0a6f18..a1f143ad5 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -13313,6 +13313,152 @@ } } }, + "/user/hooks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's webhooks", + "operationId": "userListHooks", + "parameters": [ + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/HookList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create a hook", + "operationId": "userCreateHook", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateHookOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Hook" + } + } + } + }, + "/user/hooks/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a hook", + "operationId": "userGetHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete a hook", + "operationId": "userDeleteHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Update a hook", + "operationId": "userEditHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to update", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditHookOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + } + } + } + }, "/user/keys": { "get": { "produces": [ diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 75a76db57..64daf4b2e 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -72,7 +72,7 @@ {{$index := index .GetIssueInfos 0}} {{$.locale.Tr "action.comment_pull" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}} {{else if eq .GetOpType 24}} - {{$linkText := .Content | RenderEmoji}} + {{$linkText := .Content | RenderEmoji $.Context}} {{$.locale.Tr "action.publish_release" (.GetRepoLink|Escape) ((printf "%s/releases/tag/%s" .GetRepoLink .GetTag)|Escape) (.ShortRepoPath|Escape) $linkText | Str2html}} {{else if eq .GetOpType 25}} {{$index := index .GetIssueInfos 0}} @@ -99,20 +99,20 @@ </ul> </div> {{else if eq .GetOpType 6}} - <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji | RenderCodeBlock}}</span> + <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span> {{else if eq .GetOpType 7}} - <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji | RenderCodeBlock}}</span> + <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span> {{else if or (eq .GetOpType 10) (eq .GetOpType 21) (eq .GetOpType 22) (eq .GetOpType 23)}} - <a href="{{.GetCommentLink}}" class="text truncate issue title">{{.GetIssueTitle | RenderEmoji | RenderCodeBlock}}</a> + <a href="{{.GetCommentLink}}" class="text truncate issue title">{{.GetIssueTitle | RenderEmoji $.Context | RenderCodeBlock}}</a> {{$comment := index .GetIssueInfos 1}} - {{if gt (len $comment) 0}}<p class="text light grey">{{$comment | RenderEmoji}}</p>{{end}} + {{if gt (len $comment) 0}}<p class="text light grey">{{$comment | RenderEmoji $.Context}}</p>{{end}} {{else if eq .GetOpType 11}} <p class="text light grey">{{index .GetIssueInfos 1}}</p> {{else if or (eq .GetOpType 12) (eq .GetOpType 13) (eq .GetOpType 14) (eq .GetOpType 15)}} - <span class="text truncate issue title">{{.GetIssueTitle | RenderEmoji | RenderCodeBlock}}</span> + <span class="text truncate issue title">{{.GetIssueTitle | RenderEmoji $.Context | RenderCodeBlock}}</span> {{else if eq .GetOpType 25}} <p class="text light grey">{{$.locale.Tr "action.review_dismissed_reason"}}</p> - <p class="text light grey">{{index .GetIssueInfos 2 | RenderEmoji}}</p> + <p class="text light grey">{{index .GetIssueInfos 2 | RenderEmoji $.Context}}</p> {{end}} <p class="text italic light grey">{{TimeSince .GetCreate $.locale}}</p> </div> diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index 719d5b06b..ab6f1bc58 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -5,12 +5,10 @@ <span class="text truncated-item-container"> {{avatar $.Context .ContextUser}} <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - {{if .ContextUser.IsOrganization}} - <span class="org-visibility"> - {{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} - {{if .ContextUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} - </span> - {{end}} + <span class="org-visibility"> + {{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} + {{if .ContextUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} + </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </span> <div class="context user overflow menu" tabindex="-1"> @@ -21,6 +19,10 @@ <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item truncated-item-container" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{else if .PageIsMilestonesDashboard}}milestones{{end}}"> {{avatar $.Context .SignedUser}} <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> + <span class="org-visibility"> + {{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} + {{if .ContextUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} + </span> </a> {{range .Orgs}} <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item truncated-item-container" title="{{.Name}}" href="{{.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}"> diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index 22af578fc..97234176b 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -46,56 +46,38 @@ <div class="ui dropdown icon button" title="{{.locale.Tr "home.filter"}}"> <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i> <div class="menu"> - <div class="item"> - <a @click="toggleArchivedFilter()"> - <div class="ui checkbox" id="archivedFilterCheckbox" title="{{.locale.Tr "home.show_both_archived_unarchived"}}" v-if="archivedFilter === 'both'"> - <input type="checkbox"> - <label> - {{svg "octicon-archive" 16 "gt-mr-2"}} - {{.locale.Tr "home.show_archived"}} - </label> - </div> - <div class="ui checkbox" id="archivedFilterCheckbox" title="{{.locale.Tr "home.show_only_unarchived"}}" v-if="archivedFilter === 'unarchived'"> - <input type="checkbox"> - <label> - {{svg "octicon-archive" 16 "gt-mr-2"}} - {{.locale.Tr "home.show_archived"}} - </label> - </div> - <div class="ui checkbox" id="archivedFilterCheckbox" title="{{.locale.Tr "home.show_only_archived"}}" v-if="archivedFilter === 'archived'"> - <input type="checkbox"> - <label> - {{svg "octicon-archive" 16 "gt-mr-2"}} - {{.locale.Tr "home.show_archived"}} - </label> - </div> - </a> - </div> - <div class="item"> - <a @click="togglePrivateFilter()"> - <div class="ui checkbox" id="privateFilterCheckbox" title="{{.locale.Tr "home.show_both_private_public"}}" v-if="privateFilter === 'both'"> - <input type="checkbox"> - <label> - {{svg "octicon-lock" 16 "gt-mr-2"}} - {{.locale.Tr "home.show_private"}} - </label> - </div> - <div class="ui checkbox" id="privateFilterCheckbox" title="{{.locale.Tr "home.show_only_public"}}" v-if="privateFilter === 'public'"> - <input type="checkbox"> - <label> - {{svg "octicon-lock" 16 "gt-mr-2"}} - {{.locale.Tr "home.show_private"}} - </label> - </div> - <div class="ui checkbox" id="privateFilterCheckbox" title="{{.locale.Tr "home.show_only_private"}}" v-if="privateFilter === 'private'"> - <input type="checkbox"> - <label> - {{svg "octicon-lock" 16 "gt-mr-2"}} - {{.locale.Tr "home.show_private"}} - </label> - </div> - </a> - </div> + <a class="item" @click="toggleArchivedFilter()"> + <div class="ui checkbox" + ref="checkboxArchivedFilter" + data-title-both="{{.locale.Tr "home.show_both_archived_unarchived"}}" + data-title-unarchived="{{.locale.Tr "home.show_only_unarchived"}}" + data-title-archived="{{.locale.Tr "home.show_only_archived"}}" + :title="checkboxArchivedFilterTitle" + > + <!--the "hidden" is necessary to make the checkbox work without Fomantic UI js, + otherwise if the "input" handles click event for intermediate status, it breaks the internal state--> + <input type="checkbox" class="hidden" v-bind.prop="checkboxArchivedFilterProps"> + <label> + {{svg "octicon-archive" 16 "gt-mr-2"}} + {{.locale.Tr "home.show_archived"}} + </label> + </div> + </a> + <a class="item" @click="togglePrivateFilter()"> + <div class="ui checkbox" + ref="checkboxPrivateFilter" + data-title-both="{{.locale.Tr "home.show_both_private_public"}}" + data-title-public="{{.locale.Tr "home.show_only_public"}}" + data-title-private="{{.locale.Tr "home.show_only_private"}}" + :title="checkboxPrivateFilterTitle" + > + <input type="checkbox" class="hidden" v-bind.prop="checkboxPrivateFilterProps"> + <label> + {{svg "octicon-lock" 16 "gt-mr-2"}} + {{.locale.Tr "home.show_private"}} + </label> + </div> + </a> </div> </div> </div> diff --git a/templates/user/overview/header.tmpl b/templates/user/overview/header.tmpl index 2449f5fc3..b4f7d6f90 100644 --- a/templates/user/overview/header.tmpl +++ b/templates/user/overview/header.tmpl @@ -22,15 +22,17 @@ <a class="item" href="{{.ContextUser.HomeLink}}"> {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} </a> + {{if and .IsProjectEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadProjects))}} <a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item"> - {{svg "octicon-project"}} {{.locale.Tr "user.projects"}} + {{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}} </a> - {{if (not .UnitPackagesGlobalDisabled)}} + {{end}} + {{if and .IsPackageEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadPackages))}} <a href="{{.ContextUser.HomeLink}}/-/packages" class="{{if .IsPackagesPage}}active {{end}}item"> {{svg "octicon-package"}} {{.locale.Tr "packages.title"}} </a> {{end}} - {{if .IsRepoIndexerEnabled}} + {{if and .IsRepoIndexerEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadCode))}} <a href="{{.ContextUser.HomeLink}}/-/code" class="{{if .IsCodePage}}active {{end}}item"> {{svg "octicon-code"}} {{.locale.Tr "user.code"}} </a> diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index fcaec60ea..5b445bdb0 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -107,7 +107,7 @@ {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} </a> <a href="{{.Owner.HomeLink}}/-/projects" class="{{if eq .TabName "projects"}}active {{end}}item"> - {{svg "octicon-project"}} {{.locale.Tr "user.projects"}} + {{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}} </a> {{if .IsPackageEnabled}} <a class='{{if eq .TabName "packages"}}active {{end}}item' href="{{.Owner.HomeLink}}/-/packages"> diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl index ef9ac9a97..b0cd37d44 100644 --- a/templates/user/settings/applications.tmpl +++ b/templates/user/settings/applications.tmpl @@ -140,6 +140,12 @@ </div> <div class="field"> <div class="ui checkbox"> + <input class="enable-system" type="checkbox" name="scope" value="admin:user_hook"> + <label>admin:user_hook</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> <input class="enable-system" type="checkbox" name="scope" value="notification"> <label>notification</label> </div> diff --git a/templates/user/settings/hook_new.tmpl b/templates/user/settings/hook_new.tmpl new file mode 100644 index 000000000..20aaf65f6 --- /dev/null +++ b/templates/user/settings/hook_new.tmpl @@ -0,0 +1,53 @@ +{{template "base/head" .}} +<div class="page-content user settings new webhook"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + <div class="twelve wide column content"> + {{template "base/alert" .}} + <h4 class="ui top attached header"> + {{if .PageIsSettingsHooksNew}}{{.locale.Tr "repo.settings.add_webhook"}}{{else}}{{.locale.Tr "repo.settings.update_webhook"}}{{end}} + <div class="ui right"> + {{if eq .HookType "gitea"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/gitea.svg"> + {{else if eq .HookType "gogs"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/gogs.ico"> + {{else if eq .HookType "slack"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/slack.png"> + {{else if eq .HookType "discord"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/discord.png"> + {{else if eq .HookType "dingtalk"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/dingtalk.ico"> + {{else if eq .HookType "telegram"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/telegram.png"> + {{else if eq .HookType "msteams"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/msteams.png"> + {{else if eq .HookType "feishu"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/feishu.png"> + {{else if eq .HookType "matrix"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/matrix.svg"> + {{else if eq .HookType "wechatwork"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/wechatwork.png"> + {{else if eq .HookType "packagist"}} + <img width="26" height="26" src="{{AssetUrlPrefix}}/img/packagist.png"> + {{end}} + </div> + </h4> + <div class="ui attached segment"> + {{template "repo/settings/webhook/gitea" .}} + {{template "repo/settings/webhook/gogs" .}} + {{template "repo/settings/webhook/slack" .}} + {{template "repo/settings/webhook/discord" .}} + {{template "repo/settings/webhook/dingtalk" .}} + {{template "repo/settings/webhook/telegram" .}} + {{template "repo/settings/webhook/msteams" .}} + {{template "repo/settings/webhook/feishu" .}} + {{template "repo/settings/webhook/matrix" .}} + {{template "repo/settings/webhook/wechatwork" .}} + {{template "repo/settings/webhook/packagist" .}} + </div> + + {{template "repo/settings/webhook/history" .}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/settings/hooks.tmpl b/templates/user/settings/hooks.tmpl new file mode 100644 index 000000000..02bfa8a4e --- /dev/null +++ b/templates/user/settings/hooks.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div class="page-content user settings webhooks"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + {{template "repo/settings/webhook/list" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index 8deffde0b..4afe2173c 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -26,6 +26,11 @@ {{.locale.Tr "packages.title"}} </a> {{end}} + {{if not DisableWebhooks}} + <a class="{{if .PageIsSettingsHooks}}active {{end}}item" href="{{AppSubUrl}}/user/settings/hooks"> + {{.locale.Tr "repo.settings.hooks"}} + </a> + {{end}} <a class="{{if .PageIsSettingsOrganization}}active {{end}}item" href="{{AppSubUrl}}/user/settings/organization"> {{.locale.Tr "settings.organization"}} </a> |