diff options
Diffstat (limited to 'src/guff/handlers')
-rw-r--r-- | src/guff/handlers/test-blog.cr (renamed from src/guff/handlers/test.cr) | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/guff/handlers/test.cr b/src/guff/handlers/test-blog.cr index f87800e..61f8241 100644 --- a/src/guff/handlers/test.cr +++ b/src/guff/handlers/test-blog.cr @@ -1,14 +1,14 @@ require "../handler" -require "../views/html/test" +require "../views/html/test-blog" -class Guff::Handlers::TestHandler < Guff::Handler +class Guff::Handlers::TestBlogHandler < Guff::Handler def call(context : HTTP::Server::Context) case (context.request.path || "") as String - when /^\/test\/?$/ + when /^\/test\/blog\/?$/ draw_page(context) - when /^\/test\/set_state$/ + when /^\/test\/blog\/set_state$/ set_state(context) - when /^\/test\/add_post$/ + when /^\/test\/blog\/add_post$/ add_post(context) else call_next(context) @@ -16,7 +16,7 @@ class Guff::Handlers::TestHandler < Guff::Handler end private def draw_page(context) - TestHTMLView.run(@models, context) + TestBlogHTMLView.run(@models, context) end private def add_post(context) @@ -29,7 +29,7 @@ class Guff::Handlers::TestHandler < Guff::Handler tags: ["_blog"] + (params["tags"] || "").to_s.split(" "), ) - redirect(context, "/test") + redirect(context, "/test/blog") end private def set_state(context) @@ -40,6 +40,6 @@ class Guff::Handlers::TestHandler < Guff::Handler state: params["state"].to_s, ) - redirect(context, "/test") + redirect(context, "/test/blog") end end |