mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
remove unused code
This commit is contained in:
parent
001fedff4b
commit
9077415fa7
7 changed files with 0 additions and 768 deletions
|
|
@ -1,49 +0,0 @@
|
|||
package server
|
||||
|
||||
//func handleHomePage() echo.HandlerFunc {
|
||||
// return func(ctx echo.Context) error {
|
||||
// return renderTempl(ctx, http.StatusOK, view.Index())
|
||||
// }
|
||||
//}
|
||||
|
||||
//func handleRequestBooking(bs *booking.Service) echo.HandlerFunc {
|
||||
// return func(c echo.Context) error {
|
||||
// itemStr := c.FormValue("item")
|
||||
// fromStr := c.FormValue("from")
|
||||
// toStr := c.FormValue("to")
|
||||
// name := c.FormValue("item")
|
||||
// phoneNumber := c.FormValue("phone")
|
||||
// email := c.FormValue("email")
|
||||
//
|
||||
// from, fErr := myTime.ParseFromForm(fromStr)
|
||||
// to, tErr := myTime.ParseFromForm(toStr)
|
||||
// if fErr != nil || tErr != nil {
|
||||
// return fmt.Errorf("error parsing booking request time: %q %q", fErr, tErr)
|
||||
// }
|
||||
//
|
||||
// errs := make([]string, 0)
|
||||
// if to.Sub(from) < time.Duration(0) {
|
||||
// errs = append(errs, "invalid_time_range")
|
||||
// }
|
||||
//
|
||||
// if phoneNumber == "" && email == "" {
|
||||
// errs = append(errs, "missing_communication_method")
|
||||
// }
|
||||
//
|
||||
// if len(errs) > 0 {
|
||||
// return renderTempl(c, http.StatusOK, component.RequestBookingForm(&component.RequestBookingViewModel{
|
||||
// Item: itemStr,
|
||||
// From: fromStr,
|
||||
// To: toStr,
|
||||
// Name: name,
|
||||
// PhoneNumber: phoneNumber,
|
||||
// Email: email,
|
||||
// Errors: errs,
|
||||
// }))
|
||||
// }
|
||||
//
|
||||
// bs.CreateRequest(from, to, name, phoneNumber, email, itemStr, 1)
|
||||
//
|
||||
// return renderTempl(c, http.StatusSeeOther, view.Success())
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
package component
|
||||
|
||||
import "github.com/rjNemo/rentease/internal/config"
|
||||
|
||||
type RequestBookingViewModel struct {
|
||||
Item string
|
||||
From string
|
||||
To string
|
||||
Name string
|
||||
PhoneNumber string
|
||||
Email string
|
||||
Errors []string
|
||||
}
|
||||
|
||||
func makeItems() []string {
|
||||
host := config.NewHost()
|
||||
items := make([]string, 0, 2)
|
||||
for _, i := range host.Items {
|
||||
if i.Name == "T2" || i.Name == "T3" {
|
||||
items = append(items, i.Name)
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
var items = makeItems()
|
||||
|
||||
func (rbvm RequestBookingViewModel) invalidTimeRange() bool {
|
||||
for _, e := range rbvm.Errors {
|
||||
if e == "invalid_time_range" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (rbvm RequestBookingViewModel) missingCommunicationMethod() bool {
|
||||
for _, e := range rbvm.Errors {
|
||||
if e == "missing_communication_method" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
templ RequestBookingForm(rbvm *RequestBookingViewModel) {
|
||||
<form id="booking-request-form" hx-post="/request-booking">
|
||||
<fieldset class="grid">
|
||||
<label for="item">
|
||||
Logement
|
||||
<select name="item" id="item" required>
|
||||
for _,i := range items {
|
||||
<option value={ i }>{ i }</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
<label for="from">
|
||||
Du
|
||||
<input type="date" id="from" name="from" value={ rbvm.From } required/>
|
||||
</label>
|
||||
<label for="to">
|
||||
Au
|
||||
<input
|
||||
type="date"
|
||||
id="to"
|
||||
name="to"
|
||||
value={ rbvm.To }
|
||||
required
|
||||
if rbvm.invalidTimeRange() {
|
||||
aria-invalid="true"
|
||||
}
|
||||
/>
|
||||
if rbvm.invalidTimeRange() {
|
||||
<small>La date de depart doit etre apres celle d'arrivee</small>
|
||||
}
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="grid">
|
||||
<label for="name">
|
||||
Nom *
|
||||
<input type="text" id="name" name="name" value={ rbvm.Name } required/>
|
||||
</label>
|
||||
<label for="phone">
|
||||
Telephone
|
||||
<input
|
||||
type="tel"
|
||||
id="phone"
|
||||
name="phone"
|
||||
value={ rbvm.PhoneNumber }
|
||||
if rbvm.missingCommunicationMethod() {
|
||||
aria-invalid="true"
|
||||
}
|
||||
/>
|
||||
if rbvm.missingCommunicationMethod() {
|
||||
<small>Veuillez renseigner votre numéro de télephone ou votre adresse email</small>
|
||||
}
|
||||
</label>
|
||||
<label for="email">
|
||||
Email
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
name="email"
|
||||
value={ rbvm.Email }
|
||||
if rbvm.missingCommunicationMethod() {
|
||||
aria-invalid="true"
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<label for="message">
|
||||
Message
|
||||
<textarea name="message" id="message"></textarea>
|
||||
</label>
|
||||
<button type="submit">Reservez</button>
|
||||
</form>
|
||||
}
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package component
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import "github.com/rjNemo/rentease/internal/config"
|
||||
|
||||
type RequestBookingViewModel struct {
|
||||
Item string
|
||||
From string
|
||||
To string
|
||||
Name string
|
||||
PhoneNumber string
|
||||
Email string
|
||||
Errors []string
|
||||
}
|
||||
|
||||
func makeItems() []string {
|
||||
host := config.NewHost()
|
||||
items := make([]string, 0, 2)
|
||||
for _, i := range host.Items {
|
||||
if i.Name == "T2" || i.Name == "T3" {
|
||||
items = append(items, i.Name)
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
var items = makeItems()
|
||||
|
||||
func (rbvm RequestBookingViewModel) invalidTimeRange() bool {
|
||||
for _, e := range rbvm.Errors {
|
||||
if e == "invalid_time_range" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (rbvm RequestBookingViewModel) missingCommunicationMethod() bool {
|
||||
for _, e := range rbvm.Errors {
|
||||
if e == "missing_communication_method" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func RequestBookingForm(rbvm *RequestBookingViewModel) 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 {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form id=\"booking-request-form\" hx-post=\"/request-booking\"><fieldset class=\"grid\"><label for=\"item\">Logement <select name=\"item\" id=\"item\" required>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, i := range items {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 53, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 53, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</option>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</select></label> <label for=\"from\">Du <input type=\"date\" id=\"from\" name=\"from\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(rbvm.From)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 59, Col: 62}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" required></label> <label for=\"to\">Au <input type=\"date\" id=\"to\" name=\"to\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(rbvm.To)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 67, Col: 20}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" required")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if rbvm.invalidTimeRange() {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" aria-invalid=\"true\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if rbvm.invalidTimeRange() {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<small>La date de depart doit etre apres celle d'arrivee</small>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label></fieldset><fieldset class=\"grid\"><label for=\"name\">Nom * <input type=\"text\" id=\"name\" name=\"name\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(rbvm.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 81, Col: 62}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" required></label> <label for=\"phone\">Telephone <input type=\"tel\" id=\"phone\" name=\"phone\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(rbvm.PhoneNumber)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 89, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if rbvm.missingCommunicationMethod() {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" aria-invalid=\"true\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if rbvm.missingCommunicationMethod() {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<small>Veuillez renseigner votre numéro de télephone ou votre adresse email</small>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label> <label for=\"email\">Email <input type=\"email\" id=\"email\" name=\"email\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(rbvm.Email)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/request_booking_form.templ`, Line: 104, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if rbvm.missingCommunicationMethod() {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" aria-invalid=\"true\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("></label></fieldset><label for=\"message\">Message <textarea name=\"message\" id=\"message\"></textarea></label> <button type=\"submit\">Reservez</button></form>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package view
|
||||
|
||||
import (
|
||||
"github.com/rjNemo/rentease/internal/view/component"
|
||||
"github.com/rjNemo/rentease/internal/view/layout"
|
||||
)
|
||||
|
||||
templ Index() {
|
||||
@layout.PublicLayout() {
|
||||
<section>
|
||||
<h1>Reserver votre sejour dès maintenant</h1>
|
||||
<article>
|
||||
@component.RequestBookingForm(&component.RequestBookingViewModel{
|
||||
Item: "T2",
|
||||
From: "",
|
||||
To: "",
|
||||
Name: "",
|
||||
PhoneNumber: "",
|
||||
Email: "",
|
||||
Errors: nil,
|
||||
})
|
||||
</article>
|
||||
</section>
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package view
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/rjNemo/rentease/internal/view/component"
|
||||
"github.com/rjNemo/rentease/internal/view/layout"
|
||||
)
|
||||
|
||||
func Index() 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 {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<section><h1>Reserver votre sejour dès maintenant</h1><article>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = component.RequestBookingForm(&component.RequestBookingViewModel{
|
||||
Item: "T2",
|
||||
From: "",
|
||||
To: "",
|
||||
Name: "",
|
||||
PhoneNumber: "",
|
||||
Email: "",
|
||||
Errors: nil,
|
||||
}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</article></section>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.PublicLayout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
package layout
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rjNemo/rentease/internal/config"
|
||||
)
|
||||
|
||||
type HostViewModel struct {
|
||||
Name string
|
||||
Address string
|
||||
ZipCode string
|
||||
City string
|
||||
PhoneNumber string
|
||||
PhoneUrl templ.SafeURL
|
||||
Email string
|
||||
EmailUrl templ.SafeURL
|
||||
Items []Item
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Name string
|
||||
Url templ.SafeURL
|
||||
}
|
||||
|
||||
var host = config.NewHost()
|
||||
var hvm = &HostViewModel{
|
||||
Name: host.Name,
|
||||
PhoneNumber: host.PhoneNumber,
|
||||
PhoneUrl: templ.SafeURL(fmt.Sprintf("tel:%s", host.PhoneNumber)),
|
||||
Email: host.Email,
|
||||
EmailUrl: templ.SafeURL(fmt.Sprintf("mailto:%s", host.Email)),
|
||||
Items: []Item{
|
||||
{"T2 Corail", templ.URL("logements/t2")},
|
||||
{"T3 Azur", templ.URL("logements/t3")},
|
||||
},
|
||||
}
|
||||
|
||||
templ PublicLayout() {
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" data-theme="light">
|
||||
<head>
|
||||
<title>{ hvm.Name } | Locations de vacances au Gosier en Guadeloupe</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta name="description" content="Locations de vacances au Gosier en Guadeloupe"/>
|
||||
<link rel="icon" href="/static/icons/favicon.png"/>
|
||||
<link rel="stylesheet" href="/static/css/pico.min.css"/>
|
||||
<script src="/static/js/htmx.js" defer></script>
|
||||
</head>
|
||||
<body hx-boost="false">
|
||||
<nav class="container-fluid">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/"><img src="/static/img/logo.png" alt="logo de villafleurie" width="50px"/> </a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<details class="dropdown">
|
||||
<summary>Logements</summary>
|
||||
<ul dir="rtl">
|
||||
for _, l := range hvm.Items {
|
||||
<li><a href={ l.Url }>{ l.Name }</a></li>
|
||||
}
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
<li><a href="/book" role="button">Book Now</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<main class="container">
|
||||
{ children... }
|
||||
</main>
|
||||
<footer class="container">
|
||||
<small>{ hvm.Name } © 2024 – Telephone : <a href={ hvm.PhoneUrl }>{ hvm.PhoneNumber }</a> – Email : <a href={ hvm.EmailUrl }>{ hvm.Email }</a> </small>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package layout
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rjNemo/rentease/internal/config"
|
||||
)
|
||||
|
||||
type HostViewModel struct {
|
||||
Name string
|
||||
Address string
|
||||
ZipCode string
|
||||
City string
|
||||
PhoneNumber string
|
||||
PhoneUrl templ.SafeURL
|
||||
Email string
|
||||
EmailUrl templ.SafeURL
|
||||
Items []Item
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Name string
|
||||
Url templ.SafeURL
|
||||
}
|
||||
|
||||
var host = config.NewHost()
|
||||
var hvm = &HostViewModel{
|
||||
Name: host.Name,
|
||||
PhoneNumber: host.PhoneNumber,
|
||||
PhoneUrl: templ.SafeURL(fmt.Sprintf("tel:%s", host.PhoneNumber)),
|
||||
Email: host.Email,
|
||||
EmailUrl: templ.SafeURL(fmt.Sprintf("mailto:%s", host.Email)),
|
||||
Items: []Item{
|
||||
{"T2 Corail", templ.URL("logements/t2")},
|
||||
{"T3 Azur", templ.URL("logements/t3")},
|
||||
},
|
||||
}
|
||||
|
||||
func PublicLayout() 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 {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"fr\" data-theme=\"light\"><head><title>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hvm.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/public.templ`, Line: 42, Col: 20}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | Locations de vacances au Gosier en Guadeloupe</title><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta name=\"description\" content=\"Locations de vacances au Gosier en Guadeloupe\"><link rel=\"icon\" href=\"/static/icons/favicon.png\"><link rel=\"stylesheet\" href=\"/static/css/pico.min.css\"><script src=\"/static/js/htmx.js\" defer></script></head><body hx-boost=\"false\"><nav class=\"container-fluid\"><ul><li><a href=\"/\"><img src=\"/static/img/logo.png\" alt=\"logo de villafleurie\" width=\"50px\"></a></li></ul><ul><li><details class=\"dropdown\"><summary>Logements</summary><ul dir=\"rtl\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, l := range hvm.Items {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li><a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 templ.SafeURL = l.Url
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(l.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/public.templ`, Line: 63, Col: 39}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ul></details></li><li><a href=\"/book\" role=\"button\">Book Now</a></li></ul></nav><main class=\"container\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</main><footer class=\"container\"><small>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hvm.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/public.templ`, Line: 75, Col: 21}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" © 2024 – Telephone : <a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 templ.SafeURL = hvm.PhoneUrl
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var6)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hvm.PhoneNumber)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/public.templ`, Line: 75, Col: 93}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a> – Email : <a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 templ.SafeURL = hvm.EmailUrl
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var8)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hvm.Email)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/public.templ`, Line: 75, Col: 148}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></small></footer></body></html>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
Loading…
Reference in a new issue