|
|
|
|
@ -13,6 +13,7 @@ import (
|
|
|
|
|
"git.32bit.cafe/32bitcafe/guestbook/internal/forms"
|
|
|
|
|
"git.32bit.cafe/32bitcafe/guestbook/internal/models"
|
|
|
|
|
"slices"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ -50,7 +51,7 @@ func adminBase(title string, data CommonData) templ.Component {
|
|
|
|
|
var templ_7745c5c3_Var2 string
|
|
|
|
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 21, Col: 17}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 22, Col: 17}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -63,7 +64,7 @@ func adminBase(title string, data CommonData) templ.Component {
|
|
|
|
|
var templ_7745c5c3_Var3 string
|
|
|
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(`{"includeIndicatorStyles":false}`)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 24, Col: 72}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 25, Col: 72}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -170,7 +171,7 @@ func AdminPanelLandingView(title string, data CommonData, stats AdminStat) templ
|
|
|
|
|
var templ_7745c5c3_Var7 string
|
|
|
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(title)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 63, Col: 16}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 64, Col: 16}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -183,7 +184,7 @@ func AdminPanelLandingView(title string, data CommonData, stats AdminStat) templ
|
|
|
|
|
var templ_7745c5c3_Var8 string
|
|
|
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", stats.UserCount))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 69, Col: 45}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 70, Col: 45}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -196,7 +197,7 @@ func AdminPanelLandingView(title string, data CommonData, stats AdminStat) templ
|
|
|
|
|
var templ_7745c5c3_Var9 string
|
|
|
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", stats.WebsiteCount))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 73, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 74, Col: 48}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -209,7 +210,7 @@ func AdminPanelLandingView(title string, data CommonData, stats AdminStat) templ
|
|
|
|
|
var templ_7745c5c3_Var10 string
|
|
|
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", stats.CommentCount))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 77, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 78, Col: 48}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -229,7 +230,7 @@ func AdminPanelLandingView(title string, data CommonData, stats AdminStat) templ
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AdminPanelUsersView(title string, data CommonData, users []models.User) templ.Component {
|
|
|
|
|
func AdminPanelUsersView(title string, data CommonData, users []models.User, pageNum, pageSize, total int64) templ.Component {
|
|
|
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
|
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
|
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
|
|
|
@ -296,7 +297,7 @@ func AdminPanelUsersView(title string, data CommonData, users []models.User) tem
|
|
|
|
|
var templ_7745c5c3_Var14 string
|
|
|
|
|
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(u.Username)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 98, Col: 51}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 99, Col: 51}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -309,7 +310,7 @@ func AdminPanelUsersView(title string, data CommonData, users []models.User) tem
|
|
|
|
|
var templ_7745c5c3_Var15 string
|
|
|
|
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(u.Created.Format(time.RFC3339))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 99, Col: 44}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 100, Col: 44}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -322,7 +323,7 @@ func AdminPanelUsersView(title string, data CommonData, users []models.User) tem
|
|
|
|
|
var templ_7745c5c3_Var16 string
|
|
|
|
|
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(u.Email)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 100, Col: 21}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 101, Col: 21}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
@ -333,7 +334,15 @@ func AdminPanelUsersView(title string, data CommonData, users []models.User) tem
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</table></section></div></div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</table></section>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = pagination("/admin/users", pageNum, total, pageSize).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</div></div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -368,82 +377,82 @@ func AdminPanelUserMgmtDetail(csrfToken string, user models.User) templ.Componen
|
|
|
|
|
templ_7745c5c3_Var17 = templ.NopComponent
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<div id=\"user-info\"><form><input type=\"hidden\" name=\"csrf_token\" value=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<div id=\"user-info\"><form><input type=\"hidden\" name=\"csrf_token\" value=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var18 string
|
|
|
|
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(csrfToken)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 113, Col: 59}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 115, Col: 59}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\"><section><h3>User Info</h3><div><h5>Username</h5><p>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\"><section><h3>User Info</h3><div><h5>Username</h5><p>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var19 string
|
|
|
|
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(user.Username)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 118, Col: 23}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 120, Col: 23}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</p></div><div><h5>Email</h5><p>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</p></div><div><h5>Email</h5><p>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var20 string
|
|
|
|
|
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(user.Email)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 122, Col: 20}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 124, Col: 20}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</p></div><div><h5>Joined</h5><p>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</p></div><div><h5>Joined</h5><p>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var21 string
|
|
|
|
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(user.Created.Format(time.RFC3339))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 126, Col: 43}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 128, Col: 43}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</p></div></section><section><h3>Groups</h3><ul>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</p></div></section><section><h3>Groups</h3><ul>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
for _, g := range user.Groups {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<li>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<li>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var22 string
|
|
|
|
|
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s", getGroupName(g)))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 133, Col: 46}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 135, Col: 46}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</li>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</li>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</ul></section><section><h3>Actions</h3>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</ul></section><section><h3>Actions</h3>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -451,80 +460,80 @@ func AdminPanelUserMgmtDetail(csrfToken string, user models.User) templ.Componen
|
|
|
|
|
putBanUrl := fmt.Sprintf("/admin/users/%s/ban", shortIdToSlug(user.ShortId))
|
|
|
|
|
putUnbanUrl := fmt.Sprintf("/admin/users/%s/unban", shortIdToSlug(user.ShortId))
|
|
|
|
|
deleteUrl := fmt.Sprintf("/admin/users/%s", shortIdToSlug(user.ShortId))
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<button type=\"button\" hx-get=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<button type=\"button\" hx-get=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var23 string
|
|
|
|
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(getFormUrl)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 143, Col: 45}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 145, Col: 45}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "\" hx-target=\"#user-info\">Edit</button> ")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "\" hx-target=\"#user-info\">Edit</button> ")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
if user.ID != 1 {
|
|
|
|
|
if user.Banned.IsZero() {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<button type=\"button\" hx-put=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<button type=\"button\" hx-put=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var24 string
|
|
|
|
|
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(putBanUrl)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 146, Col: 46}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 148, Col: 46}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\" hx-confirm=\"Are you sure you want to ban this user?\" hx-target=\"#user-info\" class=\"danger\">Ban</button>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "\" hx-confirm=\"Are you sure you want to ban this user?\" hx-target=\"#user-info\" class=\"danger\">Ban</button>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<button type=\"button\" hx-put=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<button type=\"button\" hx-put=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var25 string
|
|
|
|
|
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(putUnbanUrl)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 148, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 150, Col: 48}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\" hx-confirm=\"Are you sure you want to unban this user?\" hx-target=\"#user-info\">Unban</button>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "\" hx-confirm=\"Are you sure you want to unban this user?\" hx-target=\"#user-info\">Unban</button>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " <button type=\"button\" hx-delete=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, " <button type=\"button\" hx-delete=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var26 string
|
|
|
|
|
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(deleteUrl)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 150, Col: 48}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 152, Col: 48}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\" hx-confirm=\"Are you sure you want to delete this user? This is irreversible\" class=\"danger\">Delete</button>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "\" hx-confirm=\"Are you sure you want to delete this user? This is irreversible\" class=\"danger\">Delete</button>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</section></form></div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</section></form></div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -565,7 +574,7 @@ func AdminPanelUserMgmtView(title string, data CommonData, user models.User) tem
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div id=\"dashboard\">")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<div id=\"dashboard\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -577,7 +586,7 @@ func AdminPanelUserMgmtView(title string, data CommonData, user models.User) tem
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -612,112 +621,112 @@ func AdminPanelUserMgmtEditForm(csrfToken string, form forms.AdminUserMgmtForm,
|
|
|
|
|
templ_7745c5c3_Var29 = templ.NopComponent
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<div id=\"user-info\"><form><input type=\"hidden\" name=\"csrf_token\" value=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "<div id=\"user-info\"><form><input type=\"hidden\" name=\"csrf_token\" value=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var30 string
|
|
|
|
|
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(csrfToken)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 169, Col: 59}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 171, Col: 59}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "\"><fieldset><h3>User Info</h3><div><h5>Username</h5><input type=\"text\" name=\"admin_username\" id=\"username\" value=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\"><fieldset><h3>User Info</h3><div><h5>Username</h5><input type=\"text\" name=\"admin_username\" id=\"username\" value=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var31 string
|
|
|
|
|
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(form.Username)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 174, Col: 81}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 176, Col: 81}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\" required></div><div><h5>Email</h5><input type=\"text\" name=\"admin_useremail\" id=\"useremail\" value=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "\" required></div><div><h5>Email</h5><input type=\"text\" name=\"admin_useremail\" id=\"useremail\" value=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var32 string
|
|
|
|
|
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(form.Email)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 178, Col: 80}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 180, Col: 80}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "\" required></div><div><h5>Joined</h5><p>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "\" required></div><div><h5>Joined</h5><p>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var33 string
|
|
|
|
|
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(user.Created.Format(time.RFC3339))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 182, Col: 43}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 184, Col: 43}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</p></div></fieldset><section><fieldset><h3>Groups</h3>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</p></div></fieldset><section><fieldset><h3>Groups</h3>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
isAdmin := slices.Contains(user.Groups, models.AdminGroup)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "<input type=\"checkbox\" name=\"admin_usergroup_admin\" id=\"usergroup_admin\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<input type=\"checkbox\" name=\"admin_usergroup_admin\" id=\"usergroup_admin\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
if isAdmin {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, " checked")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, " checked")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if user.ID == 1 {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, " disabled")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, " disabled")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "> <label for=\"usergroup_admin\">Administrator</label> <input type=\"checkbox\" name=\"admin_usergroup_user\" id=\"usergroup_user\" checked disabled> <label for=\"usergroup_user\">User</label></fieldset></section><section><h3>Actions</h3>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "> <label for=\"usergroup_admin\">Administrator</label> <input type=\"checkbox\" name=\"admin_usergroup_user\" id=\"usergroup_user\" checked disabled> <label for=\"usergroup_user\">User</label></fieldset></section><section><h3>Actions</h3>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
putFormUrl := fmt.Sprintf("/admin/users/%s/edit", shortIdToSlug(user.ShortId))
|
|
|
|
|
getDetailUrl := fmt.Sprintf("/admin/users/%s/detail", shortIdToSlug(user.ShortId))
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<button type=\"button\" hx-put=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<button type=\"button\" hx-put=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var34 string
|
|
|
|
|
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(putFormUrl)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 199, Col: 45}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 201, Col: 45}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "\" hx-target=\"#user-info\">Save</button> <button type=\"reset\" hx-get=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "\" hx-target=\"#user-info\">Save</button> <button type=\"reset\" hx-get=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var35 string
|
|
|
|
|
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(getDetailUrl)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 200, Col: 46}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 202, Col: 46}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "\" hx-target=\"#user-info\">Cancel</button></section></form></div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "\" hx-target=\"#user-info\">Cancel</button></section></form></div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -725,7 +734,7 @@ func AdminPanelUserMgmtEditForm(csrfToken string, form forms.AdminUserMgmtForm,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.Website, pageNum int64, total int64) templ.Component {
|
|
|
|
|
func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.Website, pageNum, pageCount, total int64) templ.Component {
|
|
|
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
|
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
|
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
|
|
|
@ -758,7 +767,7 @@ func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<div id=\"dashboard\">")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<div id=\"dashboard\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -766,17 +775,17 @@ func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<div><section class=\"admin-section\"><table><th>Site Name</th><th>Owner</th><th>URL</th><th>Created</th><th>Guestbook</th>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<div><section class=\"admin-section\"><table><th>Site Name</th><th>Owner</th><th>URL</th><th>Created</th><th>Guestbook</th>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
for _, w := range websites {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<tr>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "<tr>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
detailUrl := fmt.Sprintf("/admin/websites/%s", shortIdToSlug(w.ShortId))
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "<td><a href=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "<td><a href=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -785,33 +794,33 @@ func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "\">")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var39 string
|
|
|
|
|
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(w.Name)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 221, Col: 57}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 223, Col: 57}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</a></td><td>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</a></td><td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var40 string
|
|
|
|
|
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(w.AuthorName)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 222, Col: 26}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 224, Col: 26}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</td><td><a href=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</td><td><a href=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -820,38 +829,38 @@ func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "\">")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var42 string
|
|
|
|
|
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(w.Url.String())
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 223, Col: 70}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 225, Col: 70}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "</a></td><td>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "</a></td><td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var43 string
|
|
|
|
|
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(w.Created.Format(time.RFC1123))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 224, Col: 44}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 226, Col: 44}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "</td>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
gbUrl := fmt.Sprintf("/websites/%s/guestbook", shortIdToSlug(w.ShortId))
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "<td><a href=\"")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "<td><a href=\"")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -860,20 +869,20 @@ func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "\">View</a></td></tr>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\">View</a></td></tr>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</table></section>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</table></section>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = pagination("/admin/websites", pageNum, total, 5).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
templ_7745c5c3_Err = pagination("/admin/websites", pageNum, total, pageCount).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</div></div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "</div></div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -887,7 +896,17 @@ func AdminPanelAllWebsitesView(title string, data CommonData, websites []models.
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AdminPanelWebsiteDetailView(title string, data CommonData, website models.Website, comments []models.GuestbookComment) templ.Component {
|
|
|
|
|
func truncateComment(s string, n int) string {
|
|
|
|
|
words := strings.Fields(s)
|
|
|
|
|
if len(words) < n {
|
|
|
|
|
return s
|
|
|
|
|
}
|
|
|
|
|
truncated := words[:n]
|
|
|
|
|
truncated = append(truncated, "...")
|
|
|
|
|
return strings.Join(truncated, " ")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AdminPanelWebsiteDetailView(title string, data CommonData, website models.Website, comments []models.GuestbookComment, pageNum, pageAmount, total int64) templ.Component {
|
|
|
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
|
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
|
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
|
|
|
@ -920,7 +939,7 @@ func AdminPanelWebsiteDetailView(title string, data CommonData, website models.W
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "<div id=\"dashboard\">")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "<div id=\"dashboard\">")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -928,47 +947,34 @@ func AdminPanelWebsiteDetailView(title string, data CommonData, website models.W
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "<div><section class=\"admin-section\"><table><th>Author</th><th>Created</th><th>Email</th><th>Homepage</th><th>Comment</th>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "<div><section class=\"admin-section\"><table><th>Author</th><th>Created</th><th>Email</th><th>Homepage</th><th>Comment</th>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
for _, c := range comments {
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "<tr><td>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "<tr><td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var47 string
|
|
|
|
|
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 251, Col: 26}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 263, Col: 26}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "</td><td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var48 string
|
|
|
|
|
templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.Format(time.RFC1123))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 252, Col: 44}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</td><td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var49 string
|
|
|
|
|
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorEmail)
|
|
|
|
|
var templ_7745c5c3_Var48 string
|
|
|
|
|
templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.Format(time.RFC1123))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 253, Col: 27}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 264, Col: 44}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -976,12 +982,12 @@ func AdminPanelWebsiteDetailView(title string, data CommonData, website models.W
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var50 string
|
|
|
|
|
templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorSite)
|
|
|
|
|
var templ_7745c5c3_Var49 string
|
|
|
|
|
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorEmail)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 254, Col: 26}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 265, Col: 27}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
@ -989,21 +995,43 @@ func AdminPanelWebsiteDetailView(title string, data CommonData, website models.W
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var51 string
|
|
|
|
|
templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText)
|
|
|
|
|
var templ_7745c5c3_Var50 string
|
|
|
|
|
templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorSite)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 255, Col: 27}
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 266, Col: 26}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "</td><td>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
var templ_7745c5c3_Var51 string
|
|
|
|
|
templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(truncateComment(c.CommentText, 15))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/admin.templ`, Line: 267, Col: 48}
|
|
|
|
|
}
|
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "</td></tr>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "</td></tr>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "</table></section></div></div>")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "</table></section>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
url := fmt.Sprintf("/admin/websites/%s", shortIdToSlug(website.ShortId))
|
|
|
|
|
templ_7745c5c3_Err = pagination(url, pageNum, total, pageAmount).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</div></div>")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
|