code.gitea.io/gitea@v1.22.3/templates/repo/header.tmpl (about)

     1  <div class="secondary-nav">
     2  {{with .Repository}}
     3  	<div class="ui container">
     4  		<div class="repo-header">
     5  			<div class="flex-item tw-items-center">
     6  				<div class="flex-item-leading">
     7  					{{template "repo/icon" .}}
     8  				</div>
     9  				<div class="flex-item-main">
    10  					<div class="flex-item-title tw-text-18">
    11  						<a class="muted tw-font-normal" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/<a class="muted" href="{{$.RepoLink}}">{{.Name}}</a>
    12  					</div>
    13  				</div>
    14  				<div class="flex-item-trailing">
    15  					{{if .IsArchived}}
    16  						<span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
    17  						<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.archived"}}">{{svg "octicon-archive" 18}}</div>
    18  					{{end}}
    19  					{{if .IsPrivate}}
    20  						<span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.private"}}</span>
    21  						<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.private"}}">{{svg "octicon-lock" 18}}</div>
    22  					{{else}}
    23  						{{if .Owner.Visibility.IsPrivate}}
    24  							<span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.internal"}}</span>
    25  							<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.internal"}}">{{svg "octicon-shield-lock" 18}}</div>
    26  						{{end}}
    27  					{{end}}
    28  					{{if .IsTemplate}}
    29  						<span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.template"}}</span>
    30  						<div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.template"}}">{{svg "octicon-repo-template" 18}}</div>
    31  					{{end}}
    32  					{{if eq .ObjectFormatName "sha256"}}
    33  						<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
    34  					{{end}}
    35  				</div>
    36  			</div>
    37  			{{if not (or .IsBeingCreated .IsBroken)}}
    38  				<div class="repo-buttons">
    39  					{{if $.RepoTransfer}}
    40  						<form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
    41  							{{$.CsrfTokenHtml}}
    42  							<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}}">
    43  								<button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}primary {{end}} ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
    44  									{{ctx.Locale.Tr "repo.transfer.accept"}}
    45  								</button>
    46  							</div>
    47  						</form>
    48  						<form method="post" action="{{$.RepoLink}}/action/reject_transfer?redirect_to={{$.RepoLink}}">
    49  							{{$.CsrfTokenHtml}}
    50  							<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}}">
    51  								<button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
    52  									{{ctx.Locale.Tr "repo.transfer.reject"}}
    53  								</button>
    54  							</div>
    55  						</form>
    56  					{{end}}
    57  					{{if $.EnableFeed}}
    58  					{{/* An extra div-element is not necessary here, as this button does not secretly contain two buttons. */}}
    59  					<a class="ui compact small basic button" href="{{$.RepoLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
    60  						{{svg "octicon-rss" 16}}
    61  					</a>
    62  					{{end}}
    63  					{{template "repo/watch_unwatch" $}}
    64  					{{if not $.DisableStars}}
    65  					{{template "repo/star_unstar" $}}
    66  					{{end}}
    67  					{{if and (not .IsEmpty) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}}
    68  						<div class="ui labeled button
    69  							{{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (not $.UserAndOrgForks))}}
    70  								disabled
    71  							{{end}}"
    72  							{{if not $.IsSigned}}
    73  								data-tooltip-content="{{ctx.Locale.Tr "repo.fork_guest_user"}}"
    74  							{{else if and (not $.CanSignedUserFork) (not $.UserAndOrgForks)}}
    75  								data-tooltip-content="{{ctx.Locale.Tr "repo.fork_from_self"}}"
    76  							{{end}}
    77  						>
    78  							<a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button"
    79  								{{if not $.CanSignedUserFork}}
    80  									{{if gt (len $.UserAndOrgForks) 1}}
    81  										href="#" data-modal="#fork-repo-modal"
    82  									{{else if eq (len $.UserAndOrgForks) 1}}
    83  										href="{{AppSubUrl}}/{{(index $.UserAndOrgForks 0).FullName}}"
    84  									{{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}}
    85  									{{end}}
    86  								{{else if not $.UserAndOrgForks}}
    87  									href="{{$.RepoLink}}/fork"
    88  								{{else}}
    89  									href="#" data-modal="#fork-repo-modal"
    90  								{{end}}
    91  							>
    92  								{{svg "octicon-repo-forked"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.fork"}}</span>
    93  							</a>
    94  							<a class="ui basic label" href="{{.Link}}/forks">
    95  								{{CountFmt .NumForks}}
    96  							</a>
    97  						</div>
    98  						<div class="ui small modal" id="fork-repo-modal">
    99  							<div class="header">
   100  								{{ctx.Locale.Tr "repo.already_forked" .Name}}
   101  							</div>
   102  							<div class="content tw-text-left">
   103  								<div class="ui list">
   104  									{{range $.UserAndOrgForks}}
   105  										<div class="ui item tw-py-2">
   106  											<a href="{{.Link}}">{{svg "octicon-repo-forked" 16 "tw-mr-2"}}{{.FullName}}</a>
   107  										</div>
   108  									{{end}}
   109  								</div>
   110  								{{if $.CanSignedUserFork}}
   111  								<div class="divider"></div>
   112  								<a href="{{$.RepoLink}}/fork">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a>
   113  								{{end}}
   114  							</div>
   115  						</div>
   116  					{{end}}
   117  				</div>
   118  			{{end}}
   119  		</div>
   120  		{{if $.PullMirror}}
   121  			<div class="fork-flag">
   122  				{{ctx.Locale.Tr "repo.mirror_from"}}
   123  				<a target="_blank" rel="noopener noreferrer" href="{{$.PullMirror.RemoteAddress}}">{{$.PullMirror.RemoteAddress}}</a>
   124  				{{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{TimeSinceUnix $.PullMirror.UpdatedUnix ctx.Locale}}{{end}}
   125  			</div>
   126  		{{end}}
   127  		{{if .IsFork}}<div class="fork-flag">{{ctx.Locale.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
   128  		{{if .IsGenerated}}<div class="fork-flag">{{ctx.Locale.Tr "repo.generated_from"}} <a href="{{(.TemplateRepo ctx).Link}}">{{(.TemplateRepo ctx).FullName}}</a></div>{{end}}
   129  	</div>
   130  {{end}}
   131  	<div class="ui container">
   132  		<overflow-menu class="ui secondary pointing menu">
   133  			{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
   134  				<div class="overflow-menu-items">
   135  					{{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
   136  					<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
   137  						{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
   138  					</a>
   139  					{{end}}
   140  
   141  					{{if .Permission.CanRead ctx.Consts.RepoUnitTypeIssues}}
   142  						<a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues">
   143  							{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}}
   144  							{{if .Repository.NumOpenIssues}}
   145  								<span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span>
   146  							{{end}}
   147  						</a>
   148  					{{end}}
   149  
   150  					{{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalTracker}}
   151  						<a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
   152  							{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues"}}
   153  						</a>
   154  					{{end}}
   155  
   156  					{{if and .Repository.CanEnablePulls (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests)}}
   157  						<a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls">
   158  							{{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}}
   159  							{{if .Repository.NumOpenPulls}}
   160  								<span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span>
   161  							{{end}}
   162  						</a>
   163  					{{end}}
   164  
   165  					{{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}}
   166  						<a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions">
   167  							{{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}}
   168  							{{if .Repository.NumOpenActionRuns}}
   169  								<span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span>
   170  							{{end}}
   171  						</a>
   172  					{{end}}
   173  
   174  					{{if .Permission.CanRead ctx.Consts.RepoUnitTypePackages}}
   175  						<a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item">
   176  							{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
   177  						</a>
   178  					{{end}}
   179  
   180  					{{$projectsUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeProjects}}
   181  					{{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}}
   182  						<a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item">
   183  							{{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project_board"}}
   184  							{{if .Repository.NumOpenProjects}}
   185  								<span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span>
   186  							{{end}}
   187  						</a>
   188  					{{end}}
   189  
   190  					{{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}}
   191  					<a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases">
   192  						{{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}}
   193  						{{if .NumReleases}}
   194  							<span class="ui small label">{{CountFmt .NumReleases}}</span>
   195  						{{end}}
   196  					</a>
   197  					{{end}}
   198  
   199  					{{if .Permission.CanRead ctx.Consts.RepoUnitTypeWiki}}
   200  						<a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki">
   201  							{{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}}
   202  						</a>
   203  					{{end}}
   204  
   205  					{{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalWiki}}
   206  						<a class="item" href="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer">
   207  							{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}}
   208  						</a>
   209  					{{end}}
   210  
   211  					{{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}}
   212  						<a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
   213  							{{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}}
   214  						</a>
   215  					{{end}}
   216  
   217  					{{template "custom/extra_tabs" .}}
   218  
   219  					{{if .Permission.IsAdmin}}
   220  						<span class="item-flex-space"></span>
   221  						<a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings">
   222  							{{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}}
   223  						</a>
   224  					{{end}}
   225  				</div>
   226  			{{else if .Permission.IsAdmin}}
   227  				<div class="overflow-menu-items">
   228  					<a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings">
   229  						{{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}}
   230  					</a>
   231  				</div>
   232  			{{end}}
   233  		</overflow-menu>
   234  	</div>
   235  	<div class="ui tabs divider"></div>
   236  </div>