Implement guestbook settings #20
| @ -4,6 +4,7 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"git.32bit.cafe/32bitcafe/guestbook/internal/forms" | 	"git.32bit.cafe/32bitcafe/guestbook/internal/forms" | ||||||
| @ -23,6 +24,26 @@ func (app *application) getGuestbook(w http.ResponseWriter, r *http.Request) { | |||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if !website.Guestbook.Settings.IsVisible { | ||||||
|  | 		u := app.getCurrentUser(r) | ||||||
|  | 		if u == nil { | ||||||
|  | 			app.clientError(w, http.StatusForbidden) | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 		if u.ID != website.UserId { | ||||||
|  | 			app.clientError(w, http.StatusForbidden) | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) | 	comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		app.serverError(w, r, err) | 		app.serverError(w, r, err) | ||||||
| @ -42,10 +63,76 @@ func (app *application) getGuestbookSettings(w http.ResponseWriter, r *http.Requ | |||||||
| 			app.serverError(w, r, err) | 			app.serverError(w, r, err) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	data := app.newCommonData(r) | 	data := app.newCommonData(r) | ||||||
| 	views.GuestbookSettingsView(data, website).Render(r.Context(), w) | 	views.GuestbookSettingsView(data, website).Render(r.Context(), w) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (app *application) putGuestbookSettings(w http.ResponseWriter, r *http.Request) { | ||||||
|  | 	slug := r.PathValue("id") | ||||||
|  | 	website, err := app.websites.Get(slugToShortId(slug)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	var form forms.GuestbookSettingsForm | ||||||
|  | 	err = app.decodePostForm(r, &form) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.clientError(w, http.StatusBadRequest) | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	form.CheckField(validator.PermittedValue(form.Visibility, "true", "false"), "gb_visible", "Invalid value") | ||||||
|  | 	form.CheckField(validator.PermittedValue(form.CommentingEnabled, models.ValidDisableDurations...), "gb_visible", "Invalid value") | ||||||
|  | 	form.CheckField(validator.PermittedValue(form.WidgetsEnabled, "true", "false"), "gb_remote", "Invalid value") | ||||||
|  | 	if !form.Valid() { | ||||||
|  | 		// TODO: rerender template with errors | ||||||
|  | 		app.clientError(w, http.StatusUnprocessableEntity) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	c, err := strconv.ParseBool(form.CommentingEnabled) | ||||||
|  | 	if err != nil { | ||||||
|  | 		website.Guestbook.Settings.IsCommentingEnabled = false | ||||||
|  | 		website.Guestbook.Settings.ReenableCommenting, err = app.durationToTime(form.CommentingEnabled) | ||||||
|  | 		if err != nil { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		website.Guestbook.Settings.IsCommentingEnabled = c | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	// can skip error checking for these two since we verify valid values above | ||||||
|  | 	website.Guestbook.Settings.IsVisible, err = strconv.ParseBool(form.Visibility) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 	} | ||||||
|  | 	website.Guestbook.Settings.AllowRemoteHostAccess, err = strconv.ParseBool(form.WidgetsEnabled) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 	} | ||||||
|  | 	err = app.guestbooks.UpdateGuestbookSettings(website.Guestbook.ID, website.Guestbook.Settings) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	app.sessionManager.Put(r.Context(), "flash", "Settings changed successfully") | ||||||
|  | 	data := app.newCommonData(r) | ||||||
|  | 	w.Header().Add("HX-Refresh", "true") | ||||||
|  | 	views.GuestbookSettingsView(data, website).Render(r.Context(), w) | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (app *application) getGuestbookComments(w http.ResponseWriter, r *http.Request) { | func (app *application) getGuestbookComments(w http.ResponseWriter, r *http.Request) { | ||||||
| 	slug := r.PathValue("id") | 	slug := r.PathValue("id") | ||||||
| 	website, err := app.websites.Get(slugToShortId(slug)) | 	website, err := app.websites.Get(slugToShortId(slug)) | ||||||
| @ -57,6 +144,14 @@ func (app *application) getGuestbookComments(w http.ResponseWriter, r *http.Requ | |||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) | 	comments, err := app.guestbookComments.GetAll(website.Guestbook.ID) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		app.serverError(w, r, err) | 		app.serverError(w, r, err) | ||||||
| @ -78,6 +173,14 @@ func (app *application) getGuestbookCommentCreate(w http.ResponseWriter, r *http | |||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	data := app.newCommonData(r) | 	data := app.newCommonData(r) | ||||||
| 	form := forms.CommentCreateForm{} | 	form := forms.CommentCreateForm{} | ||||||
| @ -95,6 +198,19 @@ func (app *application) postGuestbookCommentCreate(w http.ResponseWriter, r *htt | |||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if !website.Guestbook.CanComment() { | ||||||
|  | 		app.clientError(w, http.StatusForbidden) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	var form forms.CommentCreateForm | 	var form forms.CommentCreateForm | ||||||
| 	err = app.decodePostForm(r, &form) | 	err = app.decodePostForm(r, &form) | ||||||
| @ -143,6 +259,14 @@ func (app *application) getCommentQueue(w http.ResponseWriter, r *http.Request) | |||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	comments, err := app.guestbookComments.GetUnpublished(website.Guestbook.ID) | 	comments, err := app.guestbookComments.GetUnpublished(website.Guestbook.ID) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -169,6 +293,14 @@ func (app *application) getCommentTrash(w http.ResponseWriter, r *http.Request) | |||||||
| 		} | 		} | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	comments, err := app.guestbookComments.GetDeleted(website.Guestbook.ID) | 	comments, err := app.guestbookComments.GetDeleted(website.Guestbook.ID) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -200,6 +332,14 @@ func (app *application) putHideGuestbookComment(w http.ResponseWriter, r *http.R | |||||||
| 	if user.ID != website.UserId { | 	if user.ID != website.UserId { | ||||||
| 		app.clientError(w, http.StatusUnauthorized) | 		app.clientError(w, http.StatusUnauthorized) | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	cSlug := r.PathValue("commentId") | 	cSlug := r.PathValue("commentId") | ||||||
| 	comment, err := app.guestbookComments.Get(slugToShortId(cSlug)) | 	comment, err := app.guestbookComments.Get(slugToShortId(cSlug)) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -234,6 +374,14 @@ func (app *application) deleteGuestbookComment(w http.ResponseWriter, r *http.Re | |||||||
| 	if user.ID != website.UserId { | 	if user.ID != website.UserId { | ||||||
| 		app.clientError(w, http.StatusUnauthorized) | 		app.clientError(w, http.StatusUnauthorized) | ||||||
| 	} | 	} | ||||||
|  | 	website.Guestbook, err = app.guestbooks.Get(website.Guestbook.ShortId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	cSlug := r.PathValue("commentId") | 	cSlug := r.PathValue("commentId") | ||||||
| 	comment, err := app.guestbookComments.Get(slugToShortId(cSlug)) | 	comment, err := app.guestbookComments.Get(slugToShortId(cSlug)) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  | |||||||
| @ -118,3 +118,13 @@ func DefaultUserSettings() models.UserSettings { | |||||||
| 		LocalTimezone: time.Now().UTC().Location(), | 		LocalTimezone: time.Now().UTC().Location(), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (app *application) durationToTime(duration string) (time.Time, error) { | ||||||
|  | 	var result time.Time | ||||||
|  | 	offset, err := time.ParseDuration(duration) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return result, nil | ||||||
|  | 	} | ||||||
|  | 	result = time.Now().UTC().Add(offset) | ||||||
|  | 	return result, nil | ||||||
|  | } | ||||||
|  | |||||||
| @ -71,6 +71,11 @@ func main() { | |||||||
| 		logger.Error(err.Error()) | 		logger.Error(err.Error()) | ||||||
| 		os.Exit(1) | 		os.Exit(1) | ||||||
| 	} | 	} | ||||||
|  | 	err = app.guestbooks.InitializeSettingsMap() | ||||||
|  | 	if err != nil { | ||||||
|  | 		logger.Error(err.Error()) | ||||||
|  | 		os.Exit(1) | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	tlsConfig := &tls.Config{ | 	tlsConfig := &tls.Config{ | ||||||
| 		CurvePreferences: []tls.CurveID{tls.X25519, tls.CurveP256}, | 		CurvePreferences: []tls.CurveID{tls.X25519, tls.CurveP256}, | ||||||
|  | |||||||
| @ -42,6 +42,7 @@ func (app *application) routes() http.Handler { | |||||||
| 	mux.Handle("DELETE /websites/{id}/dashboard/guestbook/comments/{commentId}", protected.ThenFunc(app.deleteGuestbookComment)) | 	mux.Handle("DELETE /websites/{id}/dashboard/guestbook/comments/{commentId}", protected.ThenFunc(app.deleteGuestbookComment)) | ||||||
| 	mux.Handle("PUT /websites/{id}/dashboard/guestbook/comments/{commentId}", protected.ThenFunc(app.putHideGuestbookComment)) | 	mux.Handle("PUT /websites/{id}/dashboard/guestbook/comments/{commentId}", protected.ThenFunc(app.putHideGuestbookComment)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard/guestbook/settings", protected.ThenFunc(app.getGuestbookSettings)) | 	mux.Handle("GET /websites/{id}/dashboard/guestbook/settings", protected.ThenFunc(app.getGuestbookSettings)) | ||||||
|  | 	mux.Handle("PUT /websites/{id}/dashboard/guestbook/settings", protected.ThenFunc(app.putGuestbookSettings)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/trash", protected.ThenFunc(app.getCommentTrash)) | 	mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/trash", protected.ThenFunc(app.getCommentTrash)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard/guestbook/themes", protected.ThenFunc(app.getComingSoon)) | 	mux.Handle("GET /websites/{id}/dashboard/guestbook/themes", protected.ThenFunc(app.getComingSoon)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard/guestbook/customize", protected.ThenFunc(app.getComingSoon)) | 	mux.Handle("GET /websites/{id}/dashboard/guestbook/customize", protected.ThenFunc(app.getComingSoon)) | ||||||
|  | |||||||
| @ -34,3 +34,10 @@ type UserSettingsForm struct { | |||||||
| 	LocalTimezone       string `schema:"timezones"` | 	LocalTimezone       string `schema:"timezones"` | ||||||
| 	validator.Validator `schema:"-"` | 	validator.Validator `schema:"-"` | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | type GuestbookSettingsForm struct { | ||||||
|  | 	Visibility          string `schema:"gb_visible"` | ||||||
|  | 	CommentingEnabled   string `schema:"gb_commenting"` | ||||||
|  | 	WidgetsEnabled      string `schema:"gb_remote"` | ||||||
|  | 	validator.Validator `schema:"-"` | ||||||
|  | } | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ package models | |||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"database/sql" | 	"database/sql" | ||||||
|  | 	"errors" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| @ -14,6 +15,8 @@ type GuestbookSettings struct { | |||||||
| 	AllowRemoteHostAccess bool | 	AllowRemoteHostAccess bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | var ValidDisableDurations = []string{"true", "false", "1h", "4h", "8h", "24h", "72h", "168h"} | ||||||
|  | 
 | ||||||
| const ( | const ( | ||||||
| 	SettingGbCommentingEnabled = "commenting_enabled" | 	SettingGbCommentingEnabled = "commenting_enabled" | ||||||
| 	SettingGbReenableComments  = "reenable_comments" | 	SettingGbReenableComments  = "reenable_comments" | ||||||
| @ -33,6 +36,11 @@ type Guestbook struct { | |||||||
| 	Settings  GuestbookSettings | 	Settings  GuestbookSettings | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (g Guestbook) CanComment() bool { | ||||||
|  | 	now := time.Now().UTC() | ||||||
|  | 	return g.Settings.IsCommentingEnabled && g.Settings.ReenableCommenting.Before(now) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| type GuestbookModel struct { | type GuestbookModel struct { | ||||||
| 	DB       *sql.DB | 	DB       *sql.DB | ||||||
| 	Settings map[string]Setting | 	Settings map[string]Setting | ||||||
| @ -96,11 +104,19 @@ func (m *GuestbookModel) Get(shortId uint64) (Guestbook, error) { | |||||||
| 	var t sql.NullTime | 	var t sql.NullTime | ||||||
| 	err := row.Scan(&g.ID, &g.ShortId, &g.UserId, &g.WebsiteId, &g.Created, &t, &g.IsActive) | 	err := row.Scan(&g.ID, &g.ShortId, &g.UserId, &g.WebsiteId, &g.Created, &t, &g.IsActive) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  | 		if errors.Is(err, sql.ErrNoRows) { | ||||||
|  | 			return Guestbook{}, ErrNoRecord | ||||||
|  | 		} | ||||||
| 		return Guestbook{}, err | 		return Guestbook{}, err | ||||||
| 	} | 	} | ||||||
| 	if t.Valid { | 	if t.Valid { | ||||||
| 		g.Deleted = t.Time | 		g.Deleted = t.Time | ||||||
| 	} | 	} | ||||||
|  | 	settings, err := m.GetSettings(g.ID) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return g, err | ||||||
|  | 	} | ||||||
|  | 	g.Settings = settings | ||||||
| 	return g, nil | 	return g, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -126,6 +142,58 @@ func (m *GuestbookModel) GetAll(userId int64) ([]Guestbook, error) { | |||||||
| 	return guestbooks, nil | 	return guestbooks, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (m *GuestbookModel) GetSettings(guestbookId int64) (GuestbookSettings, error) { | ||||||
|  | 	stmt := `SELECT g.SettingId, a.ItemValue, g.UnconstrainedValue FROM guestbook_settings AS g | ||||||
|  | 			LEFT JOIN allowed_setting_values AS a ON g.AllowedSettingValueId = a.Id | ||||||
|  | 			WHERE GuestbookId = ?` | ||||||
|  | 	var settings GuestbookSettings | ||||||
|  | 	rows, err := m.DB.Query(stmt, guestbookId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return settings, err | ||||||
|  | 	} | ||||||
|  | 	for rows.Next() { | ||||||
|  | 		var id int | ||||||
|  | 		var itemValue sql.NullString | ||||||
|  | 		var unconstrainedValue sql.NullString | ||||||
|  | 		err = rows.Scan(&id, &itemValue, &unconstrainedValue) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return settings, err | ||||||
|  | 		} | ||||||
|  | 		switch id { | ||||||
|  | 		case m.Settings[SettingGbCommentingEnabled].id: | ||||||
|  | 			settings.IsCommentingEnabled, err = strconv.ParseBool(itemValue.String) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return settings, err | ||||||
|  | 			} | ||||||
|  | 			break | ||||||
|  | 		case m.Settings[SettingGbReenableComments].id: | ||||||
|  | 			settings.ReenableCommenting, err = time.Parse(time.RFC3339, unconstrainedValue.String) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return settings, err | ||||||
|  | 			} | ||||||
|  | 			break | ||||||
|  | 		case m.Settings[SettingGbVisible].id: | ||||||
|  | 			settings.IsVisible, err = strconv.ParseBool(itemValue.String) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return settings, err | ||||||
|  | 			} | ||||||
|  | 			break | ||||||
|  | 		case m.Settings[SettingGbAllowRemote].id: | ||||||
|  | 			settings.AllowRemoteHostAccess, err = strconv.ParseBool(itemValue.String) | ||||||
|  | 			if err != nil { | ||||||
|  | 				return settings, err | ||||||
|  | 			} | ||||||
|  | 			break | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	// if comment disable setting has expired, enable commenting | ||||||
|  | 	if time.Now().UTC().After(settings.ReenableCommenting) { | ||||||
|  | 		settings.IsCommentingEnabled = true | ||||||
|  | 		m.UpdateSetting(guestbookId, m.Settings[SettingGbCommentingEnabled], "true") | ||||||
|  | 	} | ||||||
|  | 	return settings, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (m *GuestbookModel) initializeGuestbookSettings(guestbookId int64, settings GuestbookSettings) error { | func (m *GuestbookModel) initializeGuestbookSettings(guestbookId int64, settings GuestbookSettings) error { | ||||||
| 	stmt := `INSERT INTO guestbook_settings (GuestbookId, SettingId, AllowedSettingValueId, UnconstrainedValue) VALUES  | 	stmt := `INSERT INTO guestbook_settings (GuestbookId, SettingId, AllowedSettingValueId, UnconstrainedValue) VALUES  | ||||||
| 	(?, ?, ?, ?), | 	(?, ?, ?, ?), | ||||||
| @ -145,11 +213,40 @@ func (m *GuestbookModel) initializeGuestbookSettings(guestbookId int64, settings | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookModel) UpdateGuestbookSettings(guestbookId int64, settings GuestbookSettings) error { | func (m *GuestbookModel) UpdateGuestbookSettings(guestbookId int64, settings GuestbookSettings) error { | ||||||
| 	err := m.UpdateSetting(guestbookId, m.Settings[SettingGbCommentingEnabled], strconv.FormatBool(settings.IsCommentingEnabled)) | 	err := m.UpdateSetting(guestbookId, m.Settings[SettingGbVisible], strconv.FormatBool(settings.IsVisible)) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	err = m.UpdateSetting(guestbookId, m.Settings[SettingGbReenableComments], settings.ReenableCommenting.String()) | 	err = m.UpdateSetting(guestbookId, m.Settings[SettingGbAllowRemote], strconv.FormatBool(settings.AllowRemoteHostAccess)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	err = m.UpdateSetting(guestbookId, m.Settings[SettingGbCommentingEnabled], strconv.FormatBool(settings.IsCommentingEnabled)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	err = m.UpdateSetting(guestbookId, m.Settings[SettingGbReenableComments], settings.ReenableCommenting.Format(time.RFC3339)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (m *GuestbookModel) InsertSetting(guestbookId int64, setting Setting, value string) error { | ||||||
|  | 	stmt := ` | ||||||
|  | INSERT INTO guestbook_settings (GuestbookId, SettingId, AllowedSettingValueId, UnconstrainedValue) | ||||||
|  | SELECT  ?,  | ||||||
|  |         settings.Id, | ||||||
|  |         (SELECT Id FROM allowed_setting_values WHERE SettingId = settings.id AND ItemValue = ?), | ||||||
|  |         CASE WHEN NOT EXISTS (SELECT 1 FROM settings AS s where s.Id = settings.Id AND s.Constrained = 1) THEN ? ELSE NULL END | ||||||
|  | FROM settings | ||||||
|  | WHERE settings.id = ? | ||||||
|  | 	` | ||||||
|  | 	result, err := m.DB.Exec(stmt, guestbookId, value, value, setting.id) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	_, err = result.LastInsertId() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -121,7 +121,7 @@ func (s *Setting) validateInt(value string) bool { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (s *Setting) validateDatetime(value string) bool { | func (s *Setting) validateDatetime(value string) bool { | ||||||
| 	v, err := time.Parse(time.DateTime, value) | 	v, err := time.Parse(time.RFC3339, value) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return false | 		return false | ||||||
| 	} | 	} | ||||||
| @ -129,7 +129,7 @@ func (s *Setting) validateDatetime(value string) bool { | |||||||
| 	var max time.Time | 	var max time.Time | ||||||
| 
 | 
 | ||||||
| 	if len(s.minValue) > 0 { | 	if len(s.minValue) > 0 { | ||||||
| 		min, err = time.Parse(time.DateTime, s.minValue) | 		min, err = time.Parse(time.RFC3339, s.minValue) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return false | 			return false | ||||||
| 		} | 		} | ||||||
| @ -138,7 +138,7 @@ func (s *Setting) validateDatetime(value string) bool { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if len(s.maxValue) > 0 { | 	if len(s.maxValue) > 0 { | ||||||
| 		max, err = time.Parse(time.DateTime, s.maxValue) | 		max, err = time.Parse(time.RFC3339, s.maxValue) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return false | 			return false | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -188,7 +188,7 @@ func (m *UserModel) Exists(id int64) (bool, error) { | |||||||
| 
 | 
 | ||||||
| func (m *UserModel) GetSettings(userId int64) (UserSettings, error) { | func (m *UserModel) GetSettings(userId int64) (UserSettings, error) { | ||||||
| 	stmt := `SELECT u.SettingId, a.ItemValue, u.UnconstrainedValue FROM user_settings AS u | 	stmt := `SELECT u.SettingId, a.ItemValue, u.UnconstrainedValue FROM user_settings AS u | ||||||
| 			LEFT JOIN allowed_setting_values AS a ON u.SettingId = a.SettingId | 			LEFT JOIN allowed_setting_values AS a ON u.AllowedSettingValueId = a.Id | ||||||
| 			WHERE UserId = ?` | 			WHERE UserId = ?` | ||||||
| 	var settings UserSettings | 	var settings UserSettings | ||||||
| 	rows, err := m.DB.Query(stmt, userId) | 	rows, err := m.DB.Query(stmt, userId) | ||||||
|  | |||||||
| @ -37,13 +37,13 @@ func (m *WebsiteModel) Insert(shortId uint64, userId int64, siteName, siteUrl, a | |||||||
| 
 | 
 | ||||||
| func (m *WebsiteModel) Get(shortId uint64) (Website, error) { | func (m *WebsiteModel) Get(shortId uint64) (Website, error) { | ||||||
| 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created, | 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created, | ||||||
| 	g.Id, g.ShortId, g.Created, g.IsActive | 	g.Id, g.ShortId | ||||||
| 	FROM websites AS w INNER JOIN guestbooks AS g ON w.Id = g.WebsiteId | 	FROM websites AS w INNER JOIN guestbooks AS g ON w.Id = g.WebsiteId | ||||||
| 	WHERE w.ShortId = ? AND w.DELETED IS NULL` | 	WHERE w.ShortId = ? AND w.DELETED IS NULL` | ||||||
| 	row := m.DB.QueryRow(stmt, shortId) | 	row := m.DB.QueryRow(stmt, shortId) | ||||||
| 	var w Website | 	var w Website | ||||||
| 	err := row.Scan(&w.ID, &w.ShortId, &w.Name, &w.SiteUrl, &w.AuthorName, &w.UserId, &w.Created, | 	err := row.Scan(&w.ID, &w.ShortId, &w.Name, &w.SiteUrl, &w.AuthorName, &w.UserId, &w.Created, | ||||||
| 		&w.Guestbook.ID, &w.Guestbook.ShortId, &w.Guestbook.Created, &w.Guestbook.IsActive) | 		&w.Guestbook.ID, &w.Guestbook.ShortId) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return Website{}, err | 		return Website{}, err | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -3,6 +3,7 @@ package views | |||||||
| import "fmt" | import "fmt" | ||||||
| import "git.32bit.cafe/32bitcafe/guestbook/internal/models" | import "git.32bit.cafe/32bitcafe/guestbook/internal/models" | ||||||
| import "git.32bit.cafe/32bitcafe/guestbook/internal/forms" | import "git.32bit.cafe/32bitcafe/guestbook/internal/forms" | ||||||
|  | import "time" | ||||||
| 
 | 
 | ||||||
| templ GuestbookDashboardCommentsView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment) { | templ GuestbookDashboardCommentsView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment) { | ||||||
| 	@base(title, data) { | 	@base(title, data) { | ||||||
| @ -150,8 +151,13 @@ templ CreateGuestbookComment(title string, data CommonData, website models.Websi | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | templ settingRadio(selected bool, name, id, value string) { | ||||||
|  | 	<input type="radio" name={ name } id={ id } value={ value } selected?={ selected }/> | ||||||
|  | } | ||||||
|  | 
 | ||||||
| templ GuestbookSettingsView(data CommonData, website models.Website) { | templ GuestbookSettingsView(data CommonData, website models.Website) { | ||||||
| 	{{ putUrl := fmt.Sprintf("/websites/%s/dashboard/guestbook/settings", shortIdToSlug(website.ShortId)) }} | 	{{ putUrl := fmt.Sprintf("/websites/%s/dashboard/guestbook/settings", shortIdToSlug(website.ShortId)) }} | ||||||
|  | 	{{ gb := website.Guestbook }} | ||||||
| 	@base("Guestbook Settings", data) { | 	@base("Guestbook Settings", data) { | ||||||
| 		<div id="dashboard"> | 		<div id="dashboard"> | ||||||
| 			@wSidebar(website) | 			@wSidebar(website) | ||||||
| @ -162,36 +168,39 @@ templ GuestbookSettingsView(data CommonData, website models.Website) { | |||||||
| 					<div> | 					<div> | ||||||
| 						<label>Guestbook Visibility</label> | 						<label>Guestbook Visibility</label> | ||||||
| 						<label for="gb_visible_true"> | 						<label for="gb_visible_true"> | ||||||
| 							<input type="radio" name="gb_visible" id="gb_visible_true"/> | 							<input type="radio" name="gb_visible" id="gb_visible_true" value="true" checked?={ gb.Settings.IsVisible }/> | ||||||
| 							Public | 							Public | ||||||
| 						</label> | 						</label> | ||||||
| 						<label for="gb_visible_false"> | 						<label for="gb_visible_false"> | ||||||
| 							<input type="radio" name="gb_visible" id="gb_visible_false"/> | 							<input type="radio" name="gb_visible" id="gb_visible_false" value="false" checked?={ !gb.Settings.IsVisible }/> | ||||||
| 							Private | 							Private | ||||||
| 						</label> | 						</label> | ||||||
| 					</div> | 					</div> | ||||||
| 					<div> | 					<div> | ||||||
| 						<label>Guestbook Commenting</label> | 						<label>Guestbook Commenting</label> | ||||||
| 						<select name="gb_commenting" id="gb-commenting"> | 						<select name="gb_commenting" id="gb-commenting"> | ||||||
| 							<option value="true">Enabled</option> | 							<option value="true" selected?={ gb.Settings.IsCommentingEnabled }>Enabled</option> | ||||||
| 							<option value="1h">Disabled for 1 Hour</option> | 							<option value="1h">Disabled for 1 Hour</option> | ||||||
| 							<option value="4h">Disabled for 4 Hours</option> | 							<option value="4h">Disabled for 4 Hours</option> | ||||||
| 							<option value="8h">Disabled for 8 Hours</option> | 							<option value="8h">Disabled for 8 Hours</option> | ||||||
| 							<option value="1d">Disabled for 1 Day</option> | 							<option value="24h">Disabled for 1 Day</option> | ||||||
| 							<option value="3d">Disabled for 3 Days</option> | 							<option value="72h">Disabled for 3 Days</option> | ||||||
| 							<option value="7d">Disabled for 7 Days</option> | 							<option value="168h">Disabled for 7 Days</option> | ||||||
| 							<option value="false">Disabled Indefinitely</option> | 							<option value="false" selected?={ !gb.Settings.IsCommentingEnabled }>Disabled</option> | ||||||
| 						</select> | 						</select> | ||||||
| 						<label>Commenting re-enabled at <datetime value="">sometime in the future</datetime></label> | 						if !website.Guestbook.CanComment() { | ||||||
|  | 							{{ localtime := gb.Settings.ReenableCommenting.In(data.CurrentUser.Settings.LocalTimezone) }} | ||||||
|  | 							<label>Commenting re-enabled on <time value={ localtime.Format(time.RFC3339) }>{ localtime.Format("2 January 2006") } at { localtime.Format("3:04PM MST") }</time></label> | ||||||
|  | 						} | ||||||
| 					</div> | 					</div> | ||||||
| 					<div> | 					<div> | ||||||
| 						<label>Enable Widgets</label> | 						<label>Enable Widgets</label> | ||||||
| 						<label for="gb_remote_true"> | 						<label for="gb_remote_true"> | ||||||
| 							<input type="radio" name="gb_remote" id="gb_remote_true"/> | 							<input type="radio" name="gb_remote" id="gb_remote_true" value="true" checked?={ gb.Settings.AllowRemoteHostAccess }/> | ||||||
| 							Yes | 							Yes | ||||||
| 						</label> | 						</label> | ||||||
| 						<label for="gb_commenting_false"> | 						<label for="gb_remote_false"> | ||||||
| 							<input type="radio" name="gb_remote" id="gb_remote_false"/> | 							<input type="radio" name="gb_remote" id="gb_remote_false" value="false" checked?={ !gb.Settings.AllowRemoteHostAccess }/> | ||||||
| 							No | 							No | ||||||
| 						</label> | 						</label> | ||||||
| 					</div> | 					</div> | ||||||
|  | |||||||
| @ -11,6 +11,7 @@ import templruntime "github.com/a-h/templ/runtime" | |||||||
| import "fmt" | import "fmt" | ||||||
| import "git.32bit.cafe/32bitcafe/guestbook/internal/models" | import "git.32bit.cafe/32bitcafe/guestbook/internal/models" | ||||||
| import "git.32bit.cafe/32bitcafe/guestbook/internal/forms" | import "git.32bit.cafe/32bitcafe/guestbook/internal/forms" | ||||||
|  | import "time" | ||||||
| 
 | 
 | ||||||
| func GuestbookDashboardCommentsView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment) templ.Component { | func GuestbookDashboardCommentsView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment) templ.Component { | ||||||
| 	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | 	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | ||||||
| @ -60,7 +61,7 @@ func GuestbookDashboardCommentsView(title string, data CommonData, website model | |||||||
| 			var templ_7745c5c3_Var3 string | 			var templ_7745c5c3_Var3 string | ||||||
| 			templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(website.SiteUrl) | 			templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(website.SiteUrl) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 12, Col: 37} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 13, Col: 37} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -131,7 +132,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 			var templ_7745c5c3_Var5 string | 			var templ_7745c5c3_Var5 string | ||||||
| 			templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(commentUrl) | 			templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(commentUrl) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 31, Col: 49} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 32, Col: 49} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -144,7 +145,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 			var templ_7745c5c3_Var6 string | 			var templ_7745c5c3_Var6 string | ||||||
| 			templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxHeaders) | 			templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxHeaders) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 31, Col: 106} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 32, Col: 106} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -157,7 +158,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 			var templ_7745c5c3_Var7 string | 			var templ_7745c5c3_Var7 string | ||||||
| 			templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(commentUrl) | 			templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(commentUrl) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 32, Col: 47} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 33, Col: 47} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -170,7 +171,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 			var templ_7745c5c3_Var8 string | 			var templ_7745c5c3_Var8 string | ||||||
| 			templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxHeaders) | 			templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxHeaders) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 32, Col: 104} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 33, Col: 104} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -203,7 +204,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 		var templ_7745c5c3_Var9 string | 		var templ_7745c5c3_Var9 string | ||||||
| 		templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) | 		templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 42, Col: 25} | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 43, Col: 25} | ||||||
| 		} | 		} | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| @ -231,7 +232,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 			var templ_7745c5c3_Var11 string | 			var templ_7745c5c3_Var11 string | ||||||
| 			templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorEmail) | 			templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorEmail) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 45, Col: 66} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 46, Col: 66} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -259,7 +260,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 			var templ_7745c5c3_Var13 string | 			var templ_7745c5c3_Var13 string | ||||||
| 			templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorSite) | 			templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorSite) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 48, Col: 85} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 49, Col: 85} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -277,7 +278,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 		var templ_7745c5c3_Var14 string | 		var templ_7745c5c3_Var14 string | ||||||
| 		templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.In(data.CurrentUser.Settings.LocalTimezone).Format("01-02-2006 03:04PM")) | 		templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.In(data.CurrentUser.Settings.LocalTimezone).Format("01-02-2006 03:04PM")) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 51, Col: 88} | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 52, Col: 88} | ||||||
| 		} | 		} | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| @ -290,7 +291,7 @@ func GuestbookDashboardCommentView(data CommonData, w models.Website, c models.G | |||||||
| 		var templ_7745c5c3_Var15 string | 		var templ_7745c5c3_Var15 string | ||||||
| 		templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) | 		templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 55, Col: 18} | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 56, Col: 18} | ||||||
| 		} | 		} | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| @ -338,7 +339,7 @@ func commentForm(form forms.CommentCreateForm) templ.Component { | |||||||
| 			var templ_7745c5c3_Var17 string | 			var templ_7745c5c3_Var17 string | ||||||
| 			templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(error) | 			templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(error) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 66, Col: 31} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 67, Col: 31} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -362,7 +363,7 @@ func commentForm(form forms.CommentCreateForm) templ.Component { | |||||||
| 			var templ_7745c5c3_Var18 string | 			var templ_7745c5c3_Var18 string | ||||||
| 			templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(error) | 			templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(error) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 74, Col: 31} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 75, Col: 31} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -386,7 +387,7 @@ func commentForm(form forms.CommentCreateForm) templ.Component { | |||||||
| 			var templ_7745c5c3_Var19 string | 			var templ_7745c5c3_Var19 string | ||||||
| 			templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(error) | 			templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(error) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 82, Col: 31} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 83, Col: 31} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -410,7 +411,7 @@ func commentForm(form forms.CommentCreateForm) templ.Component { | |||||||
| 			var templ_7745c5c3_Var20 string | 			var templ_7745c5c3_Var20 string | ||||||
| 			templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(error) | 			templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(error) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 90, Col: 31} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 91, Col: 31} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -464,7 +465,7 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb | |||||||
| 			var templ_7745c5c3_Var22 string | 			var templ_7745c5c3_Var22 string | ||||||
| 			templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(title) | 			templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(title) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 106, Col: 18} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 107, Col: 18} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -477,7 +478,7 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb | |||||||
| 			var templ_7745c5c3_Var23 string | 			var templ_7745c5c3_Var23 string | ||||||
| 			templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) | 			templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 112, Col: 38} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 113, Col: 38} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -499,7 +500,7 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb | |||||||
| 			var templ_7745c5c3_Var25 string | 			var templ_7745c5c3_Var25 string | ||||||
| 			templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(data.CSRFToken) | 			templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(data.CSRFToken) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 114, Col: 68} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 115, Col: 68} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -531,7 +532,7 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb | |||||||
| 				var templ_7745c5c3_Var26 string | 				var templ_7745c5c3_Var26 string | ||||||
| 				templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) | 				templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(c.AuthorName) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 124, Col: 26} | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 125, Col: 26} | ||||||
| 				} | 				} | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| @ -544,7 +545,7 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb | |||||||
| 				var templ_7745c5c3_Var27 string | 				var templ_7745c5c3_Var27 string | ||||||
| 				templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.Format("01-02-2006 03:04PM")) | 				templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(c.Created.Format("01-02-2006 03:04PM")) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 125, Col: 48} | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 126, Col: 48} | ||||||
| 				} | 				} | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| @ -557,7 +558,7 @@ func GuestbookView(title string, data CommonData, website models.Website, guestb | |||||||
| 				var templ_7745c5c3_Var28 string | 				var templ_7745c5c3_Var28 string | ||||||
| 				templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) | 				templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(c.CommentText) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 127, Col: 24} | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 128, Col: 24} | ||||||
| 				} | 				} | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| @ -607,7 +608,7 @@ func CreateGuestbookComment(title string, data CommonData, website models.Websit | |||||||
| 			var templ_7745c5c3_Var30 string | 			var templ_7745c5c3_Var30 string | ||||||
| 			templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(postUrl) | 			templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(postUrl) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 141, Col: 25} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 142, Col: 25} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -670,7 +671,7 @@ func CreateGuestbookComment(title string, data CommonData, website models.Websit | |||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func GuestbookSettingsView(data CommonData, website models.Website) templ.Component { | func settingRadio(selected bool, name, id, value string) templ.Component { | ||||||
| 	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | 	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 | 		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context | ||||||
| 		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { | 		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { | ||||||
| @ -691,8 +692,87 @@ func GuestbookSettingsView(data CommonData, website models.Website) templ.Compon | |||||||
| 			templ_7745c5c3_Var33 = templ.NopComponent | 			templ_7745c5c3_Var33 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
|  | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "<input type=\"radio\" name=\"") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		var templ_7745c5c3_Var34 string | ||||||
|  | 		templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(name) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 155, Col: 32} | ||||||
|  | 		} | ||||||
|  | 		_, 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, 58, "\" id=\"") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		var templ_7745c5c3_Var35 string | ||||||
|  | 		templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(id) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 155, Col: 42} | ||||||
|  | 		} | ||||||
|  | 		_, 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, 59, "\" value=\"") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		var templ_7745c5c3_Var36 string | ||||||
|  | 		templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(value) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 155, Col: 58} | ||||||
|  | 		} | ||||||
|  | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "\"") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		if selected { | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, " selected") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, ">") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		return nil | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func GuestbookSettingsView(data CommonData, website models.Website) 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_Var37 := templ.GetChildren(ctx) | ||||||
|  | 		if templ_7745c5c3_Var37 == nil { | ||||||
|  | 			templ_7745c5c3_Var37 = templ.NopComponent | ||||||
|  | 		} | ||||||
|  | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		putUrl := fmt.Sprintf("/websites/%s/dashboard/guestbook/settings", shortIdToSlug(website.ShortId)) | 		putUrl := fmt.Sprintf("/websites/%s/dashboard/guestbook/settings", shortIdToSlug(website.ShortId)) | ||||||
| 		templ_7745c5c3_Var34 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | 		gb := website.Guestbook | ||||||
|  | 		templ_7745c5c3_Var38 := 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_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context | ||||||
| 			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | 			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | ||||||
| 			if !templ_7745c5c3_IsBuffer { | 			if !templ_7745c5c3_IsBuffer { | ||||||
| @ -704,7 +784,7 @@ func GuestbookSettingsView(data CommonData, website models.Website) templ.Compon | |||||||
| 				}() | 				}() | ||||||
| 			} | 			} | ||||||
| 			ctx = templ.InitializeContext(ctx) | 			ctx = templ.InitializeContext(ctx) | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "<div id=\"dashboard\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "<div id=\"dashboard\">") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -712,39 +792,149 @@ func GuestbookSettingsView(data CommonData, website models.Website) templ.Compon | |||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "<div><h1>Guestbook Settings</h1><form hx-put=\"") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "<div><h1>Guestbook Settings</h1><form hx-put=\"") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			var templ_7745c5c3_Var35 string | 			var templ_7745c5c3_Var39 string | ||||||
| 			templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(putUrl) | 			templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(putUrl) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 160, Col: 25} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 166, Col: 25} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "\"><input type=\"hidden\" name=\"csrf_token\" value=\"") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\"><input type=\"hidden\" name=\"csrf_token\" value=\"") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			var templ_7745c5c3_Var36 string | 			var templ_7745c5c3_Var40 string | ||||||
| 			templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(data.CSRFToken) | 			templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(data.CSRFToken) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 161, Col: 66} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 167, Col: 66} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "\"><div><label>Guestbook Visibility</label> <label for=\"gb_visible_true\"><input type=\"radio\" name=\"gb_visible\" id=\"gb_visible_true\"> Public</label> <label for=\"gb_visible_false\"><input type=\"radio\" name=\"gb_visible\" id=\"gb_visible_false\"> Private</label></div><div><label>Guestbook Commenting</label> <select name=\"gb_commenting\" id=\"gb-commenting\"><option value=\"true\">Enabled</option> <option value=\"1h\">Disabled for 1 Hour</option> <option value=\"4h\">Disabled for 4 Hours</option> <option value=\"8h\">Disabled for 8 Hours</option> <option value=\"1d\">Disabled for 1 Day</option> <option value=\"3d\">Disabled for 3 Days</option> <option value=\"7d\">Disabled for 7 Days</option> <option value=\"false\">Disabled Indefinitely</option></select> <label>Commenting re-enabled at <datetime value=\"\">sometime in the future</datetime></label></div><div><label>Enable Widgets</label> <label for=\"gb_remote_true\"><input type=\"radio\" name=\"gb_remote\" id=\"gb_remote_true\"> Yes</label> <label for=\"gb_commenting_false\"><input type=\"radio\" name=\"gb_remote\" id=\"gb_remote_false\"> No</label></div><input type=\"submit\" value=\"Submit\"></form></div></div>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\"><div><label>Guestbook Visibility</label> <label for=\"gb_visible_true\"><input type=\"radio\" name=\"gb_visible\" id=\"gb_visible_true\" value=\"true\"") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if gb.Settings.IsVisible { | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, " checked") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "> Public</label> <label for=\"gb_visible_false\"><input type=\"radio\" name=\"gb_visible\" id=\"gb_visible_false\" value=\"false\"") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if !gb.Settings.IsVisible { | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, " checked") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "> Private</label></div><div><label>Guestbook Commenting</label> <select name=\"gb_commenting\" id=\"gb-commenting\"><option value=\"true\"") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if gb.Settings.IsCommentingEnabled { | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, " selected") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, ">Enabled</option> <option value=\"1h\">Disabled for 1 Hour</option> <option value=\"4h\">Disabled for 4 Hours</option> <option value=\"8h\">Disabled for 8 Hours</option> <option value=\"24h\">Disabled for 1 Day</option> <option value=\"72h\">Disabled for 3 Days</option> <option value=\"168h\">Disabled for 7 Days</option> <option value=\"false\"") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if !gb.Settings.IsCommentingEnabled { | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, " selected") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, ">Disabled</option></select> ") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if !website.Guestbook.CanComment() { | ||||||
|  | 				localtime := gb.Settings.ReenableCommenting.In(data.CurrentUser.Settings.LocalTimezone) | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "<label>Commenting re-enabled on <time value=\"") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 				var templ_7745c5c3_Var41 string | ||||||
|  | 				templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(localtime.Format(time.RFC3339)) | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 193, Col: 83} | ||||||
|  | 				} | ||||||
|  | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "\">") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 				var templ_7745c5c3_Var42 string | ||||||
|  | 				templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(localtime.Format("2 January 2006")) | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 193, Col: 122} | ||||||
|  | 				} | ||||||
|  | 				_, 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, 77, " at ") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 				var templ_7745c5c3_Var43 string | ||||||
|  | 				templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(localtime.Format("3:04PM MST")) | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 193, Col: 160} | ||||||
|  | 				} | ||||||
|  | 				_, 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, 78, "</time></label>") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "</div><div><label>Enable Widgets</label> <label for=\"gb_remote_true\"><input type=\"radio\" name=\"gb_remote\" id=\"gb_remote_true\" value=\"true\"") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if gb.Settings.AllowRemoteHostAccess { | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, " checked") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "> Yes</label> <label for=\"gb_remote_false\"><input type=\"radio\" name=\"gb_remote\" id=\"gb_remote_false\" value=\"false\"") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			if !gb.Settings.AllowRemoteHostAccess { | ||||||
|  | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, " checked") | ||||||
|  | 				if templ_7745c5c3_Err != nil { | ||||||
|  | 					return templ_7745c5c3_Err | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "> No</label></div><input type=\"submit\" value=\"Submit\"></form></div></div>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			return nil | 			return nil | ||||||
| 		}) | 		}) | ||||||
| 		templ_7745c5c3_Err = base("Guestbook Settings", data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var34), templ_7745c5c3_Buffer) | 		templ_7745c5c3_Err = base("Guestbook Settings", data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var38), templ_7745c5c3_Buffer) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| @ -768,12 +958,12 @@ func AllGuestbooksView(data CommonData, websites []models.Website) templ.Compone | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var37 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var44 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var37 == nil { | 		if templ_7745c5c3_Var44 == nil { | ||||||
| 			templ_7745c5c3_Var37 = templ.NopComponent | 			templ_7745c5c3_Var44 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		templ_7745c5c3_Var38 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | 		templ_7745c5c3_Var45 := 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_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context | ||||||
| 			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | 			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | ||||||
| 			if !templ_7745c5c3_IsBuffer { | 			if !templ_7745c5c3_IsBuffer { | ||||||
| @ -785,50 +975,50 @@ func AllGuestbooksView(data CommonData, websites []models.Website) templ.Compone | |||||||
| 				}() | 				}() | ||||||
| 			} | 			} | ||||||
| 			ctx = templ.InitializeContext(ctx) | 			ctx = templ.InitializeContext(ctx) | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "<div><h1>All Guestbooks</h1><p>This page exists only for testing the service.</p><ul>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "<div><h1>All Guestbooks</h1><p>This page exists only for testing the service.</p><ul>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			for _, w := range websites { | 			for _, w := range websites { | ||||||
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "<li>") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "<li>") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				gbUrl := fmt.Sprintf("/websites/%s/guestbook", shortIdToSlug(w.ShortId)) | 				gbUrl := fmt.Sprintf("/websites/%s/guestbook", shortIdToSlug(w.ShortId)) | ||||||
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "<a href=\"") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "<a href=\"") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				var templ_7745c5c3_Var39 templ.SafeURL = templ.URL(gbUrl) | 				var templ_7745c5c3_Var46 templ.SafeURL = templ.URL(gbUrl) | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var39))) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var46))) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "\" target=\"_blank\">") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "\" target=\"_blank\">") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				var templ_7745c5c3_Var40 string | 				var templ_7745c5c3_Var47 string | ||||||
| 				templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(w.Name) | 				templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(w.Name) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 216, Col: 59} | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/guestbooks.templ`, Line: 225, Col: 59} | ||||||
| 				} | 				} | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</a></li>") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "</a></li>") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</ul></div>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "</ul></div>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			return nil | 			return nil | ||||||
| 		}) | 		}) | ||||||
| 		templ_7745c5c3_Err = base("All Guestbooks", data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var38), templ_7745c5c3_Buffer) | 		templ_7745c5c3_Err = base("All Guestbooks", data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var45), templ_7745c5c3_Buffer) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user