14-cleanup #15
| @ -13,3 +13,7 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) { | |||||||
| 	} | 	} | ||||||
| 	views.Home("Home", app.newCommonData(r)).Render(r.Context(), w) | 	views.Home("Home", app.newCommonData(r)).Render(r.Context(), w) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (app *application) notImplemented(w http.ResponseWriter, r *http.Request) { | ||||||
|  | 	views.ComingSoon("Coming Soon", app.newCommonData(r)).Render(r.Context(), w) | ||||||
|  | } | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"git.32bit.cafe/32bitcafe/guestbook/internal/forms" | 	"git.32bit.cafe/32bitcafe/guestbook/internal/forms" | ||||||
| 	"git.32bit.cafe/32bitcafe/guestbook/internal/models" | 	"git.32bit.cafe/32bitcafe/guestbook/internal/models" | ||||||
| @ -11,17 +12,6 @@ import ( | |||||||
| 	"git.32bit.cafe/32bitcafe/guestbook/ui/views" | 	"git.32bit.cafe/32bitcafe/guestbook/ui/views" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func (app *application) getGuestbookList(w http.ResponseWriter, r *http.Request) { |  | ||||||
| 	userId := app.sessionManager.GetInt64(r.Context(), "authenticatedUserId") |  | ||||||
| 	guestbooks, err := app.guestbooks.GetAll(userId) |  | ||||||
| 	if err != nil { |  | ||||||
| 		app.serverError(w, r, err) |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| 	data := app.newCommonData(r) |  | ||||||
| 	views.GuestbookList("Guestbooks", data, guestbooks).Render(r.Context(), w) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (app *application) getGuestbook(w http.ResponseWriter, r *http.Request) { | func (app *application) getGuestbook(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)) | ||||||
| @ -128,15 +118,6 @@ func (app *application) postGuestbookCommentCreate(w http.ResponseWriter, r *htt | |||||||
| 	http.Redirect(w, r, fmt.Sprintf("/websites/%s/guestbook", slug), http.StatusSeeOther) | 	http.Redirect(w, r, fmt.Sprintf("/websites/%s/guestbook", slug), http.StatusSeeOther) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (app *application) updateGuestbookComment(w http.ResponseWriter, r *http.Request) { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (app *application) deleteGuestbookComment(w http.ResponseWriter, r *http.Request) { |  | ||||||
| 	// slug := r.PathValue("id") |  | ||||||
| 	// shortId := slugToShortId(slug) |  | ||||||
| 	// app.guestbookComments.Delete(shortId) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (app *application) getCommentQueue(w http.ResponseWriter, r *http.Request) { | func (app *application) getCommentQueue(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)) | ||||||
| @ -149,7 +130,7 @@ func (app *application) getCommentQueue(w http.ResponseWriter, r *http.Request) | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	comments, err := app.guestbookComments.GetQueue(website.Guestbook.ID) | 	comments, err := app.guestbookComments.GetUnpublished(website.Guestbook.ID) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		if errors.Is(err, models.ErrNoRecord) { | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
| 			http.NotFound(w, r) | 			http.NotFound(w, r) | ||||||
| @ -163,9 +144,104 @@ func (app *application) getCommentQueue(w http.ResponseWriter, r *http.Request) | |||||||
| 	views.GuestbookDashboardCommentsView("Message Queue", data, website, website.Guestbook, comments).Render(r.Context(), w) | 	views.GuestbookDashboardCommentsView("Message Queue", data, website, website.Guestbook, comments).Render(r.Context(), w) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (app *application) getCommentTrash(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) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	comments, err := app.guestbookComments.GetDeleted(website.Guestbook.ID) | ||||||
|  | 	if err != nil { | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	data := app.newCommonData(r) | ||||||
|  | 	views.GuestbookDashboardCommentsView("Trash", data, website, website.Guestbook, comments).Render(r.Context(), w) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (app *application) putHideGuestbookComment(w http.ResponseWriter, r *http.Request) { | func (app *application) putHideGuestbookComment(w http.ResponseWriter, r *http.Request) { | ||||||
| 
 | 	user := app.getCurrentUser(r) | ||||||
|  | 	wSlug := r.PathValue("id") | ||||||
|  | 	website, err := app.websites.Get(slugToShortId(wSlug)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.logger.Info("website 404") | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if user.ID != website.UserId { | ||||||
|  | 		app.clientError(w, http.StatusUnauthorized) | ||||||
|  | 	} | ||||||
|  | 	cSlug := r.PathValue("commentId") | ||||||
|  | 	comment, err := app.guestbookComments.Get(slugToShortId(cSlug)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.logger.Info("comment 404") | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	comment.IsPublished = !comment.IsPublished | ||||||
|  | 	err = app.guestbookComments.UpdateComment(&comment) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (app *application) putDeleteGuestbookComment(w http.ResponseWriter, r *http.Request) { | func (app *application) deleteGuestbookComment(w http.ResponseWriter, r *http.Request) { | ||||||
|  | 	user := app.getCurrentUser(r) | ||||||
|  | 	wSlug := r.PathValue("id") | ||||||
|  | 	website, err := app.websites.Get(slugToShortId(wSlug)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.logger.Info("website 404") | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if user.ID != website.UserId { | ||||||
|  | 		app.clientError(w, http.StatusUnauthorized) | ||||||
|  | 	} | ||||||
|  | 	cSlug := r.PathValue("commentId") | ||||||
|  | 	comment, err := app.guestbookComments.Get(slugToShortId(cSlug)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.logger.Info("comment 404") | ||||||
|  | 		if errors.Is(err, models.ErrNoRecord) { | ||||||
|  | 			http.NotFound(w, r) | ||||||
|  | 		} else { | ||||||
|  | 			app.serverError(w, r, err) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	comment.Deleted = time.Now().UTC() | ||||||
|  | 	err = app.guestbookComments.UpdateComment(&comment) | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (app *application) getAllGuestbooks(w http.ResponseWriter, r *http.Request) { | ||||||
|  | 	websites, err := app.websites.GetAll() | ||||||
|  | 	if err != nil { | ||||||
|  | 		app.serverError(w, r, err) | ||||||
|  | 	} | ||||||
|  | 	views.AllGuestbooksView(app.newCommonData(r), websites).Render(r.Context(), w) | ||||||
| } | } | ||||||
|  | |||||||
| @ -82,11 +82,32 @@ func (app *application) getWebsiteDashboard(w http.ResponseWriter, r *http.Reque | |||||||
| func (app *application) getWebsiteList(w http.ResponseWriter, r *http.Request) { | func (app *application) getWebsiteList(w http.ResponseWriter, r *http.Request) { | ||||||
| 
 | 
 | ||||||
| 	userId := app.sessionManager.GetInt64(r.Context(), "authenticatedUserId") | 	userId := app.sessionManager.GetInt64(r.Context(), "authenticatedUserId") | ||||||
| 	websites, err := app.websites.GetAll(userId) | 	websites, err := app.websites.GetAllUser(userId) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		app.serverError(w, r, err) | 		app.serverError(w, r, err) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	if r.Header.Get("HX-Request") == "true" { | ||||||
|  | 		w.Header().Add("HX-Trigger", "newWebsite") | ||||||
|  | 	} | ||||||
| 	data := app.newCommonData(r) | 	data := app.newCommonData(r) | ||||||
| 	views.WebsiteList("My Websites", data, websites).Render(r.Context(), w) | 	views.WebsiteList("My Websites", data, websites).Render(r.Context(), w) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (app *application) getComingSoon(w http.ResponseWriter, r *http.Request) { | ||||||
|  | 	slug := r.PathValue("id") | ||||||
|  | 	user := app.getCurrentUser(r) | ||||||
|  | 	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) | ||||||
|  | 		} | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if website.UserId != user.ID { | ||||||
|  | 		app.clientError(w, http.StatusForbidden) | ||||||
|  | 	} | ||||||
|  | 	views.WebsiteDashboardComingSoon("Coming Soon", app.newCommonData(r), website).Render(r.Context(), w) | ||||||
|  | } | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"math" | 	"math" | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | 	"runtime/debug" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| @ -21,6 +22,10 @@ func (app *application) serverError(w http.ResponseWriter, r *http.Request, err | |||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	app.logger.Error(err.Error(), "method", method, "uri", uri) | 	app.logger.Error(err.Error(), "method", method, "uri", uri) | ||||||
|  | 	if app.debug { | ||||||
|  | 		http.Error(w, string(debug.Stack()), http.StatusInternalServerError) | ||||||
|  | 		app.logger.Error(err.Error(), "method", method, "uri", uri, "stack", string(debug.Stack())) | ||||||
|  | 	} | ||||||
| 	http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) | 	http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -25,11 +25,13 @@ type application struct { | |||||||
| 	guestbookComments *models.GuestbookCommentModel | 	guestbookComments *models.GuestbookCommentModel | ||||||
| 	sessionManager    *scs.SessionManager | 	sessionManager    *scs.SessionManager | ||||||
| 	formDecoder       *schema.Decoder | 	formDecoder       *schema.Decoder | ||||||
|  | 	debug             bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func main() { | func main() { | ||||||
| 	addr := flag.String("addr", ":3000", "HTTP network address") | 	addr := flag.String("addr", ":3000", "HTTP network address") | ||||||
| 	dsn := flag.String("dsn", "guestbook.db", "data source name") | 	dsn := flag.String("dsn", "guestbook.db", "data source name") | ||||||
|  | 	debug := flag.Bool("debug", false, "enable debug mode") | ||||||
| 	flag.Parse() | 	flag.Parse() | ||||||
| 
 | 
 | ||||||
| 	logger := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug})) | 	logger := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug})) | ||||||
| @ -57,6 +59,7 @@ func main() { | |||||||
| 		users:             &models.UserModel{DB: db}, | 		users:             &models.UserModel{DB: db}, | ||||||
| 		guestbookComments: &models.GuestbookCommentModel{DB: db}, | 		guestbookComments: &models.GuestbookCommentModel{DB: db}, | ||||||
| 		formDecoder:       formDecoder, | 		formDecoder:       formDecoder, | ||||||
|  | 		debug:             *debug, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	tlsConfig := &tls.Config{ | 	tlsConfig := &tls.Config{ | ||||||
|  | |||||||
| @ -21,18 +21,29 @@ func (app *application) routes() http.Handler { | |||||||
| 	mux.Handle("POST /users/register", dynamic.ThenFunc(app.postUserRegister)) | 	mux.Handle("POST /users/register", dynamic.ThenFunc(app.postUserRegister)) | ||||||
| 	mux.Handle("GET /users/login", dynamic.ThenFunc(app.getUserLogin)) | 	mux.Handle("GET /users/login", dynamic.ThenFunc(app.getUserLogin)) | ||||||
| 	mux.Handle("POST /users/login", dynamic.ThenFunc(app.postUserLogin)) | 	mux.Handle("POST /users/login", dynamic.ThenFunc(app.postUserLogin)) | ||||||
|  | 	mux.Handle("GET /help", dynamic.ThenFunc(app.notImplemented)) | ||||||
| 
 | 
 | ||||||
| 	protected := dynamic.Append(app.requireAuthentication) | 	protected := dynamic.Append(app.requireAuthentication) | ||||||
| 
 | 
 | ||||||
| 	// mux.Handle("GET /users", protected.ThenFunc(app.getUsersList)) | 	// mux.Handle("GET /users", protected.ThenFunc(app.getUsersList)) | ||||||
| 	mux.Handle("GET /users/{id}", protected.ThenFunc(app.getUser)) | 	mux.Handle("GET /users/{id}", protected.ThenFunc(app.getUser)) | ||||||
| 	mux.Handle("POST /users/logout", protected.ThenFunc(app.postUserLogout)) | 	mux.Handle("POST /users/logout", protected.ThenFunc(app.postUserLogout)) | ||||||
|  | 	mux.Handle("GET /users/settings", protected.ThenFunc(app.notImplemented)) | ||||||
|  | 	mux.Handle("GET /users/privacy", protected.ThenFunc(app.notImplemented)) | ||||||
|  | 	mux.Handle("GET /guestbooks", protected.ThenFunc(app.getAllGuestbooks)) | ||||||
|  | 
 | ||||||
| 	mux.Handle("GET /websites", protected.ThenFunc(app.getWebsiteList)) | 	mux.Handle("GET /websites", protected.ThenFunc(app.getWebsiteList)) | ||||||
| 	mux.Handle("GET /websites/create", protected.ThenFunc(app.getWebsiteCreate)) | 	mux.Handle("GET /websites/create", protected.ThenFunc(app.getWebsiteCreate)) | ||||||
| 	mux.Handle("POST /websites/create", protected.ThenFunc(app.postWebsiteCreate)) | 	mux.Handle("POST /websites/create", protected.ThenFunc(app.postWebsiteCreate)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard", protected.ThenFunc(app.getWebsiteDashboard)) | 	mux.Handle("GET /websites/{id}/dashboard", protected.ThenFunc(app.getWebsiteDashboard)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard/guestbook/comments", protected.ThenFunc(app.getGuestbookComments)) | 	mux.Handle("GET /websites/{id}/dashboard/guestbook/comments", protected.ThenFunc(app.getGuestbookComments)) | ||||||
| 	mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/queue", protected.ThenFunc(app.getCommentQueue)) | 	mux.Handle("GET /websites/{id}/dashboard/guestbook/comments/queue", protected.ThenFunc(app.getCommentQueue)) | ||||||
|  | 	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("GET /websites/{id}/dashboard/guestbook/blocklist", protected.ThenFunc(app.getComingSoon)) | ||||||
|  | 	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/customize", protected.ThenFunc(app.getComingSoon)) | ||||||
| 	mux.Handle("GET /websites/{id}/guestbook/comments/create", protected.ThenFunc(app.getGuestbookCommentCreate)) | 	mux.Handle("GET /websites/{id}/guestbook/comments/create", protected.ThenFunc(app.getGuestbookCommentCreate)) | ||||||
| 
 | 
 | ||||||
| 	return standard.Then(mux) | 	return standard.Then(mux) | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ CREATE TABLE users ( | |||||||
|     ShortId integer UNIQUE NOT NULL, |     ShortId integer UNIQUE NOT NULL, | ||||||
|     Username varchar(32) NOT NULL, |     Username varchar(32) NOT NULL, | ||||||
|     Email varchar(256) UNIQUE NOT NULL, |     Email varchar(256) UNIQUE NOT NULL, | ||||||
|     IsDeleted boolean NOT NULL DEFAULT FALSE, |     Deleted datetime, | ||||||
|     IsBanned boolean NOT NULL DEFAULT FALSE, |     IsBanned boolean NOT NULL DEFAULT FALSE, | ||||||
|     HashedPassword char(60) NOT NULL, |     HashedPassword char(60) NOT NULL, | ||||||
|     Created datetime NOT NULL |     Created datetime NOT NULL | ||||||
| @ -29,7 +29,7 @@ CREATE TABLE guestbooks ( | |||||||
|     WebsiteId integer UNIQUE NOT NULL, |     WebsiteId integer UNIQUE NOT NULL, | ||||||
|     UserId integer NOT NULL, |     UserId integer NOT NULL, | ||||||
|     Created datetime NOT NULL, |     Created datetime NOT NULL, | ||||||
|     IsDeleted boolean NOT NULL DEFAULT FALSE, |     Deleted datetime, | ||||||
|     IsActive boolean NOT NULL DEFAULT TRUE, |     IsActive boolean NOT NULL DEFAULT TRUE, | ||||||
|     FOREIGN KEY (UserId) REFERENCES users(Id) |     FOREIGN KEY (UserId) REFERENCES users(Id) | ||||||
|         ON DELETE RESTRICT |         ON DELETE RESTRICT | ||||||
| @ -51,7 +51,7 @@ CREATE TABLE guestbook_comments ( | |||||||
|     PageUrl varchar(256), |     PageUrl varchar(256), | ||||||
|     Created datetime NOT NULL, |     Created datetime NOT NULL, | ||||||
|     IsPublished boolean NOT NULL DEFAULT TRUE, |     IsPublished boolean NOT NULL DEFAULT TRUE, | ||||||
|     IsDeleted boolean NOT NULL DEFAULT FALSE, |     Deleted datetime, | ||||||
|     FOREIGN KEY (GuestbookId)  |     FOREIGN KEY (GuestbookId)  | ||||||
|         REFERENCES guestbooks(Id) |         REFERENCES guestbooks(Id) | ||||||
|         ON DELETE RESTRICT |         ON DELETE RESTRICT | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ type Guestbook struct { | |||||||
| 	UserId    int64 | 	UserId    int64 | ||||||
| 	WebsiteId int64 | 	WebsiteId int64 | ||||||
| 	Created   time.Time | 	Created   time.Time | ||||||
| 	IsDeleted bool | 	Deleted   time.Time | ||||||
| 	IsActive  bool | 	IsActive  bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -20,8 +20,8 @@ type GuestbookModel struct { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookModel) Insert(shortId uint64, userId int64, websiteId int64) (int64, error) { | func (m *GuestbookModel) Insert(shortId uint64, userId int64, websiteId int64) (int64, error) { | ||||||
| 	stmt := `INSERT INTO guestbooks (ShortId, UserId, WebsiteId, Created, IsDeleted, IsActive) | 	stmt := `INSERT INTO guestbooks (ShortId, UserId, WebsiteId, Created, IsActive) | ||||||
|     VALUES(?, ?, ?, ?, FALSE, TRUE)` |     VALUES(?, ?, ?, ?, TRUE)` | ||||||
| 	result, err := m.DB.Exec(stmt, shortId, userId, websiteId, time.Now().UTC()) | 	result, err := m.DB.Exec(stmt, shortId, userId, websiteId, time.Now().UTC()) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return -1, err | 		return -1, err | ||||||
| @ -34,21 +34,24 @@ func (m *GuestbookModel) Insert(shortId uint64, userId int64, websiteId int64) ( | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookModel) Get(shortId uint64) (Guestbook, error) { | func (m *GuestbookModel) Get(shortId uint64) (Guestbook, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, UserId, WebsiteId, Created, IsDeleted, IsActive FROM guestbooks | 	stmt := `SELECT Id, ShortId, UserId, WebsiteId, Created, Deleted, IsActive FROM guestbooks | ||||||
|     WHERE ShortId = ?` |     WHERE ShortId = ?` | ||||||
| 	row := m.DB.QueryRow(stmt, shortId) | 	row := m.DB.QueryRow(stmt, shortId) | ||||||
| 	var g Guestbook | 	var g Guestbook | ||||||
| 	err := row.Scan(&g.ID, &g.ShortId, &g.UserId, &g.WebsiteId, &g.Created, &g.IsDeleted, &g.IsActive) | 	var t sql.NullTime | ||||||
|  | 	err := row.Scan(&g.ID, &g.ShortId, &g.UserId, &g.WebsiteId, &g.Created, &t, &g.IsActive) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return Guestbook{}, err | 		return Guestbook{}, err | ||||||
| 	} | 	} | ||||||
| 
 | 	if t.Valid { | ||||||
|  | 		g.Deleted = t.Time | ||||||
|  | 	} | ||||||
| 	return g, nil | 	return g, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookModel) GetAll(userId int64) ([]Guestbook, error) { | func (m *GuestbookModel) GetAll(userId int64) ([]Guestbook, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, UserId, WebsiteId, Created, IsDeleted, IsActive FROM guestbooks | 	stmt := `SELECT Id, ShortId, UserId, WebsiteId, Created, IsActive FROM guestbooks | ||||||
|     WHERE UserId = ?` |     WHERE UserId = ? AND DELETED IS NULL` | ||||||
| 	rows, err := m.DB.Query(stmt, userId) | 	rows, err := m.DB.Query(stmt, userId) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| @ -56,7 +59,7 @@ func (m *GuestbookModel) GetAll(userId int64) ([]Guestbook, error) { | |||||||
| 	var guestbooks []Guestbook | 	var guestbooks []Guestbook | ||||||
| 	for rows.Next() { | 	for rows.Next() { | ||||||
| 		var g Guestbook | 		var g Guestbook | ||||||
| 		err = rows.Scan(&g.ID, &g.ShortId, &g.UserId, &g.WebsiteId, &g.Created, &g.IsDeleted, &g.IsActive) | 		err = rows.Scan(&g.ID, &g.ShortId, &g.UserId, &g.WebsiteId, &g.Created, &g.IsActive) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -16,8 +16,8 @@ type GuestbookComment struct { | |||||||
| 	CommentText string | 	CommentText string | ||||||
| 	PageUrl     string | 	PageUrl     string | ||||||
| 	Created     time.Time | 	Created     time.Time | ||||||
|  | 	Deleted     time.Time | ||||||
| 	IsPublished bool | 	IsPublished bool | ||||||
| 	IsDeleted   bool |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type GuestbookCommentModel struct { | type GuestbookCommentModel struct { | ||||||
| @ -27,8 +27,8 @@ type GuestbookCommentModel struct { | |||||||
| func (m *GuestbookCommentModel) Insert(shortId uint64, guestbookId, parentId int64, authorName, | func (m *GuestbookCommentModel) Insert(shortId uint64, guestbookId, parentId int64, authorName, | ||||||
| 	authorEmail, authorSite, commentText, pageUrl string, isPublished bool) (int64, error) { | 	authorEmail, authorSite, commentText, pageUrl string, isPublished bool) (int64, error) { | ||||||
| 	stmt := `INSERT INTO guestbook_comments (ShortId, GuestbookId, ParentId, AuthorName, | 	stmt := `INSERT INTO guestbook_comments (ShortId, GuestbookId, ParentId, AuthorName, | ||||||
|     AuthorEmail, AuthorSite, CommentText, PageUrl, Created, IsPublished, IsDeleted) |     AuthorEmail, AuthorSite, CommentText, PageUrl, Created, IsPublished) | ||||||
|     VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, FALSE)` |     VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` | ||||||
| 	result, err := m.DB.Exec(stmt, shortId, guestbookId, parentId, authorName, authorEmail, | 	result, err := m.DB.Exec(stmt, shortId, guestbookId, parentId, authorName, authorEmail, | ||||||
| 		authorSite, commentText, pageUrl, time.Now().UTC(), isPublished) | 		authorSite, commentText, pageUrl, time.Now().UTC(), isPublished) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -43,21 +43,26 @@ func (m *GuestbookCommentModel) Insert(shortId uint64, guestbookId, parentId int | |||||||
| 
 | 
 | ||||||
| func (m *GuestbookCommentModel) Get(shortId uint64) (GuestbookComment, error) { | func (m *GuestbookCommentModel) Get(shortId uint64) (GuestbookComment, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | ||||||
|     CommentText, PageUrl, Created, IsPublished, IsDeleted FROM guestbook_comments WHERE ShortId = ?` |     CommentText, PageUrl, Created, IsPublished, Deleted FROM guestbook_comments WHERE ShortId = ?` | ||||||
| 	row := m.DB.QueryRow(stmt, shortId) | 	row := m.DB.QueryRow(stmt, shortId) | ||||||
| 	var c GuestbookComment | 	var c GuestbookComment | ||||||
| 	err := row.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, &c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished, &c.IsDeleted) | 	var t sql.NullTime | ||||||
|  | 	err := row.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, | ||||||
|  | 		&c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished, &t) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return GuestbookComment{}, err | 		return GuestbookComment{}, err | ||||||
| 	} | 	} | ||||||
|  | 	if t.Valid { | ||||||
|  | 		c.Deleted = t.Time | ||||||
|  | 	} | ||||||
| 	return c, nil | 	return c, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, error) { | func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | ||||||
|     CommentText, PageUrl, Created, IsPublished, IsDeleted  |     CommentText, PageUrl, Created, IsPublished  | ||||||
| 	    FROM guestbook_comments  | 	    FROM guestbook_comments  | ||||||
| 	    WHERE GuestbookId = ? AND IsDeleted = FALSE AND IsPublished = TRUE | 	    WHERE GuestbookId = ? AND IsPublished = TRUE AND DELETED IS NULL | ||||||
| 	    ORDER BY Created DESC` | 	    ORDER BY Created DESC` | ||||||
| 	rows, err := m.DB.Query(stmt, guestbookId) | 	rows, err := m.DB.Query(stmt, guestbookId) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -66,7 +71,8 @@ func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, e | |||||||
| 	var comments []GuestbookComment | 	var comments []GuestbookComment | ||||||
| 	for rows.Next() { | 	for rows.Next() { | ||||||
| 		var c GuestbookComment | 		var c GuestbookComment | ||||||
| 		err = rows.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, &c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished, &c.IsDeleted) | 		err = rows.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, | ||||||
|  | 			&c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
| @ -78,11 +84,11 @@ func (m *GuestbookCommentModel) GetAll(guestbookId int64) ([]GuestbookComment, e | |||||||
| 	return comments, nil | 	return comments, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookCommentModel) GetQueue(guestbookId int64) ([]GuestbookComment, error) { | func (m *GuestbookCommentModel) GetDeleted(guestbookId int64) ([]GuestbookComment, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | ||||||
|     CommentText, PageUrl, Created, IsPublished, IsDeleted  |     CommentText, PageUrl, Created, IsPublished, Deleted | ||||||
| 	    FROM guestbook_comments  | 	    FROM guestbook_comments  | ||||||
| 	    WHERE GuestbookId = ? AND IsDeleted = FALSE AND IsPublished = FALSE | 	    WHERE GuestbookId = ? AND Deleted IS NOT NULL | ||||||
| 	    ORDER BY Created DESC` | 	    ORDER BY Created DESC` | ||||||
| 	rows, err := m.DB.Query(stmt, guestbookId) | 	rows, err := m.DB.Query(stmt, guestbookId) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -91,7 +97,38 @@ func (m *GuestbookCommentModel) GetQueue(guestbookId int64) ([]GuestbookComment, | |||||||
| 	var comments []GuestbookComment | 	var comments []GuestbookComment | ||||||
| 	for rows.Next() { | 	for rows.Next() { | ||||||
| 		var c GuestbookComment | 		var c GuestbookComment | ||||||
| 		err = rows.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, &c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished, &c.IsDeleted) | 		var t sql.NullTime | ||||||
|  | 		err = rows.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, | ||||||
|  | 			&c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished, &t) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return nil, err | ||||||
|  | 		} | ||||||
|  | 		if t.Valid { | ||||||
|  | 			c.Deleted = t.Time | ||||||
|  | 		} | ||||||
|  | 		comments = append(comments, c) | ||||||
|  | 	} | ||||||
|  | 	if err = rows.Err(); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return comments, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (m *GuestbookCommentModel) GetUnpublished(guestbookId int64) ([]GuestbookComment, error) { | ||||||
|  | 	stmt := `SELECT Id, ShortId, GuestbookId, ParentId, AuthorName, AuthorEmail, AuthorSite, | ||||||
|  |     CommentText, PageUrl, Created, IsPublished  | ||||||
|  | 	    FROM guestbook_comments  | ||||||
|  | 	    WHERE GuestbookId = ? AND Deleted IS NULL AND IsPublished = FALSE | ||||||
|  | 	    ORDER BY Created DESC` | ||||||
|  | 	rows, err := m.DB.Query(stmt, guestbookId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	var comments []GuestbookComment | ||||||
|  | 	for rows.Next() { | ||||||
|  | 		var c GuestbookComment | ||||||
|  | 		err = rows.Scan(&c.ID, &c.ShortId, &c.GuestbookId, &c.ParentId, &c.AuthorName, &c.AuthorEmail, &c.AuthorSite, | ||||||
|  | 			&c.CommentText, &c.PageUrl, &c.Created, &c.IsPublished) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
| @ -104,10 +141,18 @@ func (m *GuestbookCommentModel) GetQueue(guestbookId int64) ([]GuestbookComment, | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *GuestbookCommentModel) UpdateComment(comment *GuestbookComment) error { | func (m *GuestbookCommentModel) UpdateComment(comment *GuestbookComment) error { | ||||||
| 	stmt := `UPDATE guestbook_comments (CommentText, PageUrl, IsPublished, IsDeleted) | 	stmt := `UPDATE guestbook_comments | ||||||
| 		VALUES (?, ?, ?, ?) | 			SET CommentText = ?, | ||||||
|  | 				PageUrl = ?, | ||||||
|  | 				IsPublished = ?, | ||||||
|  | 				Deleted = ? | ||||||
| 		WHERE Id = ?` | 		WHERE Id = ?` | ||||||
| 	_, err := m.DB.Exec(stmt, comment.CommentText, comment.PageUrl, comment.IsPublished, comment.IsDeleted, comment.ID) | 	var err error | ||||||
|  | 	if comment.Deleted.IsZero() { | ||||||
|  | 		_, err = m.DB.Exec(stmt, comment.CommentText, comment.PageUrl, comment.IsPublished, nil, comment.ID) | ||||||
|  | 	} else { | ||||||
|  | 		_, err = m.DB.Exec(stmt, comment.CommentText, comment.PageUrl, comment.IsPublished, comment.Deleted, comment.ID) | ||||||
|  | 	} | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ type User struct { | |||||||
| 	ShortId        uint64 | 	ShortId        uint64 | ||||||
| 	Username       string | 	Username       string | ||||||
| 	Email          string | 	Email          string | ||||||
| 	IsDeleted      bool | 	Deleted        bool | ||||||
| 	IsBanned       bool | 	IsBanned       bool | ||||||
| 	HashedPassword []byte | 	HashedPassword []byte | ||||||
| 	Created        time.Time | 	Created        time.Time | ||||||
| @ -30,8 +30,8 @@ func (m *UserModel) Insert(shortId uint64, username string, email string, passwo | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	stmt := `INSERT INTO users (ShortId, Username, Email, IsDeleted, IsBanned, HashedPassword, Created) | 	stmt := `INSERT INTO users (ShortId, Username, Email, IsBanned, HashedPassword, Created) | ||||||
|     VALUES (?, ?, ?, FALSE, FALSE, ?, ?)` |     VALUES (?, ?, ?, FALSE, ?, ?)` | ||||||
| 	_, err = m.DB.Exec(stmt, shortId, username, email, hashedPassword, time.Now().UTC()) | 	_, err = m.DB.Exec(stmt, shortId, username, email, hashedPassword, time.Now().UTC()) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		if sqliteError, ok := err.(sqlite3.Error); ok { | 		if sqliteError, ok := err.(sqlite3.Error); ok { | ||||||
| @ -45,7 +45,7 @@ func (m *UserModel) Insert(shortId uint64, username string, email string, passwo | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *UserModel) Get(id uint64) (User, error) { | func (m *UserModel) Get(id uint64) (User, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE ShortId = ? AND IsDeleted = FALSE` | 	stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE ShortId = ? AND Deleted IS NULL` | ||||||
| 	row := m.DB.QueryRow(stmt, id) | 	row := m.DB.QueryRow(stmt, id) | ||||||
| 	var u User | 	var u User | ||||||
| 	err := row.Scan(&u.ID, &u.ShortId, &u.Username, &u.Email, &u.Created) | 	err := row.Scan(&u.ID, &u.ShortId, &u.Username, &u.Email, &u.Created) | ||||||
| @ -59,7 +59,7 @@ func (m *UserModel) Get(id uint64) (User, error) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *UserModel) GetById(id int64) (User, error) { | func (m *UserModel) GetById(id int64) (User, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE Id = ? AND IsDeleted = FALSE` | 	stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE Id = ? AND Deleted IS NULL` | ||||||
| 	row := m.DB.QueryRow(stmt, id) | 	row := m.DB.QueryRow(stmt, id) | ||||||
| 	var u User | 	var u User | ||||||
| 	err := row.Scan(&u.ID, &u.ShortId, &u.Username, &u.Email, &u.Created) | 	err := row.Scan(&u.ID, &u.ShortId, &u.Username, &u.Email, &u.Created) | ||||||
| @ -73,7 +73,7 @@ func (m *UserModel) GetById(id int64) (User, error) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *UserModel) GetAll() ([]User, error) { | func (m *UserModel) GetAll() ([]User, error) { | ||||||
| 	stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE IsDeleted = FALSE` | 	stmt := `SELECT Id, ShortId, Username, Email, Created FROM users WHERE DELETED IS NULL` | ||||||
| 	rows, err := m.DB.Query(stmt) | 	rows, err := m.DB.Query(stmt) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| @ -121,7 +121,7 @@ func (m *UserModel) Authenticate(email, password string) (int64, error) { | |||||||
| 
 | 
 | ||||||
| func (m *UserModel) Exists(id int64) (bool, error) { | func (m *UserModel) Exists(id int64) (bool, error) { | ||||||
| 	var exists bool | 	var exists bool | ||||||
| 	stmt := `SELECT EXISTS(SELECT true FROM users WHERE Id = ? AND IsDeleted = False)` | 	stmt := `SELECT EXISTS(SELECT true FROM users WHERE Id = ? AND DELETED IS NULL)` | ||||||
| 	err := m.DB.QueryRow(stmt, id).Scan(&exists) | 	err := m.DB.QueryRow(stmt, id).Scan(&exists) | ||||||
| 	return exists, err | 	return exists, err | ||||||
| } | } | ||||||
|  | |||||||
| @ -36,48 +36,38 @@ 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, w.Deleted, | 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created, | ||||||
| 	g.Id, g.ShortId, g.Created, g.IsDeleted, g.IsActive | 	g.Id, g.ShortId, g.Created, g.IsActive | ||||||
| 	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 = ?` | 	WHERE w.ShortId = ? AND w.DELETED IS NULL` | ||||||
| 	row := m.DB.QueryRow(stmt, shortId) | 	row := m.DB.QueryRow(stmt, shortId) | ||||||
| 	var t sql.NullTime |  | ||||||
| 	var w Website | 	var w Website | ||||||
| 	err := row.Scan(&w.ID, &w.ShortId, &w.Name, &w.SiteUrl, &w.AuthorName, &w.UserId, &w.Created, &t, | 	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.IsDeleted, &w.Guestbook.IsActive) | 		&w.Guestbook.ID, &w.Guestbook.ShortId, &w.Guestbook.Created, &w.Guestbook.IsActive) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return Website{}, err | 		return Website{}, err | ||||||
| 	} | 	} | ||||||
| 	// handle if Deleted is null |  | ||||||
| 	if t.Valid { |  | ||||||
| 		w.Deleted = t.Time |  | ||||||
| 	} |  | ||||||
| 	return w, nil | 	return w, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *WebsiteModel) GetById(id int64) (Website, error) { | func (m *WebsiteModel) GetById(id int64) (Website, error) { | ||||||
| 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created, w.Deleted, | 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created, | ||||||
| 	g.Id, g.ShortId, g.Created, g.IsDeleted, g.IsActive | 	g.Id, g.ShortId, g.Created, g.IsActive | ||||||
| 	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.Id = ?` | 	WHERE w.Id = ? AND w.DELETED IS NULL` | ||||||
| 	row := m.DB.QueryRow(stmt, id) | 	row := m.DB.QueryRow(stmt, id) | ||||||
| 	var t sql.NullTime |  | ||||||
| 	var w Website | 	var w Website | ||||||
| 	err := row.Scan(&w.ID, &w.ShortId, &w.Name, &w.SiteUrl, &w.AuthorName, &w.UserId, &w.Created, &t, | 	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.IsDeleted, &w.Guestbook.IsActive) | 		&w.Guestbook.ID, &w.Guestbook.ShortId, &w.Guestbook.Created, &w.Guestbook.IsActive) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return Website{}, err | 		return Website{}, err | ||||||
| 	} | 	} | ||||||
| 	// handle if Deleted is null |  | ||||||
| 	if t.Valid { |  | ||||||
| 		w.Deleted = t.Time |  | ||||||
| 	} |  | ||||||
| 	return w, nil | 	return w, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *WebsiteModel) GetAll(userId int64) ([]Website, error) { | func (m *WebsiteModel) GetAllUser(userId int64) ([]Website, error) { | ||||||
| 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created, w.Deleted, | 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created,  | ||||||
| 	g.Id, g.ShortId, g.Created, g.IsDeleted, g.IsActive | 	g.Id, g.ShortId, g.Created, g.IsActive | ||||||
| 	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.UserId = ?` | 	WHERE w.UserId = ?` | ||||||
| 	rows, err := m.DB.Query(stmt, userId) | 	rows, err := m.DB.Query(stmt, userId) | ||||||
| @ -86,10 +76,33 @@ func (m *WebsiteModel) GetAll(userId int64) ([]Website, error) { | |||||||
| 	} | 	} | ||||||
| 	var websites []Website | 	var websites []Website | ||||||
| 	for rows.Next() { | 	for rows.Next() { | ||||||
| 		var t sql.NullTime |  | ||||||
| 		var w Website | 		var w Website | ||||||
| 		err := rows.Scan(&w.ID, &w.ShortId, &w.Name, &w.SiteUrl, &w.AuthorName, &w.UserId, &w.Created, &t, | 		err := rows.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.IsDeleted, &w.Guestbook.IsActive) | 			&w.Guestbook.ID, &w.Guestbook.ShortId, &w.Guestbook.Created, &w.Guestbook.IsActive) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return nil, err | ||||||
|  | 		} | ||||||
|  | 		websites = append(websites, w) | ||||||
|  | 	} | ||||||
|  | 	if err = rows.Err(); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return websites, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (m *WebsiteModel) GetAll() ([]Website, error) { | ||||||
|  | 	stmt := `SELECT w.Id, w.ShortId, w.Name, w.SiteUrl, w.AuthorName, w.UserId, w.Created,  | ||||||
|  | 	g.Id, g.ShortId, g.Created, g.IsActive | ||||||
|  | 	FROM websites AS w INNER JOIN guestbooks AS g ON w.Id = g.WebsiteId` | ||||||
|  | 	rows, err := m.DB.Query(stmt) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	var websites []Website | ||||||
|  | 	for rows.Next() { | ||||||
|  | 		var w Website | ||||||
|  | 		err := rows.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) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -36,6 +36,7 @@ templ topNav(data CommonData) { | |||||||
|         </div> |         </div> | ||||||
|         <div> |         <div> | ||||||
|             if data.IsAuthenticated { |             if data.IsAuthenticated { | ||||||
|  |                 <a href="/guestbooks">All Guestbooks</a> | | ||||||
|                 <a href="/websites">My Websites</a> |  |                 <a href="/websites">My Websites</a> |  | ||||||
|                 <a href="/users/settings">Settings</a> |  |                 <a href="/users/settings">Settings</a> |  | ||||||
|                 <form action="/users/logout" method="post"> |                 <form action="/users/logout" method="post"> | ||||||
|  | |||||||
| @ -103,14 +103,14 @@ func topNav(data CommonData) templ.Component { | |||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		if data.IsAuthenticated { | 		if data.IsAuthenticated { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<a href=\"/websites\">My Websites</a> |  <a href=\"/users/settings\">Settings</a> | <form action=\"/users/logout\" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\"") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<a href=\"/guestbooks\">All Guestbooks</a> | <a href=\"/websites\">My Websites</a> |  <a href=\"/users/settings\">Settings</a> | <form action=\"/users/logout\" method=\"post\"><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_Var4 string | 			var templ_7745c5c3_Var4 string | ||||||
| 			templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(data.CSRFToken) | 			templ_7745c5c3_Var4, 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/common.templ`, Line: 42, Col: 81} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 43, Col: 81} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| @ -191,7 +191,7 @@ func base(title string, data CommonData) templ.Component { | |||||||
| 		var templ_7745c5c3_Var7 string | 		var templ_7745c5c3_Var7 string | ||||||
| 		templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(title) | 		templ_7745c5c3_Var7, 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/common.templ`, Line: 65, Col: 26} | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 66, Col: 26} | ||||||
| 		} | 		} | ||||||
| 		_, 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 { | ||||||
| @ -221,7 +221,7 @@ func base(title string, data CommonData) templ.Component { | |||||||
| 			var templ_7745c5c3_Var8 string | 			var templ_7745c5c3_Var8 string | ||||||
| 			templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) | 			templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.Flash) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 76, Col: 51} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/common.templ`, Line: 77, Col: 51} | ||||||
| 			} | 			} | ||||||
| 			_, 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 { | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
| <nav><div> | <nav><div> | ||||||
| Welcome,  | Welcome,  | ||||||
| </div><div> | </div><div> | ||||||
| <a href=\"/websites\">My Websites</a> |  <a href=\"/users/settings\">Settings</a> | <form action=\"/users/logout\" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\" | <a href=\"/guestbooks\">All Guestbooks</a> | <a href=\"/websites\">My Websites</a> |  <a href=\"/users/settings\">Settings</a> | <form action=\"/users/logout\" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\" | ||||||
| \"> <button>Logout</button></form> | \"> <button>Logout</button></form> | ||||||
| <a href=\"/users/register\">Create an Account</a> |  <a href=\"/users/login\">Login</a> | <a href=\"/users/register\">Create an Account</a> |  <a href=\"/users/login\">Login</a> | ||||||
| </div></nav> | </div></nav> | ||||||
|  | |||||||
| @ -15,48 +15,6 @@ templ gbCreateForm(csrf_token string) { | |||||||
|     <button type="submit">Submit</button> |     <button type="submit">Submit</button> | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| templ gbList(guestbooks []models.Guestbook) { |  | ||||||
|     if len(guestbooks) == 0 { |  | ||||||
|         <p>No Guestbooks yet</p> |  | ||||||
|     } else { |  | ||||||
|         <ul id="guestbooks" hx-get="/guestbooks" hx-trigger="newGuestbook from:body" hx-swap="outerHTML"> |  | ||||||
|             for _, gb := range guestbooks { |  | ||||||
|                 <li><a href={ templ.URL(gbUrl(gb) + "/dashboard") }> |  | ||||||
|                 </a></li> |  | ||||||
| 
 |  | ||||||
|             } |  | ||||||
|         </ul> |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| templ GuestbookList(title string, data CommonData, guestbooks []models.Guestbook) { |  | ||||||
|     if data.IsHtmx { |  | ||||||
|         @gbList(guestbooks) |  | ||||||
|     } else { |  | ||||||
|         @base(title, data) { |  | ||||||
|             <h1>My Guestbooks</h1> |  | ||||||
|             <div> |  | ||||||
|                 <button hx-get="/guestbooks/create" hx-target="closest div">New Guestbook</button> |  | ||||||
|             </div> |  | ||||||
|             @gbList(guestbooks) |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| templ GuestbookCreate(title string, data CommonData) { |  | ||||||
|     if data.IsHtmx { |  | ||||||
|         <form hx-post="/guestbooks/create" hx-target="closest div"> |  | ||||||
|             @gbCreateForm(data.CSRFToken) |  | ||||||
|         </form> |  | ||||||
|     } else { |  | ||||||
|         @base(title, data) { |  | ||||||
|             <form action="/guestbooks/create" method="post"> |  | ||||||
|                 @gbCreateForm(data.CSRFToken) |  | ||||||
|             </form> |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 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) { | ||||||
|         <div id="dashboard"> |         <div id="dashboard"> | ||||||
| @ -67,13 +25,7 @@ templ GuestbookDashboardCommentsView(title string, data CommonData, website mode | |||||||
|                     <p>No comments yet!</p> |                     <p>No comments yet!</p> | ||||||
|                 } |                 } | ||||||
|                 for  _, c := range comments { |                 for  _, c := range comments { | ||||||
|                     <div> |                     @GuestbookDashboardCommentView(data, website, c) | ||||||
|                         <strong>{ c.AuthorName }</strong> |  | ||||||
|                         { c.Created.Format("01-02-2006 03:04PM") } |  | ||||||
|                         <p> |  | ||||||
|                             { c.CommentText } |  | ||||||
|                         </p> |  | ||||||
|                     </div> |  | ||||||
|                 } |                 } | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
| @ -138,7 +90,12 @@ templ GuestbookView(title string, data CommonData, website models.Website, guest | |||||||
|     if data.IsHtmx { |     if data.IsHtmx { | ||||||
|         @commentForm(form) |         @commentForm(form) | ||||||
|     } else { |     } else { | ||||||
|         <div id="main"> |         <html> | ||||||
|  |             <head> | ||||||
|  |             <title>{ title }</title> | ||||||
|  |             </head> | ||||||
|  |             <body> | ||||||
|  |                 <main> | ||||||
|                     <div> |                     <div> | ||||||
|                         <h1>Guestbook for { website.SiteUrl }</h1> |                         <h1>Guestbook for { website.SiteUrl }</h1> | ||||||
|                         <form action={ templ.URL(postUrl) } method="post"> |                         <form action={ templ.URL(postUrl) } method="post"> | ||||||
| @ -149,7 +106,9 @@ templ GuestbookView(title string, data CommonData, website models.Website, guest | |||||||
|                     <div id="comments"> |                     <div id="comments"> | ||||||
|                         @GuestbookCommentList(comments) |                         @GuestbookCommentList(comments) | ||||||
|                     </div> |                     </div> | ||||||
|         </div> |                 </main> | ||||||
|  |             </body> | ||||||
|  |         </html> | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -167,3 +126,54 @@ templ CreateGuestbookComment(title string, data CommonData, website models.Websi | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | templ GuestbookCommentView(c models.GuestbookComment) { | ||||||
|  |     <div> | ||||||
|  |         <strong>{ c.AuthorName }</strong> | ||||||
|  |         { c.Created.Format("01-02-2006 03:04PM") } | ||||||
|  |         <p> | ||||||
|  |             { c.CommentText } | ||||||
|  |         </p> | ||||||
|  |     </div> | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | templ GuestbookDashboardCommentView(data CommonData, w models.Website, c models.GuestbookComment) { | ||||||
|  |     {{ commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) }} | ||||||
|  |     {{ hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) }} | ||||||
|  |     <div> | ||||||
|  |         <strong>{ c.AuthorName }</strong> | ||||||
|  |         { c.Created.Format("01-02-2006 03:04PM") } | ||||||
|  |         if c.Deleted.IsZero() { | ||||||
|  |             <a href="#" hx-delete={ commentUrl } hx-target="closest div" hx-headers={ hxHeaders }>Delete</a> | ||||||
|  |             <a href="#" hx-put={ commentUrl } hx-target="closest div" hx-headers={ hxHeaders }> | ||||||
|  |                 if !c.IsPublished { | ||||||
|  |                     Publish | ||||||
|  |                 } else { | ||||||
|  |                     Hide | ||||||
|  |                 } | ||||||
|  |             </a>  | ||||||
|  |         } | ||||||
|  |         <p> | ||||||
|  |             { c.CommentText } | ||||||
|  |         </p> | ||||||
|  |     </div> | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | templ AllGuestbooksView(data CommonData, websites []models.Website) { | ||||||
|  |     @base("All Guestbooks", data) { | ||||||
|  |         <div> | ||||||
|  |             <h1>All Guestbooks</h1> | ||||||
|  |             <p> | ||||||
|  |                 This page exists only for testing the service. | ||||||
|  |             </p> | ||||||
|  |             <ul> | ||||||
|  |                 for _, w := range websites { | ||||||
|  |                     <li> | ||||||
|  |                         {{  gbUrl := fmt.Sprintf("/websites/%s/guestbook", shortIdToSlug(w.ShortId))}} | ||||||
|  |                         <a href={ templ.URL(gbUrl) } target="_blank">{ w.Name }</a> | ||||||
|  |                     </li> | ||||||
|  |                 } | ||||||
|  |             </ul> | ||||||
|  |         </div> | ||||||
|  |     } | ||||||
|  | } | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,23 +1,9 @@ | |||||||
| <input type=\"hidden\" name=\"csrf_token\" value=\" | <input type=\"hidden\" name=\"csrf_token\" value=\" | ||||||
| \"> <label for=\"siteurl\">Site URL: </label> <input type=\"text\" name=\"siteurl\" id=\"siteurl\" required> <button type=\"submit\">Submit</button> | \"> <label for=\"siteurl\">Site URL: </label> <input type=\"text\" name=\"siteurl\" id=\"siteurl\" required> <button type=\"submit\">Submit</button> | ||||||
| <p>No Guestbooks yet</p> |  | ||||||
| <ul id=\"guestbooks\" hx-get=\"/guestbooks\" hx-trigger=\"newGuestbook from:body\" hx-swap=\"outerHTML\"> |  | ||||||
| <li><a href=\" |  | ||||||
| \"></a></li> |  | ||||||
| </ul> |  | ||||||
| <h1>My Guestbooks</h1><div><button hx-get=\"/guestbooks/create\" hx-target=\"closest div\">New Guestbook</button></div> |  | ||||||
| <form hx-post=\"/guestbooks/create\" hx-target=\"closest div\"> |  | ||||||
| </form> |  | ||||||
| <form action=\"/guestbooks/create\" method=\"post\"> |  | ||||||
| </form> |  | ||||||
| <div id=\"dashboard\"> | <div id=\"dashboard\"> | ||||||
| <div><h1>Comments on  | <div><h1>Comments on  | ||||||
| </h1> | </h1> | ||||||
| <p>No comments yet!</p> | <p>No comments yet!</p> | ||||||
| <div><strong> |  | ||||||
| </strong>  |  | ||||||
| <p> |  | ||||||
| </p></div> |  | ||||||
| </div></div> | </div></div> | ||||||
| <div><label for=\"authorname\">Name: </label> | <div><label for=\"authorname\">Name: </label> | ||||||
| <label class=\"error\"> | <label class=\"error\"> | ||||||
| @ -37,15 +23,39 @@ | |||||||
| </strong>  | </strong>  | ||||||
| <p> | <p> | ||||||
| </p></div> | </p></div> | ||||||
| <div id=\"main\"><div><h1>Guestbook for  | <html><head><title> | ||||||
|  | </title></head><body><main><div><h1>Guestbook for  | ||||||
| </h1><form action=\" | </h1><form action=\" | ||||||
| \" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\" | \" method=\"post\"><input type=\"hidden\" name=\"csrf_token\" value=\" | ||||||
| \"> | \"> | ||||||
| </form></div><div id=\"comments\"> | </form></div><div id=\"comments\"> | ||||||
| </div></div> | </div></main></body></html> | ||||||
| <form hx-post=\" | <form hx-post=\" | ||||||
| \" hx-target=\"closest div\"> | \" hx-target=\"closest div\"> | ||||||
| </form> | </form> | ||||||
| <form action=\" | <form action=\" | ||||||
| \" method=\"post\"> | \" method=\"post\"> | ||||||
| </form> | </form> | ||||||
|  | <div><strong> | ||||||
|  | </strong>  | ||||||
|  | <p> | ||||||
|  | </p></div> | ||||||
|  | <div><strong> | ||||||
|  | </strong>  | ||||||
|  |   | ||||||
|  | <a href=\"#\" hx-delete=\" | ||||||
|  | \" hx-target=\"closest div\" hx-headers=\" | ||||||
|  | \">Delete</a> <a href=\"#\" hx-put=\" | ||||||
|  | \" hx-target=\"closest div\" hx-headers=\" | ||||||
|  | \"> | ||||||
|  | Publish | ||||||
|  | Hide | ||||||
|  | </a> | ||||||
|  | <p> | ||||||
|  | </p></div> | ||||||
|  | <div><h1>All Guestbooks</h1><p>This page exists only for testing the service.</p><ul> | ||||||
|  | <li> | ||||||
|  | <a href=\" | ||||||
|  | \" target=\"_blank\"> | ||||||
|  | </a></li> | ||||||
|  | </ul></div> | ||||||
| @ -6,5 +6,14 @@ templ Home(title string, data CommonData) { | |||||||
|         <p> |         <p> | ||||||
|             Welcome to webweav.ing, a collection of webmastery tools created by the <a href="https://32bit.cafe">32-Bit Cafe</a>. |             Welcome to webweav.ing, a collection of webmastery tools created by the <a href="https://32bit.cafe">32-Bit Cafe</a>. | ||||||
|         </p> |         </p> | ||||||
|  |         <p> | ||||||
|  |             Note this service is in a pre-alpha state. Your account and data can disappear at any time.  | ||||||
|  |         </p> | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | templ ComingSoon(title string, data CommonData) { | ||||||
|  |     @base(title, data) { | ||||||
|  |         <h2>Coming Soon</h2> | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -41,7 +41,7 @@ func Home(title string, data CommonData) templ.Component { | |||||||
| 				}() | 				}() | ||||||
| 			} | 			} | ||||||
| 			ctx = templ.InitializeContext(ctx) | 			ctx = templ.InitializeContext(ctx) | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<h2>Welcome</h2><p>Welcome to webweav.ing, a collection of webmastery tools created by the <a href=\"https://32bit.cafe\">32-Bit Cafe</a>.</p>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<h2>Welcome</h2><p>Welcome to webweav.ing, a collection of webmastery tools created by the <a href=\"https://32bit.cafe\">32-Bit Cafe</a>.</p><p>Note this service is in a pre-alpha state. Your account and data can disappear at any time. </p>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -55,4 +55,51 @@ func Home(title string, data CommonData) templ.Component { | |||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func ComingSoon(title string, data CommonData) 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_Var3 := templ.GetChildren(ctx) | ||||||
|  | 		if templ_7745c5c3_Var3 == nil { | ||||||
|  | 			templ_7745c5c3_Var3 = templ.NopComponent | ||||||
|  | 		} | ||||||
|  | 		ctx = templ.ClearChildren(ctx) | ||||||
|  | 		templ_7745c5c3_Var4 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<h2>Coming Soon</h2>") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			return nil | ||||||
|  | 		}) | ||||||
|  | 		templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		return nil | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| var _ = templruntime.GeneratedTemplate | var _ = templruntime.GeneratedTemplate | ||||||
|  | |||||||
| @ -1 +1,2 @@ | |||||||
| <h2>Welcome</h2><p>Welcome to webweav.ing, a collection of webmastery tools created by the <a href=\"https://32bit.cafe\">32-Bit Cafe</a>.</p> | <h2>Welcome</h2><p>Welcome to webweav.ing, a collection of webmastery tools created by the <a href=\"https://32bit.cafe\">32-Bit Cafe</a>.</p><p>Note this service is in a pre-alpha state. Your account and data can disappear at any time. </p> | ||||||
|  | <h2>Coming Soon</h2> | ||||||
| @ -13,6 +13,7 @@ templ wSidebar(website models.Website) { | |||||||
|     {{ gbUrl := wUrl(website) + "/guestbook" }} |     {{ gbUrl := wUrl(website) + "/guestbook" }} | ||||||
|     <nav> |     <nav> | ||||||
|         <div> |         <div> | ||||||
|  |             <h2>{ website.Name}</h2> | ||||||
|             <ul> |             <ul> | ||||||
|                 <li><a href={ templ.URL(dashUrl) }>Dashboard</a></li> |                 <li><a href={ templ.URL(dashUrl) }>Dashboard</a></li> | ||||||
|                 <li><a href={ templ.URL(website.SiteUrl) }>View Website</a></li> |                 <li><a href={ templ.URL(website.SiteUrl) }>View Website</a></li> | ||||||
| @ -126,6 +127,20 @@ templ WebsiteDashboard(title string, data CommonData, website models.Website) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | templ WebsiteDashboardComingSoon(title string, data CommonData, website models.Website) { | ||||||
|  |     @base(title, data) { | ||||||
|  |         <div id="dashboard"> | ||||||
|  |             @wSidebar(website)  | ||||||
|  |             <div> | ||||||
|  |                 <h1>{ website.Name }</h1> | ||||||
|  |                 <p> | ||||||
|  |                     Coming Soon | ||||||
|  |                 </p> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| templ WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) { | templ WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) { | ||||||
|     if data.IsHtmx { |     if data.IsHtmx { | ||||||
|         <form hx-post="/websites/create" hx-target="closest div"> |         <form hx-post="/websites/create" hx-target="closest div"> | ||||||
|  | |||||||
| @ -39,88 +39,101 @@ func wSidebar(website models.Website) templ.Component { | |||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		dashUrl := wUrl(website) + "/dashboard" | 		dashUrl := wUrl(website) + "/dashboard" | ||||||
| 		gbUrl := wUrl(website) + "/guestbook" | 		gbUrl := wUrl(website) + "/guestbook" | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<nav><div><ul><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<nav><div><h2>") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var2 templ.SafeURL = templ.URL(dashUrl) | 		var templ_7745c5c3_Var2 string | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2))) | 		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 16, Col: 30} | ||||||
|  | 		} | ||||||
|  | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) | ||||||
| 		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, 2, "\">Dashboard</a></li><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</h2><ul><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var3 templ.SafeURL = templ.URL(website.SiteUrl) | 		var templ_7745c5c3_Var3 templ.SafeURL = templ.URL(dashUrl) | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3))) | ||||||
| 		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, 3, "\">View Website</a></li></ul><h3>Guestbook</h3><ul><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\">Dashboard</a></li><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var4 templ.SafeURL = templ.URL(gbUrl) | 		var templ_7745c5c3_Var4 templ.SafeURL = templ.URL(website.SiteUrl) | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var4))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var4))) | ||||||
| 		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, 4, "\" target=\"_blank\">View Guestbook</a></li></ul><ul><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\">View Website</a></li></ul><h3>Guestbook</h3><ul><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var5 templ.SafeURL = templ.URL(dashUrl + "/guestbook/comments") | 		var templ_7745c5c3_Var5 templ.SafeURL = templ.URL(gbUrl) | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5))) | ||||||
| 		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, 5, "\">Manage messages</a></li><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" target=\"_blank\">View Guestbook</a></li></ul><ul><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var6 templ.SafeURL = templ.URL(dashUrl + "/guestbook/comments/queue") | 		var templ_7745c5c3_Var6 templ.SafeURL = templ.URL(dashUrl + "/guestbook/comments") | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var6))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var6))) | ||||||
| 		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, 6, "\">Review message queue</a></li><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\">Manage messages</a></li><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var7 templ.SafeURL = templ.URL(dashUrl + "/guestbook/blocklist") | 		var templ_7745c5c3_Var7 templ.SafeURL = templ.URL(dashUrl + "/guestbook/comments/queue") | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7))) | ||||||
| 		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, 7, "\">Block users</a></li><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\">Review message queue</a></li><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var8 templ.SafeURL = templ.URL(dashUrl + "/guestbook/comments/trash") | 		var templ_7745c5c3_Var8 templ.SafeURL = templ.URL(dashUrl + "/guestbook/blocklist") | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var8))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var8))) | ||||||
| 		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, 8, "\">Trash</a></li></ul><ul><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\">Block users</a></li><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var9 templ.SafeURL = templ.URL(dashUrl + "/guestbook/themes") | 		var templ_7745c5c3_Var9 templ.SafeURL = templ.URL(dashUrl + "/guestbook/comments/trash") | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var9))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var9))) | ||||||
| 		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, 9, "\">Themes</a></li><li><a href=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\">Trash</a></li></ul><ul><li><a href=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var10 templ.SafeURL = templ.URL(dashUrl + "/guestbook/customize") | 		var templ_7745c5c3_Var10 templ.SafeURL = templ.URL(dashUrl + "/guestbook/themes") | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var10))) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var10))) | ||||||
| 		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, 10, "\">Custom CSS</a></li></ul></div><div><h3>Feeds</h3><p>Coming Soon</p></div><div><h3>Account</h3><ul><li><a href=\"/users/settings\">Settings</a></li><li><a href=\"/users/privacy\">Privacy</a></li><li><a href=\"/help\">Help</a></li></ul></div></nav>") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\">Themes</a></li><li><a href=\"") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		var templ_7745c5c3_Var11 templ.SafeURL = templ.URL(dashUrl + "/guestbook/customize") | ||||||
|  | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var11))) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "\">Custom CSS</a></li></ul></div><div><h3>Feeds</h3><p>Coming Soon</p></div><div><h3>Account</h3><ul><li><a href=\"/users/settings\">Settings</a></li><li><a href=\"/users/privacy\">Privacy</a></li><li><a href=\"/help\">Help</a></li></ul></div></nav>") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| @ -144,50 +157,50 @@ func displayWebsites(websites []models.Website) templ.Component { | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var11 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var12 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var11 == nil { | 		if templ_7745c5c3_Var12 == nil { | ||||||
| 			templ_7745c5c3_Var11 = templ.NopComponent | 			templ_7745c5c3_Var12 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		if len(websites) == 0 { | 		if len(websites) == 0 { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<p>No Websites yet. <a href=\"\">Register a website.</a></p>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<p>No Websites yet. <a href=\"\">Register a website.</a></p>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<ul id=\"websites\" hx-get=\"/websites\" hx-trigger=\"newWebsite from:body\" hx-swap=\"outerHTML\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<ul id=\"websites\" hx-get=\"/websites\" hx-trigger=\"newWebsite from:body\" hx-swap=\"outerHTML\">") | ||||||
| 			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, 13, "<li><a href=\"") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<li><a href=\"") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				var templ_7745c5c3_Var12 templ.SafeURL = templ.URL(wUrl(w) + "/dashboard") | 				var templ_7745c5c3_Var13 templ.SafeURL = templ.URL(wUrl(w) + "/dashboard") | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var12))) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var13))) | ||||||
| 				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, 14, "\">") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\">") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| 				var templ_7745c5c3_Var13 string | 				var templ_7745c5c3_Var14 string | ||||||
| 				templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(w.Name) | 				templ_7745c5c3_Var14, 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/websites.templ`, Line: 57, Col: 73} | 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 58, Col: 73} | ||||||
| 				} | 				} | ||||||
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) | 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) | ||||||
| 				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, 15, "</a></li>") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</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, 16, "</ul>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</ul>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -212,109 +225,109 @@ func websiteCreateForm(csrfToken string, form forms.WebsiteCreateForm) templ.Com | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var14 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var15 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var14 == nil { | 		if templ_7745c5c3_Var15 == nil { | ||||||
| 			templ_7745c5c3_Var14 = templ.NopComponent | 			templ_7745c5c3_Var15 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<input type=\"hidden\" name=\"csrf_token\" value=\"") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<input type=\"hidden\" name=\"csrf_token\" value=\"") | ||||||
| 		if templ_7745c5c3_Err != nil { |  | ||||||
| 			return templ_7745c5c3_Err |  | ||||||
| 		} |  | ||||||
| 		var templ_7745c5c3_Var15 string |  | ||||||
| 		templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(csrfToken) |  | ||||||
| 		if templ_7745c5c3_Err != nil { |  | ||||||
| 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 65, Col: 59} |  | ||||||
| 		} |  | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) |  | ||||||
| 		if templ_7745c5c3_Err != nil { |  | ||||||
| 			return templ_7745c5c3_Err |  | ||||||
| 		} |  | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\"><div>") |  | ||||||
| 		if templ_7745c5c3_Err != nil { |  | ||||||
| 			return templ_7745c5c3_Err |  | ||||||
| 		} |  | ||||||
| 		err, exists := form.FieldErrors["sitename"] |  | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<label for=\"sitename\">Site Name: </label> ") |  | ||||||
| 		if templ_7745c5c3_Err != nil { |  | ||||||
| 			return templ_7745c5c3_Err |  | ||||||
| 		} |  | ||||||
| 		if exists { |  | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<label class=\"error\">") |  | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		var templ_7745c5c3_Var16 string | 		var templ_7745c5c3_Var16 string | ||||||
| 			templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(err) | 		templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(csrfToken) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 70, Col: 38} | 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 66, Col: 59} | ||||||
| 		} | 		} | ||||||
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) | 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) | ||||||
| 		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, 21, "</label> ") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\"><div>") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		} | 		err, exists := form.FieldErrors["sitename"] | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<input type=\"text\" name=\"sitename\" id=\"sitename\" required></div><div>") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<label for=\"sitename\">Site Name: </label> ") | ||||||
| 		if templ_7745c5c3_Err != nil { |  | ||||||
| 			return templ_7745c5c3_Err |  | ||||||
| 		} |  | ||||||
| 		err, exists = form.FieldErrors["siteurl"] |  | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<label for=\"siteurl\">Site URL: </label> ") |  | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		if exists { | 		if exists { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<label class=\"error\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<label class=\"error\">") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			var templ_7745c5c3_Var17 string | 			var templ_7745c5c3_Var17 string | ||||||
| 			templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(err) | 			templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(err) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 78, Col: 38} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 71, Col: 38} | ||||||
| 			} | 			} | ||||||
| 			_, 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 { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</label> ") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</label> ") | ||||||
| 			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, 26, "<input type=\"text\" name=\"siteurl\" id=\"siteurl\" required></div><div>") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<input type=\"text\" name=\"sitename\" id=\"sitename\" required></div><div>") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		err, exists = form.FieldErrors["authorname"] | 		err, exists = form.FieldErrors["siteurl"] | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<label for=\"authorname\">Site Author: </label> ") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<label for=\"siteurl\">Site URL: </label> ") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| 		if exists { | 		if exists { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<label class=\"error\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<label class=\"error\">") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			var templ_7745c5c3_Var18 string | 			var templ_7745c5c3_Var18 string | ||||||
| 			templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(err) | 			templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(err) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 86, Col: 38} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 79, Col: 38} | ||||||
| 			} | 			} | ||||||
| 			_, 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 { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</label> ") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</label> ") | ||||||
| 			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, 30, "<input type=\"text\" name=\"authorname\" id=\"authorname\" required></div><div><button type=\"submit\">Submit</button></div>") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<input type=\"text\" name=\"siteurl\" id=\"siteurl\" required></div><div>") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		err, exists = form.FieldErrors["authorname"] | ||||||
|  | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<label for=\"authorname\">Site Author: </label> ") | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		if exists { | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<label class=\"error\">") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			var templ_7745c5c3_Var19 string | ||||||
|  | 			templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(err) | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 87, Col: 38} | ||||||
|  | 			} | ||||||
|  | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</label> ") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<input type=\"text\" name=\"authorname\" id=\"authorname\" required></div><div><button type=\"submit\">Submit</button></div>") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| @ -338,12 +351,12 @@ func WebsiteCreateButton() templ.Component { | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var19 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var20 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var19 == nil { | 		if templ_7745c5c3_Var20 == nil { | ||||||
| 			templ_7745c5c3_Var19 = templ.NopComponent | 			templ_7745c5c3_Var20 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<button hx-get=\"/websites/create\" hx-target=\"closest div\">Add Website</button>") | 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<button hx-get=\"/websites/create\" hx-target=\"closest div\">Add Website</button>") | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| @ -367,9 +380,9 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var20 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var21 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var20 == nil { | 		if templ_7745c5c3_Var21 == nil { | ||||||
| 			templ_7745c5c3_Var20 = templ.NopComponent | 			templ_7745c5c3_Var21 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		if data.IsHtmx { | 		if data.IsHtmx { | ||||||
| @ -378,7 +391,7 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ | |||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			templ_7745c5c3_Var21 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | 			templ_7745c5c3_Var22 := 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 { | ||||||
| @ -390,7 +403,7 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ | |||||||
| 					}() | 					}() | ||||||
| 				} | 				} | ||||||
| 				ctx = templ.InitializeContext(ctx) | 				ctx = templ.InitializeContext(ctx) | ||||||
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<h1>My Websites</h1><div>") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<h1>My Websites</h1><div>") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| @ -398,7 +411,7 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ | |||||||
| 				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, 33, "</div><div>") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</div><div>") | ||||||
| 				if templ_7745c5c3_Err != nil { | 				if templ_7745c5c3_Err != nil { | ||||||
| 					return templ_7745c5c3_Err | 					return templ_7745c5c3_Err | ||||||
| 				} | 				} | ||||||
| @ -406,13 +419,13 @@ func WebsiteList(title string, data CommonData, websites []models.Website) templ | |||||||
| 				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, 34, "</div>") | 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</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(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var21), templ_7745c5c3_Buffer) | 			templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var22), templ_7745c5c3_Buffer) | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -437,12 +450,12 @@ func WebsiteDashboard(title string, data CommonData, website models.Website) tem | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var22 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var23 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var22 == nil { | 		if templ_7745c5c3_Var23 == nil { | ||||||
| 			templ_7745c5c3_Var22 = templ.NopComponent | 			templ_7745c5c3_Var23 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		templ_7745c5c3_Var23 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | 		templ_7745c5c3_Var24 := 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 { | ||||||
| @ -454,7 +467,7 @@ func WebsiteDashboard(title string, data CommonData, website models.Website) tem | |||||||
| 				}() | 				}() | ||||||
| 			} | 			} | ||||||
| 			ctx = templ.InitializeContext(ctx) | 			ctx = templ.InitializeContext(ctx) | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<div id=\"dashboard\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<div id=\"dashboard\">") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -462,26 +475,94 @@ func WebsiteDashboard(title string, data CommonData, website models.Website) tem | |||||||
| 			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, 36, "<div><h1>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "<div><h1>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 			var templ_7745c5c3_Var24 string | 			var templ_7745c5c3_Var25 string | ||||||
| 			templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) | 			templ_7745c5c3_Var25, 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/websites.templ`, Line: 120, Col: 34} | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 121, Col: 34} | ||||||
| 			} | 			} | ||||||
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) | ||||||
| 			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, 37, "</h1><p>Stats and stuff will go here.</p></div></div>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</h1><p>Stats and stuff will go here.</p></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(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var23), templ_7745c5c3_Buffer) | 		templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var24), templ_7745c5c3_Buffer) | ||||||
|  | 		if templ_7745c5c3_Err != nil { | ||||||
|  | 			return templ_7745c5c3_Err | ||||||
|  | 		} | ||||||
|  | 		return nil | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func WebsiteDashboardComingSoon(title string, 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_Var26 := templ.GetChildren(ctx) | ||||||
|  | 		if templ_7745c5c3_Var26 == nil { | ||||||
|  | 			templ_7745c5c3_Var26 = templ.NopComponent | ||||||
|  | 		} | ||||||
|  | 		ctx = templ.ClearChildren(ctx) | ||||||
|  | 		templ_7745c5c3_Var27 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div id=\"dashboard\">") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = wSidebar(website).Render(ctx, templ_7745c5c3_Buffer) | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<div><h1>") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			var templ_7745c5c3_Var28 string | ||||||
|  | 			templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(website.Name) | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/views/websites.templ`, Line: 135, Col: 34} | ||||||
|  | 			} | ||||||
|  | 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</h1><p>Coming Soon</p></div></div>") | ||||||
|  | 			if templ_7745c5c3_Err != nil { | ||||||
|  | 				return templ_7745c5c3_Err | ||||||
|  | 			} | ||||||
|  | 			return nil | ||||||
|  | 		}) | ||||||
|  | 		templ_7745c5c3_Err = base(title, data).Render(templ.WithChildren(ctx, templ_7745c5c3_Var27), templ_7745c5c3_Buffer) | ||||||
| 		if templ_7745c5c3_Err != nil { | 		if templ_7745c5c3_Err != nil { | ||||||
| 			return templ_7745c5c3_Err | 			return templ_7745c5c3_Err | ||||||
| 		} | 		} | ||||||
| @ -505,13 +586,13 @@ func WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) | |||||||
| 			}() | 			}() | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.InitializeContext(ctx) | 		ctx = templ.InitializeContext(ctx) | ||||||
| 		templ_7745c5c3_Var25 := templ.GetChildren(ctx) | 		templ_7745c5c3_Var29 := templ.GetChildren(ctx) | ||||||
| 		if templ_7745c5c3_Var25 == nil { | 		if templ_7745c5c3_Var29 == nil { | ||||||
| 			templ_7745c5c3_Var25 = templ.NopComponent | 			templ_7745c5c3_Var29 = templ.NopComponent | ||||||
| 		} | 		} | ||||||
| 		ctx = templ.ClearChildren(ctx) | 		ctx = templ.ClearChildren(ctx) | ||||||
| 		if data.IsHtmx { | 		if data.IsHtmx { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "<form hx-post=\"/websites/create\" hx-target=\"closest div\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "<form hx-post=\"/websites/create\" hx-target=\"closest div\">") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -519,12 +600,12 @@ func WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) | |||||||
| 			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, 39, "</form>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</form>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<form action=\"/websites/create\" method=\"post\">") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<form action=\"/websites/create\" method=\"post\">") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
| @ -532,7 +613,7 @@ func WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) | |||||||
| 			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, 41, "</form>") | 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</form>") | ||||||
| 			if templ_7745c5c3_Err != nil { | 			if templ_7745c5c3_Err != nil { | ||||||
| 				return templ_7745c5c3_Err | 				return templ_7745c5c3_Err | ||||||
| 			} | 			} | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| <nav><div><ul><li><a href=\" | <nav><div><h2> | ||||||
|  | </h2><ul><li><a href=\" | ||||||
| \">Dashboard</a></li><li><a href=\" | \">Dashboard</a></li><li><a href=\" | ||||||
| \">View Website</a></li></ul><h3>Guestbook</h3><ul><li><a href=\" | \">View Website</a></li></ul><h3>Guestbook</h3><ul><li><a href=\" | ||||||
| \" target=\"_blank\">View Guestbook</a></li></ul><ul><li><a href=\" | \" target=\"_blank\">View Guestbook</a></li></ul><ul><li><a href=\" | ||||||
| @ -35,6 +36,9 @@ | |||||||
| <div id=\"dashboard\"> | <div id=\"dashboard\"> | ||||||
| <div><h1> | <div><h1> | ||||||
| </h1><p>Stats and stuff will go here.</p></div></div> | </h1><p>Stats and stuff will go here.</p></div></div> | ||||||
|  | <div id=\"dashboard\"> | ||||||
|  | <div><h1> | ||||||
|  | </h1><p>Coming Soon</p></div></div> | ||||||
| <form hx-post=\"/websites/create\" hx-target=\"closest div\"> | <form hx-post=\"/websites/create\" hx-target=\"closest div\"> | ||||||
| </form> | </form> | ||||||
| <form action=\"/websites/create\" method=\"post\"> | <form action=\"/websites/create\" method=\"post\"> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user