Stuff now works better on IE2
All checks were successful
Backend Build and Test / build (push) Successful in 2m36s

This commit is contained in:
Sebastiaan de Schaetzen 2025-05-29 13:51:38 +02:00
parent 1674988751
commit 8d43f3828a
3 changed files with 16 additions and 9 deletions

View File

@ -28,8 +28,13 @@ func loadWebEndpoints(router *gin.Engine) {
} }
func redirectToPage(c *gin.Context, page string) { func redirectToPage(c *gin.Context, page string) {
redirectToPageStatus(c, page, http.StatusSeeOther)
}
func redirectToPageStatus(c *gin.Context, page string, status int) {
scheme := c.Request.URL.Scheme scheme := c.Request.URL.Scheme
c.Redirect(http.StatusSeeOther, scheme+domain+page) target := scheme + domain + page
c.Redirect(status, target)
} }
func renderLogin(c *gin.Context) { func renderLogin(c *gin.Context) {
@ -75,7 +80,7 @@ func renderCreateTask(c *gin.Context) {
return return
} }
c.Redirect(http.StatusFound, "/") redirectToPageStatus(c, "/", http.StatusFound)
} }
func renderCompleteTask(c *gin.Context) { func renderCompleteTask(c *gin.Context) {
@ -92,7 +97,7 @@ func renderCompleteTask(c *gin.Context) {
return return
} }
c.Redirect(http.StatusFound, "/") redirectToPageStatus(c, "/", http.StatusFound)
} }
func renderCreateAllowance(c *gin.Context) { func renderCreateAllowance(c *gin.Context) {
@ -129,7 +134,7 @@ func renderCreateAllowance(c *gin.Context) {
return return
} }
c.Redirect(http.StatusFound, "/") redirectToPageStatus(c, "/", http.StatusFound)
} }
func renderCompleteAllowance(c *gin.Context) { func renderCompleteAllowance(c *gin.Context) {
@ -151,7 +156,7 @@ func renderCompleteAllowance(c *gin.Context) {
return return
} }
c.Redirect(http.StatusFound, "/") redirectToPageStatus(c, "/", http.StatusFound)
} }
func getCurrentUser(c *gin.Context) *int { func getCurrentUser(c *gin.Context) *int {
@ -180,7 +185,7 @@ func getCurrentUser(c *gin.Context) *int {
func unsetUserCookie(c *gin.Context) { func unsetUserCookie(c *gin.Context) {
c.SetCookie("user", "", -1, "/", "localhost", false, true) c.SetCookie("user", "", -1, "/", "localhost", false, true)
c.Redirect(http.StatusFound, "/") redirectToPageStatus(c, "/", http.StatusFound)
} }
func renderNoUser(c *gin.Context) { func renderNoUser(c *gin.Context) {

View File

@ -3,9 +3,11 @@
<head> <head>
<title>Allowance Planner 2000</title> <title>Allowance Planner 2000</title>
<style> <style>
<!--
tr:hover { tr:hover {
background-color: #f0f0f0; background-color: #f0f0f0;
} }
-->
</style> </style>
</head> </head>
<body> <body>
@ -27,7 +29,7 @@
{{if ne .CurrentUser 0}} {{if ne .CurrentUser 0}}
<h2>Allowances</h2> <h2>Allowances</h2>
<form action="/createAllowance" method="post"> <form action="/createAllowance" method="post">
<table border="1"> <table border=1>
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -43,7 +45,7 @@
<td></td> <td></td>
<td><label><input type="number" name="target" placeholder="Target"></label></td> <td><label><input type="number" name="target" placeholder="Target"></label></td>
<td><label><input type="number" name="weight" placeholder="Weight"></label></td> <td><label><input type="number" name="weight" placeholder="Weight"></label></td>
<td><button>Create</button></td> <td><input type="submit" value="Create"></td>
</tr> </tr>
{{range .Allowances}} {{range .Allowances}}
{{if eq .ID 0}} {{if eq .ID 0}}
@ -103,7 +105,7 @@
<td><label><input type="text" name="name" placeholder="Name"></label></td> <td><label><input type="text" name="name" placeholder="Name"></label></td>
<td></td> <td></td>
<td><label><input type="number" name="reward" placeholder="Reward"></label></td> <td><label><input type="number" name="reward" placeholder="Reward"></label></td>
<td><button>Create</button></td> <td><input type="submit" value="Create"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>