2024-03-23 02:54:09 +03:00
|
|
|
<div class="secondary-nav">
|
2014-10-19 09:35:24 +04:00
|
|
|
{{with .Repository}}
|
2017-12-31 03:47:52 +03:00
|
|
|
<div class="ui container">
|
2019-02-06 00:59:26 +03:00
|
|
|
<div class="repo-header">
|
2024-04-25 00:54:14 +03:00
|
|
|
<div class="flex-item tw-items-center">
|
2024-03-21 20:04:03 +03:00
|
|
|
<div class="flex-item-leading">
|
|
|
|
{{template "repo/icon" .}}
|
|
|
|
</div>
|
2024-01-12 06:44:06 +03:00
|
|
|
<div class="flex-item-main">
|
2024-03-21 20:04:03 +03:00
|
|
|
<div class="flex-item-title gt-font-18">
|
|
|
|
<a class="muted gt-font-normal" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/<a class="muted" href="{{$.RepoLink}}">{{.Name}}</a>
|
|
|
|
</div>
|
2024-01-12 06:44:06 +03:00
|
|
|
</div>
|
|
|
|
<div class="flex-item-trailing">
|
|
|
|
{{if .IsArchived}}
|
2024-12-08 14:35:21 +03:00
|
|
|
<span class="ui label not-mobile">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
|
2024-03-21 20:04:03 +03:00
|
|
|
<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.archived"}}">{{svg "octicon-archive" 18}}</div>
|
2024-01-12 06:44:06 +03:00
|
|
|
{{end}}
|
|
|
|
{{if .IsPrivate}}
|
2024-12-08 14:35:21 +03:00
|
|
|
<span class="ui label not-mobile">{{ctx.Locale.Tr "repo.desc.private"}}</span>
|
2024-03-21 20:04:03 +03:00
|
|
|
<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.private"}}">{{svg "octicon-lock" 18}}</div>
|
2024-01-12 06:44:06 +03:00
|
|
|
{{else}}
|
|
|
|
{{if .Owner.Visibility.IsPrivate}}
|
2024-12-08 14:35:21 +03:00
|
|
|
<span class="ui label not-mobile">{{ctx.Locale.Tr "repo.desc.internal"}}</span>
|
2024-03-21 20:04:03 +03:00
|
|
|
<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.internal"}}">{{svg "octicon-shield-lock" 18}}</div>
|
2020-12-08 07:14:28 +03:00
|
|
|
{{end}}
|
2024-01-12 06:44:06 +03:00
|
|
|
{{end}}
|
|
|
|
{{if .IsTemplate}}
|
2024-12-08 14:35:21 +03:00
|
|
|
<span class="ui label not-mobile">{{ctx.Locale.Tr "repo.desc.template"}}</span>
|
2024-03-21 20:04:03 +03:00
|
|
|
<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.template"}}">{{svg "octicon-repo-template" 18}}</div>
|
2024-01-12 06:44:06 +03:00
|
|
|
{{end}}
|
2024-01-19 19:05:02 +03:00
|
|
|
{{if eq .ObjectFormatName "sha256"}}
|
2024-12-08 14:35:21 +03:00
|
|
|
<span class="ui label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
|
2024-01-19 19:05:02 +03:00
|
|
|
{{end}}
|
2020-12-08 07:14:28 +03:00
|
|
|
</div>
|
2017-12-31 03:47:52 +03:00
|
|
|
</div>
|
2021-11-23 01:32:16 +03:00
|
|
|
{{if not (or .IsBeingCreated .IsBroken)}}
|
2024-07-07 06:21:58 +03:00
|
|
|
<div class="repo-buttons button-row">
|
2021-03-01 03:47:30 +03:00
|
|
|
{{if $.RepoTransfer}}
|
|
|
|
<form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
|
|
|
|
{{$.CsrfTokenHtml}}
|
2023-09-25 11:56:50 +03:00
|
|
|
<div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{ctx.Locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}">
|
2023-09-19 01:05:31 +03:00
|
|
|
<button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}primary {{end}} ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
|
2023-09-25 11:56:50 +03:00
|
|
|
{{ctx.Locale.Tr "repo.transfer.accept"}}
|
2021-03-01 03:47:30 +03:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<form method="post" action="{{$.RepoLink}}/action/reject_transfer?redirect_to={{$.RepoLink}}">
|
|
|
|
{{$.CsrfTokenHtml}}
|
2023-09-25 11:56:50 +03:00
|
|
|
<div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{ctx.Locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}">
|
2023-05-04 16:21:30 +03:00
|
|
|
<button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
|
2023-09-25 11:56:50 +03:00
|
|
|
{{ctx.Locale.Tr "repo.transfer.reject"}}
|
2021-03-01 03:47:30 +03:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{{end}}
|
2023-12-06 23:29:26 +03:00
|
|
|
{{if $.EnableFeed}}
|
|
|
|
{{/* An extra div-element is not necessary here, as this button does not secretly contain two buttons. */}}
|
2023-12-07 06:01:32 +03:00
|
|
|
<a class="ui compact small basic button" href="{{$.RepoLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
|
2023-12-06 23:29:26 +03:00
|
|
|
{{svg "octicon-rss" 16}}
|
2023-12-07 06:01:32 +03:00
|
|
|
</a>
|
2023-12-06 23:29:26 +03:00
|
|
|
{{end}}
|
2024-02-05 12:56:20 +03:00
|
|
|
{{template "repo/watch_unwatch" $}}
|
2021-04-15 19:53:57 +03:00
|
|
|
{{if not $.DisableStars}}
|
2024-02-05 12:56:20 +03:00
|
|
|
{{template "repo/star_unstar" $}}
|
2021-04-15 19:53:57 +03:00
|
|
|
{{end}}
|
2024-02-25 13:58:23 +03:00
|
|
|
{{if not $.DisableForks}}
|
|
|
|
{{template "repo/header_fork" $}}
|
2019-10-13 16:23:14 +03:00
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-01-12 06:44:06 +03:00
|
|
|
</div>
|
2024-01-18 13:27:07 +03:00
|
|
|
{{if $.PullMirror}}
|
|
|
|
<div class="fork-flag">
|
|
|
|
{{ctx.Locale.Tr "repo.mirror_from"}}
|
|
|
|
<a target="_blank" rel="noopener noreferrer" href="{{$.PullMirror.RemoteAddress}}">{{$.PullMirror.RemoteAddress}}</a>
|
2024-11-04 14:30:00 +03:00
|
|
|
{{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{DateUtils.TimeSince $.PullMirror.UpdatedUnix}}{{end}}
|
2024-01-18 13:27:07 +03:00
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-01-12 06:44:06 +03:00
|
|
|
{{if .IsFork}}<div class="fork-flag">{{ctx.Locale.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
|
|
|
|
{{if .IsGenerated}}<div class="fork-flag">{{ctx.Locale.Tr "repo.generated_from"}} <a href="{{(.TemplateRepo ctx).Link}}">{{(.TemplateRepo ctx).FullName}}</a></div>{{end}}
|
|
|
|
</div>
|
2015-08-12 13:12:06 +03:00
|
|
|
{{end}}
|
2024-03-23 02:54:09 +03:00
|
|
|
<overflow-menu class="ui container secondary pointing tabular top attached borderless menu tw-pt-0 tw-my-0">
|
2021-11-23 01:32:16 +03:00
|
|
|
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
|
2024-03-15 05:05:31 +03:00
|
|
|
<div class="overflow-menu-items">
|
2019-10-13 16:23:14 +03:00
|
|
|
{{if .Permission.CanRead $.UnitTypeCode}}
|
2024-06-16 15:36:41 +03:00
|
|
|
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
|
|
|
|
{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
|
|
|
|
</a>
|
2019-10-13 16:23:14 +03:00
|
|
|
{{end}}
|
2017-03-18 13:59:07 +03:00
|
|
|
|
2019-10-13 16:23:14 +03:00
|
|
|
{{if .Permission.CanRead $.UnitTypeIssues}}
|
2022-12-09 16:34:51 +03:00
|
|
|
<a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}}
|
2020-10-24 14:54:33 +03:00
|
|
|
{{if .Repository.NumOpenIssues}}
|
2023-02-04 01:25:55 +03:00
|
|
|
<span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span>
|
2020-10-24 14:54:33 +03:00
|
|
|
{{end}}
|
2019-10-13 16:23:14 +03:00
|
|
|
</a>
|
|
|
|
{{end}}
|
2017-02-04 18:53:46 +03:00
|
|
|
|
2019-10-13 16:23:14 +03:00
|
|
|
{{if .Permission.CanRead $.UnitTypeExternalTracker}}
|
2022-12-09 16:34:51 +03:00
|
|
|
<a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues"}}
|
2019-10-13 16:23:14 +03:00
|
|
|
</a>
|
|
|
|
{{end}}
|
2017-02-04 18:53:46 +03:00
|
|
|
|
2019-10-13 16:23:14 +03:00
|
|
|
{{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
|
2022-12-09 16:34:51 +03:00
|
|
|
<a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}}
|
2020-10-24 14:54:33 +03:00
|
|
|
{{if .Repository.NumOpenPulls}}
|
2023-02-04 01:25:55 +03:00
|
|
|
<span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span>
|
2020-10-24 14:54:33 +03:00
|
|
|
{{end}}
|
2019-10-13 16:23:14 +03:00
|
|
|
</a>
|
|
|
|
{{end}}
|
2017-02-04 18:53:46 +03:00
|
|
|
|
2022-08-26 00:55:52 +03:00
|
|
|
{{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}}
|
2022-12-09 16:34:51 +03:00
|
|
|
<a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item">
|
2024-05-27 11:59:54 +03:00
|
|
|
{{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project"}}
|
2020-10-24 14:54:33 +03:00
|
|
|
{{if .Repository.NumOpenProjects}}
|
2023-02-04 01:25:55 +03:00
|
|
|
<span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span>
|
2020-10-24 14:54:33 +03:00
|
|
|
{{end}}
|
2020-08-17 06:07:38 +03:00
|
|
|
</a>
|
2022-08-26 00:55:52 +03:00
|
|
|
{{end}}
|
2020-08-17 06:07:38 +03:00
|
|
|
|
2022-08-26 00:55:52 +03:00
|
|
|
{{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}}
|
2024-06-16 15:36:41 +03:00
|
|
|
<a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases">
|
|
|
|
{{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}}
|
|
|
|
{{if .NumReleases}}
|
|
|
|
<span class="ui small label">{{CountFmt .NumReleases}}</span>
|
|
|
|
{{end}}
|
|
|
|
</a>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if .Permission.CanRead $.UnitTypePackages}}
|
|
|
|
<a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item">
|
|
|
|
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
|
2024-07-31 13:40:24 +03:00
|
|
|
{{if .NumPackages}}
|
|
|
|
<span class="ui small label">{{CountFmt .NumPackages}}</span>
|
|
|
|
{{end}}
|
2024-06-16 15:36:41 +03:00
|
|
|
</a>
|
2019-10-13 16:23:14 +03:00
|
|
|
{{end}}
|
2017-10-15 02:17:39 +03:00
|
|
|
|
2023-04-24 19:28:37 +03:00
|
|
|
{{if .Permission.CanRead $.UnitTypeWiki}}
|
|
|
|
<a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}}
|
2019-10-13 16:23:14 +03:00
|
|
|
</a>
|
|
|
|
{{end}}
|
2018-01-10 09:19:50 +03:00
|
|
|
|
2023-04-24 19:28:37 +03:00
|
|
|
{{if .Permission.CanRead $.UnitTypeExternalWiki}}
|
|
|
|
<a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}}
|
2023-04-24 19:28:37 +03:00
|
|
|
</a>
|
|
|
|
{{end}}
|
|
|
|
|
2024-04-28 16:47:52 +03:00
|
|
|
{{if and (.Permission.CanReadAny $.UnitTypeCode $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases)}}
|
2022-12-09 16:34:51 +03:00
|
|
|
<a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}}
|
2015-12-08 01:30:52 +03:00
|
|
|
</a>
|
2019-10-13 16:23:14 +03:00
|
|
|
{{end}}
|
|
|
|
|
2024-06-16 15:36:41 +03:00
|
|
|
{{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}}
|
|
|
|
<a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions">
|
|
|
|
{{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}}
|
|
|
|
{{if .Repository.NumOpenActionRuns}}
|
|
|
|
<span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span>
|
|
|
|
{{end}}
|
|
|
|
</a>
|
|
|
|
{{end}}
|
|
|
|
|
2019-10-13 16:23:14 +03:00
|
|
|
{{template "custom/extra_tabs" .}}
|
|
|
|
|
[FEAT] Repository flags
This implements "repository flags", a way for instance administrators to
assign custom flags to repositories. The idea is that custom templates
can look at these flags, and display banners based on them, Forgejo does
not provide anything built on top of it, just the foundation. The
feature is optional, and disabled by default. To enable it, set
`[repository].ENABLE_FLAGS = true`.
On the UI side, instance administrators will see a new "Manage flags"
tab on repositories, and a list of enabled tags (if any) on the
repository home page. The "Manage flags" page allows them to remove
existing flags, or add any new ones that are listed in
`[repository].SETTABLE_FLAGS`.
The model does not enforce that only the `SETTABLE_FLAGS` are present.
If the setting is changed, old flags may remain present in the database,
and anything that uses them, will still work. The repository flag
management page will allow an instance administrator to remove them, but
not set them, once removed.
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit ba735ce2228f8dd7ca105e94b9baa1be058ebe37)
(cherry picked from commit f09f6e029b4fb2714b86cd32dc19255078ecc0ee)
(cherry picked from commit 2f8b0414892f6099f519bda63a9e0fbc8ba6cfc7)
(cherry picked from commit d3186ee5f41fac896c7d2341402fcd39dd250bf1)
2024-01-04 16:28:19 +03:00
|
|
|
{{if and RepoFlagsEnabled .SignedUser.IsAdmin}}
|
|
|
|
<a class="{{if .IsRepoFlagsPage}}active {{end}}item" href="{{.RepoLink}}/flags">
|
|
|
|
{{svg "octicon-milestone"}} {{ctx.Locale.Tr "repo.admin.manage_flags"}}
|
|
|
|
</a>
|
|
|
|
{{end}}
|
|
|
|
|
2019-10-13 16:23:14 +03:00
|
|
|
{{if .Permission.IsAdmin}}
|
2024-04-12 20:11:21 +03:00
|
|
|
{{$highlightSettings := true}}
|
2024-03-01 15:22:40 +03:00
|
|
|
{{if and .SignedUser.EnableRepoUnitHints (not (.Repository.AllUnitsEnabled ctx))}}
|
2024-04-12 20:11:21 +03:00
|
|
|
{{$highlightSettings = false}}
|
2024-04-28 23:40:51 +03:00
|
|
|
<a class="{{if .PageIsRepoSettingsUnits}}active {{end}}item" href="{{.RepoLink}}/settings/units">
|
2024-04-30 00:57:29 +03:00
|
|
|
{{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.settings.units.add_more"}}
|
2024-01-23 12:57:49 +03:00
|
|
|
</a>
|
|
|
|
{{end}}
|
2024-04-25 23:19:24 +03:00
|
|
|
<a id="settings-btn" class="{{if and .PageIsRepoSettings (or $highlightSettings (not .PageIsRepoSettingsUnits))}}active {{end}}right item" href="{{.RepoLink}}/settings">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}}
|
2023-04-29 14:35:59 +03:00
|
|
|
</a>
|
2019-10-13 16:23:14 +03:00
|
|
|
{{end}}
|
|
|
|
</div>
|
2021-11-23 01:32:16 +03:00
|
|
|
{{else if .Permission.IsAdmin}}
|
2024-03-15 05:05:31 +03:00
|
|
|
<div class="overflow-menu-items">
|
2024-04-25 23:19:24 +03:00
|
|
|
<a id="settings-btn" class="{{if .PageIsRepoSettings}}active {{end}}right item" href="{{.RepoLink}}/settings">
|
2023-09-25 11:56:50 +03:00
|
|
|
{{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}}
|
2023-04-29 14:35:59 +03:00
|
|
|
</a>
|
2021-11-23 01:32:16 +03:00
|
|
|
</div>
|
2019-10-13 16:23:14 +03:00
|
|
|
{{end}}
|
2024-03-15 05:05:31 +03:00
|
|
|
</overflow-menu>
|
2015-12-08 01:30:52 +03:00
|
|
|
<div class="ui tabs divider"></div>
|
2016-03-04 22:50:34 +03:00
|
|
|
</div>
|