Replace inline LICENSE dump with a "View file" button
The full AGPL text was rendered inline on every repo page, pushing the README and file list far down. Repo view now just links to the license blob instead of rendering its content.
5 files changed
+14 −13
M
CHANGELOG.md
+4 −0
M
cmd/gitfed-web/handlers_repo.go
+7 −13
M
cmd/gitfed-web/render.go
+1 −0
M
internal/i18n/strings_en.go
+1 −0
M
internal/i18n/strings_fr.go
+1 −0
CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 0.9.5
+
+- The repo page no longer dumps the full LICENSE text inline — it's a lot of legal boilerplate pushing the actual content (README, files) further down. Now shows a compact "View file" button linking to the license blob instead.
+
## 0.9.4
- Redesigned the Explorer page: a name filter, a topic-chip row (click to filter, click again to clear), and repo cards matching the rest of the app's visual language instead of a plain table. Proper empty state when a filter matches nothing.
cmd/gitfed-web/handlers_repo.go
@@ -151,10 +151,10 @@ var repoTpl = newTpl("repo", `
</div>
{{end}}
-{{if .LicenseHTML}}
-<div class="gf-card">
- <div class="gf-readme-head">{{icon "file"}} {{t .Lang "repo.license"}} ({{.LicenseFile}})</div>
- <div class="gf-readme-body markdown-body">{{.LicenseHTML}}</div>
+{{if .LicenseFile}}
+<div class="gf-card gf-license-card">
+ <span>{{icon "file"}} {{t .Lang "repo.license"}} ({{.LicenseFile}})</span>
+ <a class="gf-btn" href="/repo-blob/{{.Repo.Name}}?path={{.LicenseFile}}">{{t .Lang "repo.view_file"}}</a>
</div>
{{end}}
`)
@@ -199,7 +199,7 @@ func (s *server) handleRepoView(w http.ResponseWriter, r *http.Request) {
return
}
- var readmeHTML, licenseHTML template.HTML
+ var readmeHTML template.HTML
var licenseFile string
var tags []string
if path == "" {
@@ -216,18 +216,13 @@ func (s *server) handleRepoView(w http.ResponseWriter, r *http.Request) {
}
}
- licenseContent, foundLicenseFile, licenseFound, err := s.ops.GetRepoLicense(name)
+ _, foundLicenseFile, licenseFound, err := s.ops.GetRepoLicense(name)
if err != nil {
s.serverError(w, r, err)
return
}
if licenseFound {
licenseFile = foundLicenseFile
- licenseHTML, err = renderFileContent(name, "", licenseFile, licenseContent)
- if err != nil {
- s.serverError(w, r, err)
- return
- }
}
tags, err = s.ops.ListRepoTags(name)
@@ -252,14 +247,13 @@ func (s *server) handleRepoView(w http.ResponseWriter, r *http.Request) {
Empty bool
Tags []string
ReadmeHTML template.HTML
- LicenseHTML template.HTML
LicenseFile string
CanAdminister bool
Flash template.HTML
}{
repo, s.domain, "ssh://git@" + s.domain + ":2222/" + name + ".git", "https://" + s.domain + "/" + name + ".git", branch, string(lang),
breadcrumbs(path), views, path != "", parentPath(path), path == "" && !found,
- tags, readmeHTML, licenseHTML, licenseFile, canAdminister, flash(r),
+ tags, readmeHTML, licenseFile, canAdminister, flash(r),
})
title := name
cmd/gitfed-web/render.go
@@ -344,6 +344,7 @@ const shellHeadSrc = `<!doctype html>
.gf-file-table td.meta { color: var(--text-faint); font-size: 0.78rem; text-align: right; white-space: nowrap; }
.gf-readme-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--border); font-size: 0.86rem; color: var(--text-dim); font-family: var(--mono); }
.gf-readme-body { padding: 1.3rem; }
+ .gf-license-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.1rem; font-size: 0.86rem; color: var(--text-dim); font-family: var(--mono); }
@media (max-width: 620px) {
.gf-action-bar { flex-direction: column; align-items: stretch; }
internal/i18n/strings_en.go
@@ -257,6 +257,7 @@ var en = map[string]string{
"repo.commits_title": "Commits",
"repo.commits_empty": "No commits yet.",
"repo.license": "License",
+ "repo.view_file": "View file",
"repo.binary_file": "Binary file — not shown.",
"repo.settings_title": "settings",
"repo.visibility_topics": "Visibility & topics",
internal/i18n/strings_fr.go
@@ -257,6 +257,7 @@ var fr = map[string]string{
"repo.commits_title": "Commits",
"repo.commits_empty": "Aucun commit pour le moment.",
"repo.license": "Licence",
+ "repo.view_file": "Voir le fichier",
"repo.binary_file": "Fichier binaire — non affiché.",
"repo.settings_title": "paramètres",
"repo.visibility_topics": "Visibilité et sujets",