d4c789dfc1
The last PR about clone buttons introduced an JS error when visiting an empty repo page: * https://github.com/go-gitea/gitea/pull/19028 * `Uncaught ReferenceError: isSSH is not defined`, because the variables are scoped and doesn't share between sub templates. This: 1. Simplify `templates/repo/clone_buttons.tmpl` and make code clear 2. Move most JS code into `initRepoCloneLink` 3. Remove unused `CloneLink.Git` 4. Remove `ctx.Data["DisableSSH"] / ctx.Data["ExposeAnonSSH"] / ctx.Data["DisableHTTP"]`, and only set them when is is needed (eg: deploy keys / ssh keys) 5. Introduce `Data["CloneButton*"]` to provide data for clone buttons and links 6. Introduce `Data["RepoCloneLink"]` for the repo clone link (not the wiki) 7. Remove most `ctx.Data["PageIsWiki"]` because it has been set in the `/wiki` middleware 8. Remove incorrect `quickstart` class in `migrating.tmpl`
138 lines
5.8 KiB
Handlebars
138 lines
5.8 KiB
Handlebars
<!DOCTYPE html>
|
|
<html lang="{{.i18n.Lang}}" class="theme-{{.SignedUser.Theme}}">
|
|
<head>
|
|
<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}}"/>
|
|
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
|
|
<meta name="default-theme" content="{{DefaultTheme}}" />
|
|
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}" />
|
|
<meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}" />
|
|
<meta name="keywords" content="{{MetaKeywords}}">
|
|
<meta name="referrer" content="no-referrer" />
|
|
{{if .GoGetImport}}
|
|
<meta name="go-import" content="{{.GoGetImport}} git {{.RepoCloneLink.HTTPS}}">
|
|
<meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
|
|
{{end}}
|
|
{{if .FeedURL}}
|
|
<link rel="alternate" type="application/atom+xml" title="" href="{{.FeedURL}}.atom">
|
|
<link rel="alternate" type="application/rss+xml" title="" href="{{.FeedURL}}.rss">
|
|
{{end}}
|
|
<script>
|
|
<!-- /* eslint-disable */ -->
|
|
window.config = {
|
|
appVer: '{{AppVer}}',
|
|
appSubUrl: '{{AppSubUrl}}',
|
|
assetUrlPrefix: '{{AssetUrlPrefix}}',
|
|
runModeIsProd: {{.RunModeIsProd}},
|
|
customEmojis: {{CustomEmojis}},
|
|
useServiceWorker: {{UseServiceWorker}},
|
|
csrfToken: '{{.CsrfToken}}',
|
|
pageData: {{.PageData}},
|
|
requireTribute: {{.RequireTribute}},
|
|
notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
|
|
enableTimeTracking: {{EnableTimetracking}},
|
|
{{if .RequireTribute}}
|
|
tributeValues: Array.from(new Map([
|
|
{{ range .Participants }}
|
|
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
|
|
name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
|
|
{{ end }}
|
|
{{ range .Assignees }}
|
|
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
|
|
name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
|
|
{{ end }}
|
|
{{ range .MentionableTeams }}
|
|
['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}',
|
|
name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}],
|
|
{{ end }}
|
|
]).values()),
|
|
{{end}}
|
|
mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},
|
|
{{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}}
|
|
i18n: {
|
|
copy_success: '{{.i18n.Tr "copy_success"}}',
|
|
copy_error: '{{.i18n.Tr "copy_error"}}',
|
|
error_occurred: '{{.i18n.Tr "error.occurred"}}',
|
|
network_error: '{{.i18n.Tr "error.network_error"}}',
|
|
},
|
|
};
|
|
{{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}}
|
|
window.config.pageData = window.config.pageData || {};
|
|
</script>
|
|
<link rel="icon" href="{{AssetUrlPrefix}}/img/logo.svg" type="image/svg+xml">
|
|
<link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
|
|
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
|
|
<noscript>
|
|
<style>
|
|
.dropdown:hover > .menu { display: block; }
|
|
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
|
|
</style>
|
|
</noscript>
|
|
{{if .PageIsUserProfile}}
|
|
<meta property="og:title" content="{{.Owner.DisplayName}}" />
|
|
<meta property="og:type" content="profile" />
|
|
<meta property="og:image" content="{{.Owner.AvatarLink}}" />
|
|
<meta property="og:url" content="{{.Owner.HTMLURL}}" />
|
|
{{if .Owner.Description}}
|
|
<meta property="og:description" content="{{.Owner.Description}}">
|
|
{{end}}
|
|
{{else if .Repository}}
|
|
{{if .Issue}}
|
|
<meta property="og:title" content="{{.Issue.Title}}" />
|
|
<meta property="og:url" content="{{.Issue.HTMLURL}}" />
|
|
{{if .Issue.Content}}
|
|
<meta property="og:description" content="{{.Issue.Content}}" />
|
|
{{end}}
|
|
{{else}}
|
|
<meta property="og:title" content="{{.Repository.Name}}" />
|
|
<meta property="og:url" content="{{.Repository.HTMLURL}}" />
|
|
{{if .Repository.Description}}
|
|
<meta property="og:description" content="{{.Repository.Description}}" />
|
|
{{end}}
|
|
{{end}}
|
|
<meta property="og:type" content="object" />
|
|
{{if .Repository.AvatarLink}}
|
|
<meta property="og:image" content="{{.Repository.AvatarLink}}" />
|
|
{{else}}
|
|
<meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" />
|
|
{{end}}
|
|
{{else}}
|
|
<meta property="og:title" content="{{AppName}}">
|
|
<meta property="og:type" content="website" />
|
|
<meta property="og:image" content="{{AssetUrlPrefix}}/img/logo.png" />
|
|
<meta property="og:url" content="{{AppUrl}}" />
|
|
<meta property="og:description" content="{{MetaDescription}}">
|
|
{{end}}
|
|
<meta property="og:site_name" content="{{AppName}}" />
|
|
{{if .IsSigned }}
|
|
{{ if ne .SignedUser.Theme "gitea" }}
|
|
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{.SignedUser.Theme | PathEscape}}.css?v={{MD5 AppVer}}">
|
|
{{end}}
|
|
{{else if ne DefaultTheme "gitea"}}
|
|
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{DefaultTheme | PathEscape}}.css?v={{MD5 AppVer}}">
|
|
{{end}}
|
|
{{template "custom/header" .}}
|
|
</head>
|
|
<body>
|
|
{{template "custom/body_outer_pre" .}}
|
|
|
|
<div class="full height">
|
|
<noscript>{{.i18n.Tr "enable_javascript"}}</noscript>
|
|
|
|
{{template "custom/body_inner_pre" .}}
|
|
|
|
{{if not .PageIsInstall}}
|
|
<div class="ui top secondary stackable main menu following bar light">
|
|
{{template "base/head_navbar" .}}
|
|
</div><!-- end bar -->
|
|
{{end}}
|
|
|
|
{{if false}}
|
|
{{/* to make html structure "likely" complete to prevent IDE warnings */}}
|
|
</div>
|
|
</body>
|
|
</html>
|
|
{{end}}
|