diff --git a/server/routes/page_subreddits_details.go b/server/routes/page_subreddits_details.go index a3f80ba..cac3ad3 100644 --- a/server/routes/page_subreddits_details.go +++ b/server/routes/page_subreddits_details.go @@ -8,7 +8,7 @@ import ( "github.com/tigorlazuardi/redmage/pkg/errs" "github.com/tigorlazuardi/redmage/pkg/log" "github.com/tigorlazuardi/redmage/views" - "github.com/tigorlazuardi/redmage/views/subredditsview/detailsview" + "github.com/tigorlazuardi/redmage/views/subreddits/details" ) func (routes *Routes) PageSubredditsDetails(rw http.ResponseWriter, r *http.Request) { @@ -20,7 +20,7 @@ func (routes *Routes) PageSubredditsDetails(rw http.ResponseWriter, r *http.Requ var params api.SubredditGetByNameImageParams params.FillFromQuery(r.URL.Query()) - var data detailsview.Data + var data details.Data data.FlashMessageSuccess = r.Header.Get("X-Flash-Message-Success") var err error data.Params = params @@ -33,7 +33,7 @@ func (routes *Routes) PageSubredditsDetails(rw http.ResponseWriter, r *http.Requ code, message := errs.HTTPMessage(err) rw.WriteHeader(code) data.Error = message - if err := detailsview.Detailsview(c, data).Render(ctx, rw); err != nil { + if err := details.View(c, data).Render(ctx, rw); err != nil { log.New(ctx).Err(err).Error("failed to render subreddit details page") } return @@ -47,12 +47,12 @@ func (routes *Routes) PageSubredditsDetails(rw http.ResponseWriter, r *http.Requ code, message := errs.HTTPMessage(err) rw.WriteHeader(code) data.Error = message - if err := detailsview.Detailsview(c, data).Render(ctx, rw); err != nil { + if err := details.View(c, data).Render(ctx, rw); err != nil { log.New(ctx).Err(err).Error("failed to render subreddit details page") } } - if err := detailsview.Detailsview(c, data).Render(ctx, rw); err != nil { + if err := details.View(c, data).Render(ctx, rw); err != nil { log.New(ctx).Err(err).Error("failed to render subreddit details page") } } diff --git a/views/subredditsview/detailsview/detailsview.templ b/views/subreddits/details/details.templ similarity index 97% rename from views/subredditsview/detailsview/detailsview.templ rename to views/subreddits/details/details.templ index e2f505e..698a425 100644 --- a/views/subredditsview/detailsview/detailsview.templ +++ b/views/subreddits/details/details.templ @@ -1,4 +1,4 @@ -package detailsview +package details import "github.com/tigorlazuardi/redmage/views" import "github.com/tigorlazuardi/redmage/models" @@ -18,7 +18,7 @@ type Data struct { FlashMessageSuccess string } -templ Detailsview(c *views.Context, data Data) { +templ View(c *views.Context, data Data) { @components.Doctype() { if data.Subreddit != nil { @components.Head(c, components.HeadTitle(fmt.Sprintf("Subreddit - %s", data.Subreddit.Name))) @@ -26,7 +26,7 @@ templ Detailsview(c *views.Context, data Data) { @components.Head(c, components.HeadTitle("Subreddit - 404 NOT FOUND")) } @components.Body(c) { - @DetailsContent(c, data) + @Content(c, data) @components.NotificationContainer() { if data.FlashMessageSuccess != "" { @components.SuccessNotification(data.FlashMessageSuccess) @@ -36,7 +36,7 @@ templ Detailsview(c *views.Context, data Data) { } } -templ DetailsContent(c *views.Context, data Data) { +templ Content(c *views.Context, data Data) {
@components.Container() { if data.Error != "" {