Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify 404/500 page #31409

Merged
merged 14 commits into from
Jun 23, 2024
Binary file removed public/assets/img/404.png
Binary file not shown.
Binary file removed public/assets/img/500.png
Binary file not shown.
2 changes: 1 addition & 1 deletion templates/status/404.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div role="main" aria-label="{{.Title}}" class="page-content {{if .IsRepo}}repository{{end}}">
{{if .IsRepo}}{{template "repo/header" .}}{{end}}
<div class="ui container tw-text-center">
<img class="tw-max-w-[80vw] tw-py-16" src="{{AssetUrlPrefix}}/img/404.png" alt="404">
<div class="status-page-error-code">404 Not Found</div>
<p>{{if .NotFoundPrompt}}{{.NotFoundPrompt}}{{else}}{{ctx.Locale.Tr "error404"}}{{end}}</p>
{{if .NotFoundGoBackURL}}<a class="ui button" href="{{.NotFoundGoBackURL}}">{{ctx.Locale.Tr "go_back"}}</a>{{end}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/status/500.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
<style> .ui.message.flash-message { text-align: left; } </style>
{{template "base/alert" .}}
</div>
<p class="tw-mt-8 center"><img src="{{AssetUrlPrefix}}/img/500.png" alt="Internal Server Error"></p>
<div class="status-page-error-code">500 Internal Server Error</div>
<div class="divider"></div>
<div class="ui container tw-my-8">
{{if .ErrorMsg}}
<p>{{ctx.Locale.Tr "error.occurred"}}:</p>
<pre class="tw-whitespace-pre-wrap tw-break-all">{{.ErrorMsg}}</pre>
{{end}}
<div class="center tw-mt-8">
<div class="tw-mt-8 tw-text-center">
{{if or .SignedUser.IsAdmin .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}}
{{if .SignedUser.IsAdmin}}<p>{{ctx.Locale.Tr "error.report_message"}}</p>{{end}}
</div>
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/test"
repo_service "code.gitea.io/gitea/services/repository"
"code.gitea.io/gitea/tests"

Expand All @@ -30,9 +31,9 @@ func TestCompareTag(t *testing.T) {
// A dropdown for both base and head.
assert.Lenf(t, selection.Nodes, 2, "The template has changed")

req = NewRequest(t, "GET", "/user2/repo1/compare/invalid")
req = NewRequest(t, "GET", "/user2/repo1/compare/invalid").SetHeader("Accept", "text/html")
resp = session.MakeRequest(t, req, http.StatusNotFound)
assert.False(t, strings.Contains(resp.Body.String(), "/assets/img/500.png"), "expect 404 page not 500")
assert.True(t, test.IsNormalPageCompleted(resp.Body.String()), "expect 404 page not 500")
}

// Compare with inferred default branch (master)
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ func TestLinksNoLogin(t *testing.T) {
"/user2/repo1/projects",
"/user2/repo1/projects/1",
"/user2/repo1/releases/tag/delete-tag", // It's the only one existing record on release.yml which has is_tag: true
"/assets/img/404.png",
"/assets/img/500.png",
"/.well-known/security.txt",
}

Expand Down
9 changes: 9 additions & 0 deletions web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,15 @@ img.ui.avatar,
padding-bottom: 80px;
}

.status-page-error-code {
font-size: 3em;
line-height: initial;
text-align: center;
padding: 2em 0;
font-weight: var(--font-weight-bold);
color: var(--color-text-light-3);
silverwind marked this conversation as resolved.
Show resolved Hide resolved
}

/* add margin below .secondary nav when it is the first child */
.page-content > :first-child.secondary-nav {
margin-bottom: 14px;
Expand Down