aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorjladbrook <jhladbrook@gmail.com>2023-04-25 15:08:29 +0100
committerGitHub <noreply@github.com>2023-04-25 22:08:29 +0800
commit56d4893b2a996da6388801c9c8ff16b9b588ad55 (patch)
treea9d18045562cb8c6f370cc07c6ba57e6cbe93afb /templates/repo
parentf16b66898091b3f375cbd3e2796fd87d9c5ca10b (diff)
downloadgitea-56d4893b2a996da6388801c9c8ff16b9b588ad55.tar.gz
gitea-56d4893b2a996da6388801c9c8ff16b9b588ad55.zip
Add RSS Feeds for branches and files (#22719)
Fix #22228 adding RSS feeds for branches and files. RSS feeds are accessed through: * [gitea]/src/branch/{branch}.rss * [gitea]/src/branch/{branch}/{file_name}.rss No changes have been made to the UI to expose the feed urls for branches and files.
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/branch/list.tmpl10
-rw-r--r--templates/repo/home.tmpl10
-rw-r--r--templates/repo/view_file.tmpl5
3 files changed, 20 insertions, 5 deletions
diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl
index b027c175a4..596d9ae78b 100644
--- a/templates/repo/branch/list.tmpl
+++ b/templates/repo/branch/list.tmpl
@@ -26,6 +26,11 @@
{{svg "octicon-git-branch"}}
</button>
{{end}}
+ {{if .EnableFeed}}
+ <a role="button" class="ui basic button icon" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DefaultBranch}}">
+ {{svg "octicon-rss"}}
+ </a>
+ {{end}}
{{if not $.DisableDownloadSourceArchives}}
<button class="ui basic jump dropdown icon button" data-tooltip-content="{{$.locale.Tr "repo.branch.download" ($.DefaultBranch)}}">
{{svg "octicon-download"}}
@@ -113,6 +118,11 @@
{{svg "octicon-git-branch"}}
</button>
{{end}}
+ {{if $.EnableFeed}}
+ <a role="button" class="ui basic button icon" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .Name}}">
+ {{svg "octicon-rss"}}
+ </a>
+ {{end}}
{{if and (not .IsDeleted) (not $.DisableDownloadSourceArchives)}}
<button class="ui basic jump dropdown icon button" data-tooltip-content="{{$.locale.Tr "repo.branch.download" (.Name)}}">
{{svg "octicon-download"}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 4db12f2c95..3f6cffbc8e 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -63,12 +63,12 @@
{{$n := len .TreeNames}}
{{$l := Eval $n "-" 1}}
<!-- If home page, show new pr. If not, show breadcrumb -->
+ {{if and (eq $n 0) .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
+ <a href="{{CompareLink .BaseRepo .Repository .BranchName}}">
+ <button id="new-pull-request" class="ui compact basic button" data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{.locale.Tr "repo.pulls.compare_changes"}}{{else}}{{.locale.Tr "action.compare_branch"}}{{end}}"><span class="text">{{svg "octicon-git-pull-request"}}</span></button>
+ </a>
+ {{end}}
{{if eq $n 0}}
- {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
- <a href="{{CompareLink .BaseRepo .Repository .BranchName}}">
- <button id="new-pull-request" class="ui compact basic button" data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{.locale.Tr "repo.pulls.compare_changes"}}{{else}}{{.locale.Tr "action.compare_branch"}}{{end}}"><span class="text">{{svg "octicon-git-pull-request"}}</span></button>
- </a>
- {{end}}
<a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{.locale.Tr "repo.find_file.go_to_file"}}</a>
{{end}}
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 7ee08c9efc..fe67de5392 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -42,6 +42,11 @@
</div>
<a download href="{{$.RawFileLink}}"><span class="btn-octicon" data-tooltip-content="{{.locale.Tr "repo.download_file"}}">{{svg "octicon-download"}}</span></a>
<a id="copy-content" class="btn-octicon {{if not .CanCopyContent}} disabled{{end}}"{{if or .IsImageFile (and .HasSourceRenderedToggle (not .IsDisplayingSource))}} data-link="{{$.RawFileLink}}"{{end}} data-tooltip-content="{{if .CanCopyContent}}{{.locale.Tr "copy_content"}}{{else}}{{.locale.Tr "copy_type_unsupported"}}{{end}}">{{svg "octicon-copy" 14}}</a>
+ {{if .EnableFeed}}
+ <a class="btn-octicon" href="{{$.FeedURL}}/rss/{{$.BranchNameSubURL}}{{range $i, $v := .TreeNames}}/{{$v}}{{end}}">
+ {{svg "octicon-rss" 14}}
+ </a>
+ {{end}}
{{if .Repository.CanEnableEditor}}
{{if .CanEditFile}}
<a href="{{.RepoLink}}/_edit/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .TreePath}}"><span class="btn-octicon" data-tooltip-content="{{.EditFileTooltip}}">{{svg "octicon-pencil"}}</span></a>