update assets use

This commit is contained in:
2024-12-11 17:37:58 +08:00
parent f6c961adb6
commit af08d9befc
25 changed files with 177 additions and 218 deletions

View File

@@ -2,18 +2,18 @@ package url
import (
"github.com/zhang2092/go-url-shortener/internal/templ/base"
"github.com/zhang2092/go-url-shortener/internal/templ/funcs"
"github.com/zhang2092/go-url-shortener/internal/templ/util"
"net/http"
)
templ CreateUrl(r *http.Request, page string, errorMsg string) {
@base.Base(page) {
templ CreateUrl(r *http.Request, errorMsg string) {
@base.Base() {
<div class="container">
<div class="flex flex-column align-items row py-md-5 mt-md-5">
<h1>创建短路径</h1>
<div class="col-sm-4 py-md-5">
<form action="/create-short-url" method="post">
@templ.Raw(funcs.CsrfField(r))
@templ.Raw(util.CsrfField(r))
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">

View File

@@ -10,11 +10,11 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/zhang2092/go-url-shortener/internal/templ/base"
"github.com/zhang2092/go-url-shortener/internal/templ/funcs"
"github.com/zhang2092/go-url-shortener/internal/templ/util"
"net/http"
)
func CreateUrl(r *http.Request, page string, errorMsg string) templ.Component {
func CreateUrl(r *http.Request, errorMsg string) 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 {
@@ -51,7 +51,7 @@ func CreateUrl(r *http.Request, page string, errorMsg string) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.Raw(funcs.CsrfField(r)).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = templ.Raw(util.CsrfField(r)).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -71,7 +71,7 @@ func CreateUrl(r *http.Request, page string, errorMsg string) templ.Component {
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = base.Base(page).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
templ_7745c5c3_Err = base.Base().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}