From 7447b39de71bb2dc6a6565c89b2760a373707d2a Mon Sep 17 00:00:00 2001
From: wxiaoguang <wxiaoguang@gmail.com>
Date: Sat, 22 Apr 2023 13:58:59 +0800
Subject: [PATCH] Fix footer display (#24251)

Fix #24249

Diff with ignoring spaces:
https://github.com/go-gitea/gitea/pull/24251/files?diff=split&w=1

Screenshots:

<details>

<img width="1440" alt="image"
src="https://user-images.githubusercontent.com/2114189/233592840-d9ef7296-64eb-4e48-a598-300807a7c2f9.png">

<img width="923" alt="image"
src="https://user-images.githubusercontent.com/2114189/233593015-16edc531-43c2-4ff0-b27e-ca75dbadce0c.png">

</details>

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
---
 templates/base/footer_content.tmpl | 56 ++++++++++++++----------------
 web_src/css/base.css               | 40 ---------------------
 web_src/css/home.css               | 32 +++++++++++++++--
 3 files changed, 57 insertions(+), 71 deletions(-)

diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl
index 245a61573..f282083d6 100644
--- a/templates/base/footer_content.tmpl
+++ b/templates/base/footer_content.tmpl
@@ -1,35 +1,33 @@
 <footer role="group" aria-label="{{.locale.Tr "aria.footer"}}">
-	<div class="ui container">
-		<div class="ui left" role="contentinfo" aria-label="{{.locale.Tr "aria.footer.software"}}">
-			<a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.locale.Tr "powered_by" "Gitea"}}</a>
-			{{if (or .ShowFooterVersion .PageIsAdmin)}}
-				{{.locale.Tr "version"}}:
-				{{if .IsAdmin}}
-					<a href="{{AppSubUrl}}/admin/config">{{AppVer}}</a>
-				{{else}}
-					{{AppVer}}
+	<div class="ui left" role="contentinfo" aria-label="{{.locale.Tr "aria.footer.software"}}">
+		<a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.locale.Tr "powered_by" "Gitea"}}</a>
+		{{if (or .ShowFooterVersion .PageIsAdmin)}}
+			{{.locale.Tr "version"}}:
+			{{if .IsAdmin}}
+				<a href="{{AppSubUrl}}/admin/config">{{AppVer}}</a>
+			{{else}}
+				{{AppVer}}
+			{{end}}
+		{{end}}
+		{{if and .TemplateLoadTimes ShowFooterTemplateLoadTime}}
+			{{.locale.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong>
+			{{.locale.Tr "template"}}{{if .TemplateName}} {{.TemplateName}}{{end}}: <strong>{{call .TemplateLoadTimes}}</strong>
+		{{end}}
+	</div>
+	<div class="ui right links" role="group" aria-label="{{.locale.Tr "aria.footer.links"}}">
+		{{if .ShowFooterBranding}}
+			<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">{{svg "octicon-mark-github"}}<span class="sr-only">GitHub</span></a>
+		{{end}}
+		<div class="ui dropdown upward language">
+			<span>{{svg "octicon-globe"}} {{.locale.LangName}}</span>
+			<div class="menu language-menu">
+				{{range .AllLangs}}
+					<a lang="{{.Lang}}" data-url="{{AppSubUrl}}/?lang={{.Lang}}" class="item {{if eq $.locale.Lang .Lang}}active selected{{end}}">{{.Name}}</a>
 				{{end}}
-			{{end}}
-			{{if and .TemplateLoadTimes ShowFooterTemplateLoadTime}}
-				{{.locale.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong>
-				{{.locale.Tr "template"}}{{if .TemplateName}} {{.TemplateName}}{{end}}: <strong>{{call .TemplateLoadTimes}}</strong>
-			{{end}}
-		</div>
-		<div class="ui right links" role="group" aria-label="{{.locale.Tr "aria.footer.links"}}">
-			{{if .ShowFooterBranding}}
-				<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">{{svg "octicon-mark-github"}}<span class="sr-only">GitHub</span></a>
-			{{end}}
-			<div class="ui dropdown upward language">
-				<span>{{svg "octicon-globe"}} {{.locale.LangName}}</span>
-				<div class="menu language-menu">
-					{{range .AllLangs}}
-						<a lang="{{.Lang}}" data-url="{{AppSubUrl}}/?lang={{.Lang}}" class="item {{if eq $.locale.Lang .Lang}}active selected{{end}}">{{.Name}}</a>
-					{{end}}
-				</div>
 			</div>
-			<a href="{{AssetUrlPrefix}}/js/licenses.txt">{{.locale.Tr "licenses"}}</a>
-			{{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}}
-			{{template "custom/extra_links_footer" .}}
 		</div>
+		<a href="{{AssetUrlPrefix}}/js/licenses.txt">{{.locale.Tr "licenses"}}</a>
+		{{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}}
+		{{template "custom/extra_links_footer" .}}
 	</div>
 </footer>
diff --git a/web_src/css/base.css b/web_src/css/base.css
index 2079c3749..7e510346b 100644
--- a/web_src/css/base.css
+++ b/web_src/css/base.css
@@ -1805,46 +1805,6 @@ img.ui.avatar,
   color: var(--color-warning-text);
 }
 
-footer {
-  background-color: var(--color-footer);
-  border-top: 1px solid var(--color-secondary);
-  width: 100%;
-  flex-basis: 40px;
-  color: var(--color-text-light);
-}
-
-footer .container {
-  padding: 0 0.5rem;
-  max-width: 100%;
-}
-
-footer .container .links > * {
-  border-left: 1px solid var(--color-secondary-dark-1);
-  padding-left: 8px;
-  margin-left: 5px;
-}
-
-footer .container .links > *:first-child {
-  border-left: 0;
-}
-
-footer .ui.language .menu {
-  height: 500px;
-  max-height: calc(100vh - 60px);
-  overflow-y: auto;
-  margin-bottom: 7px;
-}
-
-footer .ui.language .svg {
-  margin-right: 0.15em;
-  margin-top: 1px;
-}
-
-footer .ui.left,
-footer .ui.right {
-  line-height: 39px; /* there  is a border-top on the footer, so make the line-height 1px less */
-}
-
 .center:not(.popup) {
   text-align: center;
 }
diff --git a/web_src/css/home.css b/web_src/css/home.css
index 5d36da594..25643cda2 100644
--- a/web_src/css/home.css
+++ b/web_src/css/home.css
@@ -43,9 +43,37 @@
   color: var(--color-green);
 }
 
+footer {
+  background-color: var(--color-footer);
+  border-top: 1px solid var(--color-secondary);
+  line-height: 39px;
+  flex-basis: 40px;
+  color: var(--color-text-light);
+  padding: 0 20px;
+}
+
+footer .right.links {
+  min-width: 180px; /* make sure the menu dropdown doesn't overflow horizontally when language name is short */
+}
+
+footer .right.links > a {
+  border-left: 1px solid var(--color-secondary-dark-1);
+  padding-left: 8px;
+  margin-left: 5px;
+}
+
+footer .ui.dropdown.language .menu {
+  height: 500px;
+  max-height: calc(100vh - 60px);
+  overflow-y: auto;
+  margin-bottom: 10px;
+}
+
+
 @media (max-width: 880px) {
-  footer .ui.container .left,
-  footer .ui.container .right {
+  footer .ui.left,
+  footer .ui.right {
+    width: 100%;
     display: block;
     text-align: center;
     float: none;