summaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-07-08 11:19:00 +0800
committerGitHub <noreply@github.com>2023-07-08 05:19:00 +0200
commit6375419468edc95fdfac94aac3b0e10b23743557 (patch)
treee104617051a314fa33e62ebcf7c149d0d0434b82 /templates/repo
parente0a780d75b79233ceb97116b9ae8563a9942aff9 (diff)
downloadgitea-6375419468edc95fdfac94aac3b0e10b23743557.tar.gz
gitea-6375419468edc95fdfac94aac3b0e10b23743557.zip
Newly pushed branches hints on repository home page (#25715)
This PR will display a pull request creation hint on the repository home page when there are newly created branches with no pull request. Only the recent 6 hours and 2 updated branches will be displayed. Inspired by #14003 Replace #14003 Resolves #311 Resolves #13196 Resolves #23743 co-authored by @kolaente
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/code/recently_pushed_new_branches.tmpl11
-rw-r--r--templates/repo/home.tmpl1
2 files changed, 12 insertions, 0 deletions
diff --git a/templates/repo/code/recently_pushed_new_branches.tmpl b/templates/repo/code/recently_pushed_new_branches.tmpl
new file mode 100644
index 0000000000..e936fa4bb4
--- /dev/null
+++ b/templates/repo/code/recently_pushed_new_branches.tmpl
@@ -0,0 +1,11 @@
+{{range .RecentlyPushedNewBranches}}
+ <div class="ui positive message gt-df gt-ac">
+ <div class="gt-f1">
+ {{$timeSince := TimeSince .UpdatedUnix.AsTime $.locale}}
+ {{$.locale.Tr "repo.pulls.recently_pushed_new_branches" (PathEscapeSegments .Name) $timeSince | Safe}}
+ </div>
+ <a aria-role="button" class="ui compact positive button gt-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo (PathEscapeSegments .Name)}}">
+ {{$.locale.Tr "repo.pulls.compare_changes"}}
+ </a>
+ </div>
+{{end}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 01ea5d9122..386908e424 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -3,6 +3,7 @@
{{template "repo/header" .}}
<div class="ui container {{if .IsBlame}}fluid padded{{end}}">
{{template "base/alert" .}}
+ {{template "repo/code/recently_pushed_new_branches" .}}
{{if and (not .HideRepoInfo) (not .IsBlame)}}
<div class="ui repo-description">
<div id="repo-desc">