From 87469d1a67f810127be11ba8775c8e5cdba5629b Mon Sep 17 00:00:00 2001 From: poyo Date: Sat, 8 Aug 2026 20:35:53 +0200 Subject: [PATCH] gist access from navbar --- app/gists.go | 12 ++++++------ static/css/navbar.css | 24 +++++++++++++----------- templating/views/header.html | 8 +++++++- templating/views/layouts/repo.html | 12 ++++++------ 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/app/gists.go b/app/gists.go index 8f9010c..fe37779 100644 --- a/app/gists.go +++ b/app/gists.go @@ -23,16 +23,16 @@ func (a *App) NewGist(w http.ResponseWriter, r *http.Request) { return } - form, ok := md.Form[GistNewForm](r) // r being the request - if !ok { - http.Error(w, "Invalid form.", http.StatusBadRequest) - return - } - switch r.Method { case http.MethodGet: templating.Render(w, r, "base", "gists/new") case http.MethodPost: + form, ok := md.Form[GistNewForm](r) // r being the request + if !ok { + http.Error(w, "Invalid form.", http.StatusBadRequest) + return + } + gist, err := a.Store.NewGist(user.ID, form.Title, form.Content) if err != nil { http.Error(w, "Internal Server Error", http.StatusInternalServerError) diff --git a/static/css/navbar.css b/static/css/navbar.css index 2c9b2bd..f9eebb3 100644 --- a/static/css/navbar.css +++ b/static/css/navbar.css @@ -20,9 +20,21 @@ align-items: center; gap: 0 5px; - a { + a, + details { height: 100%; min-height: max-content; + + color: var(--bg-col); + background-color: var(--link-col); + text-align: center; + padding: 4px; + font-size: 1.1rem; + font-weight: bold; + } + + details .menu *:first-child { + border-block: 1px solid var(--bg-col); } .navbar-admin { @@ -30,14 +42,4 @@ background-color: var(--error); } } - - #links a { - color: var(--bg-col); - background-color: var(--link-col); - float: left; - text-align: center; - padding: 4px; - font-size: 1.1rem; - font-weight: bold; - } } \ No newline at end of file diff --git a/templating/views/header.html b/templating/views/header.html index f756ffb..7c00ffa 100644 --- a/templating/views/header.html +++ b/templating/views/header.html @@ -5,7 +5,13 @@