diff --git a/controllers/threads_controller.go b/controllers/threads_controller.go index 6eb4819..6b81528 100644 --- a/controllers/threads_controller.go +++ b/controllers/threads_controller.go @@ -25,9 +25,7 @@ func GetThread(c *gin.Context) { threadIDString := c.Param("threadID") threadID, err := strconv.Atoi(threadIDString) if err != nil { - // TODO: рендерить шаблон 404 - log.Println("error:", err) - c.JSON(http.StatusOK, gin.H{"error": true}) + c.HTML(http.StatusOK, "404.html", nil) return } thread, err := Repositories.Posts.GetThreadByPostID(threadID) @@ -38,7 +36,7 @@ func GetThread(c *gin.Context) { return } if thread == nil { - // TODO: рендерить шаблон 404 + c.HTML(http.StatusOK, "404.html", nil) return } c.HTML(http.StatusOK, "thread.html", thread) diff --git a/static/error-image.css b/static/error-image.css new file mode 100644 index 0000000..725ab78 --- /dev/null +++ b/static/error-image.css @@ -0,0 +1,9 @@ +.error-image { + max-width: 50%; + max-height: 50%; + transition: 0.2s; +} +.error-image:hover { + max-width: 60%; + max-height: 60%; +} \ No newline at end of file diff --git a/static/images/errors/404.png b/static/images/errors/404.png new file mode 100644 index 0000000..658b250 Binary files /dev/null and b/static/images/errors/404.png differ diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..a13d501 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,43 @@ + +
+ {{ template "static" }} + + +