Fix accept cookie button and reestyle the reply button

jocadbz
Joca 2026-02-23 20:38:03 -03:00
parent 13b0821eef
commit 6e6eba2ca1
Signed by: jocadbz
GPG Key ID: B1836DCE2F50BDF7
14 changed files with 543 additions and 523 deletions

View File

@ -1,11 +1,11 @@
package handlers
import (
"github.com/gorilla/sessions"
"html/template"
"io/ioutil"
"log"
"net/http"
"github.com/gorilla/sessions"
"html/template"
)
func AboutHandler(app *App) http.HandlerFunc {
@ -32,7 +32,7 @@ func AboutHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
AboutContent: template.HTML(aboutContent),
}

View File

@ -1,11 +1,11 @@
package handlers
import (
"github.com/gorilla/sessions"
"log"
"net/http"
"strconv"
"threadr/models"
"github.com/gorilla/sessions"
)
func BoardHandler(app *App) http.HandlerFunc {
@ -117,7 +117,7 @@ func BoardHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Board: *board,
Threads: threads,

View File

@ -1,11 +1,11 @@
package handlers
import (
"github.com/gorilla/sessions"
"log"
"net/http"
"strconv"
"threadr/models"
"github.com/gorilla/sessions"
)
func BoardsHandler(app *App) http.HandlerFunc {
@ -105,7 +105,7 @@ func BoardsHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
PublicBoards: publicBoards,
PrivateBoards: privateBoards,

View File

@ -237,7 +237,7 @@ func ChatHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
ContentTemplate: "chat-content",
BodyClass: "chat-page",
},

View File

@ -1,10 +1,10 @@
package handlers
import (
"github.com/gorilla/sessions"
"log"
"net/http"
"path/filepath"
"github.com/gorilla/sessions"
)
func HomeHandler(app *App) http.HandlerFunc {
@ -22,7 +22,7 @@ func HomeHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: filepath.Join(app.Config.ThreadrDir, "static"),
CurrentURL: r.URL.String(),
CurrentURL: r.URL.RequestURI(),
},
}
if err := app.Tmpl.ExecuteTemplate(w, "home", data); err != nil {

View File

@ -52,7 +52,7 @@ func LoginHandler(app *App) http.HandlerFunc {
LoggedIn: false,
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Error: "",
}

View File

@ -1,11 +1,11 @@
package handlers
import (
"github.com/gorilla/sessions"
"log"
"net/http"
"strconv"
"threadr/models"
"github.com/gorilla/sessions"
)
func NewsHandler(app *App) http.HandlerFunc {
@ -84,7 +84,7 @@ func NewsHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
News: newsItems,
IsAdmin: isAdmin,

View File

@ -68,7 +68,7 @@ func PreferencesHandler(app *App) http.HandlerFunc {
ShowCookieBanner: false,
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
ContentTemplate: "preferences-content",
},
Preferences: prefs,

View File

@ -1,10 +1,10 @@
package handlers
import (
"github.com/gorilla/sessions"
"log"
"net/http"
"threadr/models"
"github.com/gorilla/sessions"
)
func ProfileHandler(app *App) http.HandlerFunc {
@ -41,7 +41,7 @@ func ProfileHandler(app *App) http.HandlerFunc {
ShowCookieBanner: false,
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
User: *user,
DisplayName: displayName,

View File

@ -117,7 +117,7 @@ func ProfileEditHandler(app *App) http.HandlerFunc {
ShowCookieBanner: false,
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
User: *user,
}

View File

@ -30,7 +30,7 @@ func SignupHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Error: "Passwords do not match. Please try again.",
}
@ -56,7 +56,7 @@ func SignupHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Error: "An error occurred during sign up. Please try again.",
}
@ -81,7 +81,7 @@ func SignupHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Error: "",
}

View File

@ -122,7 +122,7 @@ func ThreadHandler(app *App) http.HandlerFunc {
ShowCookieBanner: cookie == nil || cookie.Value != "accepted",
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Thread: *thread,
Board: *board,

View File

@ -1,10 +1,10 @@
package handlers
import (
"github.com/gorilla/sessions"
"log"
"net/http"
"threadr/models"
"github.com/gorilla/sessions"
)
func UserHomeHandler(app *App) http.HandlerFunc {
@ -36,7 +36,7 @@ func UserHomeHandler(app *App) http.HandlerFunc {
ShowCookieBanner: false,
BasePath: app.Config.ThreadrDir,
StaticPath: app.Config.ThreadrDir + "/static",
CurrentURL: r.URL.Path,
CurrentURL: r.URL.RequestURI(),
},
Username: user.Username,
}

View File

@ -551,6 +551,26 @@ p.thread-info {
position: relative;
}
.chat-message .post-actions {
position: absolute;
top: -12px;
right: 0;
margin: 0;
opacity: 0;
pointer-events: none;
background-color: #fef6e4;
border: 1px solid #001858;
border-radius: 4px;
padding: 2px 4px;
z-index: 10;
transition: opacity 0.15s ease;
}
.chat-message:hover .post-actions {
opacity: 1;
pointer-events: auto;
}
.chat-message-header {
display: flex;
align-items: center;
@ -622,20 +642,16 @@ p.thread-info {
font-size: 0.9em;
}
.chat-message:hover .post-actions {
opacity: 1;
}
.post-actions a {
.chat-message .post-actions a {
color: #001858;
text-decoration: none;
font-size: 0.8em;
padding: 2px 5px;
border: 1px solid #001858;
border: none;
border-radius: 3px;
}
.post-actions a:hover {
.chat-message .post-actions a:hover {
background-color: #8bd3dd;
color: #fef6e4;
}
@ -851,12 +867,16 @@ p.thread-info {
background-color: #555;
}
.post-actions a {
color: #fef6e4;
.chat-message .post-actions {
background-color: #444;
border-color: #fef6e4;
}
.post-actions a:hover {
.chat-message .post-actions a {
color: #fef6e4;
}
.chat-message .post-actions a:hover {
background-color: #8bd3dd;
color: #001858;
}