chore: normalize admin UI styles for v1.5.65
This commit is contained in:
1 parent
b8c5bb08e5
commit
117b026c70
1 file changed
+307
@@ -0,0 +1,307 @@
|
||||
name: Normalize Landwelle admin UI v1.5.65
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '.github/workflows/normalize-admin-ui-v1565.yml'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
normalize:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24.4'
|
||||
cache: true
|
||||
|
||||
- name: Normalize admin base stylesheet and references
|
||||
shell: bash
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
|
||||
base_path = Path('web/assets/admin-v36.css')
|
||||
base = base_path.read_text(encoding='utf-8').rstrip()
|
||||
marker = '/* v1.5.65: einheitliches Admin-Buttonsystem */'
|
||||
override = r'''
|
||||
|
||||
/* v1.5.65: einheitliches Admin-Buttonsystem */
|
||||
.admin-dashboard-page .admin-primary-button,
|
||||
.admin-dashboard-page .admin-secondary-button,
|
||||
.admin-dashboard-page .admin-danger-button{
|
||||
display:inline-flex!important;
|
||||
align-items:center!important;
|
||||
justify-content:center!important;
|
||||
gap:8px!important;
|
||||
min-height:42px!important;
|
||||
height:auto!important;
|
||||
margin:0!important;
|
||||
padding:10px 16px!important;
|
||||
border-radius:10px!important;
|
||||
font:inherit!important;
|
||||
font-size:.84rem!important;
|
||||
line-height:1.2!important;
|
||||
font-weight:800!important;
|
||||
text-decoration:none!important;
|
||||
cursor:pointer!important;
|
||||
box-shadow:none!important;
|
||||
transition:background .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-primary-button{
|
||||
border:1px solid #128d3d!important;
|
||||
background:linear-gradient(135deg,var(--lw-green),var(--lw-green-dark))!important;
|
||||
color:#fff!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-primary-button:hover:not(:disabled){
|
||||
background:linear-gradient(135deg,#149d46,#076f2f)!important;
|
||||
border-color:#087b34!important;
|
||||
transform:translateY(-1px)!important;
|
||||
box-shadow:0 7px 18px rgba(14,126,53,.18)!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-secondary-button{
|
||||
border:1px solid #cfd9d1!important;
|
||||
background:#fff!important;
|
||||
color:#26352a!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-secondary-button:hover:not(:disabled){
|
||||
border-color:#9fb4a4!important;
|
||||
background:#f3f7f4!important;
|
||||
color:#153b22!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-danger-button{
|
||||
border:1px solid #e8c3c0!important;
|
||||
background:#fff5f4!important;
|
||||
color:#a3312d!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-danger-button:hover:not(:disabled){
|
||||
border-color:#d99590!important;
|
||||
background:#fce7e5!important;
|
||||
color:#84231f!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-primary-button:disabled,
|
||||
.admin-dashboard-page .admin-secondary-button:disabled,
|
||||
.admin-dashboard-page .admin-danger-button:disabled{
|
||||
cursor:not-allowed!important;
|
||||
opacity:.5!important;
|
||||
transform:none!important;
|
||||
box-shadow:none!important;
|
||||
}
|
||||
.admin-dashboard-page button:focus-visible,
|
||||
.admin-dashboard-page a[class*="button"]:focus-visible,
|
||||
.admin-login-page button:focus-visible{
|
||||
outline:3px solid rgba(24,168,75,.24)!important;
|
||||
outline-offset:2px!important;
|
||||
}
|
||||
.admin-login-page .admin-primary-button{
|
||||
display:flex!important;
|
||||
width:100%!important;
|
||||
align-items:center!important;
|
||||
justify-content:space-between!important;
|
||||
height:57px!important;
|
||||
min-height:57px!important;
|
||||
margin-top:5px!important;
|
||||
padding:0 22px!important;
|
||||
border:0!important;
|
||||
border-radius:14px!important;
|
||||
background:linear-gradient(135deg,var(--lw-green),#0d8d3d)!important;
|
||||
color:#fff!important;
|
||||
font-weight:850!important;
|
||||
box-shadow:0 12px 25px rgba(17,150,62,.25)!important;
|
||||
}
|
||||
.admin-login-page .admin-primary-button:hover:not(:disabled){
|
||||
transform:translateY(-2px)!important;
|
||||
box-shadow:0 16px 30px rgba(17,150,62,.31)!important;
|
||||
}
|
||||
.admin-dashboard-page .admin-event-heading-actions button,
|
||||
.admin-dashboard-page .event-admin-summary button,
|
||||
.admin-dashboard-page .admin-event-form-actions button,
|
||||
.admin-dashboard-page .admin-event-category-row button,
|
||||
.admin-dashboard-page .admin-event-category-create button{
|
||||
min-height:42px;
|
||||
border:1px solid #128d3d;
|
||||
border-radius:10px;
|
||||
padding:10px 16px;
|
||||
background:linear-gradient(135deg,var(--lw-green),var(--lw-green-dark));
|
||||
color:#fff;
|
||||
font:inherit;
|
||||
font-size:.84rem;
|
||||
line-height:1.2;
|
||||
font-weight:800;
|
||||
cursor:pointer;
|
||||
box-shadow:none;
|
||||
}
|
||||
.admin-dashboard-page .admin-event-heading-actions .is-secondary,
|
||||
.admin-dashboard-page .admin-event-form-actions .is-secondary{
|
||||
border-color:#cfd9d1;
|
||||
background:#fff;
|
||||
color:#26352a;
|
||||
}
|
||||
'''
|
||||
if marker in base:
|
||||
raise SystemExit('v1.5.65 admin override already present in admin-v36.css')
|
||||
Path('web/assets/admin-v37.css').write_text(base + override + '\n', encoding='utf-8')
|
||||
|
||||
admin_templates = sorted(Path('web/admin').glob('*.html'))
|
||||
if not admin_templates:
|
||||
raise SystemExit('no admin templates found')
|
||||
missing = []
|
||||
for path in admin_templates:
|
||||
text = path.read_text(encoding='utf-8')
|
||||
if '/assets/admin-v36.css' not in text:
|
||||
missing.append(str(path))
|
||||
continue
|
||||
path.write_text(text.replace('/assets/admin-v36.css', '/assets/admin-v37.css'), encoding='utf-8')
|
||||
if missing:
|
||||
raise SystemExit('admin templates without current base CSS: ' + ', '.join(missing))
|
||||
|
||||
for path in Path('.').glob('*.go'):
|
||||
text = path.read_text(encoding='utf-8')
|
||||
if 'admin-v36.css' in text:
|
||||
path.write_text(text.replace('admin-v36.css', 'admin-v37.css'), encoding='utf-8')
|
||||
|
||||
main = Path('main.go')
|
||||
text = main.read_text(encoding='utf-8')
|
||||
if 'applicationVersion = "1.5.64"' not in text:
|
||||
raise SystemExit('unexpected applicationVersion before v1.5.65 bump')
|
||||
main.write_text(text.replace('applicationVersion = "1.5.64"', 'applicationVersion = "1.5.65"', 1), encoding='utf-8')
|
||||
|
||||
main_test = Path('main_test.go')
|
||||
text = main_test.read_text(encoding='utf-8')
|
||||
if 'applicationVersion != "1.5.64"' not in text:
|
||||
raise SystemExit('main_test.go does not expect v1.5.64')
|
||||
main_test.write_text(text.replace('applicationVersion != "1.5.64"', 'applicationVersion != "1.5.65"', 1), encoding='utf-8')
|
||||
|
||||
test = r'''package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAdminTemplatesUseCurrentBaseCSSAndExistingAssets(t *testing.T) {
|
||||
assetPattern := regexp.MustCompile(`(?:href|src)="(/assets/[^"?#]+\.(?:css|js))`)
|
||||
entries, err := os.ReadDir("web/admin")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".html") {
|
||||
continue
|
||||
}
|
||||
path := filepath.Join("web/admin", entry.Name())
|
||||
raw, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
html := string(raw)
|
||||
if !strings.Contains(html, `/assets/admin-v37.css`) {
|
||||
t.Fatalf("%s lädt nicht das aktuelle Admin-Basis-CSS", path)
|
||||
}
|
||||
if strings.Contains(html, `/assets/admin-v35.css`) || strings.Contains(html, `/assets/admin-v36.css`) {
|
||||
t.Fatalf("%s referenziert ein veraltetes Admin-Basis-CSS", path)
|
||||
}
|
||||
for _, match := range assetPattern.FindAllStringSubmatch(html, -1) {
|
||||
asset := filepath.Join("web", strings.TrimPrefix(match[1], "/"))
|
||||
if _, err := os.Stat(asset); err != nil {
|
||||
t.Fatalf("%s referenziert fehlendes Asset %s: %v", path, match[1], err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminButtonSystemHasFinalNormalizedRules(t *testing.T) {
|
||||
raw, err := os.ReadFile("web/assets/admin-v37.css")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
css := string(raw)
|
||||
for _, expected := range []string{
|
||||
"v1.5.65: einheitliches Admin-Buttonsystem",
|
||||
".admin-dashboard-page .admin-primary-button",
|
||||
".admin-dashboard-page .admin-secondary-button",
|
||||
".admin-dashboard-page .admin-danger-button",
|
||||
".admin-login-page .admin-primary-button",
|
||||
".admin-dashboard-page button:focus-visible",
|
||||
} {
|
||||
if !strings.Contains(css, expected) {
|
||||
t.Fatalf("admin-v37.css fehlt %q", expected)
|
||||
}
|
||||
}
|
||||
marker := strings.LastIndex(css, "v1.5.65: einheitliches Admin-Buttonsystem")
|
||||
legacy := strings.Index(css, ".admin-secondary-button{")
|
||||
if marker < 0 || legacy < 0 || marker <= legacy {
|
||||
t.Fatal("normalisierte Button-Regeln stehen nicht nach den Legacy-Regeln")
|
||||
}
|
||||
}
|
||||
'''
|
||||
Path('admin_ui_regression_test.go').write_text(test, encoding='utf-8')
|
||||
|
||||
changelog = Path('CHANGELOG.md')
|
||||
text = changelog.read_text(encoding='utf-8')
|
||||
section = '''## v1.5.65 – Einheitliches Admin-Design\n\n- Admin-Basis-CSS auf `admin-v37.css` angehoben und alle Admin-Templates sowie dynamisch erzeugten Adminseiten darauf umgestellt.\n- Widersprüchliche Legacy-Regeln für Primär-, Sekundär- und Löschbuttons durch ein abschließendes, einheitliches Button-System neutralisiert.\n- Hover-, Fokus- und Disabled-Zustände vereinheitlicht; Login-Button und Veranstaltungsaktionen an dieselbe Designsprache angepasst.\n- Regressionstest prüft künftig für jede Admin-Template-Datei das aktuelle Basis-CSS und die Existenz aller referenzierten CSS-/JS-Assets.\n- Keine neue Datenbankmigration.\n\n'''
|
||||
if not text.startswith('## v1.5.65'):
|
||||
changelog.write_text(section + text, encoding='utf-8')
|
||||
|
||||
readme = Path('README.md')
|
||||
text = readme.read_text(encoding='utf-8')
|
||||
text = text.replace('**Aktueller Stand: Landwelle v1.5.64 – 24. September 2026**', '**Aktueller Stand: Landwelle v1.5.65 – 24. September 2026**', 1)
|
||||
needle = 'Version 1.5.64 korrigiert den Abschlussstatus der KI-Audio-Module:'
|
||||
if 'Version 1.5.65 vereinheitlicht das Admin-Design' not in text and needle in text:
|
||||
paragraph = 'Version 1.5.65 vereinheitlicht das Admin-Design: Alle Adminseiten verwenden `admin-v37.css`; widersprüchliche ältere Button-Regeln werden durch ein gemeinsames Primär-/Sekundär-/Gefahr-Design mit konsistenten Hover-, Fokus- und Disabled-Zuständen ersetzt. Ein Regressionstest prüft zusätzlich alle Admin-CSS-/JS-Referenzen.\n\n'
|
||||
text = text.replace(needle, paragraph + needle, 1)
|
||||
text = text.replace('Erwartete Version: `Landwelle v1.5.64`.', 'Erwartete Version: `Landwelle v1.5.65`.', 1)
|
||||
readme.write_text(text, encoding='utf-8')
|
||||
|
||||
handover = Path('CHATUEBERGABE.md')
|
||||
if handover.exists():
|
||||
text = handover.read_text(encoding='utf-8')
|
||||
text = text.replace('v1.5.64', 'v1.5.65', 1)
|
||||
if '## v1.5.65' not in text:
|
||||
text += '\n\n## v1.5.65 – Admin-UI\n- Alle Adminseiten verwenden `admin-v37.css`.\n- Primär-, Sekundär- und Löschbuttons besitzen wieder ein einheitliches Design.\n- Admin-Asset-Referenzen werden durch Regressionstests geprüft.\n'
|
||||
handover.write_text(text, encoding='utf-8')
|
||||
PY
|
||||
|
||||
gofmt -w admin_ui_regression_test.go main_test.go admin_navigation_regression_test.go
|
||||
|
||||
- name: Verify modules
|
||||
run: go mod verify
|
||||
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: ARM64 production build
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
GOOS: linux
|
||||
GOARCH: arm64
|
||||
run: |
|
||||
go build -trimpath -o /tmp/landwelle-portal-linux-arm64 .
|
||||
go build -trimpath -o /tmp/landwelle-migrate-linux-arm64 ./cmd/migrate
|
||||
go build -trimpath -o /tmp/landwelle-adminpass-linux-arm64 ./cmd/adminpass
|
||||
|
||||
- name: Commit normalized admin UI
|
||||
shell: bash
|
||||
run: |
|
||||
rm -f .github/workflows/normalize-admin-ui-v1565.yml
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
git commit -m "fix: normalize admin button design and asset validation"
|
||||
git push origin HEAD:main
|
||||
Reference in new issue
Block a user